diff --git a/rpcsx-os/ops.cpp b/rpcsx-os/ops.cpp index bfd611057..dd2f24dce 100644 --- a/rpcsx-os/ops.cpp +++ b/rpcsx-os/ops.cpp @@ -32,6 +32,10 @@ loadPrx(orbis::Thread *thread, std::string_view name, bool relocate, std::map> &loadedObjects, std::map> &loadedModules, std::string_view expectedName) { + if (auto it = loadedObjects.find(expectedName); it != loadedObjects.end()) { + return {{}, it->second}; + } + if (auto it = loadedObjects.find(name); it != loadedObjects.end()) { return {{}, it->second}; } @@ -106,7 +110,7 @@ loadPrx(orbis::Thread *thread, std::string_view name, bool relocate, } static std::pair> -loadPrx(orbis::Thread *thread, std::string_view name, bool relocate) { +loadPrx(orbis::Thread *thread, std::string_view path, bool relocate) { std::map> loadedObjects; std::map> loadedModules; @@ -115,8 +119,21 @@ loadPrx(orbis::Thread *thread, std::string_view name, bool relocate) { loadedModules[module->moduleName] = module; } - return loadPrx(thread, name, relocate, loadedObjects, loadedModules, {}); -}; + std::string expectedName; + if (auto sep = path.rfind('/'); sep != std::string_view::npos) { + auto tmpExpectedName = path.substr(sep + 1); + + if (tmpExpectedName.ends_with(".sprx")) { + tmpExpectedName.remove_suffix(5); + } + + expectedName += tmpExpectedName; + expectedName += ".prx"; + } + + return loadPrx(thread, path, relocate, loadedObjects, loadedModules, + expectedName); +} orbis::SysResult mmap(orbis::Thread *thread, orbis::caddr_t addr, orbis::size_t len, orbis::sint prot, orbis::sint flags,