Talk:Pokémon data structure (Generation IV): Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
(→‎Data Block's order: new section)
No edit summary
Line 9: Line 9:
I'm analizyng pokesav. I try to understand encrypt algorithm.
I'm analizyng pokesav. I try to understand encrypt algorithm.
I found the system used by ds game for ordering the blocks.
I found the system used by ds game for ordering the blocks.
i'll test it and may write the algorithm
i'll test it and may write the algorithm -[[User:Whivel|Whivel]] 20:45, 9 July 2008 (UTC)

Revision as of 18:46, 9 July 2008

A checksum calculation algorithm is outlined (in Deutsch) at Pokemon Inside. I coded up a version of it in Perl; the first byte of the checksum calculates properly, but the algorithm listed there doesn't seem to work for the second byte. Can anyone shed some light on this? -Tsanth 23:15, 12 December 2007 (UTC)

  • Okay, I found the problem: the algorithm described on the page is incorrect in regards to the second checksum byte. The first checksum byte is indeed calculated as [sum of even-numbered bytes in blocks] % 0x100. However, to get the second byte of the checksum, we need to do ([sum of all bytes in blocks] + ([sum of even-numbered bytes in blocks] / 0x100)) % 0x100. Instead of taking the modulus for the second byte, we need the quotient. I just tested it on two pkm files I have on-hand; I'll do some more testing later. -Tsanth 00:00, 13 December 2007 (UTC)
  • I found another way to calculate checksum. I analyzed a software, Legit.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)

Data Block's order

I'm analizyng pokesav. I try to understand encrypt algorithm. I found the system used by ds game for ordering the blocks. i'll test it and may write the algorithm -Whivel 20:45, 9 July 2008 (UTC)