# 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.

- Type: Case study
- Targets: Game
- Category: Independent reconstruction cases
- Relationship: Independent reconstruction project
- Sources reviewed: 2026-10-19
- Added to the catalog: 2026-10-28
- Original resource: <https://github.com/adonis-singh/re4>
- Primary source: <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/README.md>
- Catalog page: <https://awesomerea.org/resources/re4-gamecube-debug-decomp-case/>
- Record JSON: <https://awesomerea.org/resources/re4-gamecube-debug-decomp-case/record.json>
- Chinese version: [简体中文](https://awesomerea.org/zh/resources/re4-gamecube-debug-decomp-case/index.md)

## 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.
- 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.

## Primary sources

1. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/README.md>
2. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/LICENSE>
3. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/CONTRIBUTING.md>
4. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/configure.py>
5. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/config/G4BE08/build.sha1>
6. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/tools/sn-gcc/build.sh>
7. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/tools/extract_orig.py>
8. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/docs/naming.md>
9. <https://github.com/adonis-singh/re4/blob/9b76ff003081d6ece8b838453fb8310743a972c7/docs/research/README.md>

## More in Games

- [sead: a decompilation of Nintendo’s first-party C++ standard library](https://awesomerea.org/resources/sead-nintendo-library-decomp-case/index.md) · Case study
- [Skyward Sword: Wii decompilation with hash-checked relinking](https://awesomerea.org/resources/skyward-sword-decomp-case/index.md) · Case study
- [Sly Cooper and the Thievius Raccoonus: matching PlayStation 2 decompilation](https://awesomerea.org/resources/sly1-matching-decomp-case/index.md) · Case study
- [Snowboard Kids 2: an LLM-assisted N64 matching decompilation](https://awesomerea.org/resources/snowboardkids2-decomp-case/index.md) · Case study
- [Snowboard Kids: an agent-assisted N64 matching decompilation](https://awesomerea.org/resources/snowboardkids-matching-decomp-case/index.md) · Case study
- [Sonic Advance 1 & 2: a matching GBA decompilation with widescreen ports](https://awesomerea.org/resources/sonic-advance-1-2-decomp-port-case/index.md) · Case study

## About this entry

The description was reviewed against primary sources.
Original editorial content: MIT. Linked projects, papers and assets retain their own rights and licenses.
