Jump to content

Coin Case glitches: Difference between revisions

→‎Cause: Explained that the terminator problem is caused by a language difference, not a technical version difference.
mNo edit summary
(→‎Cause: Explained that the terminator problem is caused by a language difference, not a technical version difference.)
Line 142:
 
==Cause==
In the Japanese versions of Pokémon Gold and Silver, after the hiraganatext 'まい'displayed inwhen the dialogCoin case is used is "あなたの コイン (n)<x>まい" (youryou numberhave of<x> coins). appearsNotably, aafter hex:57printing controlthe characternumber isof usedcoins (atwhich offset 0xF9FE,happens in bothtext versionscommand mode), andthe ingame bothgoes revisionsback v1.0into andplain v1text mode to print the string "まい".1 This is followed by a 0x57 character (<code><DONE></code> in the disassembly), which is a terminator that terminates both the string and itthe isenclosing validtext asscript<ref>[https://github.com/pret/pokecrystal/blob/c01409be5a9930d6f0687ce53c1c898e1855c884/home/text.asm#L567-L574 aThe terminatorfunction into thesehandle versionsthe <code><DONE></code> character]</ref>.
 
TheIn hex:57the characterEnglish isversions, stillthis usedtext asis atranslated terminator forto "Coins: (<x)>", inwhich is still followed by a 0x57 <code><DONE></code> character. However, the Englishgame versionsremains (atin offsettext 01985B0)command mode after printing the number <x>, butand it0x57 is no longernot a valid text command byte (the only valid terminator therechecked by the text command processor is 0x50 <ref>[https://github.com/pret/pokecrystal/blob/c01409be5a9930d6f0687ce53c1c898e1855c884/home/text.asm#L673-L678 The gamemain jumpsloop for the text command processor], which checks for the terminator <code>TX_END</code> (0x50)</ref>). Trying to execute text command 0x57 causes the game intoto memoryjump atto echo RAM address E112, which is essentially C112 and executes arbitrary code from there. This section of the memory can be changed by listening to cries, but if the player didn't listen to any cry, it is mainly 00, so 'nothing happens'. <!--I can't find a ret and I found an invalid opcode eventually, why doesn't the game freeze?-->
 
When the player listens to a certain Pokémon cry before using the Coin Case, the game will execute code that has a noticeable effect, including glitch dimensions, altered number of coins text and freezes, due to the data no longer being mainly 00.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.