How to search for pointers W/ Gateway?

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by DarkFlare69, Mar 1, 2016.

  1. DarkFlare69
    OP

    DarkFlare69 GBAtemp Psycho!

    Member
    4,680
    2,509
    Dec 8, 2014
    United States
    Ohio
    I've been making codes for a while now and am finally ready to learn how to use pointers. I have a basic understanding of how they work, but if someone could explain them and tell me how to find one and the proper codetype to use it with, that'd be great!

    Thanks
     
  2. DesuIsSparta

    DesuIsSparta GBAtemp Advanced Fan

    Member
    540
    174
    Oct 13, 2015
    United States
    Weaboo land
    A pointer points to a value stored at a an address in memory.

    In order for us to change the player's health, we have to first find the address at which the address is referenced. If you're on PC you can just use Cheat Engine to do this, or on the 3DS you can use NTR or possibly even gateway, but I don't know how that works, so I can't tell you about that.

    Once we find the place a value is referenced, we can just edit the value to what we want. But notice if you make the health 9999/1000, and the player gets hit, he might drop to 9998/1000 or even 999/1000 which would mean you will have to use the cheat again before the player dies. But what if we wanted the player to be invincible? Well depending on how you're cheating, you may be able to freeze the value. Cheat Engine can do this, but that's not a 3DS tool. So what we need to do is find out what is telling the value what to be. This is a 'pointer'. The pointer tells the references what the value should be. If you only edit a reference, the pointer will just continue with what it knows how to do. But what happens if we give the pointer new instructions? Then it will relay our message to all of the child references, so in this case when the player gets hurt or drinks a health potion, they will be invincible health-wise without having to edit every single reference everytime the health is updated.

    But how do you find pointers?

    Well, it can be quite difficult, especially for a beginner. If you don't know how memory works, I suggest watching some YouTube videos about it, as well as reading up on basic hex values. You should know 0-F and what they mean in integer format (e.g. 1 is 1, A is 10, and 10 is 16). After that, you need some way of reading the memory in a way that allows you to analyze the data between sequences. Breakpoints are very often used in debugging to find out what's going on with the program. When we set a breakpoint, the program will be stalled when it reaches a certain point in memory, and we can read all of the information it has before it continues. This allows us to analyze the data with as much time as we need. After we're done analyzing, we can step the program ('continue' is a loose word), and it will continue until the next breakpoint or the next memory change (it depends on the program you're using to debug). Programs like Cheat Engine are easy to use to find pointers, because they have a simple option to 'find where this address is written to from', which can help you find a pointer in a matter of minutes. But if we don't have such an option, which I'm more than certain we don't on 3DS memory debuggers, then we have to find the pointer the old fashioned way. Set a breakpoint, dump the data, pass the breakpoint, dump the data, then analyze the dumps.. I'm not sure how well that works, but it'd probably be a mess if it even works.

    Here's a tutorial in Chinese for NTR, but the translation will be broken and likely confusing in English if you use Google Translate, though that's your best option.
    http://www.speedfly.cn/9892.html

    Note that in that tutorial, NTR 2.2 is being used, with debugger 2.2 DEX which a Chinese user custom-made including the ntr.bin file but is only available on the o3DS (As versions of NTR below 3.0 are only compatible with N3DS).

    Sorry my explanation is kind of shitty, you'll likely find a better explanation on Google.
     
  3. dsrules

    dsrules GBAtemp Psycho!

    Member
    3,634
    503
    Sep 20, 2005
  4. Retroboy

    Retroboy GBAtemp Advanced Fan

    Member
    662
    211
    May 28, 2015
    I'm having to try find a pointer for a game but not sure how youd do it so the code works for the entire game rather than each level/character.

    I can find the code, restart the level and find the code again, use both dumps to find the pointer, but it only applies to that level/character.

    It would be ideal if i could find the pointer so its just one code.