Difference between revisions of "Disassembly instructions"
Jump to navigation
Jump to search
m (Basically changed the Ghirda info since there are compiled versions of Ghirda on GitHub) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
* The disassembly is still written in PowerPC assembly language, and we only have access to the names of functions, classes, and so on; even then, some of them might be missing. We don't have access to the names of variables or anything like that. | * The disassembly is still written in PowerPC assembly language, and we only have access to the names of functions, classes, and so on; even then, some of them might be missing. We don't have access to the names of variables or anything like that. | ||
− | * The symbol map (i.e. the thing that gives functions, classes, etc. a name) for ''Pikmin 2'' can | + | * The symbol map (i.e. the thing that gives functions, classes, etc. a name) for ''Pikmin 2'' can be found in the final version of the game but the demo version of the game, the one found inside of a multi-game demo disc 17. has a more complete map than final. These instructions apply to that demo. For most purposes, it's good enough, since the code should be very similar to the final game. You can apply this guide to the final version of ''Pikmin 2'', but you won't be able to get the symbol map working without a lot of effort. |
== Getting the necessary files == | == Getting the necessary files == | ||
Line 24: | Line 24: | ||
== Setting up a disassembly environment == | == Setting up a disassembly environment == | ||
=== Basics === | === Basics === | ||
− | # Install [https://github.com/Cuyler36/Ghidra-GameCube-Loader Ghidra] | + | # Install [https://ghidra-sre.org Ghidra] (and maybe familiarize yourself with how it works). |
+ | # Go to the [https://github.com/aldelaro5/ghidra-gekko-broadway-lang Ghidra Gekko/Brodway language project], and follow the instructions to install it on Ghidra. | ||
+ | # Go to the [https://github.com/Cuyler36/Ghidra-GameCube-Loader Ghidra GameCube loader project], and follow the instructions to install it on Ghidra. | ||
# In Ghidra, create a project for the game you want, and add that respective game's <code>.dol</code> file you extracted to the project. The type should be detected automatically, but if not, you should select Nintendo GameCube Binary for the format, and PowerPC:BE:32:Gekko_Brodway:default for the language. | # In Ghidra, create a project for the game you want, and add that respective game's <code>.dol</code> file you extracted to the project. The type should be detected automatically, but if not, you should select Nintendo GameCube Binary for the format, and PowerPC:BE:32:Gekko_Brodway:default for the language. | ||
# When asked if you want to include a symbol map, choose yes, and pick the <code>.map</code> file you extracted. | # When asked if you want to include a symbol map, choose yes, and pick the <code>.map</code> file you extracted. |
Latest revision as of 02:41, 11 March 2024
The following guide will teach you how to get a disassembler environment with Pikmin or Pikmin 2's code, complete with the symbol map. Some things to keep in mind:
- The disassembly is still written in PowerPC assembly language, and we only have access to the names of functions, classes, and so on; even then, some of them might be missing. We don't have access to the names of variables or anything like that.
- The symbol map (i.e. the thing that gives functions, classes, etc. a name) for Pikmin 2 can be found in the final version of the game but the demo version of the game, the one found inside of a multi-game demo disc 17. has a more complete map than final. These instructions apply to that demo. For most purposes, it's good enough, since the code should be very similar to the final game. You can apply this guide to the final version of Pikmin 2, but you won't be able to get the symbol map working without a lot of effort.
Contents
Getting the necessary files[edit]
Pikmin[edit]
- Obtain any copy of Pikmin, as long as it's on the GameCube.
- Add it to Dolphin's game list.
- Right-click it, Properties, Filesystem:
- Right-click Disc at the top of the tree, Extract DOL..., and extract it somewhere.
- Right-click
/dataDir/build.map
, Extract File..., and extract it somewhere.
Pikmin 2[edit]
- Obtain the Multi Game Demo Disc Version 17 (US).
- Add it to Dolphin's game list.
- Right-click it, Properties, Filesystem, go down to
zz_Pikmin2_game.tgc
, right-click it, Extract File..., and extract it somewhere. - Add the Pikmin 2 demo you've extracted to Dolphin's game list.
- If your version of Dolphin can't read .tgc files, download tgctogcm and run the .tgc file through it, in order to get a plain old .gcm file.
- Right-click the Pikmin 2 demo in Dolphin's game list, Properties, Filesystem:
- Right-click Disc at the top of the tree, Extract DOL..., and extract it somewhere.
- Right-click
pikmin2UP.MAP
, Extract File..., and extract it somewhere.
Setting up a disassembly environment[edit]
Basics[edit]
- Install Ghidra (and maybe familiarize yourself with how it works).
- Go to the Ghidra Gekko/Brodway language project, and follow the instructions to install it on Ghidra.
- Go to the Ghidra GameCube loader project, and follow the instructions to install it on Ghidra.
- In Ghidra, create a project for the game you want, and add that respective game's
.dol
file you extracted to the project. The type should be detected automatically, but if not, you should select Nintendo GameCube Binary for the format, and PowerPC:BE:32:Gekko_Brodway:default for the language. - When asked if you want to include a symbol map, choose yes, and pick the
.map
file you extracted. - Drag the
.dol
file to the CodeBrowser tool. When prompted to analyze the project, press Yes, and go with the defaults.
Details[edit]
Pikmin 2[edit]
- In the disassembly pane, select all with Ctrl+A.
- Right-click, Set Register Values...
- Set r2 to
8051e2a0
, and r13 to8051c5c0
.- The game uses these registers a lot to load data. These values can be obtained by playing the demo in Dolphin with debug mode, pausing emulation, and examining the value of the registers, since they're always the same.