Case study

re4: a byte-identical decompilation of the Resident Evil 4 GameCube debug build

Reconstructs C and C++ source for the two-disc Resident Evil 4 GameCube debug prototype (G4BE08) and rebuilds main.dol and all 114 REL overlays with the compilers the README names, checking every output against a SHA-1 list. Function names are Capcom’s own from the debug build’s Bio4.sym files, and most struct and field names are aligned from the PS2 debug build’s debug information. The project’s research log says AI agents did the matching work; byte identity is project-reported.

Requirements & limits

  • Reviewed at the 2026-10-02 head, under four weeks after the first commit of 2026-09-07. README calls the decompilation complete: every unit compiles to the original bytes, src/ holds about 570,000 lines of C and C++ with no assembly files, and 526 `// COMPILER-DIFF:` spots coax the compiler’s register or instruction choices without emitting code. Nearly all remaining inline assembly is in routines the vendors also wrote in assembly. The output is the debug prototype’s DOL and RELs, not a retail build or PC port.
  • Supply your own images of both debug discs in orig/G4BE08/: disc 1 provides main.dol and most RELs, disc 2 the four island-stage RELs, and configure.py also reads the matching Bio4 symbol files from them. The game code’s compiler is built from SN Systems’ GPL source release of its ProDG 3.9.3 GCC port, which the user also supplies. The repository contains no game assets.
  • The documented host is Linux with Python 3 and ninja. tools/sn-gcc/build.sh builds SN’s GCC 2.95.3 (SN BUILD v1.79) natively once with the project’s Linux-host and memory-flag patches; CRI middleware builds with Metrowerks CodeWarrior 2.4.7 and the Nintendo SDK, taken from dolsdk2004, with GC/1.2.5n. The first configure run downloads pinned decomp-toolkit, objdiff, wibo and CodeWarrior compiler releases.
  • A successful build should end with ninja reporting 100% matched and linked, and dtk shasum against config/G4BE08/build.sha1 should print OK for all 115 binaries; tools/bytecmp.py compares single units and tools/asmcheck.py --all counts instructions emitted from asm templates, a total changes must not alter. The repository has no CI workflow or release, so these results are project-reported, and this collection built nothing.
  • LICENSE applies CC0 only to the project’s build scripts, tools, configuration and documentation. README and LICENSE state that the reconstructed game, SDK and middleware source in src/ and include/ remains the property of Capcom, Nintendo and CRI Middleware and is published for research and preservation only. docs/research/README.md describes its matching notes as written by the AI agents that did the matching work; no REA use is documented.

About this entry

Type
Case study
Category
Independent reconstruction cases
Relationship
Independent reconstruction project
Targets
Game

Sources reviewed

The description was reviewed against primary sources. This does not establish runtime testing, security auditing or verified compatibility.

Report an outdated entry Suggest a translation fix

Primary sources

  1. README.md GitHub · adonis-singh/re4 · Revision 9b76ff0
  2. LICENSE GitHub · adonis-singh/re4 · Revision 9b76ff0
  3. CONTRIBUTING.md GitHub · adonis-singh/re4 · Revision 9b76ff0
  4. configure.py GitHub · adonis-singh/re4 · Revision 9b76ff0
  5. config/G4BE08/build.sha1 GitHub · adonis-singh/re4 · Revision 9b76ff0
  6. tools/sn-gcc/build.sh GitHub · adonis-singh/re4 · Revision 9b76ff0
  7. tools/extract_orig.py GitHub · adonis-singh/re4 · Revision 9b76ff0
  8. docs/naming.md GitHub · adonis-singh/re4 · Revision 9b76ff0
  9. docs/research/README.md GitHub · adonis-singh/re4 · Revision 9b76ff0

More in Games

All 231 entries in GamesGames case studies (189)