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 4

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

Posted by: asphere
Date: 2017-07-01 10:04:55

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.)

ok sorry i wrong section and mention xD

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

Posted by: forsyz
Date: 2017-08-11 06:21:06
has any one tried coin case ace on the gold sliver vc injects because i've heard coincase ace does not work on vba or the gb tower because of inaccurate emulation this may cause it not to work on gold sliver vc

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

Posted by: Flandre Scarlet
Date: 2017-08-11 07:06:25

has any one tried coin case ace on the gold sliver vc injects because i've heard coincase ace does not work on vba or the gb tower because of inaccurate emulation this may cause it not to work on gold sliver vc


Nobody has had a chance yet since Gen 2 VC doesn't come out until September 22nd.

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

Posted by: forsyz
Date: 2017-08-11 20:16:14
you can inject them into the vc if you have cfw and they just reuse the same emulator for all the games they changed a few things with the gen 1 vc emulator but it emulates just like the older one. edit tried it on the vc emulator and it does work so coin case stuff should work on the vc versions of gs as long as the terminator is not changed

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

Posted by: forsyz
Date: 2017-08-12 23:28:51


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
tried to do it with 8 great balls but it just cases game to white screen looks like it only works with 2 or 4 great balls which mean you have you do the glitch twice if swap the items out in the pc if you want to change the item into one that's more then 2 index numbers away

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

Posted by: Parzival
Date: 2017-08-13 00:55:59
You're dealing with Coin Case ACE here. You either did something wrong… or you need to switch to BGB. ;)

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

Posted by: forsyz
Date: 2017-08-13 03:03:11

You're dealing with Coin Case ACE here. You either did something wrong… or you need to switch to BGB. ;)
i did do something wrong the first time i tried it with 8 great balls the Pokemon in first party slot was holding no item idk if that will affect it or you can only raise the index by 1 or 2 with 2 or 4 great balls I've tried 2 and 4 great balls and they work. edit: found out you have to use multiple stacks of great balls if you want to increase the index by more then 2

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

Posted by: ISSOtm
Date: 2017-08-13 05:28:28
forsyz, Coin Case ACE uses Echo RAM (since it basically runs code from there), and it didn't work with VBA because it didn't emulate Echo RAM.
The VC is known to emulate Echo RAM (as seen here), so Coin Case had to work.

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

Posted by: Flandre Scarlet
Date: 2017-09-23 08:18:18
Is there any method to make a pokemon learn a specific move with the coin case? Mainly so that I could get Aeroblast on Lugia in Gold Version since that isn't possible otherwise. Using the method where you only use Box Names if possible similar to this video by Torchikens https://youtu.be/NeC36_MhSBA

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

Posted by: FMK
Date: 2017-09-25 15:34:26

Is there any method to make a pokemon learn a specific move with the coin case? Mainly so that I could get Aeroblast on Lugia in Gold Version since that isn't possible otherwise. Using the method where you only use Box Names if possible similar to this video by Torchikens https://youtu.be/NeC36_MhSBA


It's most certainly possible – and actually extremely simple for Aeroblast in particular, though to use any of my Coin Case ACEs you need to do the following first:

[REQUIRED] One-off code so all future codes don't need the 'return to game' code:
Box 1 : Ap0w'vA55    (XOR A; OR b6; SUB 0x80)
Box 2 : é'm2p'v7'v'd (LD [d2f8], A; XOR A; SUB fd; SUB d0)
Box 3 : éA355555    (LD [80f9], A)
Box 4+: 55555555    (Safe filler code)
Box 13: 5555péD9    (XOR A; LD [83ff], A)
Box 14: 'l'lA'lx'd55 (POP DE; POP DE; INC SP; POP DE; OR A; RET NC)

Pokemon 5, Move 4 Modifier (Aeroblast) - Box 1, change r to whatever and replace 5555 with 'v(Letter)55 or 'v(Letter)'v(Letter) when needed:
Box 1: Ap0r5555  (XOR A; OR b1)
Box 2: é455555  (LD [efda], A)
Box 3+: 55555555
Box 13 and 14: Should never be modified after using the required code.



