Pokémon data structure (Generation IV)

Pokémon in the games Diamond and Pearl are all stored the same way in a 136-byte structure.

  • Need to figure out how checksum is computed
  • Need to figure out the encryption algorithm for bytes 08-87

The Pokémon data structure is divided into four 32-byte blocks, A through D. The personality value and checksum are stored into the save data, and the remaining 128 bytes are encrypted in a never-before-seen complex method using some combination of the PV and checksum as the encryption key. (It is no longer as simple as XOR'ing the 2 values.) Then, something (not PV mod 24 as in the GBA games) determines which order the data gets stored in, i.e. BACD or CABD or one of the 22 other possible permutations. This algorithm needs to be figured out.

Everything is stored in little endian

Unencrypted bytes

Block A

  • 08-09 Species ID
  • 0A-0B Held Item
  • 0C-0D OT ID
  • 0E-0F OT Secret ID
  • 10-13 Experience points
  • 14 Friendship/Egg Steps to Hatch
  • 15 Ability
  • 16 Markings
  • 17 Country of Origin
  • 18-1D Effort values
  • 1E-23 Contest stats
  • 24-27 Ribbons

Block B

  • 28-2F Moveset
  • 30-33 Move PP
  • 34-37 Move PP Ups
  • 38-3B Individual values
  • 3C-3F Unknown
  • 40 Gender
  • 41-47 Unknown

Block C

  • 48-5D Nickname
  • 5E Unknown
  • 5F Hometown
  • 60-62 Contests
  • 63-67 Unknown

Block D

  • 68-77 OT Name
  • 78-7A Date Egg Received
  • 7B-7D Date Met
  • 7E-7F Egg Location
  • 80-81 Met At Location
  • 82 Poké Rus
  • 83 Poké Ball
  • 84 Met At Level
  • 85 Specific Location
  • 86-87 Unknown