Creating Gateshark codes using Citra!

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by Shadow LAG, Jan 25, 2017.

  1. Shadow LAG
    OP

    Shadow LAG Member

    Newcomer
    46
    73
    May 10, 2013
    United States
    Things you will need:
    * Citra build with Gateshark cheat support
    (Currently Citra Bleeding Edge 150 at the time of writing this)
    *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 code that controls your value. In this example I will be using the bank in MM3D to Add and Subtract Rupees.
    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 bank to change the value. After I change the value in cheat engine to match the new value in game. I deposited 6 rupees, leaving my rupees at 6 (since we originally had 12). 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 for the number of rupees I have in game, and continuing to "Next Scan" until we are left with just a couple of entries in the code list.

    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 is now our Citra memory address for rupees. We then take our 3DS Gateshark address and change the first number in the address to "0".
    Example:
    Gateshark Code:
    10775318 000003E7
    We just need the address so we remove the second part:
    10775318
    Now we change the first number of the address to zero
    00775318
    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.

    Step 8. (Finding Citra memory difference)
    Now that we have our Citra memory address for rupees, 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 address.
    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:
    www.calculator.net/hex-calculator.html

    We now 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
    //[Rupees]
    Citra Address: 280EB358
    //minus
    3ds Address: 00775318
    //equals
    27976040
    //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.

    Test
    //[B button: Fairy Sword]
    3DS code: 2077532A 0000004F
    //Remove Gateshark definition
    0077532A 0000004F
    //Remove Values
    3ds Address: 0077532A
    //Citra Memory Difference
    (0077532A) + 27976040
    //New Address
    Citra Address: 280EB36A

    We now click "add address manually" in cheat engine to add the Citra Address. Cheat engine will have you enter in the 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 to determine the number of bytes.
    0 = 4 bytes
    1 = 2 bytes
    2 = byte

    Since our original gateshark code begins with 2, we will select byte
    (2077532A 0000004F)

    Our final product should look like this:
    Address: 280EB36A
    Description: B Button: Fairy sword
    Type: Byte

    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:
    280FE95A
    280FE958

    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:
    280FE95A 00000000
    280FE958 00000000

    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:

    0078891A
    00788918

    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:

    0078891A
    00788918

    We now add the values we modified from cheat engine after the Gateshark Addresses

    0078891A 00000000
    00788918 00000000

    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!

    Footnote
    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.
     
    Last edited by Shadow LAG, Jan 25, 2017
    Klairm and x65943 like this.
  2. Gow supremo

    Gow supremo I am playing my 2ds

    Member
    240
    12
    Jan 24, 2016
    Spain
    In the earth
    I have create yokai watch 2 codes and found but the objets only found when have a x1 min.
    How to create a code with add a item and edit a 99 items?
    Example a code generated and found on 3ds:
    [Souls Secrets]
    086F8C28 00000063
     
  3. Klairm

    Klairm Member

    Newcomer
    12
    3
    Feb 28, 2017
    Hey, i can do a tutorial in spanish from this tutorial?
     
  4. JKM

    JKM Member

    Newcomer
    26
    1
    Jul 27, 2017
    United States
    Where is da video?