PDA

View Full Version : I'm Fixin' It: The Pokédex Glitch


HackMew
February 16th, 2010, 02:34 AM
Brief Intro
The Pokédex Glitch (http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_FireRed_and_LeafGreen_Versions#Trivia) is a glitch exclusive to FireRed and LeafGreen US v1.0. The species names present are cut off, most specifically those species names made up of more than one word with a space in between. This causes Pokémon like Squirtle to be listed as "Tiny Pokémon" rather than "Tiny Turtle Pokémon." This was addressed in later releases of the games.

Description
Here's a part of the routine disassembled from FireRed US v1.0:

[css-div="font-family:consolas, courier new,monospace"]0810583a 7828 ldrb r0, [r5, #0x0]
0810583c 2800 cmp r0, #0x0
0810583e d01b beq $08105878
08105840 4669 mov r1, sp
08105842 1909 add r1, r1, r4
08105844 3108 add r1, #0x8
08105846 1928 add r0, r5, r4
08105848 7800 ldrb r0, [r0, #0x0]
0810584a 7008 strb r0, [r1, #0x0]
0810584c 1c60 add r0, r4, #0x1
0810584e 0600 lsl r0, r0, #0x18
08105850 0e04 lsr r4, r0, #0x18
08105852 1928 add r0, r5, r4
08105854 7800 ldrb r0, [r0, #0x0]
08105856 2800 cmp r0, #0x0
08105858 d00e beq $08105878[/css-div]

The very first byte of the species name is loaded. If this byte is 0x0, no name will be loaded because the routine would treat that as an empty string.
Going on with the routine, there are some other instructions, but we just need to focus on the second cmp. There, the current name byte is checked to see if the end of the string was reached yet.
A blank space (0x0) is confused for the terminating byte (0xFF), basically. Now, changing the cmp instructions a little:

[css-div="font-family:consolas, courier new,monospace"]0810583a 7828 ldrb r0, [r5, #0x0]
0810583c 28ff cmp r0, #0xff
0810583e d01b beq $08105878
08105840 4669 mov r1, sp
08105842 1909 add r1, r1, r4
08105844 3108 add r1, #0x8
08105846 1928 add r0, r5, r4
08105848 7800 ldrb r0, [r0, #0x0]
0810584a 7008 strb r0, [r1, #0x0]
0810584c 1c60 add r0, r4, #0x1
0810584e 0600 lsl r0, r0, #0x18
08105850 0e04 lsr r4, r0, #0x18
08105852 1928 add r0, r5, r4
08105854 7800 ldrb r0, [r0, #0x0]
08105856 28ff cmp r0, #0xff
08105858 d00e beq $08105878[/css-div]

Fixing it is so easy it's not even fair; just replace 00 with FF.

The Offsets



FireRed US v1.0

[css-div="font-family:consolas,courier new,monospace"]0x10583C
0x105856[/css-div]

LeafGreen US v1.0

[css-div="font-family:consolas,courier new,monospace"]0x105814
0x10582E[/css-div]



This research document is Copyright © 2010 by HackMew.
You are not allowed to copy, modify or distribute it without permission.

Tropical Sunlight
February 16th, 2010, 08:07 AM
What else will they make :D
Good job!

I wonder what other differences between v1.0 and v1.1 are.

HackMew
February 16th, 2010, 09:20 AM
What else will they make :D
Good job!

I wonder what other differences between v1.0 and v1.1 are.

Thank you. And I wonder too. AFAIK, there are not many differences at all. Except the said glitch, and the presents screen, I wouldn't really know.
Comparing the ROMs is not a solution because all the data got shifted, making all offsets and pointers different.

NarutoActor
February 16th, 2010, 02:21 PM
Nice Nintendo should hire you. XD I never herd of these glitches; They never happened to me. What other glitches are there in FireRed?

TB Pro
February 18th, 2010, 06:04 PM
Great job HackMew! I was suffering from this glitch, so thanks for fixing it. ^^

HackMew
February 25th, 2010, 08:55 AM
Nice Nintendo should hire you. XD I never herd of these glitches; They never happened to me. What other glitches are there in FireRed?

There are quite some glitches, but don't worry: I'll fix all of them, one by one xD


Great job HackMew! I was suffering from this glitch, so thanks for fixing it. ^^

You're welcome.

FlameShocker
August 5th, 2010, 05:53 PM
Since the thread revival limit does not apply here.... I noticed this way back in '04 when I got FireRed (I still have that cartridge, and the Wireless Adapter that came with it). At the time, I thought that they were going to stick with not having the full species name thing in future games. I also didn't know that they fixed it in later versions of Fire Red.

LocksmithArmy
February 5th, 2013, 05:49 AM
this same technique can be done in a Hex editor (jump to those 2 offsets and make them FF)