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

## Arbitrary Code Execution Discussion

### Alternate Ending with ACE: Champion Oak - Page 1

Previous Page

- 1

Next Page

#### Alternate Ending with ACE: Champion Oak

Posted by: Altaria26
Date: 2019-11-16 17:51:34
Hi all, first time posting here.
I've really enjoyed learning about all the ACE possibilities from the discussions here, and I thought I should contribute something :)
After gifting myself a few flawless Pokemon, I wanted to see if I could pull off something a bit more elaborate, perhaps similar to LuckyTyphlosion's mew truck demo (but much simpler code-wise).
I remembered that unused trainer data for Prof. Oak exists in the game, implying that he was originally intended to be the Pokemon league champ. Why not bring that idea to life?
A PC box full of spaghetti code later, and the result is here: https://youtu.be/rtb69s56kM0
Of course, a ROM hacker can do this and more, but I like to think that my 8 year old self would have got a kick out of knowing that this "alternate ending" can be unlocked through elaborate glitching ;D
The code's not well documented, but I'll give the gist:

[li]Change Lance's room current script number to 51, effectively picking a pointer out of garbage data that happens to point to my PC box full of code[/li]
[li]The code there runs when you enter Lance's room, and performs a similar misdirection for Gary's room (and also temporarily changes rival name to "OAK" so that Lance says it)[/li]
[li]The custom code in Gary's room then modifies the map header such that the room's script pointer now points to a specific location in my PC box. I now have control of the scripting in this room.[/li]
[li]The new script (in the PC) orchestrates the events you see in the video, by doing stuff like immediately moving Gary off the map, unhiding Oak, changing Oak's position, facing direction, movement bytes etc., changing the opponent ID, and changing the map text pointers so that they point to my custom text, written byte-by-byte into the PC D:[/li]

Hopefully someone gets some use (or entertainment) out of this…
Enjoy!

#### Re: Alternate Ending with ACE: Champion Oak

Posted by: Sherkel
Date: 2019-11-16 23:24:21
Whoooa! That's a lot of input and quite a bit of figuring out too. Crazy. Would you be able to post more about your setup?
Well, this is…a lot of attention. Not undeserved, of course.
[img]https://i.imgur.com/MsiNrgS.png[/img]

#### Re: Alternate Ending with ACE: Champion Oak

Posted by: Torchickens
Date: 2019-11-17 00:52:36
Whoa this is incredible!! :o You're a genius. It must have taken a lot of planning and determination. Umm is it ok if you share your save file? Thank you for your hard work! :D

#### Re: Alternate Ending with ACE: Champion Oak

Posted by: Altaria26
Date: 2019-11-19 16:07:57
Glad you like it :)

> Would you be able to post more about your setup?

> Umm is it ok if you share your save file?

Perhaps what I'll do is try and copy the final code into emulator so that everyone can play it or inspect the code :)
Previous Page

- 1

Next Page