- 37
- Posts
- 7
- Years
- Seen May 20, 2021
Hi guys, I'm trying to make a routine to decrypt pokemon data but I can't figure out how the IVs are encrypted. I read the explanation of the data structure in bulbapedia but I'm confused about IVs.
The IVs are supposed to be given by a xor operation between the personnality value and the trainer ID, right? or correct me if I'm wrong.
However, it never gives me the good value! I made a test with a pidgey, I went to the start address of the pokemon data (0x02024284), its personnality value is ffab1a6f and its original trainer id is 4f9d9ed5. When I make a xor between those 2 values, it gives me b03684ba. This word should be the 32 bits for IV values (5 bits for each stat and the 2 last bits for other info).
I wanted to make sure that it's correct with an IV calculator online, the pidgey is level 100(caught in the wild by hacking wild encounters with advance map), then it can gives me the exact IVs of pidgey for each stat: it's 10, 20, 12, 17, 28 and 8. So, technically the 30 bits are 010101010001100100011110001000, which gives a word like 0x15464788 approximately(without counting the 2 last bits).
The IVs given by the calculator don't match the IVs given by the xor operation, then why? Where did I do something wrong?
I also tried to take the encrypted word of IVs and xor it with the xor PersonnalityValue-trainerID, but still nothing. the encrypted IVs are 3a049083 (and I'm sure that the sections are in the good order, I checked it).
SO WHY??!! I tried everything, honestly, I'm comfortable with ASM but this IV thing is driving me crazy. I can't make any decrypt routine since I don't know how IVs are encrypted.
My question is just: how are IVs encrypted in the pokemon data? I would really appreciate your help!
The IVs are supposed to be given by a xor operation between the personnality value and the trainer ID, right? or correct me if I'm wrong.
However, it never gives me the good value! I made a test with a pidgey, I went to the start address of the pokemon data (0x02024284), its personnality value is ffab1a6f and its original trainer id is 4f9d9ed5. When I make a xor between those 2 values, it gives me b03684ba. This word should be the 32 bits for IV values (5 bits for each stat and the 2 last bits for other info).
I wanted to make sure that it's correct with an IV calculator online, the pidgey is level 100(caught in the wild by hacking wild encounters with advance map), then it can gives me the exact IVs of pidgey for each stat: it's 10, 20, 12, 17, 28 and 8. So, technically the 30 bits are 010101010001100100011110001000, which gives a word like 0x15464788 approximately(without counting the 2 last bits).
The IVs given by the calculator don't match the IVs given by the xor operation, then why? Where did I do something wrong?
I also tried to take the encrypted word of IVs and xor it with the xor PersonnalityValue-trainerID, but still nothing. the encrypted IVs are 3a049083 (and I'm sure that the sections are in the good order, I checked it).
SO WHY??!! I tried everything, honestly, I'm comfortable with ASM but this IV thing is driving me crazy. I can't make any decrypt routine since I don't know how IVs are encrypted.
My question is just: how are IVs encrypted in the pokemon data? I would really appreciate your help!
Last edited: