Difference between revisions of "Disassembly instructions"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:''Pikmin 2'' disassembly instructions}} The following guide will teach you how to get a disassembler environment with ''Pikmin 2'''s code, complete with the fun...")
 
(Oh, not just functions.)
Line 1: Line 1:
 
{{DISPLAYTITLE:''Pikmin 2'' disassembly instructions}}
 
{{DISPLAYTITLE:''Pikmin 2'' disassembly instructions}}
The following guide will teach you how to get a disassembler environment with ''Pikmin 2'''s code, complete with the function symbol map. Some things to keep in mind:
+
The following guide will teach you how to get a disassembler environment with ''Pikmin 2'''s code, complete with the symbol map. Some things to keep in mind:
* The symbol map (i.e. the thing that gives functions a name) can only be found in a ''Pikmin 2'' demo inside of a multi-game demo disc.
+
* The symbol map (i.e. the thing that gives functions, classes, etc. a name) can only be found in a ''Pikmin 2'' demo inside of a multi-game demo disc.
 
* 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.
 
* 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.
* The disassembly is still written in PowerPC assembly language, and we only have access to the function name symbols; even then, some of them might be missing.
+
* 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.
  
 
== Getting the necessary files ==
 
== Getting the necessary files ==

Revision as of 22:19, 12 May 2019

The following guide will teach you how to get a disassembler environment with Pikmin 2's code, complete with the symbol map. Some things to keep in mind:

  • The symbol map (i.e. the thing that gives functions, classes, etc. a name) can only be found in a Pikmin 2 demo inside of a multi-game demo disc.
  • 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.
  • 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.

Getting the necessary files

  1. Obtain the Multi Game Demo Disc Version 17 (US).
  2. Add it to Dolphin's game list.
  3. Right-click it, Properties, Filesystem, go down to zz_Pikmin2_game.tgc, right-click it, Extract File..., and extract it somewhere.
  4. 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.
  5. Right-click the Pikmin 2 demo in Dolphin's game list, Properties, Filesystem:
    1. Right-click Disc at the top of the tree, Extract DOL..., and extract it somewhere.
    2. Find pikmin2UP.MAP, right-click it, Extract File..., and extract it somewhere.

Setting up a disassembly environment

  1. Install Ghidra (and maybe familiarize yourself with how it works).
  2. Go to the Ghidra Gekko/Brodway language project, and follow the instructions to install it on Ghidra.
  3. Go to the Ghidra GameCube loader project, and follow the instructions to install it on Ghidra.
  4. In Ghidra, create a project for Pikmin 2, and add the .dol file you extracted to the project. The type should be detected automatically, but you should select GameCube game.
  5. When asked if you want to include a symbol map, choose yes, and pick the .MAP file you extracted.
  6. Drag the .dol file to the CodeBrowser tool. When prompted to analyze the project, press Yes, and go with the defaults.
Credits: Espyo, Yoshi2