Talk:Pokémon data structure (Generation IV)

From Bulbapedia, the community-driven Pokémon encyclopedia.
⧼bulbapediamonobook-jumptonavigation⧽⧼bulbapediamonobook-jumptosearch⧽

inverse PRNG?

  • TCCPhreak> As this is the only page on which the PRNG is explained, would it be useful to write some information about inverting the PRNG? I did some calculations yesterday so I can write about it, but I'm not sure whether such information (only useful for "rolling back" the PRNG) is in the scope of this page.

TO DO

  • 0x08-0x09: List species IDs
  • 0x0A-0x0B: List held items
  • 0x14: Explain dual purpose of offset
  • 0x15: List abilities
  • 0x17: List countries
  • 0x1E-0x23: Split into individual contest stats (1 byte/stat)
  • 0x28-0x2F: List moves
  • 0x30-0x33: Split into PP/moveslot
  • 0x34-0x37: Split into PPUp/moveslot, describe effects out of range [0..3]
  • 0x38-0x3B: Describe bitfield packing of IVs, significance and use of highest two bits
  • 0x40-0x41: Describe spot encoding
  • 0x48-0x5D: Describe limitations on nickname
  • 0x5E-0x5F: List hometowns
  • 0x60-0x63: Describe bitfield packing for contests
  • 0x68-0x77: Describe limitations on OT name
  • 0x78-0x7A: Describe date format
  • 0x7B-0x7D: Describe date format
  • 0x7E-0x7F: List locations
  • 0x80-0x81: List locations
  • 0x82: Describe bitfield packing for Pokérus status (contagious/immune)
  • 0x83: List Poké Balls
  • 0x84-0x85: Describe coding

Checksum

  • I found another way to calculate checksum. I analyzed a software, Legal.exe and it use another algorithm. It divides the 80 bytes that describe the pokemon in groups of two bytes (words). The groups are added to each other. You take the last word's bytes. Note: you must adjust the bytes of words (from little endian to big endian), sum it, adjust it again and then divide the result. XX YY ZZ AA BB CC (the 80 bytes) -> YY XX AA ZZ CC BB (adjusted words) -> YY XX + AA ZZ + CC BB (sum) -> MODULE 0x100 (take the last word) -> MM NN (checksum) -Whivel 16:14, 9 July 2008 (UTC)Reply


Updates

Something that I've always wondered...

Is the encryption of the data structure the reason why saving a game in Generation IV takes so ridiculously long compared to other games? --Blaziken257 07:57, 11 March 2010 (UTC)Reply

Probably. Furthermore, the save takes even longer than normal when it has to encrypt all of the Pokémon in the PC storage system, which is why sometimes you get the "Saving a lot of data" message (if you go into the PC and make any changes). --Codemonkey85, 16:45, 11 March 2010 (EST)