mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Reschedule on module load/unload more correctly.
This commit is contained in:
parent
cc92d6fb34
commit
5fe49b23e9
1 changed files with 14 additions and 11 deletions
|
@ -1653,12 +1653,12 @@ static u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr)
|
|||
if (!info.exists) {
|
||||
ERROR_LOG(LOADER, "sceKernelLoadModule(%s, %08x): File does not exist", name, flags);
|
||||
// ERRNO_FILE_NOT_FOUND
|
||||
return 0x80010002;
|
||||
return hleDelayResult(0x80010002, "module loaded", 500);
|
||||
}
|
||||
|
||||
if (!size) {
|
||||
ERROR_LOG(LOADER, "sceKernelLoadModule(%s, %08x): Module file is size 0", name, flags);
|
||||
return SCE_KERNEL_ERROR_FILEERR;
|
||||
return hleDelayResult(SCE_KERNEL_ERROR_FILEERR, "module loaded", 500);
|
||||
}
|
||||
|
||||
DEBUG_LOG(LOADER, "sceKernelLoadModule(%s, %08x)", name, flags);
|
||||
|
@ -1671,15 +1671,15 @@ static u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr)
|
|||
lmoption = (SceKernelLMOption *)Memory::GetPointer(optionAddr);
|
||||
if (lmoption->position < PSP_SMEM_Low || lmoption->position > PSP_SMEM_HighAligned) {
|
||||
ERROR_LOG_REPORT(LOADER, "sceKernelLoadModule(%s): invalid position (%i)", name, (int)lmoption->position);
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE;
|
||||
return hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE, "module loaded", 500);
|
||||
}
|
||||
if (lmoption->position == PSP_SMEM_LowAligned || lmoption->position == PSP_SMEM_HighAligned) {
|
||||
ERROR_LOG_REPORT(LOADER, "sceKernelLoadModule(%s): invalid position (aligned)", name);
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ALIGNMENT_SIZE;
|
||||
return hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_ALIGNMENT_SIZE, "module loaded", 500);
|
||||
}
|
||||
if (lmoption->position == PSP_SMEM_Addr) {
|
||||
ERROR_LOG_REPORT(LOADER, "sceKernelLoadModule(%s): invalid position (fixed)", name);
|
||||
return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED;
|
||||
return hleDelayResult(SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED, "module loaded", 500);
|
||||
}
|
||||
WARN_LOG_REPORT(LOADER, "sceKernelLoadModule: unsupported options size=%08x, flags=%08x, pos=%d, access=%d, data=%d, text=%d", lmoption->size, lmoption->flags, lmoption->position, lmoption->access, lmoption->mpiddata, lmoption->mpidtext);
|
||||
}
|
||||
|
@ -1697,7 +1697,9 @@ static u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr)
|
|||
if (!module) {
|
||||
if (magic == 0x46535000) {
|
||||
ERROR_LOG(LOADER, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic);
|
||||
return -1;
|
||||
// TODO: What's actually going on here?
|
||||
error = -1;
|
||||
return hleDelayResult(error, "module loaded", 500);
|
||||
}
|
||||
|
||||
if (info.name == "BOOT.BIN")
|
||||
|
@ -1711,13 +1713,14 @@ static u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr)
|
|||
{
|
||||
// Module was blacklisted or couldn't be decrypted, which means it's a kernel module we don't want to run..
|
||||
// Let's just act as if it worked.
|
||||
// TODO: Allocate an actual module?
|
||||
NOTICE_LOG(LOADER, "Module %s is blacklisted or undecryptable - we lie about success", name);
|
||||
return 1;
|
||||
return hleDelayResult(1, "module loaded", 500);
|
||||
}
|
||||
else
|
||||
{
|
||||
NOTICE_LOG(LOADER, "Module %s failed to load: %08x", name, error);
|
||||
return error;
|
||||
ERROR_LOG(LOADER, "Module %s failed to load: %08x", name, error);
|
||||
return hleDelayResult(error, "module loaded", 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1924,11 +1927,11 @@ static u32 sceKernelUnloadModule(u32 moduleId)
|
|||
u32 error;
|
||||
Module *module = kernelObjects.Get<Module>(moduleId, error);
|
||||
if (!module)
|
||||
return error;
|
||||
return hleDelayResult(error, "module unloaded", 150);
|
||||
|
||||
module->Cleanup();
|
||||
kernelObjects.Destroy<Module>(moduleId);
|
||||
return moduleId;
|
||||
return hleDelayResult(moduleId, "module unloaded", 500);
|
||||
}
|
||||
|
||||
u32 hleKernelStopUnloadSelfModuleWithOrWithoutStatus(u32 exitCode, u32 argSize, u32 argp, u32 statusAddr, u32 optionAddr, bool WithStatus) {
|
||||
|
|
Loading…
Add table
Reference in a new issue