Files
PS2Recomp/ps2xRuntime
Ranieri 75d729ce40 Feature/iop emulator (#244)
* refactor: from guest  threads to EE scheduler

* feat: bad wip mpeg fix for code veronica

* feat: cheap copy from host
feat: small perf o vsync tick

* feat: added EE clock Hz
fix: fix MPEG out of sync with new EE refactor

* fix: fix lotr tests

* fix: fix cri dtx loading
fix: fix wrong mmi instruction translation
fix: fix thread info params
feat: added EE  timers decoder and consumer
feat: split SFI and IOP memory to prevent collision and overrides

* feat: revert wrong changes

* refactor: change GS architecture

* feat: IOP emulator
refactor: codegen to catch callbacks on mips code
feat: added a lot of entries or IOP emulator

* feat: analyzer resolve the complete constant-producing sequence with five-instruction backward scan stopped at LUI and therefore

* feat: remove recompiled version of GetRomName
refactor: split IOP emulator logic
feat: added more HLE IOP modules
feat: added ps2_path

* eat: enhance ELF parser with improved callable entry detection and control flow analysis

* feat: update memory hint handling and enhance entry point discovery logic

* feat: add SET_GPR_ZE32 macro for zero-extending loads with unsigned semantics

* refactor: Refactor PS2 IOP Host Adapter and Memory Management
feat: Added PS2Vfs for virtual file system operations, including file opening, reading, writing, and path resolution.
feat: Improve VIF1 data processing to handle GIF image packets more efficiently.

* feat: added a lot of tests

* fix: fix texture caching
feat: wip multi version on dbcman

* feat: remove LLE IOPs
2026-09-19 21:31:44 -03:00
..
2026-06-26 21:04:39 -03:00
2026-09-19 21:31:44 -03:00
2026-09-19 21:31:44 -03:00
2026-09-19 21:31:44 -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.

Vita Build Notes

The Vita runtime uses Quenom/raylib-5.5-vita for vita build. I recommend build runtime only.

Expected environment:

  • VITASDK points to your VitaSDK root.
  • Quenom/raylib-5.5-vita has already been built and installed into $VITASDK/arm-vita-eabi.
  • SDL2 with the PVR backend required by that raylib fork is also installed into the same VitaSDK prefix.
  • PS2X_DEFAULT_BOOT_ELF is mandatory, you need to define where your game is like "ux0:data/RANJ00001/game/SLUS_201.84".

The CMake for ps2xRuntime consumes those preinstalled headers and libraries from VitaSDK. It does not fetch or install the Vita raylib fork for you.

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