Falsebound Archive
7 The decompilation 7.1

Project status and how the original was built

A matching decompilation turns a game’s machine code back into C source that, built with the same compiler and settings, produces exactly the original bytes. Every function is rewritten by hand and checked against the original instruction by instruction, so the source is a faithful record of what the game does, mistakes included.

The game’s main program, main.dol, can already be rebuilt from the project’s source into a file identical to the one on the disc. Every source file is now built into it; 11 single functions still take the original’s code because their C does not match yet. The table below shows how far each part has come.

Where
main.dol and the 233 effect modules in effect/B_MODULE.MRG and Z_MODULE.MRG
main.dol rebuilt from the project’s source
Byte-identical to the retail file
Functions in main.dol matched
2,721 of 2,732 (as of 2026-11-03)
Effect modules with C source
All 233, all rebuilt byte for byte
Compiler
Metrowerks CodeWarrior, a different version per part
Engine library
HAL Laboratory’s sysdolphin (HSD), as in Super Smash Bros. Melee

Progress, as of 2026-11-03

Matched counts functions whose C compiles to exactly the original code. Linked is the share of the code in source files built into the rebuilt program instead of copied from the original; inside those files, 11 functions of main.dol and 3 of the effect modules still take the original’s code, because their C does not match yet. Work is ongoing, so these numbers move.

Part Functions matched Code matched Code linked
Game code (Konami) 1,106 of 1,112 96.5% 100%
HSD, HAL’s sysdolphin library 518 of 518 100% 100%
Nintendo’s Dolphin SDK 753 of 754 99.8% 100%
C library, debugger stub and runtime 272 of 272 100% 100%
Sound driver (Konami) 72 of 76 94.5% 100%
All of main.dol 2,721 of 2,732 98.0% 100%

Every function in main.dol already has C source; where it does not match yet, it is written to behave the same. The sound driver is split into seven source files, all of them now built into the program.

The attack effects are separate programs, loaded from the disc when an attack plays (next page). Every module has C source, and all 233 are rebuilt byte for byte.

Part Functions matched Code matched Code linked
Effect modules 3,994 of 3,997 99.8% 100%

How the original was built

Compilers

The whole game was compiled with Metrowerks CodeWarrior, the standard GameCube compiler, but not with one version. Each part keeps the version its authors used, and the decompilation has to use the same one, since each version arranges code a little differently:

Part CodeWarrior version
Game code, HSD, effect modules GC/1.3.2
Sound driver GC/1.3.2 (the later releases up to 2.7 gave the same code where they were tried, so it could be one of them)
Nintendo’s Dolphin SDK (built 5 June 2002, “Dolphin OS revision 54”) GC/1.2.5n (three files GC/1.2.5: the matrix library and two parts of the movie player)
C library (MSL), debugger stub (MetroTRK), runtime GC/1.3

Settings per file

The game code was compiled with full optimisation, but the setting that decides which small functions are copied into their callers (“inlining”) differs from file to file. Under one of those settings the compiler writes a file’s functions out in reverse order, so several of the project’s source files list their functions from the last address to the first. The effect modules use their own settings: no multiply-add instructions, registers saved through helper calls instead of the multiple-store instruction, and only functions explicitly marked inline are copied into callers. One data-only file, the card tables, comes out right only with optimisation off: at full optimisation the compiler pads each table, and the tables in the game are packed.

Exceptions in the sound driver

Konami’s sound driver was built with C++ exception handling switched on: every function with a stack frame has an exception table entry, though none of them uses exceptions. Whether its source was C or C++ cannot be told from the code, since both compile to the same instructions.

HAL’s engine library

Models, animation, cameras, lights and much of the drawing go through sysdolphin (HSD), HAL Laboratory’s GameCube library, the same one Super Smash Bros. Melee is built on. The decompilation of Melee had already matched this library, and its source was adapted here.

How the program is laid out

main.dol holds the game, the libraries and the sound driver. The visuals of every attack, spell and hit flash are not in it: they are 233 small relocatable programs (modules) packed in two archives on the disc, effect/B_MODULE.MRG and effect/Z_MODULE.MRG. Each sits in a fixed slot of 0x8000 bytes, and the game loads one into memory when a battle needs it.

Evidence

For the game code the neighbouring releases were each tried on whole files, and every one of them gets some function wrong, so GC/1.3.2 is certain there. The linker’s version cannot be read from the program; the rebuild uses the GC/1.3.2 linker, which produces the same file.

Thanks

The decompilation builds on open tools made by others: decomp-toolkit and objdiff to split and compare the program, m2c to draft C from the machine code, decomp-permuter to search for source variations, and cadmic’s mwcc-debugger, run under retrowin32, to read the compiler’s register choices. The HSD and SDK source was adapted from the Super Smash Bros. Melee decompilation (doldecomp/melee). See the Credits page.