Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Generation II Glitch Discussion

Non TM/HM pocket TM47 in Pokémon Gold - Page 1

Non TM/HM pocket TM47 in Pokémon Gold

Posted by: Torchickens
Date: 2016-12-18 12:47:05
This is a 'TM/HM outside of the TM/HM pocket' glitch item that misaligns the player sprite and NPCs by two spaces. I'm not sure how best to describe it, but when you save and reset after using TM47, the changes you make on the map aren't just visual; so if you moved an NPC out of bounds (such as the Victory Road badge checker) to allow you to walk past them you could walk past them.

It was planned for Pokémon Gold catch 'em all (with glitches) but I'm not sure if anybody ever got around to running it. For non-speedrunning purposes you should just be able to force it into the wrong pocket with Coin Case arbitrary code execution.

The glitch item interests me as there are some cool videos of someone bypassing certain events with it; like being able to enter Mahogany Town gym before defeating the Rockets at Rocket Hideout which makes this and party overloading map corruption examples of useful glitches other than Coin Case ACE.

The videos can be found here (and I'd like to make a video of both getting TM47 and performing these exploits).
http://wiki.pokemonspeedruns.com/index.php?title=User:Entrpntr/Gold_251#Miscealleneous_TM47_vids

Does anybody who knows a lot about the speedrunning scene know who discovered it?

Re: Non TM/HM pocket TM47 in Pokémon Gold

Posted by: luckytyphlosion
Date: 2016-12-18 14:37:19
The TM47 discovery was a semi-joint discovery by both entrpntr (Pokemon Speedrunner, although he does more routing stuff) and I. We knew that TMs and HMs could execute code from invalid addresses, so we went out and tested each and every one. Out of all the TMs and HMs, only 3 stuck out:

TM47: This item jumps to this subfunction , which increments the wOverworldMapAnchor. While using this only visually affects the map, reloading the map or crossing a connection applies the map changes to the loaded metatiles, allowing one to slowly clip through walls and access unintended parts of the map.

TM36: This item jumps here, which is in the middle of the Poke Ball function. While this could hypothetically allow you to catch whatever was the last loaded enemy mon, unfortunately the b register (used to store catch rate) is always 0 when entering this function (both through an invalid pocket and through select menu), so you'll end up with a 1/256 chance of catching the enemy mon, or 11/256 if the mon has a FRZ/SLP status.

HM03: I just found this out today while trying to figure out the interesting TM efffects, and it has a very useful application. This jumps here, which is in the middle of the function called when withdrawing the stored daycare mon from the daycare lady. The function doesn't check whether a daycare mon is present (or clears the relevant data either, as it wouldn't be needed), so you can continually use HM03 to clone the daycare lady's stored mon. The only stipulation is that the new moves learned (by calculating level based on raw experience, which may not reflect the current level as the daycare step function does not recalculate level for every exp point gained) is based on the last loaded Pokemon, in 0xd004.

Re: Non TM/HM pocket TM47 in Pokémon Gold

Posted by: Torchickens
Date: 2016-12-18 15:15:18

The TM47 discovery was a semi-joint discovery by both entrpntr (Pokemon Speedrunner, although he does more routing stuff) and I. We knew that TMs and HMs could execute code from invalid addresses, so we went out and tested each and every one. Out of all the TMs and HMs, only 3 stuck out:

TM47: This item jumps to this subfunction , which increments the wOverworldMapAnchor. While using this only visually affects the map, reloading the map or crossing a connection applies the map changes to the loaded metatiles, allowing one to slowly clip through walls and access unintended parts of the map.

TM36: This item jumps here, which is in the middle of the Poke Ball function. While this could hypothetically allow you to catch whatever was the last loaded enemy mon, unfortunately the b register (used to store catch rate) is always 0 when entering this function (both through an invalid pocket and through select menu), so you'll end up with a 1/256 chance of catching the enemy mon, or 11/256 if the mon has a FRZ/SLP status.

