Things you will need:
- Citra build with Gateshark cheat support: (currently #150 at time of writing)
- Cheat Engine: http://www.cheatengine.org/aboutce.php
- Basic knowledge of creating codes
Step 1: (Preparation)
Find a pre-made Gateshark code for the game you wish make codes for (THE SIMPLER THE BETTER).
For this example I will be using the INF Rupees code for Majoras Mask 3DS (US) Version 1.0. 10775318 000003E7
Step 2: (Interfacing cheat engine with Citra)
Load up Citra and start your game (MM3DS in this case) prior to loading up cheat engine.
Next, go to the cheat engine window and select open and select the citra process
Step 3: (Starting a code search)
You will need to use cheat engine to find the Citra equivalent of the code we chose in Step 1. In this example I will be using the bank in MM3D to Add and Subtract Rupees in game. Using the game to control our rupee value will help us in our search.
I start off with 12 rupees and set cheat engine to “Exact Value” “2 Bytes” --make sure hex value is unchecked. I then input the number 12 and click “First Scan”. This should generate a huge list of codes on the left side of the screen.
Step 4: (Defining a code search)
I then either deposit / withdraw rupees using the ingame bank to change the number of rupees I have in my inventory. After I change the value of rupees I have ingame, I then go back to cheat engine to change the number I am searching for to the new number of rupees I currently have.
I start off with 12 rupees from my first scan. I then deposited 6 rupees, leaving my new rupee count at 6. This means I need to change the number in cheat engine from 12 to the new value which is now “6”.
Now I click “Next Scan” which should now reduce the number of codes in the list on the left side of the cheat engine window.
Step 5. (Refining a code search)
Lastly, I repeat the above process by going in game, changing my rupee count, changing the search value in Cheat Engine to the number of rupees I have currently in the game, and continuing to “Next Scan” after every change. We repeat this process until we are left with just a couple of entries in the code list.
We are basically telling cheat engine to look for the code that controls the number of rupees we have. Every time we perform “Next Scan” with a new number of rupees, cheat engine can begin filtering out the search results that do not match our new rupee count. This process of elimination helps us find the code we are looking for.
Step 6. (Completing a code search)
Right click the codes generated by Cheat engine (in the list on the left). Select the option to “Add selected addresses to the address list”. Now your code result(s) should be added to the bottom list. Double click on the value (this will be the number of rupees you have) and change it to 99.
If your Rupees now show 99, congratulations you found the code we are looking for. If you do not see a change, continue to try changing the value to 99 on the other codes in the list (if there are any). You may now remove any other codes we added to the address list as we have found the code we are looking for.
Step 7. (Finding Gateshark code address)
Now we open up notepad and type the address that we just found in Cheat Engine. This is known as our Citra memory address which we will be revisiting in step 8.
We then take our 3DS Gateshark code (Refer to Step 1) and change the first number in the address to “0”.
We just need the address so we remove the second part:
Now we change the first number of the address to zero
The reason we do this is because the first number just tells gateshark how to handle the code. Since we remove the gateshark instruction, we now have our 3DS memory address for rupees. Now paste your 3DS memory address in notepad just below the Citra memory address
Step 8. (Finding Citra memory difference)
Now that we have our Citra memory address, and the 3DS memory address for rupees, we will need to convert any other codes we find in cheatengine to gateshark codes so other people can use them. In order to do that, we need to find the difference between the two addresses.
We need to use a hex calculator to find that difference. This is the one I use which is web based and does not require you to download anything:
Use hex calculator to subtract the 3DS address from the Citra address like so:
NOTE: THE CITRA ADDRESS CHANGES EVERYTIME YOU RE-OPEN CITRA SO MY CITRA ADDRESS WILL NOT MATCH YOURS
#Finding Citra base Address
Citra Address: 280EB358
3ds Address: 00775318
//Citra Memory Difference
(3ds Address) + 27976040
Step 9. (Converting Gateshark codes to Citra Address codes)
We now test the Citra memory difference by using another gateshark code. In this example, I am using fairy sword on B button for Majoras Mask 3DS. We simply use the Citra Memory difference equation above to convert our gateshark code to citra.
//[B button: Fairy Sword]
3DS code: 2077532A 0000004F
//Remove Gateshark definition
3ds Address: 0077532A
//Citra Memory Difference
(0077532A) + 27976040
Citra Address: 280EB36A
We now click “add address manually” in cheat engine. Cheat engine will open a new window with a field to enter in an address. The address we enter will be the Citra Address we just found. In the next fields you will have the option to name the code, and select the number of bytes. We will name the code: B Button: Fairy sword. Next we will use the first number of the original gateshark code (Refer to Step 1) to determine the number of bytes.
0 = 4 bytes
1 = 2 bytes
2 = byte
Since our original gateshark code begins with 2 (2077532A 0000004F), we will select byte
Our final product should look like this:
Description: B Button: Fairy sword
Finally click "OK"
The code should now appear in the bottom list of cheat engine. Right click the code we just added and select “Show as hexadecimal”. Next, click the check box next to the code to activate it. Now change the value to 4F and return to the game. If we did everything correct, we should now pull out the Fairy sword when we press B.
Congratulations! We tested our first ported code.
Step 10. (Finding & Porting Citra Address codes to Gateshark codes)
This step requires you to use the tools in cheat engine to find your own code. If you need help with using the tools, there are plenty of tutorials online. For this example I will be using a brand new code I have found for MM3D.
I wanted to find a code to allow items to be used anywhere / anytime that are normally locked in certain situations. For example, in Zelda Majoras Mask, you cannot use the fierce deity mask unless you are in a boss fight. This code enables you to use it anywhere.
I remember in the N64 version that when an item was locked from use, the value would change to FF. This made finding the code extremely easy as I had experience with this code and the 3DS version is mostly the same. Since I know the usable items generate a value of 00, this makes my life a whole lot easier when searching.
I go in game and place a usable item on X button and run a first scan in cheat engine for the exact value (with hex checkbox checked) of 00. I then spam the next scan button until the code results on the left stop decreasing (or slows down). I then replace the item on the X button with an unusable one (Fierce Deity mask) before going into cheat engine and changing the value to FF. I then spam the next scan button until the value stops decreasing (or slows down).
I repeat the above process until I am left with two code results in the list to the left:
I add both of these results to the bottom address list in cheat engine. I then right click one of them and select “browse memory region”. Now when I set the memory viewer window next to the citra window, I can see values change from 00 to FF as I assign the unusable item (Fierce Deity’s Mask) to each button one by one.
I can see a total of 4 bytes change from 00 to FF depending on the button. This makes sense as each button represents a byte. I then close out of the memory viewer and head back to the main window of cheat engine to define my address type. I double click on the byte type displayed after both of my addresses to change the bytes to 4.
I now enable the codes by checking the boxes next to them and changing the value to 00000000
Essentially our Citra Address code should look like this:
I have now verified that when I press one of the buttons with an item that is unusable, I can use it. This means the code I found worked. We simply need to do the inverse of step 9 and subtract the citra memory difference from these codes using the hex calculator.
(280FE95A) - 27976040 = 78891A
(280FE958) - 27976040 = 788918
This leaves us with addresses that are two short. We must make them equal 8 characters long. We do this by adding zeros to the front which keeps the address the same, but also makes the addresses the correct length:
Now we just need to replace the first number of each address with the gateshark instructions:
0 = 4 bytes
1 = 2 bytes
2 = byte
Since we are writing to 8 bytes we leave the first number of both addresses as "0"
We now have our Gateshark Addresses:
We now add the values we modified from cheat engine after the Gateshark Addresses
Lastly, we disable the codes in cheat engine and add/enable the Gateshark code we just made in Citra. If all goes well you should now see your code active using just the cheats function in Citra. Congratulations you just created a Gateshark code!
I know this looks like quite a bit of work to do, but I assure you once you’ve done it once or twice it becomes a cake walk. I plan on uploading a video soon of this process. Please feel free to ask if you need anything clarified.