diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 1e3566ed00..39cbd0f4ec 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -219,7 +219,7 @@ DisableHLEFlags AlwaysDisableHLEFlags() { // // sceFont is the odd one out: the module is on the disc like the others, but it reads its fonts // from flash0:/font, so it is only usable with a firmware dump installed - see - // CheckDisableHLEAvailability, which puts the HLE back when those fonts aren't there. + // HLECheckModuleAvailability, which puts the HLE back when those fonts aren't there. // // sceParseUri and sceParseHttp are not here - those two are also in the firmware, and // sceUtility can load them (modules 0x103 and 0x104), so unlike the rest a game may import them @@ -348,7 +348,7 @@ static void hleDelayResultFinish(u64 userdata, int cycleslate) { // (Death Jr. has MPEG.PRX and LIBATRAC3PLUS.PRX under PSP_GAME/USRDIR/MODULES), and dropping the // flag for want of firmware would replace a perfectly good disc module with our HLE. Those check for // a real module at the point they would load one, and warn there if neither source has it. -static void CheckDisableHLEAvailability() { +void HLECheckModuleAvailability() { g_unavailableDisableFlags = (DisableHLEFlags)0; // libfont.prx/sceFont is shipped on game discs but reads its fonts from flash0:/font and has @@ -375,7 +375,6 @@ static void CheckDisableHLEAvailability() { } void HLEInit() { - CheckDisableHLEAvailability(); RegisterAllModules(); // Latched lazily rather than here: the compat flags this depends on aren't loaded yet. g_disableHLELatched = false; diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index 049d850a00..09f294b207 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -187,6 +187,7 @@ inline s64 hleDelayResult(s64 result, const char *reason, int usec) { } void HLEInit(); +void HLECheckModuleAvailability(); void HLEDoState(PointerWrap &p); void HLEShutdown(); const HLEFunction *HLEGetFunctionBeingCalled(); diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 35d4a9fe2f..60df845931 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -2171,6 +2171,9 @@ void __KernelLoadReset() { HLEShutdown(); Replacement_Init(); HLEInit(); + // LoadExec keeps the PSP filesystems mounted, so refresh the filesystem-dependent HLE + // availability state after rebuilding the basic HLE state. + HLECheckModuleAvailability(); } __KernelModuleInit(); diff --git a/Core/System.cpp b/Core/System.cpp index 62f75b570c..bd2c3bd2e3 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -506,6 +506,10 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin DisplayHWInit(); + // Initialize the HLE state before mounting filesystems. This includes the module tables and + // CoreTiming event needed by savestates, but does not inspect any filesystem paths. + HLEInit(); + // TODO: Put this somewhere better? if (!g_CoreParameter.mountIso.empty()) { g_CoreParameter.mountIsoLoader = ConstructFileLoader(g_CoreParameter.mountIso); @@ -518,12 +522,9 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin MountFileSystems(); - // Init all the HLE modules. After the mount, and after the firmware install above, so that the - // checks in HLEInit deciding whether a library can run its real module instead of our HLE can - // ask the PSP filesystem the way everything else does - and see a firmware this very boot just - // installed off the disc. Nothing between CoreTiming::Init above and here touches HLE, and the - // kernel and the game's modules both come later, in the switch below. - HLEInit(); + // The module availability checks need the mounted PSP filesystem and the firmware installed + // above. Keep them after the mount, before any kernel or game module can be loaded. + HLECheckModuleAvailability(); // Game-specific settings are load from for example Load_PSP_ISO (which calls g_Config.LoadGameConfig). // We can't do things that depend on these before the below switch. So for example, the adjustment of the GPU core