// HACKER NEWS — CYBERSECURITY
Resident Evil 4 (GameCube) – complete byte-identical decompilation to C/C++
A complete, byte-identical decompilation of Resident Evil 4 for the Nintendo GameCube: the
G4BE08 debug build (the "Nov 25 2004" prototype, both discs), whose Bio4.sym files name every
function. Building the repository reproduces main.dol and all 114 REL overlays exactly
(config/G4BE08/build.sha1, checked on every build).
The repository contains no game assets and no code or data copied from the discs. You need your
own images of the debug discs to build (disc 1 for main.dol and most RELs, disc 2 for the four
island-stage RELs); the original files are read from them at configure time.
Linux, Python 3, ninja. Compilers and tools (decomp-toolkit, objdiff,
wibo, the CodeWarrior builds) are downloaded by the first configure run, except the native SN GCC:
ninja ends with the progress report (100% matched and linked for the DOL and the REL modules);
build/tools/dtk shasum -c config/G4BE08/build.sha1 prints 115 OK lines. To work on a unit, python3 tools/bytecmp.py game/foo compares its object with
the original word by word and python3 tools/fdiff.py game/foo shows one function.
Every unit compiles to the original bytes with the original compilers. Where the compiler needed a
particular source shape to reproduce a register choice or a schedule and no natural spelling was
found, the construct is marked with a // COMPILER-DIFF: comment (644 of them: dead tests, empty
asm("") launders and anchors, register T x asm("rN") pins, padding statements). None of them
emits an instruction: python3 tools/asmcheck.py --all compiles every GCC unit with its asm templates
marked and lists the instructions that came from a template — the only hits are the hardware kernels
below (TOTAL 231; the eight asm-bodied units are reported on their own line and kept out of that
number). An earlier state of this tree had ~100 hand-placed instructions (asm("li %0,0"),
asm("lis/addi"), asm("mr")) in the game code and ~100 register-pinning asm { } blocks in the CRI
libraries; they were replaced by C on 2026-09-17 (docs/research/compiler.md, section "Asm-removal pass", records the recipe
and the compiler mechanism per site). Each tag's mechanism is documented in docs/matching.md and
docs/research/.
Assembly that remains, all of it code the original authors also wrote in assembly because their
compilers had no other way to express it:
Function names are Capcom's, from the debug build's Bio4.sym files; they are C++-mangled, which is
why the game code is C++ and the SDK, CRI and newlib units are C. File names and unit boundaries come
from the D:/Bio4/Prog/.cpp strings the asserts left in the binaries. Struct and field names are
of three kinds: the vendor's, from the PS2 debug build's type information (matched to the GameCube
layouts by tools/ps2sym.py); ours, named from usage and marked as such; and placeholders xNN
(offset in hex, meaning unknown). Vendor names keep the vendor's spelling, so the tree mixes
conventions on purpose. #line directives reproduce the vendor's line numbers in the assert strings.
docs/naming.md has the full account and the counts.
CONTRIBUTING.md: build, the three verification checks, the rules (bytes never change, no
instruction-emitting asm, naming), and how to propose a rename with evidence.
The reconstructed game and SDK source is the intellectual property of its respective owners
(Capcom, Nintendo, CRI Middleware) and is published for research and preservation only. The build
scripts, tools and documentation written for this project are released under CC0 (LICENSE).