Save data structure (Generation I): Difference between revisions

Fixed stuff that sounded too informal.
m (Added further clarification to Playtime)
(Fixed stuff that sounded too informal.)
Line 2: Line 2:
{{cleanup}}
{{cleanup}}
The '''save data structure''' for [[Generation I]] is stored in the cartridge's volatile
The '''save data structure''' for [[Generation I]] is stored in the cartridge's volatile
battery-backed RAM chip (SRAM), or as a ".sav" file from most emulators. The
battery-backed RAM chip (SRAM), or as a ".sav" file by most emulators. The
structure consists of 32 KB of data divided between 4 banks each 8KB or 0x2000
structure consists of 32 KB of data divided between 4 banks each 8KB, or 0x2000,
and overall contains potentially hundreds of variables, though there are quite a
and overall contains potentially hundreds of variables, though there are quite a
few areas that are either completely left alone, only read from, or only written
few areas that are either completely left alone, only read from, or only written
to. There are also a number of areas that are only used in certain game states
to. There are also a number of areas that are only used in certain game states
that can't ever be saved in including various runtime-only data and thus useless
that can't be saved to, including various runtime-only data.
in save data since it will just be either immediately be overwritten on gameplay
or when the game reaches a certain state.


Most areas, therefore, can freely be written to with custom data or at the very
Most areas can freely be written to with custom data or at the very
least cleared out. Most of these areas will never be touched by the game unless
least cleared out. Most of these areas will not be altered by the game unless
the hidden "Clear Save Dialog" is triggered on the title screen, some sections
the "Clear Save Dialog" is triggered on the title screen. Some sections
of the data will even load untouched into the in-game memory during gameplay and
of the data will load untouched into the in-game memory during gameplay and
re-saved back on each save. The "Clear Save Dialog" is the only way to truly
re-saved back on each save.
format all bytes in the data to zero and will never be called automatically,
otherwise only used areas are cleared out making many areas immune to even
starting a new game or when corruption is detected.


3 Sections of the data are protected with a simple integrity check using a
Sections of the data are protected with a simple integrity check using a
checksum to verify data corruption such as the battery dying or power cut during
checksum to verify data corruption in cases such as the power being lost during the saving process.  
save, potential hardware failure or issues, etc... Of course data can be
PC boxes have additional checksums for each box's contents on the bank in addition to the normal whole-bank checksum. The Hall of Fame is the only section of used data which doesn't have a checksum and furthermore lies on an unusual bank number because it's so large.
corrupted in many other ways including triggering various game glitches. PC
boxes have additional checksums for each box contents on the bank in addition to the normal whole-bank checksum. The Hall of Fame is the only section of used data which
doesn't have a checksum and furthermore lies on an unusual bank number
because it's so large.


==Save Data Structure==
==Save Data Structure==
8

edits