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

Arbitrary code execution in Gold/Silver UE using the Coin Case - Page 3

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Spoink
Date: 2016-02-03 08:35:04
Can anybody provide a completed save file that has all of the necessary requirements for the coin case glitch? I lost the old one, sadly.

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: lowena
Date: 2016-02-14 16:43:59
Does anyone have any ideas on how this glitch was fixed in Crystal? Is it just the text end byte for the Coin Case or is there more? I'm curious since we have a great disassembly of Crystal but not Gold/Silver which can help a lot with glitching/hacking. I haven't looked at the disassembly yet though or tried this glitch so maybe it would be easy to "unfix" in Crystal to have the glitch working. Obviously it would only work on emulators unless you had a flash cart or something, but it would be cool to have working for fun. :)

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Krys3000
Date: 2016-02-15 07:07:06
Well since this glitch is due to a translation mistake (the japanese terminator character was mistakenly not replaced by the english one) I'm guessing they just corrected it.

Using TM33 Code Execution might allow you to replace the japanese terminator in crystal games, thus reactivating the glitch, but I'm not an expert about this glitch so I'm not sure it can be done (Torchickens knows, maybe). If such, this would be the only way I could think of to legit create a Coin Case Glitch in either emulated or real game without any cheating device.

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: lowena
Date: 2016-02-15 17:14:34
Yeah, hopefully that's the case. I know nothing about Crystal's code or glitches, but I'm gonna take a look and see if I can find anything :)

EDIT: A quick look shows that the terminator was indeed changed from 0x57 to 0x50 from G/S to Crystal. Also I found that changing the code for the Coin Case from db "@@" to done changed the terminator from 50 50 00 to 57 00 so that's cool. ;p I'll put the code and hex/text for Crystal below for reference:

Code for Coin Case:
UnknownText_0x1c5c7b::
text "Coins:"
line "@"
deciram Coins, 2, 4
db "@@"


Hex and text for Coin Case:
82 AE A8 AD B2 9C 4F 50 09 55 D8 24 50 50 00
Coins:=($50)($09)+($D8)($24)($50)($50)($00)


2ND EDIT: I don't think this will work. :/ Changing the terminator to 57 does lead to an invalid pointer, but the invalid pointer goes to the middle of VRAM (8ccd), so it just crashes the game and restarts.

That's really disappointing. :'(

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Spoink
Date: 2016-02-18 18:38:56
I really need a completed save file with the glitch ready, as I want to search for cool effects?

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: lowena
Date: 2016-02-20 16:16:02
Here you go. Look at the bottom of this thread, and download the working one. It worked fine for me.

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Spoink
Date: 2016-02-21 13:42:02
Got one:

Enter, exit, and re-enter radio tower in goldenrod (twss), then go:



Then do the glitch. The effect is similar to the pokecenter music box, but with more drums.

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: bestgoldglitche
Date: 2016-07-12 04:26:06

Item cloning is possible with Pokemon cloning. Now we need to find a way to do item mutation.


I've been playing around with this glitch for a while now and recently found a way to produce any item.  The process is almost the same as what TheZZAZZGlitch laid out in his video where he explained how to get Celebi. 

https://www.youtube.com/watch?v=SpfgOVfGVTo

Basically, you place 43 Fresh Water in your PC instead of 42, and you'll jump to the item of the first Pokemon in your party instead of the ID number.  Given the normal set up that would yield HM09 I think which can be sold for about 19000 Pokebucks…

This happens because the stack of 4 Great balls increases the index number of the item where TheZZAZZGlitch placed HM07 in the video, so you don't just get back the same item that you put in the PC.  Also, using only 2 Great Balls increases the index number by 1 and using multiple stacks of Great Balls will increase the index number in the same manner.

This can be helpful for getting stray items by finding base items that have an index number before theirs as you can swap out HM07 with other base items to mutate.  This way you don't even lose the item you were initially working with.

I don't know much assembly, but I know enough to understand the concepts behind how the glitch works.  Given that 42 Fresh Water correspond to changing the ID number of the first Pokemon in your party, subsequently adding Fresh Water with move you one byte further into the Pokemon's data allowing you to overwrite things like moves by having 44 to 47 Fresh Waters or EXP by having 50 to 52. 

There's a simple list of the data structure here:
http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_in_Generation_II

An interesting way to use this is getting a level 100 by changing the EXP of a Pokemon and simply knocking out one wild Pokemon.  I'm pretty sure this takes 50 Fresh Water.

So there's a rudimentary form of item mutation and also access to all the Pokemon's stats and their Attacks, EXP, Friendship etc.

Oh, and a nice list of Pokemon, Moves, and Items by index number courtesy of TheZZAZZGlitch's video:
http://pastebin.com/raw/arPmsvYu

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: TheUnReturned
Date: 2016-07-12 08:15:46


Item cloning is possible with Pokemon cloning. Now we need to find a way to do item mutation.


I've been playing around with this glitch for a while now and recently found a way to produce basically any item.  The process is basically the same as what TheZZAZZGlitch laid out in his video where he explained how to get Celebi. 

https://www.youtube.com/watch?v=SpfgOVfGVTo

Basically, you place 43 Fresh Water in your PC instead of 42, and you'll jump to the item of the first Pokemon in your party instead of the ID number.  Given the normal set up that would yield HM09 I think which can be sold for about 19000 Pokebucks…

This happens because the stack of 4 Great balls increases the index number of the item where TheZZAZZGlitch placed HM07 in the video, so you don't just get back the same item that you put in the PC.  Also, using only 2 Great Balls increases the index number by 1 and using multiple stacks of Great Balls will increase the index number in the same manner.

This can be helpful for getting stray items by finding base items that have an index number before theirs as you can swap out HM07 with other base items to mutate.  This way you don't even lose the item you were initially working with.

I don't know much assembly, but I know enough to understand the concepts behind how the glitch works.  Given that 42 Fresh Water correspond to changing the ID number of the first Pokemon in your party, subsequently adding Fresh Water with move you one byte further into the Pokemon's data allowing you to overwrite things like moves by having 44 to 47 Fresh Waters or EXP by having 50 to 52. 

There's a simple list of the data structure here:
http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_in_Generation_II

An interesting way to use this is getting a level 100 by changing the EXP of a Pokemon and simply knocking out one wild Pokemon.  I'm pretty sure this takes 50 Fresh Water.

So there's a rudimentary form of item mutation and also access to all the Pokemon's stats and their Attacks, EXP, Friendship etc.

Oh, and a nice list of Pokemon, Moves, and Items by index number courtesy of TheZZAZZGlitch's video:
http://pastebin.com/raw/arPmsvYu
Really nice :9

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Torchickens
Date: 2016-07-12 09:01:19
Neato! ^^

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Torchickens
Date: 2016-12-18 18:12:30
Adding a useful bit of information.

Although stored PC items have been a common requirement (with Crystal_ having a stored PC item RAM editor), you may want to use PC names instead of box items, like what is done in glitched speedruns because literally the only things you need are a Pokédex with Bellsprout in it, the slide Pokémon in slot 3 and a special Quagsire in slot 4 (no items other than TM02 and TM27 are required).

To do this, you may give Quagsire a TM02 (available from Goldenrod Department Store) instead of HP Up or Protein and have Return as its first move. This will redirect the code to PC box 1's name character 2 after you do the specific movements (e.g. the ones from Elm's Lab and from Cherrygrove City).

