Gateway Code Creation Question

Discussion in '3DS - Flashcards & Custom Firmwares' started by bluedart, Nov 13, 2016.

  1. bluedart
    OP

    bluedart Member

    Newcomer
    34
    5
    Nov 13, 2016
    United States
    Hello, first-time posting on GBATemp, although I've been lurking for years. (I honestly thought I had an account already, but apparently not!)

    Anyway, I've had a Gateway for about three years now and I've just started jumping into code creation recently. I've been playing Pokémon Moon and managed to figure out how to use Gateway's in-game-menu to find and edit memory addresses, which I've been having some decent fun with. After successfully finding and changing some things in game, I'm a bit confused as to how to properly convert them into Gateway codes that work instead of just freezing the game.

    I decided to start messing with the Festival Plaza and FC to see if I could. Finding and modifying on-hand FC and total collected FC worked pretty quickly, which surprised me a bit. I also managed to find values for things like Poké Beans in Poké Pelago as well as the byte used to store the amount of scan power remaining in the QR Scanner. (Which ranges from 0-200, at 20 per scan.) Of course those values just reset immediately for whatever reason, so I don't think I can use those for anything. I also found the value for Island Scan Points, and managed to set it to 100, which could be useful. Of course, I still need to figure out how to turn these into actual codes and not just memory locations. I gleamed some info from the guide here, but after all was said and done I still wasn't able to get these codes working. I tried adding the obligatory 'end code' to them just in case, but it didn't do anything. (D2000000 00000000). I also tried changing the first hex on the single-byte code (the scan points one) to 1, which also just crashed. If anyone can help me with this I'd appreciate it.

    For anyone who's curious, the 'codes' (the ones that don't work) are right here:
    Warning: Spoilers inside!

    My setup is as follows:
    Warning: Spoilers inside!
     
  2. DarkFlare69

    DarkFlare69 GBAtemp Psycho!

    Member
    4,713
    2,568
    Dec 8, 2014
    United States
    Ohio
    The codetypes drop the first digit of the address. For the first one, it thinks your address is "03124D58" and you're doing an "if less than".

    The proper way would be to set the starting address to whatever the first digit in your address is followed by 7 0's:
    D3000000 30000000
    03124D58 00186A0
    D2000000 00000000

    This shouldn't freeze. Follow this format for all of your codes. If you want, post them here when you're done and I can see if they're right or not
     
    Last edited by DarkFlare69, Nov 13, 2016
  3. NazoXIII

    NazoXIII Advanced Member

    Newcomer
    85
    5
    Aug 10, 2008
    United States
    Poke Pelago beans is a bit weird, I myself have been trying for days and it seems like no matter what you do to change the value, it stays exactly what it is.
    For example, If I tried to change the Pattern Beans, upon leaving the gateway cheat menu, it goes right back to what it was. It also appears to be a pointer code.
     
  4. Quantumcat

    Quantumcat Dead and alive

    Member
    11,024
    5,910
    Nov 23, 2014
    Australia
    Canberra, Australia
    It might be being calculated from something else
     
  5. bluedart
    OP

    bluedart Member

    Newcomer
    34
    5
    Nov 13, 2016
    United States
    Thank you for the replies. I've managed to get the codes working, at least mostly. The FC codes work properly, as well as the Island Scan code. In addition, I found out how Poké Beans are calculated and stored. Apparently they're all stored in 15 separate bytes for the individual beans themselves, and the product of these values is simply used in Poké Pelago. I managed to make a code that sets all of these values to 99 and it seems to be working properly. As far as the QR scans are concerned I'm not quite sure how they seem to work. The code that locks the byte value to the max of 200 does indeed keep a full 10 scans shown on the top screen, but it doesn't allow additional scans after 10 to occur.

    Here are the complete codes for anyone interested.
    Warning: Spoilers inside!

    On a side note, it takes all of 3 Rainbow Beans to max out a Pokémon's affection in Pokémon Refresh, so that's neat.
     
    NazoXIII and Quantumcat like this.
  6. Quantumcat

    Quantumcat Dead and alive

    Member
    11,024
    5,910
    Nov 23, 2014
    Australia
    Canberra, Australia
    If you do research into this stuff for different games and different items maybe make a webpage or new post about it so people can link to when people ask about Gateway codes or the memory structure of different games.
     
  7. NazoXIII

    NazoXIII Advanced Member

    Newcomer
    85
    5
    Aug 10, 2008
    United States
    Yeah, I can see that now, the game seems to constantly check/compare the sum of the Poke Refresh Beans value then sets it to the Poke Pelago beans address. That's actually pretty clever, it keeps you from just changing the Pelago bean value because it'll just check the total sum again and undo your work.

    That's pretty eye opening, I wonder if anything else in the game does that, maybe Items perhaps, I don't doubt nintendo wouldn't want us messing with item quantities, wouldn't want 999x Gold Bottle cap codes running amok.
     
    Last edited by NazoXIII, Nov 14, 2016
    Quantumcat likes this.
  8. Quantumcat

    Quantumcat Dead and alive

    Member
    11,024
    5,910
    Nov 23, 2014
    Australia
    Canberra, Australia
    I ran into this trying to cheat at Pocket Card Jockey - the hearts at the end of each race weren't manipulable :-(
     
  9. NazoXIII

    NazoXIII Advanced Member

    Newcomer
    85
    5
    Aug 10, 2008
    United States
    And coincidentally, Game Freak made that game too. Looks like they aren't messing around anymore, they're doubling down on their anti cheating measures.
    Unfortunately for them that just makes things more interesting.
     
    Quantumcat likes this.
  10. Quantumcat

    Quantumcat Dead and alive

    Member
    11,024
    5,910
    Nov 23, 2014
    Australia
    Canberra, Australia
    IMG_1888.JPG
     
    NazoXIII likes this.
  11. bluedart
    OP

    bluedart Member

    Newcomer
    34
    5
    Nov 13, 2016
    United States
    Yeah, I couldn't have made the code without knowing that. Actually, I'm fairly certain they only did this because it's more efficient, not to screw with the very niche minority that has access to these kinds of things. Either way I ended up resetting after getting that code to work because I didn't really want infinite beans on my save file; I was honestly just curious. Poké Pelago is a neat little diversion every few hours, whereas the Festival Plaza is already so boring that I wanted to cheat just to move it along. Incidentally bright navy blue is an amazing dye color.

    Anyway, the only other thing I'd really like to know right now is what determines whether or not you have any QR scans remaining, since I've only managed to find the visual representation of that and not whatever actually controls it. Hopefully it's not a single byte that's changing from 1 to 0 or something. That would suck to find. At the moment I kinda just want to continue playing the game, I'm only just past the part where you get Mudsdale.
     
  12. NazoXIII

    NazoXIII Advanced Member

    Newcomer
    85
    5
    Aug 10, 2008
    United States
    Sounds like that's gonna be a royal pain.
    I tried my hand at it, figured to start with an unsigned 16 bit search just in case, and after an hour of less than and greater than searches I honestly lost motivation. It really emphasizes the Gateway's lack of searching for other data types... I wouldn't mind being able to search for floats, I'm sure that's what it uses for it.
     
    Last edited by NazoXIII, Nov 15, 2016
  13. bluedart
    OP

    bluedart Member

    Newcomer
    34
    5
    Nov 13, 2016
    United States
    Okay, so more progress has been made. Not necessarily toward what I wanted, but I did manage to find some other neat things.

    I made some codes to control the amount of turns remaining in the battle cafe thing for whatever reason. I also added some button combos to them, mostly to test that I could make codes that way. This is sort of fun. I also made a code for BP since getting it is a royal pain without well-bred Pokémon, and you need to purchase the Destiny Knot for 48 BP to get them. It's a real catch-22.

    Warning: Spoilers inside!

    And of course, here's some stuff that doesn't work. So I remember playing HGSS a while back and there was only one code I used when I played it. It was the one where you could hold L to view IVs and hold R to view EVs on the summary screen. I started by finding where the values for the pokemon you're currently viewing when you select pokemon on the bottom screen and view your active party. That didn't take too long actually, but unfortunately... Well, changing these values doesn't change what is shown on screen, so I can't seem to progress past this point. Also, I spent a few hours trying to find where IVs and EVs are stored. The only thing I found out is they are not stored as the actual values, which is unfortunate. Any help here would be massively appreciated.

    Warning: Spoilers inside!

    Okay, one last thing. I was messing around and found where some of the values for items are stored. Interestingly enough there's some crazy bitwise shenanigans going on here. A bit confusing since one of the 4 bytes always seems to be 0, but at least I seem to have found where this information is stored. Turns out they use 4 bytes to store one item slot in your inventory, and only use 3 of those. The first byte controls only what the item is, and the second and third bytes control both what the item is and how much of it there is. This number is in multiples of 4 to accommodate their bitwise shenanigans, which is why anyone looking for exact numbers in item count wouldn't have found them.

    I didn't really bother with this once I figured out how it worked, since PKHex can do a much better job of this than a code can, but here's the memory location for slot 35 of the Item pocket if anyone is interested: 330D59BC.
     
    Quantumcat likes this.