Talk:Pokémon data substructures (Generation III): Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
No edit summary
No edit summary
Line 24: Line 24:
Using little endian. This means for every word (two bytes), you reverse the order of the bytes. The encryption and decryption will work as long as you keep the order the same for the key and the data.
Using little endian. This means for every word (two bytes), you reverse the order of the bytes. The encryption and decryption will work as long as you keep the order the same for the key and the data.
[[User:Twigpi|Twigpi]] 14:01, 29 October 2007 (UTC)
[[User:Twigpi|Twigpi]] 14:01, 29 October 2007 (UTC)
== Decryption Steps ==
I think this article needs to be more specific about the decryption. I wanted to verify some of the game mechanics so I learned all about the data structures and how to decrypt them. But I'm having problems because I don't know exactly how to do this. I've tried tons of combinations and nothing is turning out right. My personality is ef 4c 3c 98. My OT ID is 8d ea e7 bf. My checksum is b1 4b. (All are in normal order, not little endian.) Can anyone point out what I'm doing wrong? I've read all the information in the article and the talk page but can't figure it out. Here's the steps I take to decrypt:
*Open Game And Memory Viewer
*Jump To Pokemon Data Location
*Record Personality, OT ID, and Checksum In 16 Bit Little Endian
*Record Substructures In Order They Appear In Memory
*Break Substructures Into Groups Of 4
*Arrange Groups In 16 Bit Little Endian
*XOR Personality And OT ID
*XOR Result And Each Group In Order
*Repeat Until All Are Decrypted
*Add All Results Up
*Mod Sum By 10000
*Result Should Match Checksum (Right?)
*Convert Personality To Decimal
*Mod Personality By 24
*Result Determines Data Locations
--[[User:EV Love|EV Love]] 16:41, 11 July 2008 (UTC)

Revision as of 16:41, 11 July 2008

The "Order" section must be wrong. When I calculed Personality 3935877326(in decimal) by 24(decimal too) I got "14" - which correspond to order EAGM - but something was wrong. After 4 hours intense counting and trying I realized the ordering was wrong. The correct ordering was GEAM . Game version: Ruby (US version) Pokemon: First in party Myself: ICQ: 343370964 . btw: Now I am stuck at recalculating data checksum. If somebody know... please...

I have solved your problem. 3935877326 turns to 0xEA98B8CE in hexadecimal. You have to use little endian, to which the rule applies, least significant byte first. In other words, the very last byte will end up being first. Rearranged as follows
0x1234ABCD -> little endian -> CDAB3412. So your number should be 0xCEB898EA, or 3468204266 in decimal. 3468204266 MOD 24 = 2, which is GEAM. Nice? Twigpi 20:51, 29 October 2007 (UTC)
Also, the checksum loops. Adding the unencrypted values should give you a value greater then 0xFFFF (max size), so it just loops. To find the correct value, MOD by 65536 (decimal) or 0x10000. Twigpi 20:51, 29 October 2007 (UTC)

Substruct encryption

If you play in an emulator like No$GBA or VBA, you can open a RAM viewer. Sometimes, if you look at a Pokémon data structure, you can see the encrypted substructs change values in a flash. This is because the game decrypts the whole thing for use and encrypts them again immediately afterwards. I always did wonder how it was supposed to use the data if it's encrypted... --Kyoufu Kawa 16:52, 31 July 2007 (UTC)

DVs

Investigation of Fire Red assembly code reveals that the DVs field is not exactly as described. More to follow. --Kyoufu Kawa 20:06, 10 August 2007 (UTC)

As stated in my previous edit, the last two DV bits are actually used. One of them is the egg flag, as opposed to the ribbons, which was an endian error on my part.

Little Endian

Using little endian. This means for every word (two bytes), you reverse the order of the bytes. The encryption and decryption will work as long as you keep the order the same for the key and the data. Twigpi 14:01, 29 October 2007 (UTC)

Decryption Steps

I think this article needs to be more specific about the decryption. I wanted to verify some of the game mechanics so I learned all about the data structures and how to decrypt them. But I'm having problems because I don't know exactly how to do this. I've tried tons of combinations and nothing is turning out right. My personality is ef 4c 3c 98. My OT ID is 8d ea e7 bf. My checksum is b1 4b. (All are in normal order, not little endian.) Can anyone point out what I'm doing wrong? I've read all the information in the article and the talk page but can't figure it out. Here's the steps I take to decrypt:

  • Open Game And Memory Viewer
  • Jump To Pokemon Data Location
  • Record Personality, OT ID, and Checksum In 16 Bit Little Endian
  • Record Substructures In Order They Appear In Memory
  • Break Substructures Into Groups Of 4
  • Arrange Groups In 16 Bit Little Endian
  • XOR Personality And OT ID
  • XOR Result And Each Group In Order
  • Repeat Until All Are Decrypted
  • Add All Results Up
  • Mod Sum By 10000
  • Result Should Match Checksum (Right?)
  • Convert Personality To Decimal
  • Mod Personality By 24
  • Result Determines Data Locations

--EV Love 16:41, 11 July 2008 (UTC)