ran-j / PS2Recomp
- четверг, 29 января 2026 г. в 00:00:05
Playstation 2 Static Recompiler & Runtime Tool to make native PC ports
PS2Recomp is a tool designed to statically recompile PlayStation 2 ELF binaries into C++ code that can be compiled for any modern platform. This enables running PS2 games natively on PC and other platforms without traditional emulation.
PS2Recomp works by:
Parsing a PS2 ELF file to extract functions, symbols, and relocations Decoding the MIPS R5900 instructions in each function Translating those instructions to equivalent C++ code Generating a runtime that can execute the recompiled code
The translated code is very literal, with each MIPS instruction mapping to a C++ operation. For example, addiu $r4, $r4, 0x20 becomes ctx->r4 = ADD32(ctx->r4, 0X20);.
git clone --recurse-submodules https://github.com/ran-j/PS2Recomp.git
cd PS2Recomp
# Create build directory
mkdir build
cd build
cmake ..
cmake --build ../ps2xRecomp/example_config.toml)./ps2recomp your_config.toml
Compile the generated C++ code Link with a runtime implementation
PS2Recomp uses TOML configuration files to specify:
[general]
input = "path/to/game.elf"
output = "output/"
single_file_output = false
# Functions to stub
stubs = ["printf", "malloc", "free"]
# Functions to skip
skip = ["abort", "exit"]
# Patches
[patches]
instructions = [
{ address = "0x100004", value = "0x00000000" }
]To execute the recompiled code, you'll need to implement or use a runtime that provides:
A basic runtime lib is provided in ps2xRuntime folder.