Thread: Research: FireRed Pokédex Hacking
View Single Post
  #134    
Old September 6th, 2011, 03:00 AM
Jambo51's Avatar
Jambo51
Glory To Arstotzka
 
Join Date: Jun 2009
Gender: Male
Nature: Quiet
There's a Malloc (Memory Allocation) in the lead up to the Pokédex routine. If you don't hack this to have the correct length of memory, the ROM will simply crash when it attempts to load the NATIONAL dex (The Kanto Dex is loaded separately, but uses the same Malloc as the National Dex).

The Pokédex's Malloc is specifically designed to support a maximum of 386 Pokémon, and you need to raise that limit to 411 to support the Unown remnants. (Among other complicated things too!).

The length of the malloc is determined at 0x1025EC, with a mov r0, #0xC1.

The safest way (and the way I did it personally) was to insert a small routine at this location which branches off to a custom routine.
This is the routine I would have used if I simply wanted the Unown Remnants to be included:

Code:
.text
.align 2
.thumb
.thumb_func
.global dexmemorylengthen
main:
 ldr r0, length
 bl there
 ldr r1, return
 bx r1
there: ldr r1, there2
 bx r1
.align
length: .word 0x00000CD8
return: .word 0x081025F5
there2: .word 0x08002B9D
To insert this routine, navigate to 0x1025EC, and change the code there to:

Code:
00 48 00 47 XX XX XX 08
Where the XXXXXX08 stands for your pointer to the routine plus 1 for thumb.

This should help, as everything else is more obvious, and this is the one thing which is truly quite well hidden.

EDIT: I should have said that the "length" is the number of Pokémon in your Pokédex multiplied by 8. So for an unexpanded Pokédex it would be:
(0x182 * 0x8) = 0xC10
For including the Unown remnants, it would be:
(0x19B * 0x8) = 0xCD8
For having 649 Pokémon, it would be:
(0x289 * 0x8) = 0x1448.
Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!

Last edited by Jambo51; September 11th, 2011 at 05:00 AM.