General Save File Structure
A Pokémon Diamond and Pearl save file is divided into two pairs of blocks. Each pair consists of one general block, one storage box block, and one hall of fame block. The storage box block contains current information regarding Bebe's storage system, including stored Pokémon, box names, box wallpapers, and the current open box. The general block contains current information on every other aspect of the game's progress, such as the trainer's name, ID number, acquired badges, party Pokémon, items, and much more. The hall of fame block contains information about the Pokémon used to defeat the Elite 4. The other pair is a backup from the previous save.
The first general block in the file begins at 0x00000. The first storage block begins at 0x0C100. The first hall of fame block starts at 0x20000. The second general, storage, and hall of fame blocks are at the same address + 0x40000. The current blocks are not always stored in linear order in the save file (i.e. if the second general block is the more current, the first or second storage box block can possibly be the current as well).
Block Footers
The last 20 bytes of each general and storage box block is a footer. The last 24 bytes of each hall of fame block is a footer. The footer is used to determine:
- The size of the block
- Whether the block is current or a backup.
- Which big & small blocks link together.
General/Storage Box Footer
Offset | Purpose |
---|---|
0x00 - 0x03 | Storage Block Save Count |
0x04 - 0x07 | General Block Save Count |
0x08 - 0x0B | Size of block |
0x0C - 0x0F | Run-time usage |
0x10 - 0x11 | Run-time usage |
0x12 - 0x13 | Checksum |
Hall of Fame Footer
Offset | Purpose |
---|---|
0x00 - 0x03 | Save ID number |
0x04 - 0x07 | Save index number |
0x08 - 0x0B | Run-time usage |
0x0C - 0x0F | Run-time usage |
0x10 - 0x13 | Size of block |
0x14 - 0x15 | Run-time usage |
0x16 - 0x17 | Checksum |
Loading/Saving A Save File
When one starts a new game for the very first time, every byte of the save file is set to 0xFF. The first time the game is saved, the "current" info is written to the second half of the save file. This is important to note when loading a save.
When the game loads a save file, it first compares the small block save count of both general blocks. If the general block with the highest save count has a correct checksum, then the game moves on to check the storage blocks. The storage block with the highest storage block save count is chosen first, and if its general block save count matches the currently chosen general block (and has a correct checksum), the file is successfully loaded. If both storage blocks have the same storage block save count, then the storage block with a higher general block save count is chosen instead, and the if the checksum is correct, the file is successfully loaded. If the checksum was incorrect for either block, the game falls on the other pair of general and storage blocks; if the checksums are correct in both, the game reports a save file corruption error, and that is the data loaded. If the checksum in either block is incorrect, the game reports a save file corruption error, and the save file is not loaded. A new game must be started at that point.
When the game saves data, the general block save count is incremented + 1. If nothing in the storage block has changed, then no changes are made to the storage block and no further changes are made to the general block. However, if changes have been made to the storage block, then the storage block save count is incremented by 1 in both the storage block and general block footers. At this point, the backup general block is overwritten with the new general block data, and (if changes were made to the storage block), the backup storage block is also overwritten. This is the reason why the game varies on how long it takes to save.
Thus, either general block can be linked with either storage block, and the current pair is identified using the footer information.
Small block offsets
Adventure Started - 0x34
- Unsigned 32bit integer.
- Number of seconds since 1/1/2000 00:00:00
Pokémon League Champ Date - 0x3C
- Unsigned 32bit integer.
- Number of seconds since 1/1/2000 00:00:00
Trainer Name - 0x64
- 8 unsigned 16bit integers.
- Each word represents a character in the game's character table.
Trainer ID - 0x74
- Random unsigned 16bit integer
- The visible identification number of a trainer
- Determines ownership of Pokémon.
Secret ID - 0x76
- Random unsigned 16bit integer
- The hidden identification number of a trainer
- Determines ownership of Pokémon.
- Determines variation in the game.
Money - 0x78
- Unsigned 32bit integer.
- Limited to 0xF423F (999,999)
Trainer Gender - 0x7C
- 0 if male, 1 if female.
- Determines ownership of Pokémon.
Country of Origin - 0x7D
- Unsigned 8bit integer.
- Determines whether or not Pokémon get an outsider EXP bonus.
- 0x1 = 日本語 (Japan)
- 0x2 = English (US/UK/AU)
- 0x3 = Français (France/Québec)
- 0x4 = Italiano (Italy)
- 0x5 = Deutsch (Germany)
- 0x7 = Español (Spain/Latin Americas)
- 0x8 = 한국어 (South Korea)
Badges - 0x7E
- Unsigned 8bit bitfield
- Determines what PokéMart items are for sale, what level outsider Pokémon will obey until, and flags certain in-game events.
- 0x01 = Coal Badge
- 0x02 = Forest Badge
- 0x04 = Cobble Badge
- 0x08 = Fen Badge
- 0x10 = Relic Badge
- 0x20 = Mine Badge
- 0x40 = Icicle Badge
- 0x80 = Beacon Badge
Multiplayer Avatar - 0x7F
- Unsigned 8bit integer.
- Determines the sprite seen by other players in a multiplayer environment such as the Union Room.
- 0x00 = None
- 0x03 = School Kid
- 0x05 = Bug Catcher
- 0x06 = Lass
- 0x07 = Battle Girl
- 0x0B = Ace Trainer Male
- 0x0D = Beauty
- 0x0E = Ace Trainer Female
- 0x0F = Roughneck
- 0x1F = Pop Idol
- 0x23 = Social
- 0x25 = Cowgirl
- 0x2A = Ruin Maniac
- 0x32 = Black Belt
- 0x3E = Rich Boy
- 0x3F = Lady
- 0x46 = Psychic
Total Playtime - 0x86
- Hours = unsigned 16bit integer.
- Minutes = unsigned 8bit integer.
- Seconds = unsigned 8bit integer.
Number of Current Party Pokémon - 0x94
- Unsigned 8bit integer.
Party Pokémon - 0x98
The Pokémon in the trainer's party.
- 6 blocks of 236byte structures
- Main article: Pokemon NDS Structure
General Items - 0x624
- Main article: Other items
The items in the Trainer's general Items bag pocket.
- 165 blocks of 4 byte structures (two bytes for item index, two bytes for quantity)
Key Items - 0x8B8
- Main article: Key items
The items in the Trainer's Key Items bag pocket.
- 50 blocks of 4 byte structures (two bytes for item index, two bytes for quantity).
TMs & HMs - 0x980
- Main article: TMs and HMs
The items in the Trainer's TMs & HMs bag pocket.
- 100 blocks of 4 byte structures (two bytes for item index, two bytes for quantity).
- TMs & HMs are auto-sorted by item index in ascending order.
Mail - 0xB10
- Main article: Mail
The items in the Trainer's Mail bag pocket.
- 12 blocks of 4 byte structures (two bytes for item index, two bytes for quantity).
Medicine - 0xB40
- Main article: Medicine
The items in the Trainer's Medicine bag pocket.
- 40 blocks of 4 byte structures (two bytes for item index, two bytes for quantity).
Berries - 0xBE0
- Main article: Berries
The items in the Trainer's Berries bag pocket.
- 64 blocks of 4 byte structures (two bytes for item index, two bytes for quantity).
- Berries are auto-sorted by item index in ascending order.
Balls - 0xCE0
- Main article: Pokéballs
The items in the Trainer's Balls bag pocket.
- 15 blocks of 4 byte structures (two bytes for item index, two bytes for quantity).
Battle Items - 0xD1C
- Main article: Battle items
The items in the Trainer's Battle Items bag pocket.
- 56 (?) blocks of 4 byte structures (two bytes for item index, two bytes for quantity).
Starter Pokémon - 0xDFC
The Pokédex number of the starter chosen.
- Unsigned 16bit integer.
Lotto number - 0xE14
- Unsigned 16bit integer.
Fly Locations - 0x1112
- 9byte bit field
Has obtained lotto prize - 0x1131
- 1 if obtained, 0 if not yet obtained
Pokétch Enabled (?) - 0x114C
- 0x00 if disabled, can be 0x03 or 0x07 if enabled
Number of Pokétch Apps Enabled - 0x114D
- Max number = 25 (0x19)
Currently Selected Pokétch App - 0x114E
Pokétch app currently viewed in DS bottom screen.
- Pokétch apps are ordered like so:
- 0x00 = Digital Watch
- 0x01 = Calculator
- 0x02 = Memo Pad
- 0x03 = Pedometer
- 0x04 = Pokémon List
- 0x05 = Friendship Checker
- 0x06 = Dowsing Machine
- 0x07 = Berry Searcher
- 0x08 = Day-Care Checker
- 0x09 = Pokémon History
- 0x0A = Counter
- 0x0B = Analog Watch
- 0x0C = Marking Map
- 0x0D = Link Searcher
- 0x0E = Coin Toss
- 0x0F = Move Tester
- 0x10 = Calendar
- 0x11 = Dot Artist
- 0x12 = Roulette
- 0x13 = Trainer Counter
- 0x14 = Kitchen Timer
- 0x15 = Color Changer
- 0x16 = Matchup Checker
- 0x17 = Stopwatch
- 0x18 = Alarm Clock
Pokétch Apps Enabled - 0x114F
- 25 one byte flags, each corresponding to one Pokétch app (in the same order as above)
- 1 = enabled, 0 = disabled
Map ID Number - 0x1238
- Main article: List of Maps
- Unsigned 16bit integer.
Sinnoh Pokédex Unlocked - 0x1414
- 1 if unlocked, 0 if not unlocked.
National Pokédex Unlocked - 0x1415
- 1 if unlocked, 0 if not unlocked.
Berry Trees - 0x1E84
- 128 blocks of 14byte structures
- List of Berry Tree locations
- Main article: Berry Trees
Rival's Name - 0x25A8
- 8 unsigned 16bit integers.
- Each word represents a character in the game's character table.
Map X Coordinate - 0x25FA
- Unsigned 16bit integer.
Map Y Coordinate - 0x25FE
- Unsigned 16bit integer.
Map Z Coordinate - 0x2602
- Unsigned 16bit integer.
Players Met Underground - 0x3A2C
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Spheres Obtained - 0x3A38
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Fossils Obtained - 0x3A3C
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Gifts Given - 0x3A40
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Traps Hit - 0x3A44
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Traps Triggered - 0x3A48
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Flags Captured - 0x3A60
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Poffins - 0x5050
- 98 (?) blocks of 8byte structures
- 0x00: Poffin Type (Overall flavor?)
- 0x01: Spicy/Cool Level
- 0x02: Dry/Beauty Level
- 0x03: Sweet/Cute Level
- 0x04: Bitter/Smart Level
- 0x05: Sour/Tough Level
- 0x06: Smooth Level
- 0x07: value is 0
Trainer Card Signature - 0x5904
The signature on the back of the Trainer Card.
- 192 blocks of 8 byte structures
- The signature can be changed by speaking to the NPC behind the leftmost counter on the top floor of any Pokémon Center. It is created using the stylus.
- Main article: Trainer Card Signature
Score - 0x5F08
A measure of the player's progress or performance in the game.
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Pokémon Caught - 0x5F2C
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Pokémon Met While Fishing - 0x5F30
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Pokémon Eggs - 0x5F34
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Pokémon Defeated - 0x5FAC
- Unsigned 32bit integer
- Max value = 999999 (0xF423F)
Single Battle Wins - 0x5FCA
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Consecutive Single Battle Wins - 0x5FCC
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Double Battle Wins - 0x5FCE
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Consecutive Double Battle Wins - 0x5FD0
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Multi Battle Wins - 0x5FD2
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Consecutive Multi Battle Wins - 0x5FD4
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Link Multi Battle Wins - 0x5FD6
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Consecutive Link Multi Battle Wins - 0x5FD8
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Wi-Fi Battle Wins - 0x5FDA
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Consecutive Wi-Fi Battle Wins - 0x5FDC
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Contests Won - 0x5FE2
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Ribbons - 0x5FE6
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Capsules in PC - 0x6050
- 12 blocks of 24 bytes structures.
Battle Points - 0x65F8
- Unsigned 16bit integer
- Max value = 9999 (0x270F)
Safari Zone Pokémon - 0x72D0
- Unsigned 32bit integer result from the ARNG.
- Four daily safari zone Pokémon
- Indexn = ( ARNG >> ( n * 0x5 ) ) & 0x1F
- List of Safari Zone Pokémon
- Notes: Both Safari Zone Pokémon and Swarm Pokémon have the same ARNG value.
Swarm Pokémon - 0x72D4
- Unsigned 32bit integer result from the ARNG.
- One daily swarm Pokémon
- Index = ARNG % 0x1C
- List of Swarm Pokémon
- Notes: Both Safari Zone Pokémon and Swarm Pokémon have the same ARNG value.
Daily Trophy Pokémon Today - 0x72DC
- Unsigned 8bit integer
- First daily trophy garden Pokémon
- List of Daily Trophy Pokémon
Daily Trophy Pokémon Yesterday - 0x72DE
- Unsigned 8bit integer
- Second daily trophy garden Pokémon
- List of Daily Trophy Pokémon
- Notes: Yesterday's Pokémon can be caught after beating the Elite 4 and receiving the National Pokédex upgrade.
Honey Trees - 0x72E4
- 21 blocks of 8byte structures
- List of Honey Tree locations
- Main article: Honey Trees
GTS Pokémon - 0x73E8
One Pokémon
- 1 block of 236byte structures
- The data for the Pokémon currently uploaded to the GTS (if any).
- Main article: Pokemon NDS Structure
Recommended Comments
There are no comments to display.