From c44e4de7e6065f9366b461f4d7eb90d460a0f77f Mon Sep 17 00:00:00 2001 From: sum2012 Date: Fri, 31 May 2013 07:36:06 +0800 Subject: [PATCH] Fix sceKernelModule Fix Army Of Two 40th Day https://github.com/hrydgard/ppsspp/issues/1919 Thanks unknownbrackets , JPCSP r3181 --- Core/HLE/sceKernelModule.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index a99d272b21..38bdeea250 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1103,24 +1103,25 @@ void sceKernelStartModule(u32 moduleId, u32 argsize, u32 argAddr, u32 returnValu int attribute = module->nm.attribute; u32 entryAddr = module->nm.entry_addr; - if ((entryAddr == -1) || entryAddr == module->memoryBlockAddr - 1) + if (module->nm.module_start_func != 0 && module->nm.module_start_func != (u32)-1) { - if (module->nm.module_start_func != 0 && module->nm.module_start_func != (u32)-1) - { - entryAddr = module->nm.module_start_func; - attribute = module->nm.module_start_thread_attr; - } - else if (optionAddr) - { - attribute = smoption.attribute; - } - else - { - // TODO: Why are we just returning the module ID in this case? - ERROR_LOG_REPORT(HLE, "sceKernelStartModule(): doing nothing for some reason?"); - RETURN(moduleId); - return; - } + entryAddr = module->nm.module_start_func; + attribute = module->nm.module_start_thread_attr; + } + else if ((entryAddr == -1) || entryAddr == module->memoryBlockAddr - 1) + { + if (optionAddr) + { + // TODO: Does sceKernelStartModule() really give an error when no entry only if you pass options? + attribute = smoption.attribute; + } + else + { + // TODO: Why are we just returning the module ID in this case? + WARN_LOG(HLE, "sceKernelStartModule(): module has no start or entry func"); + RETURN(moduleId); + return; + } } if (Memory::IsValidAddress(entryAddr))