Falsebound Archive
4 Secrets & leftovers 4.5

Code the linker removed

When the game was built, the linker dropped every function that nothing called. It did not drop the constants those functions used: numbers such as 1.5 or 768.0 that the compiler had already placed in a shared table of constants next to the functions that survived. So some tables hold values that no remaining code reads.

Where
main.dol and effect/*_MODULE.MRG, constant pools (.rodata)
Removed functions leave constants behind
Yes, in many parts of main.dol, in the HSD library and in most effect modules
What the removed functions did
Not recoverable in generalUnconfirmed

These orphaned constants turn up in many parts of main.dol (math, camera, drawing, model, text, battle and map code, the effect loader and helper units) and in the HSD library, and at the start of 157 of the 233 attack effect modules, whose first 0x50 bytes of constants belong to shared library code that each module was built with and then lost.

They show that the original source had more code than the game contains, for example extra effect parts that a module’s author wrote and then stopped calling. The compiler places constants in the order it meets them, so a stray constant sometimes shows where a removed function stood: in the special attacks of Dark Magician (z020) and Gemini Elf (z171), the values 1.8, 2816.0 and 768.0 sit between the constants of two live parts, in the order in which a strand-placing function that five basic-attack modules still contain (b008, b133, b134, b135, b156) uses them, so a copy of that function probably stood there.

Values that match a known kind of function are rare. What a removed function did usually cannot be read back from a few numbers; often all that is known is that it existed.

Evidence

Rebuilding the game’s code byte for byte means reproducing these tables exactly, including the values nothing uses. Each orphaned constant has to be accounted for in the right place before a rebuilt part comes out identical to the original, which is how they were all found.