mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-14 08:12:16 +00:00
Fix sceKernelLoadStartModule (#2635)
This commit is contained in:
parent
46b1bafa17
commit
8bcdd9c068
1 changed files with 23 additions and 12 deletions
|
@ -43,19 +43,30 @@ s32 PS4_SYSV_ABI sceKernelLoadStartModule(const char* moduleFileName, u64 args,
|
||||||
std::filesystem::path path;
|
std::filesystem::path path;
|
||||||
std::string guest_path(moduleFileName);
|
std::string guest_path(moduleFileName);
|
||||||
|
|
||||||
const bool is_root = guest_path[0] == '/';
|
s32 handle = -1;
|
||||||
if (is_root || guest_path.contains('/')) {
|
|
||||||
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) {
|
if (guest_path[0] == '/') {
|
||||||
|
// try load /system/common/lib/ +path
|
||||||
|
// try load /system/priv/lib/ +path
|
||||||
|
path = mnt->GetHostPath(guest_path);
|
||||||
|
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 handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_root) {
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ORBIS_KERNEL_ERROR_ENOENT;
|
return ORBIS_KERNEL_ERROR_ENOENT;
|
||||||
|
|
Loading…
Add table
Reference in a new issue