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

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
No edit summary
(manual trading works!)
Line 6: Line 6:
1. Save the game state in VBA - you know the "Save Game - Oldest Slot" routing. The file that it makes is a GZIP'd copy of the GBA's RAM. So to edit it, just ungzip it!
1. Save the game state in VBA - you know the "Save Game - Oldest Slot" routing. The file that it makes is a GZIP'd copy of the GBA's RAM. So to edit it, just ungzip it!
:'''zcat "Pokemon Sapphire7.sg2" > PS-7'''
:'''zcat "Pokemon Sapphire7.sg2" > PS-7'''
Then run your hex editor on the PS-7 file, and then put it back:
2. Then run your hex editor on the PS-7 file... then put it back:
:'''gzip PS-7'''
:'''gzip PS-7'''
:'''ren PS-7.gz "Pokemon Sapphire7.sg2"'''
:'''ren PS-7.gz "Pokemon Sapphire7.sg2"'''
Line 14: Line 14:
It is possible to change the original trainer name field without triggering the "Bad Egg" error, however I triggered it when playing with the personality of the pokemon sorta randomly. Perhaps not all values are actually in the checksum? [[User:Iliekmudkips|Iliekmudkips]] 02:50, 25 September 2007 (UTC)
It is possible to change the original trainer name field without triggering the "Bad Egg" error, however I triggered it when playing with the personality of the pokemon sorta randomly. Perhaps not all values are actually in the checksum? [[User:Iliekmudkips|Iliekmudkips]] 02:50, 25 September 2007 (UTC)
: Damn right it doesn't. Only the substructures are actually checked. The live stats and name aren't. --[[User:Kyoufu Kawa|Kyoufu Kawa]] 19:46, 25 September 2007 (UTC)
: Damn right it doesn't. Only the substructures are actually checked. The live stats and name aren't. --[[User:Kyoufu Kawa|Kyoufu Kawa]] 19:46, 25 September 2007 (UTC)
::I have been able to perform a manual trade of sorts between saved states of VBA v1.8 with success. The 80 bytes values in the VBA saved state can literally be copy and pasted between games. The simplest way to do this is to paste the 80 bytes right on top of a Poke already in the box. Basically you follow the above procedure for step one above, but on two saved files. Open both in the hex editor, and copy/paste the value from one into the other, on top of a Poke that you don't mind "trading" out, like Magikarp. I have not yet tested this between different flavors of Gen 3, but it definitely works for Sapphire to Sapphire trades.
I may document this better in the future, also, I don't expect that 100% manual trading between game-based saves will ever work because of the whole ROM-checksum issue, there will always be some calculator or something needed.
Worth mention: The manually traded Poke will behave just like a wire-traded one, including boosted experience, if the original trainer ID is different.


== Font and Sanity ==
== Font and Sanity ==

Revision as of 22:10, 26 September 2007

I'm gonna leave this to the experts here. WHAT IN THE WORLD DOES THIS MEAN?--Machamp ion 16:44, 10 August 2007 (UTC)

It's how the game is coded. Pretty complex stuff, but interesting nonetheless. TTEchidna 11:02, 3 September 2007 (UTC)
Yeah, basically each individual Pokémon in the game is defined by this structure. You got your wild encounter data and trainer data and that's just a simple species/level pair but when you actually encounter those monsters, they get a full 100 byte structure built up. Any specific questions? --Kyoufu Kawa 17:28, 5 September 2007 (UTC)

This page is beautiful. I was part way into cracking the data structure myself, having finally figured out the character set by making a Pokemon be named ABCDEEEE, and then searching the pattern in memory. I googled to see if anyone else had started documenting it, and I found the page for the 100-byte data structures! Anyways, how can you possible use this thing, with the damned "The save file is deleted" message? Easy: 1. Save the game state in VBA - you know the "Save Game - Oldest Slot" routing. The file that it makes is a GZIP'd copy of the GBA's RAM. So to edit it, just ungzip it!

zcat "Pokemon Sapphire7.sg2" > PS-7

2. Then run your hex editor on the PS-7 file... then put it back:

gzip PS-7
ren PS-7.gz "Pokemon Sapphire7.sg2"

A consequence of the fact that the last 20 bytes are discarded when the poke is boxed means you can play with those without triggering the bad-egg problem in the game right away; realistically speaking if the checksum is computed based on the 80 byte value it can't possibly cover the 100-byte value as well, right? More to come... Iliekmudkips 02:24, 25 September 2007 (UTC)

It is possible to change the original trainer name field without triggering the "Bad Egg" error, however I triggered it when playing with the personality of the pokemon sorta randomly. Perhaps not all values are actually in the checksum? Iliekmudkips 02:50, 25 September 2007 (UTC)

Damn right it doesn't. Only the substructures are actually checked. The live stats and name aren't. --Kyoufu Kawa 19:46, 25 September 2007 (UTC)
I have been able to perform a manual trade of sorts between saved states of VBA v1.8 with success. The 80 bytes values in the VBA saved state can literally be copy and pasted between games. The simplest way to do this is to paste the 80 bytes right on top of a Poke already in the box. Basically you follow the above procedure for step one above, but on two saved files. Open both in the hex editor, and copy/paste the value from one into the other, on top of a Poke that you don't mind "trading" out, like Magikarp. I have not yet tested this between different flavors of Gen 3, but it definitely works for Sapphire to Sapphire trades.

I may document this better in the future, also, I don't expect that 100% manual trading between game-based saves will ever work because of the whole ROM-checksum issue, there will always be some calculator or something needed.

Worth mention: The manually traded Poke will behave just like a wire-traded one, including boosted experience, if the original trainer ID is different.

Font and Sanity

I did some research. The font byte can be 0, 1 or 2. 0 and 2 are both Western to the degree that they look exactly the same but may have some extra characters. 1 is the Japanese font. Also notice that the variable-width font engine can fit all ten characters in a six tile space, but the Japanese font does not. For this reason, the game automatically cuts off at the sixth character if the font is set to Japanese.

The sanity byte determines if the individual is an egg. Zero and 2 are a regular monster, 1, 3-5 are Bad EGGs but can be changed back, 6 makes the game write "EGG" instead of the monster's nickname but doesn't actually make it an egg and 7 is the actual Bad EGG. When you break the checksum, the sanity byte is set to 7. This persists! Several actions in the game make it check for Bad EGGs and keep resetting the byte to 7, for example stepping into tall grass and opening the party screen. Good luck turning the Bad EGG back into a real monster. Note that only the first few bits matter so the pattern repeats after 7.

This research was brought to you by --Kyoufu Kawa 14:34, 14 September 2007 (UTC)