NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
|
Welcome to the New Super Mario Bros. Wii decompilation project!
New Super Mario Bros. Wii was written in a mix of C and C++ and then compiled to PowerPC (PPC) assembly code by the Metrowerks CodeWarrior compiler. While C/C++ code is not directly executable, PPC Assembly Code can be run directly on the Wii's hardware.
The final game only includes the PPC assembly code, and it's highly unlikely that the original C/C++ code for the game will ever be made public. The objective of this decompilation project is to reconstruct the latter to gain insights into how the game functions, making it easier to implement changes.
The game's code is physically divided into five files:
This division, while providing modularity during the development process, likely originates from a size limit for main.dol
, imposed by Nintendo on all Wii game developers.
main.dol
is the game's primary executable, akin to an .exe
file for the Wii. It's loaded by the disc loader (usually the Wii Menu) and is statically linked, meaning it always loads to the same memory location.
The .rel.LZ
files hold most of the game-specific code and operate in a manner similar to .dll
files on Windows. They are dynamically loaded and linked after the health and safety screen by dedicated code in main.dol
. Although they are technically relocatable, meaning they could load at different memory addresses each time, due to the deterministic nature of the game's early code they consistently load at the same address.
The decompilation aims to provide matching C/C++ code for all of these files.
The game code can be logically divided into five major components, each comprising multiple sub-components:
Thanks to the symbols we have recovered, we can divide the game-specific code into several parts as follows:
f
) is the core of the game engine. For a general introduction, start here.c
prefix.d
) is truly game-specific code.