This is a complete decompilation of the GameCube debug build of Resident Evil 4, G4BE08, the
"Nov 25 2004" prototype on two discs. The debug build shipped with Bio4.sym symbol files that name
every function, and that is what made a full decompilation possible.
Building the repository gives back the exact original files: main.dol and all 114 REL overlays,
checked against config/G4BE08/build.sha1 on every build. The source is about 570,000 lines of C and
C++ in src/ and 44,000 lines of headers in include/, with no assembly files.
The code is built with the compilers the original was built with:
| Code | Compiler |
|---|---|
| The game | SN Systems ProDG 3.9.3, GCC 2.95.3 "SN BUILD v1.79", built from SN's GPL source release |
CRI middleware (adx_*, sfd_*, mpv_* and the rest in src/lib/) |
Metrowerks CodeWarrior 2.4.7, which CRI shipped the libraries with |
Nintendo SDK (OS*, GX* and the rest in src/lib/) |
Metrowerks CodeWarrior GC/1.2.5n, sources from dolsdk2004 |
There are no game assets in this repository. To build it you need your own images of the debug
discs. Disc 1 has main.dol and most of the RELs, disc 2 has the four RELs for the island stages.
You need Linux, Python 3 and ninja. The first configure run downloads decomp-toolkit, objdiff, wibo and the CodeWarrior compilers. The SN GCC is built once from SN's source:
# 1. build the SN compiler once (needs SN's GPL source release, see tools/sn-gcc/build.sh)
SN_GCC_SRC=/path/to/NGC_GNU_SRC/NGC tools/sn-gcc/build.sh
# 2. copy in your disc images
cp re4_debug_disc1.iso re4_debug_disc2.gcm orig/G4BE08/
# 3. build
python3 configure.py && ninjaninja finishes with a progress report that should say 100% matched and linked. To check the result,
build/tools/dtk shasum -c config/G4BE08/build.sha1 should print one OK per file, 115 in all.
When working on one unit, python3 tools/bytecmp.py game/foo compares its object file with the
original, and python3 tools/fdiff.py game/foo <symbol> shows one function side by side.