Other simple, randomish codes, for any interested (All boxes not used for code should all be 5's, except 13 and 14):

255x Ball 1, Master Ball:
Box 1: Ap09é8't5  (XOR A; OR ff; LD [fed5], A)
Box 2: p0B'vAé7't (XOR A; OR 0x81; SUB 0x80; LD[fdd5], A)

Player Sprite Modifier - Permanent (Old Man; Change 's and A to different values for different results, can replace the 55 for Box 1 with 'v(Another Letter) too, if desired value is unobtainable):
Box 1: Ap0's'vA55 (XOR A; OR d4; SUB 0x80)
Box 2: é9'l55555  (LD [ffd1], A)

Tons of Money:
Box 1: Ap0/'vA55  (XOR A; OR f3; SUB 0x80)
Box 2: é'm2p0955  (LD [d2f8], A; XOR A; OR ff)
Box 3: éA't55555  (LD [80d5], A)

Tons of Coins:
Box 1: Ap04'vA55  (XOR A; OR fa; SUB 0x80)
Box 2: é'm2p0955  (LD [d2f8], A; XOR A; OR ff)
Box 3: éA't55555  (LD [80d5], A)


Kudos to Torchickens for the following, just stripped off the RTG code.

Turn Pokémon 1 Shiny:
Box 1: Ap0'd'vR55  (XOR A; OR d0; SUB 0x91)
Box 2: é'm2pp045  (LD [d2f8], A; XOR A; XOR A; OR fa)
Box 3: éA4p0'd'vQ  (LD [80fa], A; XOR A; OR d0; SUB 0x90)
Box 4: é?2p0k55    (LD [e6f8], A; XOR A; OR aa)
Box 5: 55éA4555    (LD [80fa], A)

Change Pokemon 1 (Celebi) - Box 2, change the first 5 to whatever and the last two 55's to 'v(Letter) when needed:
Box 1: Ap0k'vA55  (XOR A; OR aa; SUB 80)
Box 2: é'm2p0555  (LD [d2f8], A; XOR A; OR fb)
Box 3: éA455555  (LD [80fa], A)

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

Posted by: Flandre Scarlet
Date: 2017-09-25 21:21:50
The codes all worked very well, thank you so much for your hard work!

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

Posted by: forsyz
Date: 2017-09-26 08:16:54
a code that makes a pokemon hold any item using box names would be useful means you can still do some coincase item setups even if you have already used the tms and forgot to clone them

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

Posted by: Torchickens
Date: 2017-09-26 15:07:15


Is there any method to make a pokemon learn a specific move with the coin case? Mainly so that I could get Aeroblast on Lugia in Gold Version since that isn't possible otherwise. Using the method where you only use Box Names if possible similar to this video by Torchikens https://youtu.be/NeC36_MhSBA


It's most certainly possible – and actually extremely simple for Aeroblast in particular, though to use any of my Coin Case ACEs you need to do the following first:

[REQUIRED] One-off code so all future codes don't need the 'return to game' code:
Box 1 : Ap0w'vA55    (XOR A; OR b6; SUB 0x80)
Box 2 : é'm2p'v7'v'd (LD [d2f8], A; XOR A; SUB fd; SUB d0)
Box 3 : éA355555    (LD [80f9], A)
Box 4+: 55555555    (Safe filler code)
Box 13: 5555péD9    (XOR A; LD [83ff], A)
Box 14: 'l'lA'lx'd55 (POP DE; POP DE; INC SP; POP DE; OR A; RET NC)

Pokemon 5, Move 4 Modifier (Aeroblast) - Box 1, change r to whatever and replace 5555 with 'v(Letter)55 or 'v(Letter)'v(Letter) when needed:
Box 1: Ap0r5555  (XOR A; OR b1)
Box 2: é455555  (LD [efda], A)
Box 3+: 55555555
Box 13 and 14: Should never be modified after using the required code.



Other simple, randomish codes, for any interested (All boxes not used for code should all be 5's, except 13 and 14):

255x Ball 1, Master Ball:
Box 1: Ap09é8't5  (XOR A; OR ff; LD [fed5], A)
Box 2: p0B'vAé7't (XOR A; OR 0x81; SUB 0x80; LD[fdd5], A)

Player Sprite Modifier - Permanent (Old Man; Change 's and A to different values for different results, can replace the 55 for Box 1 with 'v(Another Letter) too, if desired value is unobtainable):
Box 1: Ap0's'vA55 (XOR A; OR d4; SUB 0x80)
Box 2: é9'l55555  (LD [ffd1], A)

Tons of Money:
Box 1: Ap0/'vA55  (XOR A; OR f3; SUB 0x80)
Box 2: é'm2p0955  (LD [d2f8], A; XOR A; OR ff)
Box 3: éA't55555  (LD [80d5], A)

Tons of Coins:
Box 1: Ap04'vA55  (XOR A; OR fa; SUB 0x80)
Box 2: é'm2p0955  (LD [d2f8], A; XOR A; OR ff)
Box 3: éA't55555  (LD [80d5], A)


Kudos to Torchickens for the following, just stripped off the RTG code.

Turn Pokémon 1 Shiny:
Box 1: Ap0'd'vR55  (XOR A; OR d0; SUB 0x91)
Box 2: é'm2pp045  (LD [d2f8], A; XOR A; XOR A; OR fa)
Box 3: éA4p0'd'vQ  (LD [80fa], A; XOR A; OR d0; SUB 0x90)
Box 4: é?2p0k55    (LD [e6f8], A; XOR A; OR aa)
Box 5: 55éA4555    (LD [80fa], A)

Change Pokemon 1 (Celebi) - Box 2, change the first 5 to whatever and the last two 55's to 'v(Letter) when needed:
Box 1: Ap0k'vA55  (XOR A; OR aa; SUB 80)
Box 2: é'm2p0555  (LD [d2f8], A; XOR A; OR fb)
Box 3: éA455555  (LD [80fa], A)



This is great, thank you FMK!  :)

I've come up with a code that allows you to obtain 49 of every TM/HM in the TM/HM pocket. It only just fit box 1-box 6, and the name for box 7 is completely changed. It is x49 because register a is still 0x31, the least significant byte of ByteFill.

First off use the one-off code in FMK's post.

Secondly, name the boxes from box 1-6 the following:

Ap'vCé025
'vj'vué25
'v.é32p'v9
é22pé425
'vué62'v 5
é52'v:é72
5555555

And use the Coin Case after following the usual steps.

What this code does is call $314C with parameters hl=D57E and bc= $0x39.

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

Posted by: DoubleNegative
Date: 2017-09-26 21:25:40
No matter what I try, I keep getting a glitch dimension instead of box name code. My slide pokemon is the hatched togepi and I'm using a wooper holding sweet scent. It's a bit of a pain, but I can get headbutt, but I tried that once already.

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

Posted by: Torchickens
Date: 2017-09-26 22:24:04

No matter what I try, I keep getting a glitch dimension instead of box name code. My slide pokemon is the hatched togepi and I'm using a wooper holding sweet scent. It's a bit of a pain, but I can get headbutt, but I tried that once already.


If you're using one of my or FMK's codes the TM12 Sweet Scent won't work as it would end up skipping the first twelve box name characters instead of only skipping the first character (for when you use TM02 Headbutt). I think it's easiest just to use the TM02 Headbutt.

I don't know how reliable Togepi are but if you haven't already try catching many Pokémon west of New Bark Town on Route 29 (even if you end up catching 20 or more and try each one, as some people have been really unlucky).

Wooper is used in speedruns instead of Quagsire, but because the jump is conditional (jp nz,$xxyy) to be safe it may be best to use Quagsire which has a jump without a conditional (jp, $xxyy).