View Single Post
  #1    
Old November 9th, 2012, 12:36 PM
-Cygnus-'s Avatar
-Cygnus-
It's an odyssey
 
Join Date: Feb 2011
Gender: Male
Nature: Mild
Hey everyone:

I just wanted to write up a quick tutorial for those of you interested in fooling around with gen II ROMs. I recently started Silver again on my phone, and ran into a shiny Graveler, but was disappointed that I couldn't evolve him! So instead of downloading some tool to trade him over to another game, I did what any responsible gamer would do... I changed the game! Here's what I've learned:

You will need:
  • Pokemon Gold/Silver ROM
  • An emulator
  • A hex editor
  • Basic understanding of hex/decimal conversions
  • To be comfortable around long strings of hex digits!

Now... open up the ROM in your hex editor, and jump to the offset 0x000429B3. From here until 0x00043E56 (an area 5,284 bytes long) is where every Pokemon's move and evolution data is located. It seems like a lot, but it follows a very simple and easy-to-understand pattern. Let's start at the beginning, with Bulbasaur:

Code:
01 10 02 00 01 21 04 2D ... 00
The first few bytes represent the Pokemon's evolutionary data. The first byte (01) signals what kind of evolution the Pokemon will have. 01 is code for standard, level-up evolution, so the remaining bytes until the 00 (the end of the evo data) tell the game what the conditions for the Pokemon's evolution are. In the case of a standard evolution, the second byte (10) tells the game what level the Pokemon evolves at, and the third (02) is the species that the Pokemon will evolve into. 16 in hexadecimal is 10, so Bulbasaur will evolve into Ivysaur (Pokemon index # 2) at level 16! The game then reaches the 00 byte, telling it that the Pokemon has no more evolutions.

If that was a little confusing, don't worry- moves are much easier to understand. The next bytes up until the final 00 (signifying the end of the moves and the end of that Pokemon's move/evo data) should be looked at 2 at a time. The first byte represents the level the Pokemon learns a move, and the second byte represents what move will be learned. So, for the four bytes after the evo data, we see that Bulbasaur learns move number 21, which is tackle, at level 01, and move number 2D, Growl, at level 04! The ellipsis just represents the remainder of Bulbasaur's moves, following the same format, until the 00 at the end of its data.

The Pokemon go in order from here until the end of this section, but it should be noted that they are NOT designated by their index number before their data. You kind of have to figure out based on move and evo data where each Pokemon starts and ends (or use the pointers in the section before).





Standard evolution is designated by the byte 01, so let's see the other evolution codes:
Spoiler:

00 = no evolution
00 ...
end

01 = standard level up
01 10 02 00 ...
code, level, species, end

02 = item evolution (17 = thunder, 18 = water, 16 = fire, 08 = moon, A9 = sun)
02 17 87 00 ...
code, item #, species, end

03 = trade
03 FF 5E 00 ...
code, item (FF is none), species, end

04 = happiness (01 = anytime, 02 = day, 03 = night)
04 01 19 00 ...
code, time of day, species, end

05 = stat (01 = atk > def, 02 = def > atk, 03 def = atk)
05 14 03 ED 00 ...
code, level, condition, species, end



There are several examples of each code in the ROM except condition number 05, which applies only to Tyrogue. The 00 code is most common, as it signifies there is no evolution data, thus the movelist begins immediately thereafter. Let's look at one more example:

Exeggcute and Exeggutor's Evo Data and Moves:

0 x 0004322F , 0 x 00043252
02 22 67 00 01 8C 01 5F 07 73 0D 49 13 5D 19 4E 1F 4D 25 4F 2B 4C 00 00 01 8C 01 5F 01 5D 13 17 1F 79 00


The red is the evolutionary data, and the blue is the move data. As we can see, Exeggcute evolves via item evolution (02), using a leaf stone (item 22), into Exeggutor (species 67). As for its moves, at level 1 (01), Exeggcute learns Barrage (8C) and Hypnosis (5F). At level 7 (07) it learns Reflect (73), level 14 (0D) Leech Seed (49) and so on... The move data signifies its end with an empty byte (00), and preps the game for the next Pokemon's data. Exeggutor is a final form pokemon, and as such, it's doesn't evolve. The 00 byte simply signals the end of the evo data and the start of the move data, which we can see is similar to Exeggcute's.





I hope that everyone learned something from this, and thanks for reading! Even if you're not planning on doing a full-scale ROM hack, it's nice and interesting to know how the game works. Who knows, it may even come in handy one day when you catch a shiny Onix, but want a shiny Steelix

* Thanks to Coolboyman's Gold ROM map for locations!
Spinning, whirling, still descending
Like a spiral sea unending

Last edited by -Cygnus-; November 16th, 2012 at 11:04 AM.