The operations you can access via box names are highly limited (see Sanqui's Pastebin http://pastebin.com/raw/arPmsvYu) but fortunately it's still possible to do things like RAM editing (I do it using the xor a and sub xx operations to give 'a' a value and then the ld (xxyy),a operation to write 'a' into that address).

Though Coin Case gives you a corrupted stack and the game would glitch dimension/freeze after ret, you can solve the issue by using the following edits as part of a footer in your code.


xor a
ld (ff83),a
pop de
pop de
inc sp
pop de
or a
ret nc


(Found from deconstructing the box name code here).

There is one catch and something you need to know:

inc sp (hex:33) cannot normally be represented by box characters. However, you can get the ID for inc sp with the following: xor a;  sub fd; sub d0 and then use ld (xxyy),a to self-modify your code to add an inc sp.

This method also has a bad side effect of slowing menus down to an extreme, but after closing the menu if you hold down A and tap down you will be able to move the cursor to SAVE, mash A to save the game and reset the game to bring things back to normal.

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Nostalgia
Date: 2016-12-19 01:28:51
So basically this would enable ACE stuff much earlier into the game then before? Because before with the item lists in the PC you would need stuff like TM06 (Toxic) which cannot be obtained until after beating the Elite Four.

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: Torchickens
Date: 2016-12-19 07:17:13

So basically this would enable ACE stuff much earlier into the game then before? Because before with the item lists in the PC you would need stuff like TM06 (Toxic) which cannot be obtained until after beating the Elite Four.


Yeah you can conveniently do this early in game once you get the Coin Case (and TM02, TM27). I think it's also easier to set up.

Note I think Quagsire can possibly be replaced with Wooper (jp nz,$xxyy) like in the previously linked speedrunning route, and werster's 43:47 speedrun uses a particular path in the Pokémon Center with the starter Croconaw in slot 4 (possibly meaning a specific Croconaw could work too).

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: asphere
Date: 2017-07-01 07:55:27


So basically this would enable ACE stuff much earlier into the game then before? Because before with the item lists in the PC you would need stuff like TM06 (Toxic) which cannot be obtained until after beating the Elite Four.


Yeah you can conveniently do this early in game once you get the Coin Case (and TM02, TM27). I think it's also easier to set up.

Note I think Quagsire can possibly be replaced with Wooper (jp nz,$xxyy) like in the previously linked speedrunning route, and werster's 43:47 speedrun uses a particular path in the Pokémon Center with the starter Croconaw in slot 4 (possibly meaning a specific Croconaw could work too).


Hey, is possible to change my ID number on Pokemon Silver? i need to change it on pokemon silver 2 gen ITALY…
thanks :)

Re: Arbitrary code execution in Gold/Silver UE using the Coin Case

Posted by: ISSOtm
Date: 2017-07-01 09:47:48
You're in the wrong topic for this, the Coin Case glitch doesn't work in European localizations of Gold/Silver. There are other methods to obtain ACE, but they are more complicated.
(I will continue replying in the "G/S/C glitch discussion")


(Also the post you quoted has no relation whatsoever to what you asked. Quoting a post should be done when you refer to it, please.)