Skip to content

Commit

Permalink
ps5: do not patch sceKernelGetMainSocId
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Nov 24, 2024
1 parent 44acb30 commit 804d195
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions rpcsx/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,24 +673,28 @@ ExecEnv guestCreateExecEnv(orbis::Thread *mainThread,
std::abort();
}

for (auto sym : libkernel->symbols) {
if (sym.id == 0xd2f4e7e480cc53d0) {
auto address = (uint64_t)libkernel->base + sym.address;
::mprotect((void *)rx::alignDown(address, 0x1000),
rx::alignUp(sym.size + sym.address, 0x1000), PROT_WRITE);
std::println("patching sceKernelGetMainSocId");
struct GetMainSocId : Xbyak::CodeGenerator {
GetMainSocId(std::uint64_t address, std::uint64_t size)
: Xbyak::CodeGenerator(size, (void *)address) {
mov(eax, 0x710f00);
ret();
}
} gen{address, sym.size};
if (orbis::g_context.fwType == orbis::FwType::Ps4) {
for (auto sym : libkernel->symbols) {
if (sym.id == 0xd2f4e7e480cc53d0) {
auto address = (uint64_t)libkernel->base + sym.address;
::mprotect((void *)rx::alignDown(address, 0x1000),
rx::alignUp(sym.size + sym.address, 0x1000), PROT_WRITE);
std::println("patching sceKernelGetMainSocId");
struct GetMainSocId : Xbyak::CodeGenerator {
GetMainSocId(std::uint64_t address, std::uint64_t size)
: Xbyak::CodeGenerator(size, (void *)address) {
mov(eax, 0x710f00);
ret();
}
} gen{address, sym.size};

::mprotect((void *)rx::alignDown(address, 0x1000),
rx::alignUp(sym.size + sym.address, 0x1000),
PROT_READ | PROT_EXEC);
break;
::mprotect((void *)rx::alignDown(address, 0x1000),
rx::alignUp(sym.size + sym.address, 0x1000),
PROT_READ | PROT_EXEC);
break;
}
}
}
}
}

Expand Down

0 comments on commit 804d195

Please sign in to comment.