Skip to content

NSMBW-Community/NSMBW-Decomp

Repository files navigation

NSMBW-Decomp

Progress badge DOL Progress badge d_profileNP Progress badge d_basesNP Progress badge d_en_bossNP

A decompilation project of New Super Mario Bros. Wii, based on the PALv1 binaries.

Quick Links

Overview

This project aims to produce an accurate reconstruction of New Super Mario Bros. Wii's code by decompiling the original binaries. The build process consists of three major stages:

1. Compilation

All decompiled source files are compiled into object files in bin/compiled/.

2. Slicing

Parts of the binary without corresponding source files are extracted from the original binaries using slicing. This produces object files in bin/sliced/, using slice information defined in the slices/ directory.

3. Linking and Rebuilding

Compiled and sliced object files are linked together to reconstruct the final .dol and .rel files that match the originals byte-for-byte.

Other Relevant Files

  • alias_db.txt: Contains relocation helpers for rebuilding the .rel files.
  • syms.txt: Contains known symbol names for main.dol. Will eventually be replaced by a proper symbol map.

Setup

  1. Obtain main.dol and the four .rel.LZ files from a dumped PALv1 disc of New Super Mario Bros. Wii. A tutorial to do so can be found here.
  2. Use tools/uncompress_lz.py to decompress the .rel.LZ files into .rel.
  3. Rename main.dol to wiimj2d.dol, and place it along with the decompressed .rel files into the original/ directory.
  4. Verify the following checksums:
$ md5sum original/*
17096d0ed441d44a0c31039138a8d7f8  original/d_basesNP.rel
f8cffd634edbec6c1bc210dab02c1e32  original/d_en_bossNP.rel
458f1aa94706dde1a8f2f9d97ff1f35c  original/d_enemiesNP.rel
393bf12ef4254dd1ea1366d5b06fbebb  original/d_profileNP.rel
ddab9e5dca53d8c18bf4051b927e822e  original/wiimj2d.dol
  1. Download the CodeWarrior for Embedded PowerPC binaries from here and extract it into the compilers/ directory. The compiler should be located at compilers/Wii/1.1/mwcceppc.exe.

    • Windows users: No additional setup is required.
    • Linux/macOS users: Install wibo or use WINE. wibo is recommended for faster compilation and is used automatically if detected on PATH.
  2. Install ninja (if not already installed):

pip install ninja

Building

  1. Generate the build script:
./configure.py
  1. Run the build using ninja:
ninja
  1. (Optional) Verify that the rebuilt binaries match the originals:
./progress.py --verify-bin

Documentation

You can generate source documentation using Doxygen.

  1. Install Doxygen.
  2. If not already present, download the doxygen-awesome-css theme and place its contents into the following directory:
website/doxygen/doxygen-awesome-css/
  1. Generate the documentation:
doxygen

The generated HTML documentation will be placed in the doxygen directory.

Contributing

We welcome contributions to this project! Please see CONTRIBUTING.md for detailed guidelines.

Decompilation

Usage of objdiff is recommended for decompilation work.

To prepare the repository for use with objdiff, run:

./prepare_objdiff.py

This sets up the necessary files and configuration.

About

A decompilation of New Super Mario Bros. Wii

Resources

Contributing

Stars

Watchers

Forks