HM03: I just found this out today while trying to figure out the interesting TM efffects, and it has a very useful application. This jumps here, which is in the middle of the function called when withdrawing the stored daycare mon from the daycare lady. The function doesn't check whether a daycare mon is present (or clears the relevant data either, as it wouldn't be needed), so you can continually use HM03 to clone the daycare lady's stored mon. The only stipulation is that the new moves learned (by calculating level based on raw experience, which may not reflect the current level as the daycare step function does not recalculate level for every exp point gained) is based on the last loaded Pokemon, in 0xd004.


Ooh I see, nice!

Thanks for sharing the information about TM36 and HM03.

I successfully caught Will's Xatu after putting it to sleep, blacking out and using TM36 many times. The game asked if I wanted to give a nickname to "2U" (which made me wonder for a moment if it had an unterminated nickname like a fake bad clone), but it became a normal non-nicknamed Xatu after I chose to not give it a nickname.

Edit: You can catch Trainer House Pokémon too.

Re: Non TM/HM pocket TM47 in Pokémon Gold

Posted by: Yeniaul
Date: 2016-12-19 08:03:02
I had a question asked of me a few hours ago. Q: Will we as a species ever stop breaking games for fun?
My A: No. If it can be broken, it will be.

Re: Non TM/HM pocket TM47 in Pokémon Gold

Posted by: ISSOtm
Date: 2016-12-19 08:05:30
+1

Re: Non TM/HM pocket TM47 in Pokémon Gold

Posted by: entrpntr
Date: 2018-02-04 02:53:16
As lucky mentioned, there were originally two methods for applying the map changes to the loaded metatiles (reloading the map or crossing a connection). Back in August, gifvex realized a third way: using the GB Printer function. This is specifically done by attempting to print either a Pokédex entry (select the PRINT option) or a Pokémon's mail (press START while reading the mail).

An initial demonstration video can be seen here: https://www.youtube.com/watch?v=9mtrq5T43Wg. This method largely replaces the need for S&Q, which is convenient because it is so much faster. Being forced to reset over and over again just to skip different parts of the map isn't much fun in a casual setting or a speedrun setting.

I made use of this to a great degree in Gold "No ACE" speedruns back in August. I had created a highlight of going from Goldenrod to Indigo Plateau to give another taste for how this looks: https://www.twitch.tv/videos/170151642. I also saw mention on Torchic's recent video of the disappearance of old TM47 videos, so I reuploaded them to a youtube playlist for posterity: https://www.youtube.com/playlist?list=PLQpdNvoYOPZxUp6IdnkRv5QqoAigFdmnc.

gifvex also found two other TMs in Gold/Silver with interesting functions. First, TM14, which lets you instantly tag the "last loaded species" as "seen and caught":
TM14 (0xCD) in Pokemon Gold - when used from another pocket outside of battle, it jumps to the following code:
https://github.com/PikalaxALT/pokegold/blob/dff855fedfd7632a24340c4e36df2810edb8db83/engine/move_mon.asm#L879

looking at lines 923-925 you will find:

ld a, [wd004]
dec a
call SetSeenAndCaughtMon

notes:
* wd004 is "the last loaded species"
* wd004 can be set by scrolling over pokemon marked as seen in the pokedex


Also, TM46 - calls GetMovementPermissions, which is the function that updates wTileDown - wTileRight, the values used for collision, based on wPlayerStandingMapX and Y. This didn't seem to have much practical usage, but I think there was one instance of using it in combination with TM47 in a semi-useful way.

Re: Non TM/HM pocket TM47 in Pokémon Gold

Posted by: Torchickens
Date: 2018-02-04 08:44:35
Awesome. Thanks entrpntr. :)

Re: Non TM/HM pocket TM47 in Pokémon Gold

Posted by: Krys3000
Date: 2018-02-04 10:20:22
That's cool! Could be very useful. Thanks for sharing all these data guys, and for the work discovering it. I'm clearly not into speedrunning, so I don't catch up with interesting glitches used there if they are not posted here  ;)