Only execute the WUMSLoader for the Game and Menu process

This commit is contained in:
Maschell 2022-05-08 12:37:15 +02:00
parent d7a4c8abda
commit e5ac7dc723
2 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,7 @@ std::vector<std::shared_ptr<ModuleData>> OrderModulesByDependencies(const std::v
// The compiler tries to optimize this otherwise and calling the main function earlier // The compiler tries to optimize this otherwise and calling the main function earlier
extern "C" int _start(int argc, char **argv) { extern "C" int _start(int argc, char **argv) {
InitFunctionPointers(); InitFunctionPointers();
static uint8_t ucSetupRequired = 1; static uint8_t ucSetupRequired = 1;
if (ucSetupRequired) { if (ucSetupRequired) {
gHeapHandle = MEMCreateExpHeapEx((void *) (MEMORY_REGION_USABLE_HEAP_START), MEMORY_REGION_USABLE_HEAP_END - MEMORY_REGION_USABLE_HEAP_START, 1); gHeapHandle = MEMCreateExpHeapEx((void *) (MEMORY_REGION_USABLE_HEAP_START), MEMORY_REGION_USABLE_HEAP_END - MEMORY_REGION_USABLE_HEAP_START, 1);
@ -31,7 +32,10 @@ extern "C" int _start(int argc, char **argv) {
ucSetupRequired = 0; ucSetupRequired = 0;
} }
uint32_t upid = OSGetUPID();
if (upid == 2 || upid == 15) {
doStart(argc, argv); doStart(argc, argv);
}
return ((int (*)(int, char **))(*(unsigned int *) 0x1005E040))(argc, argv); return ((int (*)(int, char **))(*(unsigned int *) 0x1005E040))(argc, argv);
} }

View File

@ -15,6 +15,7 @@ IMPORT(MEMFreeToExpHeap);
IMPORT(MEMAllocFromExpHeapEx); IMPORT(MEMAllocFromExpHeapEx);
IMPORT(MEMGetAllocatableSizeForExpHeapEx); IMPORT(MEMGetAllocatableSizeForExpHeapEx);
IMPORT(MEMCreateExpHeapEx); IMPORT(MEMCreateExpHeapEx);
IMPORT(OSGetUPID);
IMPORT(OSUninterruptibleSpinLock_Acquire); IMPORT(OSUninterruptibleSpinLock_Acquire);
IMPORT(OSUninterruptibleSpinLock_Release); IMPORT(OSUninterruptibleSpinLock_Release);
IMPORT(OSReport); IMPORT(OSReport);