A work-in-progress matching decompilation of Ratchet: Deadlocked (Ratchet: Gladiator in PAL regions; Insomniac Games, 2005) for the PlayStation 2 (SCUS_974.65, NTSC-U v1.00), part of the OpenRAC initiative.
The objective is to produce C/C++ source code that, when compiled with the original toolchain, generates a byte-identical copy of the retail executable. Matched code is then refactored toward readable, idiomatic C++ with accurate types and naming, using matching builds as continuous regression tests.
Note
This repository contains no game assets, retail executables, or disassembly. To build, you must provide your own legally obtained copy of the game. Please review LEGAL.md before contributing.
Decompilation progress is tracked live on openrac.dev and decomp.dev/OpenRAC/rac-deadlocked-decomp.
| Version | Region | Target ID | Code Matched | Functions Matched |
|---|---|---|---|---|
| v1.00 | NTSC-U | SCUS_974.65 |
Only NTSC-U is targeted; PAL (Ratchet: Gladiator) may follow as a second version if someone with a PAL disc joins. There is no linked image yet: a function counts as matched when its compiled code equals retail with only the fields it relocates masked (tools/audit_matches.py), so a function that calls or reads the wrong symbol can still count.
Each level carries its own build of the level code, loaded over the resident
image when the level starts (docs/OVERLAYS.md). There are
47 overlays (24 campaign and 23 multiplayer levels) that share 85 to 97 percent of
their code at different addresses. Their functions are split and counted once
each: code shared by two or more levels under Common (4,714 functions),
code found in one level only under Level-specific (2,315 functions, all of
them the multiplayer menu's), and in the row of every level that contains it.
As in rac1-decomp, their sources live in src/overlays/shared/ and
src/overlays/lNN_<level>/.
Functions identical to one in the resident level text are counted there, not
twice. The overlays come from your own disc: unpack it with the
wrench build tool and run
tools/split_overlays.py (see docs/OVERLAYS.md).
Per level
Each row counts the overlay code of that level, including the common code it contains (code identical to the resident level text is counted under Resident level code instead).
- Linux & macOS: Docker or Podman (uses the prebuilt Wine container via GitHub Container Registry), and Python 3.10+.
- Windows: Git Bash, Python 3.10+, and community toolchain mirrors.
The compilers run natively (no Wine or container needed). The venv's interpreter is
venv/Scripts/python.exe: use it wherever these docs sayvenv/bin/python.
-
Clone the repository:
git clone https://github.com/OpenRAC/rac-deadlocked-decomp.git cd rac-deadlocked-decomp -
Provide your original executable: Copy
SCUS_974.65from your disc image intobaserom/:# Expected SHA-1: aa91b1c3b9b1a244320c47580b77342ef9856e95 cp /path/to/SCUS_974.65 baserom/SCUS_974.65 -
Generate the disassembly and fetch toolchains:
bash tools/setup_asm.sh # unpack, split, splat -> asm/ git clone https://github.com/AngheloAlf/SN-Systems-ProDG_for_PS2_3.01 toolchain/sn-prodg-3.01 git clone https://github.com/AngheloAlf/sce_ps2_sdk_24 toolchain/sn-prodg-24 -
Build and verify:
# Windows (native): bash tools/build.sh # Linux & macOS (via container): bash tools/docker/run.sh bash tools/build.sh # Then compare every function with retail and write the progress report: venv/bin/python tools/audit_matches.py python3 tools/gen_progress_report.py
For detailed documentation:
docs/WORKFLOW.md– Setup in full, and the step-by-step function matching guidedocs/TOOLCHAIN.md– Compiler, flags, assembler passes, libraries and the containerdocs/RESEARCH.md– How the retail executable is packed and taken apartdocs/OVERLAYS.md– The 47 level overlays and how they are split and counted
Contributions are warmly welcome! Whether you are interested in decompiling functions, researching engine quirks, or improving documentation:
- See
CONTRIBUTING.mdfor contribution guidelines and rules. - See
docs/WORKFLOW.mdfor the step-by-step function matching guide. - Join our Discord Community to discuss progress, ask questions, and collaborate!
This project builds upon years of dedicated reverse-engineering research and tooling by the community:
- GFI (Game Fuckery Inc.) – Special thanks to the GFI Discord community for years of reverse engineering, game research, and technical insights that made this decompilation possible.
- rac1-decomp – Repository layout, README, progress workflow and report generator, toolchain notes, the libgcc build recipe, and
tools/ps2eeas_nops.py/tools/ps2eeas_dli.py(the nops and constant sequences of SN's assembler). - rac3-uya-decomp by vetusmagnus – Up Your Arsenal, the closest engine relative. Compiler research (SN ee-gcc 2.95.3 v1.36) and the
-fopt-stack,-G8and global-declaration findings. - OpenRAC – Status of Deadlocked, sourcing policy, and the sibling decompilations of the engine family.
- Lombyte by mateuszklysz – R&C1 NTSC decomp, checked for Deadlocked coverage (none).
- Wrench by chaoticgd – PS2 Ratchet & Clank modding tools; its documentation of the packed image (
docs/file_loading.md, "WAD Compression") and the executable's layout, and the level overlays it unpacks. - GCC and newlib – The library sources in
src/libgcc/andsrc/libm/(seeTHIRD_PARTY_NOTICES.md). - Decompilation Tooling & Ecosystem:
- splat & spimdisasm – Binary splitting and MIPS disassembly.
- m2c & asm-differ – Assembly-to-C translation and diffing.
- objdiff – Object diffing tool.
- decomp.dev & decomp.wiki – Progress tracking and decompilation knowledge base.
- AngheloAlf – PS2 toolchain mirrors.
- Code written for this project is licensed under the GNU General Public License v3.0.
- Reconstructed libraries and third-party components retain their original licenses (see
THIRD_PARTY_NOTICES.mdandLEGAL.md). - Ratchet: Deadlocked is a registered trademark of Sony Interactive Entertainment. This project is not affiliated with or endorsed by Sony or Insomniac Games.