diff --git a/src/core/libraries/kernel/process.cpp b/src/core/libraries/kernel/process.cpp index ed833068c..d61ee37ac 100644 --- a/src/core/libraries/kernel/process.cpp +++ b/src/core/libraries/kernel/process.cpp @@ -43,19 +43,30 @@ s32 PS4_SYSV_ABI sceKernelLoadStartModule(const char* moduleFileName, u64 args, std::filesystem::path path; std::string guest_path(moduleFileName); - const bool is_root = guest_path[0] == '/'; - if (is_root || guest_path.contains('/')) { + s32 handle = -1; + + if (guest_path[0] == '/') { + // try load /system/common/lib/ +path + // try load /system/priv/lib/ +path path = mnt->GetHostPath(guest_path); - } else if (!guest_path.contains('/')) { - path = mnt->GetHostPath("/app0/" + guest_path); - } - - if (const s32 handle = linker->LoadAndStartModule(path, args, argp, pRes); handle != -1) { - return handle; - } - - if (is_root) { - UNREACHABLE(); + handle = linker->LoadAndStartModule(path, args, argp, pRes); + if (handle != -1) + return handle; + } else { + if (!guest_path.contains('/')) { + path = mnt->GetHostPath("/app0/" + guest_path); + handle = linker->LoadAndStartModule(path, args, argp, pRes); + if (handle != -1) + return handle; + // if ((flags & 0x10000) != 0) + // try load /system/priv/lib/ +basename + // try load /system/common/lib/ +basename + } else { + path = mnt->GetHostPath(guest_path); + handle = linker->LoadAndStartModule(path, args, argp, pRes); + if (handle != -1) + return handle; + } } return ORBIS_KERNEL_ERROR_ENOENT;