HLE: split filesystem-dependent initialization

This commit is contained in:
keycross committed 2026-09-18 10:24:43 +09:00
1 parent 2385698f8e
commit 5c80533ee3
4 files changed
+13 -9

No files matched your search

+2 -3
View File
@@ -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;
+1
View File
@@ -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();
+3
View File
@@ -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();
+7 -6
View File
@@ -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