Using Ghidra with the Wii

From WiiBrew
Jump to navigation Jump to search

Ghidra is a FOSS reverse-engineering tool by the US National Security Agency. It includes a disassembler and a decompiler.

Use with GameCube/Wii games

Ghidra does not include a GameCube loader by default, nor does it understand Broadway's slightly extended instruction set featuring paired singles. However, this can be fixed by installing Ghidra-GameCube-Loader, which contains both a loader for various formats and a language definition that includes paired singles. After these are installed, DOL, REL, and Apploader files can be imported using the normal import system. To extract those files from a disc image, one option is to open the properties for the disc in Dolphin, go to the filesystem tab, right-click, and select "Extract System Data" (or "Extract Entire Disc"/"Extract Entire Partition"). If a game includes debug symbols, then those can also be imported. When importing an ELF file, make sure to select the Gekko/Broadway PowerPC variant (which is selected by default for DOL and REL files).

Use with IOS

Ghidra can naturally import some IOS ARM Binaries, specifically those that are just regular ELF files. However, it will produce bad results due to the use of undefined instructions for syscalls. A language definition exists to fix this (though it will not produce the cleanest results since it doesn't know what various registers are used/changed by each syscall). For ELFLOADER files (used for monolithic IOS versions, and the kernel in non-monolithic IOS versions), the file must be converted to a normal ELF file first (by removing everything before the ELF header, or using the program on the ARM Binaries page).

There is also a data type archive and FunctionID database available to use when disassembling IOS.

Use with Disc Drive firmware

A MN102 processor spec exists.

Use with DSP microcode

A processor spec exists.

Use with Wii Speak firmware

A µPD77210 processor spec exists.

External Links