Files
PS2Recomp/ps2xRuntime
Ranieri 7ca6a866c9 Feature/ghidra export and syscall fixes (#100)
* docs: deprecate the local analyzer workflow in favor of Ghidra
feat: improve the Ghidra exporter for stripped games and internal entry points
fix: correct FindAddress behavior in the runtime
fix: emit missing delay-slot code in recompiler  edge cases
feat: add SetSyscall support from @Whoneon
feat: add dispatchSyscallOverride support from @Whoneon
fix: fix  Unmatched '{' due to missing newlines from issue #96
feat: delete python ghidra script I never updated it anyway
feat: added a lot more of regression test
feat: added a lot of logs to help debug on runtime
fix: fix wrong syscall ID on runtime
2026-03-09 00:41:51 -03:00
..
2025-04-12 03:49:35 -03:00
2025-11-29 01:50:07 -03:00

Runtime Library

The runtime library provides the execution environment for recompiled code, including:

  • Memory management (32MB main RAM, scratchpad, etc.)
  • Register context (128-bit GPRs, VU0 registers, etc.)
  • Function table for dynamic linking
  • Basic PS2 system call stubs

How to use:

Take your decompiled code and place the cpp files on ps2xRuntime/src/runner and header files on ps2xRuntime/include and compile/be happy.

Adding Custom Function Implementations

You can add custom implementations for PS2 system calls or game functions by:

  1. Creating function implementations that match the signature:
void function_name(uint8_t* rdram, R5900Context* ctx, PS2Runtime *runtime);
  1. Registering them with the runtime:
runtime.registerFunction(address, function_name);

Advanced Features

Memory Translation The runtime handles PS2's memory addressing, including:

  • KSEG0/KSEG1 direct mapping
  • TLB lookups for user memory
  • Special memory areas (scratchpad, I/O registers)

Vector Unit Support

PS2-specific 128-bit MMI instructions and VU0 macro mode instructions are supported via SSE/AVX intrinsics.

Instruction Patching

You can patch specific instructions in the recompiled code to fix game issues or implement custom behavior.

Limitations

  • Graphics and sound output require external implementations
  • Some PS2-specific hardware features may not be fully supported
  • Performance may vary based on the complexity of the game