How to Make AR Codes - Categories

Tutorial 2 - Button Combo + Increment

First...

Make sure to read Tutorial 1 . This tutorial picks up where it left off and assumes that you’ve read it. This tutorial will show you how to make a code that is activated by a button combo! Setting the value of Gold directly is fine and all, but this time I want to be able to increase and decrease it manually.

Second...

Find the memory address that keeps track of the currently held buttons. At the bottom of the Enhacklopedia page there is a [Button Values] section – this shows the Halfword hexadecimal values that the GameCube uses for different buttons. So, first I click on [Reset scan] in DME and change the search parameter to [2 bytes (Halfword)]. Then I hold a button, pause Dolphin, make a search for that value, and repeat. There may be several results still, but they can be narrowed down further by doing searches each frame with a new button pressed or by searching for 0 when there is an input on the control stick. Eventually, I narrowed it down to one result: [80311D1E].

Third...

Determine the hexadecimal value of the button combo you want to use. For this example, I want to find the value for [L+R+Dpad Up] and [L+R+Dpad Down]. Now that I know which address keeps track of player inputs, all I have to do is press these buttons simultaneously and check what hexadecimal value pops up! In this way, I found that the value for [L+R+Dpad Up] is [0068] while the value for [L+R+Dpad Down] is [0064].

Fourth...

Refer to the Action Replay code types over at Enhacklopedia to make the first line of your code! For this example, I want my code to function as follows: “When the player holds L+R+Dpad Up, increase Gold. When the player holds L+R+Dpad Down, decrease Gold.” For the first line of this code, I want to refer to the [Conditional: If Equal] section so I can make it check when the button input address is equal to the input I want. Since I only want to do one thing when that happens, I look to the [Next line] section, and since the button input value is a halfword I then look to the [16-Bit] section (2 bytes = 16 bits). By plugging in the button input address and L+R+Dpad Up value to the template shown, we create the first line: [0A311D1E 00000068]!

Fifth...

Make the second line of your code! When the first line is true, I want it to increase my Gold, so I look to the [Signed Increment/Decrement] section, and because the value for Gold is a word I then look to the [32-Bit] section. Let’s say I want Gold to increase by 100 at a time, I can use DME or a decimal-to-hex converter to find that the hexadecimal value for 100 is [64]. This is only a byte, so to convert it to a word you just add zeroes in front of it: [00000064]. By plugging in the Gold address and increment value to the template shown, we create the second line: [8430BB40 00000064]!

Sixth...

Use steps Four and Five to make the final two lines of your code! To run the third part of my code, “When the player holds L+R+Dpad Down…” all I need to do is copy/paste the first line into the third line and change the end from [00000068] to [00000064], because that is the input value for L+R+Dpad Down. To run the fourth part of my code, “decrease Gold,” all I need to do is copy/paste the second line into the fourth line and change the end from [00000064] to [FFFFFF9C], because that is the hexadecimal word value for -100. Now, the code looks like this:
0A311D1E 00000068
8430BB40 00000064
0A311D1E 00000064
8430BB40 FFFFFF9C

Finally...

Add the code to Dolphin and test it out in the game. My Gold increases and decreases properly when I hold down the button combos. Success! Use what you’ve learned from these two tutorials to experiment with other values and code types. Once you’re confident in the structure and logic behind it, you can even use it to “reverse-engineer” other codes and find out exactly what they’re editing!