Burned Tower Silver executing arbitrary code in German and Spanish Crystal.
Posted by: Torchickens
Date: 2015-01-10 11:59:58
In the Burned Tower, you can find your rival Silver. In Pokémon Gold and Silver, the rival talks to you after you enter but in Pokémon Crystal you have to approach him from the right.
[img]http://i1.minus.com/iGdcX8395O3V.png[/img]
The game glitches out if you use walk through walls to talk to him directly (or approach him from the left in most versions). In most versions, the game may just freeze without executing code from writable memory. In English Crystal, talking to Silver this way executed an invalid opcode at RO61:607E, freezing the game.
[img]http://i5.minus.com/ik5yG8tRPbDl2.png[/img]
[img]http://i2.minus.com/i6TH1yzrzrxyQ.png[/img]
German Pokémon Crystal is special, because the game let me battle Silver as a Trainer with non-freezing glitch text; who was a male Swimmer called KTE with a level 21 Staryu.
(In French, German, Italian and Spanish Crystal the collision addresses seem to be the same as the English version, so the WTW codes 00100FAC2, 0100FBC2, 0100FCC2, 0100FDC2 will work)
[img]http://i6.minus.com/irj8MSlnemVQN.png[/img][img]http://i2.minus.com/iZVwt70OwFzoy.png[/img]
[img]http://i3.minus.com/ijwzL7DgXhccF.png[/img][img]http://i3.minus.com/iQwAz10U3Jyqh.png[/img]
[img]http://i1.minus.com/iyaL4qTgJ0Sht.png[/img][img]http://i1.minus.com/iyaL4qTgJ0Sht.png[/img]
After beating KTE, the game executed code from SRAM:B3B3, which may be a writable location.
But this glitch is most promising if you somehow avoid the battle (with all fainted Pokémon from ????? FF or no Pokémon at all).
The game did some stuff and executed code from WRAM:C610, and then later WRAM:DD63 which is the total HP of Pokémon 3. So maybe with specific Pokémon you could execute arbitrary code? I think the game probably messed up the stack though, so we may need a workaround to that and you would have to terminate the script somehow.
[img]http://i1.minus.com/ibe2QR0qq11ZxC.png[/img]
[img]http://i5.minus.com/i89Dh4KaxTAZe.png[/img]
In Spanish Pokémon Crystal, Silver won't walk up to you from the left, but you can still talk to him and this will execute code from SRAM:B2CD.
[img]http://i5.minus.com/igDMxg78UfEQJ.png[/img]
Edit on July 9th 2015: Fixed WTW GameShark codes.