gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Load game varification problem

#49093 - thos_thom - Tue Jul 26, 2005 12:28 pm

does anyone have any thoughts as to how i would go about varifying if a save game has become corrupted or not used before.

In my game as it stnds when you load a game that has not been saved to, you get the nonsense that was in the sram previously.

Any ideas as to a robust way i could determine if a savegame has been previously used and is not corrupted?

I supposed i could check that everything was in acceptable ranges (those variables that should be enums for example) but if corruption had occoured within that range i would not know.

perhaps a checksum would solve the problem, is this how comercial games do their varification? Or perhaps this is overkill, is there a simple way to solve this problem that i have overlooked?

any thoughts welcome, thanks

thom
_________________
--------------
^thom(as)?
--------------

#49095 - thos_thom - Tue Jul 26, 2005 12:35 pm

ooh, or perhaps a hash :D
_________________
--------------
^thom(as)?
--------------

#49106 - poslundc - Tue Jul 26, 2005 4:03 pm

A simple checksum should suffice. Your number one cause of data loss will be someone shutting off their GBA while writing, which a checksum should detect.

I would also store some kind of basic identifier key - maybe a few bytes in length - as well as a hardcoded version number so you can quickly and easily invalidate your save data whenever the format changes.

Dan.

#49213 - thos_thom - Wed Jul 27, 2005 9:42 am

yes, ive not got a really lamely calculated checksum variable in my save state struct, it seems to work fine, awesome, thanks

thom
_________________
--------------
^thom(as)?
--------------