Re: Arbitrary code execution in Red/Blue using the "8F" item
Posted by: TheZZAZZGlitch
Date: 2018-10-01 06:23:57
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.
There is a Daycare cloning script, which is easy to set up. Store the Pokemon you want to clone into the Daycare, take it out, use 8F, take it out again, repeat to infinity.
Something like ld hl,a16 ; ld a,(hl) ; sub d8 ; ld (hl),a will do the trick if you want to remove less than 256.
WRA1:D322 21 A6 DA ld hl,DAA6
WRA1:D325 7E ld a,(hl)
WRA1:D326 D6 01 sub a,(Exp to remove)
WRA1:D328 04 inc b
WRA1:D329 77 ld (hl),a
WRA1:D32A C9 ret
Well, I don't have much time to work on it and test it, but I guess that, starting from item 3, if the Pokémon to edit is in the first slot of the PC,
Thunderstone x166
TM18 x126
TM14 x(Exp to remove)
Poké Ball x119
TM01 x[Any qty]
May remove (Exp to remove) to this Pokémon.
Corresponding ASM isWRA1:D322 21 A6 DA ld hl,DAA6
WRA1:D325 7E ld a,(hl)
WRA1:D326 D6 01 sub a,(Exp to remove)
WRA1:D328 04 inc b
WRA1:D329 77 ld (hl),a
WRA1:D32A C9 ret
Then sub a,d8 has to be replaced by add a,d8 (hex:C6, which is HM03). It's annoying because you won't see its quantity. There are plenty of workaround that you think of to fix this, but I still think it's a better idea to make a code that replaces exp last byte by the value you want instead of adding to the current xp, don't you think?
WRA1:D322 21 A6 DA ld hl,DAA6
WRA1:D325 04 inc b
WRA1:D326 77 (Exp) ld (hl),(Exp)
WRA1:D32A C9 ret
WRA1:D322 21 A6 DA ld hl,DAA6
WRA1:D325 01 2C 00 ld bc,002C
WRA1:D328 3E (Exp) ld a,(Exp)
WRA1:D32A 16 (Nb) ld d,(Nb)
WRA1:D32C 77 ld (hl),a
WRA1:D32D 09 add hl,bc
WRA1:D32E 15 dec d
WRA1:D32F C8 ret z
WRA1:D330 C3 2C D3 jp D32C
From the Big List:
You'd need 4 (RB:119) for the ld (hl),a instead of the Max Revive used for ld (hl),$xx, an in-bag Boulder Badge for dec d, and RB:195 for jp $xxyy. If I recall correctly, RB:119 requires a B press or two to scroll past.
You can easily answer that by copying my code into GBZ80toitems.
codeElem.innerText is undefined (line 1635)
Stack trace :
compile@https://eldred.fr/gbz80toitems3/compiler.js:1635:3
@https://eldred.fr/gbz80toitems3/compiler.js:1879:4
n.event.dispatch@https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:12392
n.event.add/r.handle@https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:9156
It seems to refer directly to the Big List and not lose count like I do, so that's a good tool. :)
You can easily answer that by copying my code into GBZ80toitems.
You can easily answer that by copying my code into GBZ80toitems.
That website seems to be broken - no matter what I paste into the the input box the corresponding items box always tells me to type something in the input box. The compile button also doesn't do anything - the corresponding item box does not change and I get this error message after pasting your second code in.codeElem.innerText is undefined (line 1635)
Stack trace :
compile@https://eldred.fr/gbz80toitems3/compiler.js:1635:3
@https://eldred.fr/gbz80toitems3/compiler.js:1879:4
n.event.dispatch@https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:12392
n.event.add/r.handle@https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:3:9156