Resident Evil 4 for GameCube gets a full byte-perfect C/C++ decompilation
Original source
Resident Evil 4 (GameCube) – complete byte-identical decompilation to C/C++
Hacker News →A new project reconstructs the source of Resident Evil 4’s GameCube debug build (the G4BE08 ‘Nov 25 2004’ prototype) so faithfully that recompiling it reproduces the original main.dol and all 114 REL overlays byte for byte, a match re-verified by SHA-1 checksum on every build. Crucially, the repo ships no game code or assets — builders must supply their own images of both debug discs, from which original files are read at configure time. The toolchain leans on the actual period compilers (GCC 2.95, CodeWarrior/MWCC, and SN Systems’ ProDG), which is what makes an exact match plausible in the first place.
The engineering discipline is the story. The only assembly that survives is code the original authors also hand-wrote in assembly — paired-single math kernels, matrix routines, crt0 startup, and vendor CRI library primitives — while roughly 100 hand-placed instructions and 100 register-pinning asm blocks that once padded the tree were rewritten in C on Sept 17, 2026. Where the compiler demanded an unnatural source shape to reproduce a specific register choice or instruction schedule, the spot is flagged with a COMPILER-DIFF comment (644 of them), none of which emit an instruction, and an asmcheck tool proves it. Function, file, and struct names are recovered from Capcom’s own Bio4.sym debug symbols and leftover assert strings; the C++ mangling in those symbols is why the game code is expressed in C++.
For preservation and reverse-engineering, this is a high-water mark: a verifiable, documented account of how a commercial GameCube engine was actually built, complete with matching methodology and per-unit research logs. The legal posture is deliberately careful — the reconstructed game and SDK source remains the IP of Capcom, Nintendo, and CRI Middleware and is published for research only, while the project’s own build scripts, tools, and docs are released under CC0.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.