We need a Pokemon GBA PokeSAV equivalent.

Discussion in 'GBA - Game Development, ROM Hacks and Translations' started by MarkusE, Oct 15, 2007.

Oct 15, 2007
  1. MarkusE
    OP

    Newcomer MarkusE Advanced Member

    Joined:
    Aug 28, 2007
    Messages:
    54
    Country:
    United States
    PokemonMaker, etc. just don't cut it. They generate action replay codes and AR-created Pokemon are highly prone to data corruptions.

    We need a program that works just like the DS Pokesav except for R/S/E/FR/LG. Which works by directly editing the .sav

    I'd be willing to contribute up to $100 towards the donation fund for a programmer to get working on this.

    This document explains how a Pokemon is structured and how the encryption works:
    http://www.princeton.edu/~jdonald/pokemon/...onMakerHelp.txt

    Steps:
    1. Get Pokemon parameters (nature, gender, OT data, moves, etc. etc.) via user input
    2. Generate .pkm file (80 bytes) - this is the unencrypted data as outlined in the document above
    3. Load .pkm files into .sav - use the XOR encryption algorithm as outlined in the document above and store it into the .sav
    (Where to store varies by game -- I believe FireRed stores the beginning of Box 01, Position 01 at around 0x5050)
    4. Recompute the game's checksum -- check filb.de for details on the algorithm

    So it's doable. Just a lot of work and I'm still working on the DP Pokesav PHP upgrade right now. So anyone who wants to tackle this will get a lot of praise from me and probably some donations, too. [​IMG]
     


  2. gizmo_gal

    Member gizmo_gal QWEEN of the RadioActive Force!!!

    Joined:
    Apr 10, 2008
    Messages:
    1,171
    Location:
    1st dimension, Earth
    Country:
    United States
    I dont have any finances to contribute, but I'd love to help any other way. Make a website maybe, or help monetize the site.
     
  3. Urza

    Member Urza hi

    Joined:
    Jul 18, 2007
    Messages:
    6,493
    Country:
    United States
    I said LAST COUPLE DAYS.
     
  4. ItsMetaKnight

    Member ItsMetaKnight GBAtemp Advanced Fan

    Joined:
    Mar 4, 2008
    Messages:
    612
    Country:
    Denmark
    nobody would do this, gba is dead man
     
  5. Chotaz

    Member Chotaz I'm back! :D

    Joined:
    Sep 20, 2007
    Messages:
    757
    Country:
    Portugal
    No console dies, until everyone quits playing it, and hell fucking yeah I play my snes
     
  6. PuppyBoy

    Newcomer PuppyBoy Newbie

    Joined:
    May 9, 2008
    Messages:
    3
    Country:
    United Kingdom
    I was looking at coding something similar for the DS, so you could view pokémon from your GBA game's hidden stats and such without dumping the data and reading it with PokéReader. I probably wouldn't go as far as editing them though due to the huge potential for fuck-upages and corruption of the data.

    Is there any other documentation of pokemon GBA save data like this? My previous attempts to find anything usually turn up nothing.
     
  7. Jack-Of-Trades

    Member Jack-Of-Trades GBAtemp Fan

    Joined:
    Apr 21, 2008
    Messages:
    311
    Country:
    United States
    You could probably

    Take a save file with slot 6 empty
    and another sav where slot 6 has a hacked pokemon

    And then use something like hex compare
    So you can see where it store's it's data
     
  8. PuppyBoy

    Newcomer PuppyBoy Newbie

    Joined:
    May 9, 2008
    Messages:
    3
    Country:
    United Kingdom
    If only it was as simple as that. I've compared three save files and the location changes everytime. There's probably some way it structures everything based on your trainer ID or something. There's no way I can work it out on my own though...
     
  9. Xeronage

    Member Xeronage GBAtemp Advanced Fan

    Joined:
    Aug 6, 2006
    Messages:
    612
    Country:
    1. Checksum
    2. It contains 2 or 3 savefile backups in one (Against Data corruption)
     
  10. PuppyBoy

    Newcomer PuppyBoy Newbie

    Joined:
    May 9, 2008
    Messages:
    3
    Country:
    United Kingdom
    There's only one backup I believe. From what I've read it uses 128kb of flash memory to store a 64kb save file aswell as a backup of it. I think that it puts the main save at 0x0A010000, 64kb into the save data and the backup at 0x0A000000 - this would explain why running in VBA gives you the 'File is corrupt, previous file will be loaded' message - VBA just doesn't save the full 128kb sav file - but I have to confirm this...

    Okay, ignore that. There's one back up. The save file's split into 28 4096kbyte, slightly out of order ,chunks - 14 for the most recent save, 14 for the previous save. Only 16 chunks are saved in the 64kb file that VBA outputs unless you give it a 128kb file, it doesn't seem to like generating them itself. :S
     
  11. Lumstar

    Member Lumstar Princess

    Joined:
    Mar 6, 2006
    Messages:
    3,531
    Location:
    Darling
    Country:
    United States
    We need a flash cart with proper 128kb save support, for that matter... Most either handle them oddly or choke on it.
     
  12. Jack-Of-Trades

    Member Jack-Of-Trades GBAtemp Fan

    Joined:
    Apr 21, 2008
    Messages:
    311
    Country:
    United States
    Yeah reason i hate to use VBA to use cheats then put them back on my cart

    turns my 32KB file to a 64KB file (still work's on card though)

    My Cart handles
    8,16,32,64,128 Files
     
  13. Eternal Myst

    Member Eternal Myst Back from the Myst.

    Joined:
    May 2, 2008
    Messages:
    1,634
    Location:
    I have a bomb alallalallala
    Country:
    United States
     
    1 person likes this.
  14. TSPhoenix

    Member TSPhoenix GBAtemp Regular

    Joined:
    Aug 7, 2007
    Messages:
    158
    Country:
    Australia
    I've been working (I use that term loosely, I'm pretty crap at this) on a tool that can read savefiles for the original Red/Blue games. (If you have relevant links/info a PM would be appreciated)

    In a similar vein if we could make an editor for older games it'd be nice to have a converter that will import old generation Pokemon into newer generations. I know this means adding in data such as gender and doubling (with 50% +1) IVs and capping EVs and so forth but what I eventually want to do is find an old GB(C/A) linker I can use to dump/restore saves from real Pokemon RBY(GSC/RSE) carts and process the data. I don't see my Blue savefile lasting that much longer so I'd like to salvage it.
     
  15. gumbyscout

    Member gumbyscout GBAtemp Regular

    Joined:
    Sep 2, 2007
    Messages:
    215
    Location:
    Who cares?
    Country:
    United States
    It would be awesome to have a Red/Blue/Yellow/Silver/Gold/Crystal to LGreen/FRed/Ruby/Sapphire/Emerald/Diamond/Pearl converter. I've always wanted one, but It would require someone who knew ALOT about how pokemon are stored, and how to program.
     
  16. ptudia

    Banned ptudia Banned

    Joined:
    Dec 28, 2006
    Messages:
    53
    Country:
    United States
  17. TSPhoenix

    Member TSPhoenix GBAtemp Regular

    Joined:
    Aug 7, 2007
    Messages:
    158
    Country:
    Australia
    Or not solved. As neat as Pokemon Maker is, we did just finish discussing how its not what we want here.
     
  18. MarkusE
    OP

    Newcomer MarkusE Advanced Member

    Joined:
    Aug 28, 2007
    Messages:
    54
    Country:
    United States
    I'm still interested in this.

    We're discussing a program that (like Pokesav for D/P) directly edits the raw game file (for example, the .sav file entered into VBA), not one that generates Gameshark codes. Because of the way these cheat devices work, they have high tendencies of corrupting data.

    -----------------------------------------------------------------------------------

    Anyway, the main problem right now isn't the individual Pokemon data structure, but the overall encryption.

    And as brought up earlier, the address where the Pokemon PC data begins changes every time. For my latest save it's 0x3004 and 0x12004 (the latter serves as a backup in case the data gets corrupted.)

    Each box Pokemon is 80 (0x50) bytes. You can't just copy and paste the contents of 0x3004-0x3053 to 0x3054-0x3103 to duplicate it; the game simply gets corrupted and falls back to the 0x12004 save. If you do it for both chunks (0x3004 and 0x12004), the game thinks both chunks are corrupted, and your file is automatically deleted. So there is definitely a checksum in each of the chunks.

    For an easier start than directly editing Pokemon, how about, for example, enabling all items in the bag and setting them to max quantities? Or having a full Pokedex? Or even easier yet, changing your trainer ID without corrupting the game? These might provide insights as to how to decode the more complicated data...
     
  19. ArvinaLove

    Member ArvinaLove GBAtemp Regular

    Joined:
    Jul 31, 2007
    Messages:
    174
    Country:
    United States
    Remind me now. Why do you still need this? What good will it do? What are your intents and motivation?
     
  20. Sir-Fritz

    Member Sir-Fritz GBAtemp Maniac

    Joined:
    May 4, 2008
    Messages:
    1,336
    Location:
    Brisbane, Australia
    Country:
    Australia
    To make customs pokemon and stuff in the gba poke games!!
     

Share This Page