diff --git a/rpcsx-os/linker.cpp b/rpcsx-os/linker.cpp index 1c4869a2d..3cc17984d 100644 --- a/rpcsx-os/linker.cpp +++ b/rpcsx-os/linker.cpp @@ -527,6 +527,26 @@ Ref rx::linker::loadModule(std::span image, orbis::Relocation *nonPltRelocations = nullptr; std::size_t nonPltRelocationCount = 0; + auto patchSoName = [](std::string_view name) { + if (name.ends_with(".prx")) { + name.remove_suffix(4); + } + if (name.ends_with("-PRX")) { + name.remove_suffix(4); // TODO: implement lib scan + } + if (name.ends_with("-module")) { + name.remove_suffix(7); // TODO: implement lib scan + } + if (name.ends_with("_padebug")) { + name.remove_suffix(8); + } + if (name.ends_with("_sys")) { + name.remove_suffix(4); + } + + return name; + }; + for (auto dyn : dyns) { // std::printf("%s: %lx", toString((OrbisElfDynamicType)dyn.d_tag), // dyn.d_un.d_val); @@ -553,9 +573,9 @@ Ref rx::linker::loadModule(std::span image, } if (dyn.d_tag == kElfDynamicTypeSoName) { - std::strncpy(result->soName, - sceStrtab + static_cast(dyn.d_un.d_val), - sizeof(result->soName)); + auto name = patchSoName(sceStrtab + static_cast(dyn.d_un.d_val)); + std::memcpy(result->soName, name.data(), name.size()); + std::memcpy(result->soName + name.size(), ".prx", sizeof(".prx")); } if (dyn.d_tag == kElfDynamicTypeNeeded) { @@ -565,19 +585,7 @@ Ref rx::linker::loadModule(std::span image, // HACK for broken FWs result->needed.push_back("libSceDolbyVision"); } else { - if (name.ends_with(".prx")) { - name.remove_suffix(4); - } - if (name.ends_with("-PRX")) { - name.remove_suffix(4); // TODO: implement lib scan - } - if (name.ends_with("-module")) { - name.remove_suffix(7); // TODO: implement lib scan - } - if (name.ends_with("_padebug")) { - name.remove_suffix(8); - } - + name = patchSoName(name); if (name != "libSceFreeTypeOptBm") { // TODO result->needed.push_back(std::string(name)); result->needed.back() += ".prx"; @@ -836,7 +844,7 @@ Ref rx::linker::loadModuleFile(const char *path, static Ref createSceFreeTypeFull(orbis::Process *process) { auto result = orbis::create(); - std::strncpy(result->soName, "libSceFreeTypeFull-PRX.prx", + std::strncpy(result->soName, "libSceFreeTypeFull.prx", sizeof(result->soName) - 1); std::strncpy(result->moduleName, "libSceFreeType", sizeof(result->moduleName) - 1); @@ -848,7 +856,7 @@ static Ref createSceFreeTypeFull(orbis::Process *process) { {"libSceFreeTypeSubFunc", "libSceFreeTypeOl", "libSceFreeTypeOt", "libSceFreeTypeOptOl", "libSceFreeTypeHinter"}) { result->needed.push_back(dep); - result->needed.back() += "-PRX.prx"; + result->needed.back() += ".prx"; } for (auto needed : result->needed) { diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index 8ff72b48d..ccd13a937 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -460,7 +460,7 @@ static int ps4Exec(orbis::Process *mainProcess, std::vector envpOffsets; auto libkernel = rx::linker::loadModuleFile( - "/system/common/lib/libkernel.sprx", mainProcess); + "/system/common/lib/libkernel_sys.sprx", mainProcess); // *reinterpret_cast( // reinterpret_cast(libkernel->base) + 0x6c2e4) = ~0;