Solution for extracting Pokemon Emerald cartridge saves with Memories

For most games that I have created Memories save states for, I end up with a .sav file and a .sta file. However, Pokemon Emerald (as well as Ruby and Sapphire) currently doesn't create a .sav file when using Memories on a cartidge version, making it difficult to extract the save data to play in a GBA core or to merely preserve it.

Thankfully, after doing a bit of digging, I found a pretty easy way to create a .sav file from the .sta file:

  1. Save your game normally, then create a Memories save state
  2. Close the game, plug your SD card into your computer (or use developer tools to mount SD to USB), and find the .sta file for Emerald in the Memories folder
  3. Using a hex editor of your choice (I just used hexed.it), copy the data from address 0x60F4A to 0x80F49 (inclusive) into a new file and name it [name of your emerald rom before ".gba"].sav
  4. If you want to play with this save in a GBA core on your Pocket, copy it to the appropriate Saves directory on your SD card for whatever core you're using

And voila! Why the Pocket doesn't create the .sav file for Emerald like other games in the first place is beyond me, but luckily it's still easy enough to create from the Memories data. Have fun in Hoenn!

​


Edit: The memory addresses listed work for the USA version of Emerald. As u/VerusVerenus noted below, the addresses vary depending on the region of the game you're making a memory of. In the case of the German version, the start address is 0x60CF6 and the end address is 0x80CF5.

Basically what you're looking for in the .sta file is a string of repeating A0003001000C0000A0003001000C0001 characters. The first 00 byte after the final instance of that repeated string is the start byte of the .sav file, and the byte located at the address 0x1FFFF greater than the start byte is the final byte of the .sav file.

Posted Jan 13, 2023, 5:51 AM UTC · edited

228
Jupiter_lover1•

Thanks! Also another way is to get that .sta file into openFPGA, load GBA core with emerald and load the .sta file, then save game normally and you should have the .sav file in the sd ready to move.

1
meteorbowerOP•

i actually tried this! unfortunately i was never able to load the sta file — i would always get a “loading failed” error and the game would white screen. hence what sent me down this rabbit hole lol

1
Bweef_Ellington•

Weird. Maybe the rom and the cart are slightly different revisions of the game? Or did you dump the rom from the cart?

1
VerusVerenus•

Hi, just tried this but I have no experience whatsoever with HEX editors. I can't seem to copy or paste anything in hexed.it, also not sure how to save a new file. Basically all of point 3 is a mystery to me... Could you maybe explain in super simple terms what I need to do? Would really appreciate.

1
meteorbowerOP•

Yeah, sure thing.

  1. Open hexed.it and click "Open file" at the top, then select your .sta file. You should see something like this pop up, with the text Pokemon: Emerald Version (or ruby or sapphire, whatever game you're using) appearing with some other symbols. That's the "human-readable" equivalent of the hex code in the center at those addresses.
  2. There will be a little section labelled "Go To", it'll either be on the top right, or you'll need to scroll down a bit on the left side if all the panes are on the left. Below Current Address and Last Address, click the Go To textbox and input 0x60F4A then click enter. The editor will jump to that place in the code and look like this. That highlighted 00 in the editor is the byte at the memory address that starts your save file.
  3. In that same "Go To" textbox, replace 0x60F4A with 0x80F49, but this time don't click enter. What this will do is highlight the byte at that address in editor, without jumping to it. Instead, use the scrollbar to scroll down to the line that is labelled 000804F0 and you will see that highlighted byte in that row. Shift-click on it to select everything between the address from step 2 and this new address. It should look like this and say "131,072 bytes selected in 1 range" in the far bottom left. This is the entirety of your save file.
  4. Right click anywhere within that selection and a menu will pop up -- choose "Export selected bytes to file", if you're trying to play it with a rom on the pocket, name it [name of your emerald rom before ".gba"].sav, otherwise name it whatever you want.

Let me know if any of this doesn't work for you. I wish step 3 was easier but unfortunately with hexedit I think manually scrolling to that address is the only way to select bytes between addresses.

2
alicia2468•

Just throwing some thanks your way, was trying for ages to figure out why Pocket wasn't giving a .sav file.

Instead, use the scrollbar to scroll down to the line that is labelled 000804F0 and you will see that highlighted byte in that row.

Hopefully this also helps people, but I believe you mean 00080F40 here. Other than that this worked perfectly!

2
meteorbowerOP•

thank you for the gold! and you’re correct, i’ve updated my comment — thanks for catching that, and happy this helped you out! :D

2
VerusVerenus•

Thank you for writing this up, unfortunately I can’t seem to get it to work. The symbols next to the hex numbers look different than your screenshots. Also, for some reason my hex file stops at line 00080D00. (Pokémon Emerald / Germany ROM) So even if I highlight the last byte I only highlight 130,490 bytes. I tried to export everything and of course, my desktop emulator can’t seem to read the .sav Any ideas? For explanation, I’m trying to continue my original emerald cartridge save on any desktop emulator. Maybe there is one that can read the sta?

1
meteorbowerOP•

Can you DM me a link to your .sta file? Unfortunately I'm not super familiar with any regional differences that would make the games' memories save differently on the Pocket, but I can try poking around with the file and see if the data is still there but just at different memory addresses or something.

2
VerusVerenus•

I’ve sent them via DM. Thanks so much!

2