how to make a save game editor ???

Discussion in 'NDS - ROM Hacking and Translations' started by omarrrio, Aug 22, 2010.

  1. omarrrio
    OP

    omarrrio GBAtemp Advanced Fan

    Member
    4
    Feb 18, 2010
    Macau
    nowhere
    hi guys, can anybody help me finding me a tutorial on make a save game editor for some nds games, from AR codes of course, and thank you.
     
  2. Masked Ranger

    Masked Ranger GBAtemp Advanced Fan

    Member
    2
    Nov 24, 2009
    I'm going to toss in my $0.02 here. You'll want to use a PC emulator and work from several different save files. AR codes only change things in memory, and not the save files themselves until after you save.

    Totally random example: Memory location 0xE4567E keeps track of how many golden whatizitz you have. You don't know where in the save file while the bytes that holds that value. Your AR code to give you 5 whatizitz will not change the save file amount.

    Take your save file that has 1 whatizitz and compare it with a post-AR save with 5 whatizitz. You would want to write a program that will edit GAME.SAV at byte 3496 since you now know where the value is kept.

    So making a save editor from just AR codes, IMHO, is impossible.
     
  3. BlueFlame90

    BlueFlame90 GBAtemp Regular

    Member
    2
    Aug 7, 2008
    Gambia, The
    It's just as Masked Ranger said: it's impossible to make a save game editor from AR codes!

    If you want to make a save game editor you need to learn:
    1. A programming language like C#, Java or C++
    2. some basics about file manipulation
    3. HEX

    Now all you need to do is find the values in the save file and write a program for it, however it's not always so easy as in Masked Rangers example.
     
  4. omarrrio
    OP

    omarrrio GBAtemp Advanced Fan

    Member
    4
    Feb 18, 2010
    Macau
    nowhere
    thank you guys, but how do i compare the bytes, there are billions, is there an easy tool to do that ???
     
  5. BlueFlame90

    BlueFlame90 GBAtemp Regular

    Member
    2
    Aug 7, 2008
    Gambia, The
    Some HEX editor have a compare function like this freeware: Hex-Editor MX
    In this program you click on search->compare and then you choose the 2 files.

    If you need help with something you can ask me anytime.
     
  6. Gaz777

    Gaz777 Member

    Member
    5
    Feb 23, 2009
    UK
    I sometimes do a bit of save game editing and begin to write programs for it, though I get bored before I finish everything or release it.
    Damn my attention span and laziness.

    When finding value positions, what your doing now, I use HxD.

    HxD is a hex viewer/editor, it also has a useful feature that allows you to compare files, showing you all the differences.

    One thing that hasn't been mentioned is that save files will often have a checksum in them to make sure the file isn't changed externally or corrupted.
    There could be one, many or no checksums in a file.


    Think that's all I have to say for now, hope it helps.
    If you have any more questions feel free to ask, I may be able to give some guidance.

    Gaz
     
  7. Masked Ranger

    Masked Ranger GBAtemp Advanced Fan

    Member
    2
    Nov 24, 2009
    No, there aren't "billions" of bytes. A 1MB save file will have 1,048,576 bytes. Most save files that my friends have are 512KB.

    Do what so many people have done, make your own tool.
    Do what so many people have done, search the internet.
     
  8. omarrrio
    OP

    omarrrio GBAtemp Advanced Fan

    Member
    4
    Feb 18, 2010
    Macau
    nowhere
    well thank you guys, one more question what is the best/easiest tool to write a save editor ?? thank you
     
  9. BlueFlame90

    BlueFlame90 GBAtemp Regular

    Member
    2
    Aug 7, 2008
    Gambia, The
    What you need is a Compiler/Linker fitting for the programming languange you use.
    A good one is Visual Studio.
     
  10. omarrrio
    OP

    omarrrio GBAtemp Advanced Fan

    Member
    4
    Feb 18, 2010
    Macau
    nowhere
    thank you very much guys, i'll start my first sav editor right after DLing VS, request done, topic can be closed.
     
  11. Momoro

    Momoro Newbie

    Newcomer
    1
    Oct 7, 2019
    United States
    Buddy, it's actually REALLY, REALLY EASY TO WRITE A TOOL LIKE THAT.(Mind my caps...)

    It's almost the same as writing a "Running Indoors Editor"(From PokeCommunity)

    What you would be generally doing is this:

    Make three buttons.

    One is for opening,

    one is for saving,

    and one is for changing player name.

    Okay:

    When the player name button is pressed, have it disable it.

    i.e. button1.Enabled = false;

    Okay, then with the open button...

    Make an OpenFileDialog, and open the save file.

    I don't know the player name offsets(sorry, bud) so I can't help you there.

    Use a BinaryReader to read for the name(in bytes), and make a string for it.

    Make a textbox, and at the end of the BinaryReader, say "textBox1.Text = <mystring>"


    ... You're probably wondering why I am not doing any Byte-Writing yet...

    Go to the save button.

    There, use the BinaryWriter to write it.(Use the same baseStream.Seek(byte) method as the BinaryReader)

    Now, do this:

    if (button1.Enabled ==false)
    {
    bw.Write(textBox1.Text);
    bw.Dispose();
    bw.Close();
    }




    That's about it!

    This was mainly for GBA/NDS POKEMON Games

    - Though, I AM DISAPPOINTED IN ALL OF YOU WHO DIDN'T ANSWER HIM CORRECTLY. Seriously, I am easily pointing him in the right direction, while, all of you are shooting him down. Lol, by the way.
     
  12. FAST6191

    FAST6191 Techromancer

    pip Reporter
    24
    Nov 21, 2005
    United Kingdom
    As your first post you necroed a largely solved 9 year old thread to add no new information, and what information you did try to add won't do anything for the OP's problem? A search did not reveal the quotes as anything than this thread so presumably not a spambot. Curious.

    For the sake of others now reading.
    As was mentioned above AR codes are for where things are stored in memory, and not where they are stored in the save (at least as far as the DS is concerned -- there might be an older console that maps its save to main memory and at least an emulator that cares to reach out and touch those areas). You can try to compare where changes to that or values from it end up in the save (though be aware some games, like pokemon, alternate save slots to both reduce wear on the memory and have a backup they can fall back to if they are broken), and sometimes things will be copied directly from memory to the save and back again rather than sliced up and put into different areas of memory so you can search for a state and go from there. For most though they will either be doing a cheat like search but using saves (for changing money then make a save, do very little but spend some money, save again, compare the two saves and what will have changed will include the money and a hash which we will cover shortly, and possibly something like a time/save counter, and if you did not sell an item back from buying in a shop then that too but as your money is likely far larger a number than a potion counter which presumably only increased by one then that should be obvious) or you will be watching how the game works from the lowest levels (maybe even step by step from the save itself until it lands is a location in memory you know the function of) and if you can do that you likely know all I have written here.

    The vast majority of games will hash/checksum their save. The DS does not have any system wide things the devs might fall back on either so expect custom implementations in every different game, though probably not between regions and I have also seen ROM hackers change the hash format to prevent issues with original saves and their hacks. You will need to figure this out or figure out a way to disable it in the game -- the game itself could be used to load your modded save and save back again with corrected hash and that is acceptable to release to the world, though many will also do this to help figure out the save format and not have to worry about the hash while they do that. Alas it is seldom a common hash over a clearly defined area as much as a minor tweak to a common hash/checksum method (if you know hashes then think the minor things your hex editor might allow for a custom CRC) over a defined area but not necessarily an obvious one (though do try obvious things like end of hash to start of next save slot/end of save). To that end you will probably have to get your hands dirty following the save protocol/logic through its hashing routine, or possibly see if another game from the same series or dev has something.
    Edit. Just to note I have seen everything from basic parity and bytesums to mid tier could still be collision matched on a normal PC in minutes to full bore crypto grade hash methods used, and no particular pattern in what dev does what (I have seen high end RPGs with bytesums and utter junk mobile phone ports with SHA1 and similar).

    To program the editor itself then once you have the hash (or a workaround) and some locations then yeah you need some means of editing a file, and better if it can do the common binary operations (most will but there are some languages where it is tedious to try to edit things down to individual bits). We had a discussion a while back on the various languages commonly seen in such circles or in the world at large but I will stand by it for today's purposes
    https://gbatemp.net/threads/rom-hacking-programming-languages-and-programming-tools-also-asm.324116/
     
    Ryccardo likes this.
Quick Reply
Draft saved Draft deleted
Loading...