Main Menu
Main Page
Forums
Recent changes
Random page
Help

Databases
GlitchDex
AttackDex
AreaDex
DexDex
ItemDex
MetascriptDex
TMHMDex
TrainerDex
TypeDex
UnownDex
More

Major Glitches
Trainer escape glitch
Old man glitch
Celebi Egg glitch
SRAM glitch
Buffer overflow techniques
Pomeg glitch data corruption (Glitzer Popping)
Tweaking
Pokémon cloning
Select glitches (Japan)
Time Capsule exploit
Arbitrary code execution
More

Other Glitch Categories
Glitches by generation
Japan-only/language specific glitches
Natural glitches
Non-core series glitches
Non-Pokémon glitches
Recurring glitches
More

References
Pokémon GameShark codes
Pokémon Game Genie codes
Disassembly projects
The Big HEX List
GB programming
Curiosities
Debugging features
Error traps
Non-glitch exploits
Pokémon glitch terminology
Unused content and prerelease information
More

Useful Tools
8F Helper
GBz80 to Items
Old man trick name generator
PATH (Prama's Advanced Tweaking Heaven)
Save file editors
Special stat/Pokémon converter
Trainer escape Trainer Pokémon finder

Affiliates
Legendary Star Blob 2 (Hakuda)
Pokémon Speedruns wiki
PRAMA Initiative
Become an affiliate!

Technical
Site Source Code

Search Wiki

 

Search Forums

 

Author Topic: Incomplete OT check in Pokémon Crystal  (Read 1399 times)

0 Members and 1 Guest are viewing this topic.

IIMarckus

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Impersonal Text
    • View Profile
    • iimarck.us
Incomplete OT check in Pokémon Crystal
« on: July 07, 2012, 11:22:47 pm »
To catch Ho‐oh in Pokémon Crystal, you must catch Raikou, Entei, and Suicune in the same game file and have the Pokémon stored in your party or PC, then talk to Eusine in Celadon Pokémon Center.

The game checks the species, ID number, and OT of every Pokémon in the party and PC until it finds a match (so a Raikou, Entei, or Suicune traded from another game will not match). However, it only checks the first five characters of the OT name. This worked correctly in Pocket Monsters Crystal, where player names were only five characters long, but the English version of Pokémon Crystal supports player names up to seven.

Code: [Select]
        ld hl, PlayerName

        ld a, [de]
        cp [hl]
        jr nz, .notfound
        cp "@"
        jr z, .found ; reached end of string
        inc hl
        inc de

        ld a, [de]
        cp [hl]
        jr nz, .notfound
        cp $50
        jr z, .found
        inc hl
        inc de

        ld a, [de]
        cp [hl]
        jr nz, .notfound
        cp $50
        jr z, .found
        inc hl
        inc de

        ld a, [de]
        cp [hl]
        jr nz, .notfound
        cp $50
        jr z, .found
        inc hl
        inc de

        ld a, [de]
        cp [hl]
        jr z, .found

.notfound

A quick fix would be to copy/paste two more instances of this ASM, to check two more characters.

Code: [Select]
        ld a, [de]
        cp [hl]
        jr nz, .notfound
        cp $50
        jr z, .found
        inc hl
        inc de

Of course, this would be hard to exploit, because you would need a second game file with the same ID number anyway (1⁄65536 chance).
« Last Edit: July 07, 2012, 11:24:33 pm by IIMarckus »

Hālian

  • That worldbuilding/micronations/MTG guy
  • Member+
  • *
  • Offline Offline
  • Gender: Male
  • For a better world
    • View Profile
    • Hoennese Realm
Re: Incomplete OT check in Pokémon Crystal
« Reply #1 on: July 09, 2012, 10:05:17 am »
Isn't there a GameShark code to change your ID number?
Hoennese Realm



All sprites made by Naitekiakki, except:
Recolored Gardevoir made by me

Photon-Phoenix

  • Gotta pop dem windows.
  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
    • View Profile
Re: Incomplete OT check in Pokémon Crystal
« Reply #2 on: July 09, 2012, 02:16:34 pm »
Isn't there a GameShark code to change your ID number?

There's a GameShark code to encounter a Ho-oh so there's no point to abuse the exploit with it. :V
« Last Edit: July 09, 2012, 02:19:34 pm by Photon-Phoenix »

Raven Freak

  • Sonic 2 SMS Haxor
  • Member+
  • *
  • Offline Offline
  • Gender: Male
  • Haxor
    • View Profile
Re: Incomplete OT check in Pokémon Crystal
« Reply #3 on: July 09, 2012, 06:50:51 pm »
That's rather interesting that they forgot about this line of code. Is there any other checks that involve the player's name in the game? If so, there's probably multiple instances of this error. This is definitely making me want to start hacking Crystal now. :P

IIMarckus

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Impersonal Text
    • View Profile
    • iimarck.us
Re: Incomplete OT check in Pokémon Crystal
« Reply #4 on: July 09, 2012, 11:05:06 pm »
That's rather interesting that they forgot about this line of code. Is there any other checks that involve the player's name in the game?

Yes, but they generally do a null‐terminated compare instead of relying on the maximum length of the name.

In fact, several additions to Crystal were programmed in a strange way. I suspect they pushed some inexperienced programmers onto Crystal who weren’t there for Pokémon G/S. (Examples of other weird implementations: Buena’s Password is added very haphazardly; the Battle Tower appears to have a connection to Route 40, but instead the edge of the route was manually added to the edge of the map, even adding a faux NPC!)
« Last Edit: July 09, 2012, 11:05:19 pm by IIMarckus »