PSFLoader: Fix recursive _lib loading

This commit is contained in:
Nahuel Gaitan 2025-07-22 07:23:05 -03:00 committed by GitHub
parent a34aee68a7
commit 3f26179f30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -193,14 +193,12 @@ bool PSFLoader::LoadLibraryPSF(const std::string& path, bool use_pc_sp, Error* e
const std::string lib_path = Path::BuildRelativePath(path, lib_name.value());
INFO_LOG("Loading parent PSF '{}'", Path::GetFileName(lib_path));
// We should use the initial SP/PC from the **first** parent lib.
const bool lib_use_pc_sp = (depth == 0);
if (!LoadLibraryPSF(lib_path.c_str(), lib_use_pc_sp, error, depth + 1))
// We should use the initial SP/PC from the deepest **first** parent lib.
if (!LoadLibraryPSF(lib_path.c_str(), use_pc_sp, error, depth + 1))
return false;
// Don't apply the PC/SP from the minipsf file.
if (lib_use_pc_sp)
use_pc_sp = false;
use_pc_sp = false;
}
// apply the main psf