In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "Using Ghidra with the Wii"

From WiiBrew
Jump to navigation Jump to search
m (added category)
(Ghidra GameCube Loader now includes the language spec)
Line 3: Line 3:
 
== Use with GameCube/Wii games ==
 
== Use with GameCube/Wii games ==
  
Ghidra does not include a GameCube loader by default, nor does it understand [[Hardware/Broadway|Broadway]]'s slightly extended instruction set featuring [[paired single]]s.  However, this can be fixed by installing [https://github.com/aldelaro5/ghidra-gekko-broadway-lang ghidra-gekko-broadway-lang] and [https://github.com/Cuyler36/Ghidra-GameCube-Loader Ghidra-GameCube-Loader].  After these are installed, [[DOL]] and [[REL]] files can be imported using the normal import system. <!-- TODO: Explain how to overlay REL files in a way that makes sense, if that's been implemented --> To extract those files from a [[Wii Disc|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 [https://wiki.dolphin-emu.org/index.php?title=Ships_with_Debugging_Symbols 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).
+
Ghidra does not include a GameCube loader by default, nor does it understand [[Hardware/Broadway|Broadway]]'s slightly extended instruction set featuring [[paired single]]s.  However, this can be fixed by installing [https://github.com/Cuyler36/Ghidra-GameCube-Loader 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. <!-- TODO: Explain how to overlay REL files in a way that makes sense, if that's been implemented --> To extract those files from a [[Wii Disc|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 [https://wiki.dolphin-emu.org/index.php?title=Ships_with_Debugging_Symbols 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]] ==
 
== Use with [[IOS]] ==

Revision as of 01:50, 22 December 2021

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 functionID database available to help disassemble an IOS kernel in Ghidra. It can be found here.

Use with Disc Drive firmware

A MN102 processor spec exists.

Use with DSP microcode

A work in progress processor spec exists.

External Links