Fun with bootleg Pokemon Emerald

Discussion in 'GBA - Console and Game Discussions, Help and Tips' started by romanaOne, Dec 7, 2015.

  1. romanaOne
    OP

    romanaOne GBAtemp Regular

    Member
    287
    35
    Apr 18, 2014
    United States
    where the potential goes to zero
    So I'm trying to load a save with Elite 4 defeated I downloaded (converted from gameshark SPS using VBA) and GBA Backup Tool (Running off R4 "Revolution For DS" in slot 1) will not write the file to the cart.

    Playing through the whole game has potential to be a very frustrating project knowing that my save might be lost after that point, so I wanted to do a test on my obviously bogus Pokemon Emerald game.

    It won't write any other .sav file either, but it will read the save data to the 128KB sav. It also dumps the whole ROM, which appears to be 32MB?! I thought Pokemon Emerald was supposed to be 16MB...

    GBA Backup Tool says the save type is FLASH 1M (128KB)


    Am I using GBA Backup Tool correctly:
    1. Press R to go to the Save Restore screen
    2. Press A (making sure the correct .sav file is selected on the top screen) to copy .sav to cart.
    I tried pressing B to "initialize save area" but it didn't do anything either: A red progress bar quickly fills but when I start game (after inserting it in a GBA), my old save file is still there.
     

    Attached Files:

    Last edited by romanaOne, Dec 7, 2015
  2. MajinCubyan

    MajinCubyan The Funky Super Saiyan

    Member
    GBAtemp Patron
    MajinCubyan is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    590
    948
    Nov 24, 2014
    United States
    Orre
    Did you rename the save to "Pokemon_Emer.sav"?
     
  3. romanaOne
    OP

    romanaOne GBAtemp Regular

    Member
    287
    35
    Apr 18, 2014
    United States
    where the potential goes to zero
    GBA Backup Tool dumps saves from this cart as POKEMON_EMER_BPEE00.sav.
    So I tried renaming the file to exactly that. Same result: the old save is still in the cart.

    Pressing B ("Initialize save area") still fails to erase it.
     
  4. MajinCubyan

    MajinCubyan The Funky Super Saiyan

    Member
    GBAtemp Patron
    MajinCubyan is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    590
    948
    Nov 24, 2014
    United States
    Orre
    Damn, I don't know then. Sorry, wish I could help. Maybe cause its a bootleg it can't write to it.
     
  5. romanaOne
    OP

    romanaOne GBAtemp Regular

    Member
    287
    35
    Apr 18, 2014
    United States
    where the potential goes to zero
    Could it be that GBA Backup Tool can only write battery-powered SRAM saves? Perhaps it can't restore flash saves?

    Could someone with a real copy of Pokemon Emerald test?
     
  6. Ammako

    Ammako GBAtemp Guru

    Member
    6,424
    3,547
    Dec 22, 2009
    Canada
    It definitely works with genuine cartridges.
    Likely this bootleg uses some obscure way of saving the game and existing tools don't know how to deal with it.

    When you dump the save file from the cartridge, does it actually dump a 128KB save file?

    Possibly the rom says Flash 1M, but the cartridge actually uses a different method of saving, so the backup tool attempts to read/write assuming it is flash-based save file, but it actually is something else? Maybe, I don't know.
     
    Last edited by Ammako, Dec 8, 2015
  7. romanaOne
    OP

    romanaOne GBAtemp Regular

    Member
    287
    35
    Apr 18, 2014
    United States
    where the potential goes to zero
    Yes, it does. However the dumped save is something no emulator except VBA will read. Attempting to write the save in VBA freezes the game, but seems to produce a usable save file.

    Even more strangely, VBA will overwrite the file with a 64KB save as soon as I open it. You can check 128k flash or 64k flash in the menu; VBA doesn't care and does the same thing every time. It also doesn't matter whether I "import" it through the GUI or just throw the save in the same folder as the rom.

    I tried a few save editors ("Pokemon Enciclopedia" and some clunky java thing) but they will not open the 128K file or the 64K file. (Had no problem opening one I got from gamefaqs, so I'm pretty sure the editors work.)

    Now I am really confused: I played the game some more until I got to Slateport (about 9 hours playtime, 24 pokemon). It saves and restores fine when playing the actual cart on my GBA SP. Then I used GBA Backuptool to extract the save. I opened it in VBA and it shows playtime 6:26 and 15 in the pokedex!

    Maybe the cart's flash save area is 2 banks of 64KB? And VBA only reads one bank? And the cart alternates between the two banks?
    Could it be related the message (only in fakes, AFAIK) "The previous save file will be loaded."?

    This guess is inspired by what happened when I dumped the ROM and got a 32MB file. GBATA was able to chop off the "overdump" to get down to 16MB. Seems to work fine.

    I'll attach the output of GBA Backup Tool and the post VBA file. Anybody handy with dd at the command line or recommend a good hex editor to chop the file in half so I can test VBA importing each half?

    btw, berries are not growing when I play the cart, but do grow when I use the dumped ROM in gpSP (on OpenPandora) and VBA (on PC). So there is definitely no clock in this cart.


    EDIT: Mystery solved!!!! The damn bootleg cart writes to the ROM and the 128k save area every time you save the game.

    Code:
    >ls -la
    total 65544
    drwxrwxr-x 24096 Dec 10 14:08 .
    drwxr-xr-x 4 4096 Dec 10 14:08 ..
    -rw-r--r-- 1  33554432 Dec  9 21:04 POKEMON_EMER_BPEE00.gba
    -rw-r--r-- 1  33554432 Dec  7 01:15 POKEMON_EMER_BPEE00.gba.old
    
    >diff POKEMON_EMER_BPEE00.gba POKEMON_EMER_BPEE00.gba.old
    Binary files POKEMON_EMER_BPEE00.gba and POKEMON_EMER_BPEE00.gba.old differ
    
    You have to redump game ROM and its save and use the same ROM/.sav pair to get VBA to load the sav file.
     

    Attached Files:

    Last edited by romanaOne, Dec 10, 2015
    Ammako likes this.
  8. Ammako

    Ammako GBAtemp Guru

    Member
    6,424
    3,547
    Dec 22, 2009
    Canada
    Interesting... yeah, even on legit save files, you have two banks of data which are basically two save files, that are a little bit under 64KB each. This is so if one gets corrupted, by turning off while saving for example, it can still load the previous one and the save file isn't completely lost.
    However, there is some space at the end of the 128KB save file to which the game would normally write to after you beat the elite four, data of some sort, and the game attempts to read from there when you load the game after beating the elite four. When playing on roms that have been patched to use a 64KB save file, it writes to nothing, and it can't read from there because no data actually exists there, so the save file is regarded as corrupted and is destroyed.

    I am not sure how that bootleg would handle it...

    It's also possible it was rtc-patched so that the clock runs while the game is running, but it doesn't have an actual rtc on it so it stops when the game isn't running anymore.
     
  9. romanaOne
    OP

    romanaOne GBAtemp Regular

    Member
    287
    35
    Apr 18, 2014
    United States
    where the potential goes to zero
    Turns out the save file is not even needed! I just assumed it was, but when I deleted the .sav VBA still restores the game right where it left off when I dumped the ROM. All of the save is in the ROM. I don't know what VBA is doing to the save file, but it doesn't even matter.
     
  10. Ammako

    Ammako GBAtemp Guru

    Member
    6,424
    3,547
    Dec 22, 2009
    Canada
    Does VBA write the save file to the rom too when saving?
     
  11. romanaOne
    OP

    romanaOne GBAtemp Regular

    Member
    287
    35
    Apr 18, 2014
    United States
    where the potential goes to zero
    Nope. If I try to save in the emulator, it freezes. Same thing in gpSP. Maybe this is by design? I mean I wouldn't want an emulator that corrupted ROMs. The only way to save in VBA/gpSP is using snapshots.

    I tried hexdumping the two roms and using meld (a GUI side-by-side text file comparison application) to compare, but there are loads of scattered diffs, not all in one contiguous 64k or 128k block as I was hoping.

    It also appears that obviously fake Emerald games are all over eBay even if you limit the search to NA, many with the same label oddities as mine. I wonder if any are playable all the way to the end? Some people selling real Emerald games have screenshots of the save screen showing 8 badges. I haven't yet spotted a fake one with better assurances than the "saves good" or "fresh battery," when the cart obviously doesn't have a battery!

    I'm starting to invest significant time in this game, so I may give up on the GBA cart and just keep playing from this point on gpSP/Pandora. Kinda feels like a DS. Gotta get my berries. I don't suppose anybody ever came up with a patch for the berry machine w/o wireless? Not that I have a legit rom, anyways....I tried the clock-in-every-pokecenter patch on one I got someplace with the wrong checksum but it seems to work.
     
    Last edited by romanaOne, Dec 11, 2015
  12. aquapearl736

    aquapearl736 Newbie

    Newcomer
    1
    0
    Sep 14, 2016
    United States
    I realize that this is an extremely old post... but I can't find anything else on this topic anywhere. I'm trying to do the same thing you did, use my backup rom/save from a fake cart on vba. but when i do, no save file shows up. I don't really understand how you fixed this issue, so if you don't mind explaining it in layman's terms, I'd really appreciate the help.