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 I Glitch Discussion

Making "Super Glitch" moves useful (Red/Blue/Green) - Page 1

Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: TheZZAZZGlitch
Date: 2013-04-02 07:35:13
Well, I've been doing a lot of Super Glitch research for a year now, and I finally decided to show off some things that I found.
At the moment, Super Glitches are considered only as a fun little distraction without real use. And my goal is to turn things around and make them useful and predictable. Because if you think long enough, these moves have quite the power. They can write large numbers of values to the RAM by just displaying their names. You may also think "if there was a way to manipulate values or range of Super Glitch's memory corruption, that would be amazing".

OK, done with this boring foreword. Yes, there is a way to manipulate (and exploit) the way Super Glitch modifies the RAM. It worked on 4 different savefiles on emulator and on the actual cart, so I'm pretty sure it will work for everyone. But before we go into how to do it and before I show you some examples of useful "Super Glitch glitches", let's talk about some theory.

We all know Super Glitch heavily messes up the game's RAM. But from where it gets those values from? And where does it write? And why it even writes those values?
This is a subject worth a 10-page research document, but I will at least try to make this short and quick, presenting only a few facts needed. If you want a more detailed, technical explanation, read http://justpaste.it/2bbt

First of all, it's not the move that is real dangerous, it's the name of the move that makes the game go weird. Super Glitch's name pointer is read wrongly by the game, and it makes the game believe the name of this move resides in the RAM. Which is an absolute nonsense, RAM has no move names at all. And when the game tries to read a move name, it buffers it byte by byte until it encounters a terminator byte (0x50). The problem is, RAM most likely won't ever contain a terminating character. So the game copies way more data than it should, resulting in a buffer overflow. And this is why Super Glitches corrupt the RAM.
The data is copied from address $CD6D, the buffer for move loading subroutine. And it is copied to $D0E1, the moveset buffer if you activate Super Glitch by viewing stats/learning a move/opening the fight menu, or to $CF4B if you activate Super Glitch by selecting/using it in battle. The buffer overflow causes a huge number of bytes from $CD6D to be copied to either $D0E1 or $CF4B.

[img]http://i.minus.com/ivDgtkGBfktfB.png[/img]

And if we look what does the $CD6D address contains, we will find out that theres a full screen copy here!

[img]http://i.minus.com/ibvKjSqUAEVkbl.png[/img]

What does it mean? By changing what's on the screen at the moment, we can manipulate the values Super Glitch writes! And by positioning 0x50 overworld tiles on the exact places on the screen, we can also manipulate the length of Super Glitch corruption! However, the screen information here isnt just ordinary screen copy at the moment, it is refreshed only at certain times:


This is even more convenient for us! If you for example open up the item menu in overworld, close it immediately, and go into a battle, if you dont open any menus while battling, the overworld screen copy will still be there as there was no need to overwrite it. By opening and closing the Pokemon menu in certain spots and not opening the start menu anymore, we can cause a single Super Glitch effect to happen almost 100% of the time.

Also, because $D0E1 is not a single move buffer but a move list, a number of characters the move names before the Super Glitch have can also affect the length and values of corruption, shuffling the corrupted address by around 1-10 bytes.

Examples:

Moveset: Agility, Agility, TM28, [Super Glitch]
Agility [7 chars] + Agility [7 chars] + TM28 [4 chars] = 18 chars
D0E116 + 1810 + 310* = D0F616   
The Super Glitch will start its corruption at address $D0F6


Moveset: Barrage, Clamp, [Super Glitch], Hi Jump Kick
Barrage [7 chars] + Clamp [5 chars] = 12 chars
D0E116 + 1210 + 210* = D0EF16 
The Super Glitch will start its corruption at address $D0EF


[size=8pt]* - while calculating the resulting starting address you have to add number of moves before the Super Glitch, as they are separated within the code by an invisible whitespace line feed character 0x4E[/size]

Now we have some information on how to modify the values Super Glitch writes - so let's jump into some useful applications of it!

[size=18pt]Harmless Super Glitch trick[/size]
Use: You can use this trick to learn/forget Super Glitches without any problem, view stats of Pokemon with Super Glitch moves, or swap/use Super Glitches in battle without crazy effects.
Statistics: Worked on all 5 tested saves on the first try.
Video: http://www.youtube.com/watch?v=Q2_aczBkpxM#t=8s
Prerequisites:
- A Pokemon with Super Glitch, obviously.
- Access to Celadon City.

Execution:

1. Go to the exact spot shown on the screenshot below (1st floor of Celadon Mansion). Open up your Pokemon menu while still standing on that spot.

[img]http://i.minus.com/ieB2Tly27VDEn.PNG[/img]

2. Congratulations. You just now immune to Super Glitches' glitchiness. Now you can learn, forget, view stats with Super Glitches involved without risking your save file.
3. You can also carry this effect to your local patch of grass in order to swap or use Super Glitches in battle without risk. Just open your Pokemon menu again, close it, go into a patch of grass and fight.
Note: Do not open your start menu at all while going to the grass or while fighting. This will reset Super Glitch to its usual glitchness.

Screenshots from all 5 tested saves:
[img]http://i.minus.com/ibe0DqTdUAB9En.png[/img]

[size=18pt]Access Pokemon beyond the sixth slot[/size]
Use: With a corrupted Pokemon list and a corrupted item list (achievable using corrupted Pokemon list), you can make a lot of serious memory modifications - it's like having a memory viewer in your GB.
Statistics: Save #1,4,5 - Worked on the 1st try, Save #2,3 - Worked on the second try
Video: http://www.youtube.com/watch?v=Q2_aczBkpxM#t=145s
Prerequisites:
- Access to Celadon City.
- A Pokemon meeting very specific moveset requirements:
  a) It needs to have a Super Glitch as a 4th move,
  b) Its three moves besides the Super Glitch have to contain 28 characters in total
    (for example: BODY SLAM [9 chars], DOUBLESLAP [10 chars], WATER GUN [9 chars])
- At least 5 Pokemon in your party, a party of 6 is recommended.

These moveset requirements aren't a real problem if you're using LM4, as its default starting moveset has 3 moves with 28 characters in total.
LM4 will have to learn no new moves till level 24, and at level 24 Hypnosis should be replaced with Super Glitch. Then you will be able to use previously described Harmless Super Glitch trick to switch the first move with the last.
Note: 4 first Pokemon in your party will change their species, but it isn't a problem as you're probably not going to save after this glitch anyways.

Execution:

1. Go to the exact spot shown on the screenshot below (second to last house on Celadon's south-east). Open up and close immediately your Pokemon menu while still standing on that spot.

[img]http://i.minus.com/ibxPoFRCenomoK.PNG[/img]

2. Go into a patch of grass and encounter a wild Pokemon. Again, do not open your start menu while going there.
3. Open and close your fight menu a few times, the run from the battle.
4. Check your Pokemon list. Try to scroll past your 6th Pokemon. If you can't, repeat step 1. If you can - congratulations, you did it. If your game crashes, you obviously did something wrong.

Screenshots from all 5 tested saves:
[img]http://i.minus.com/ibo3DC4b9CQs1S.png[/img]

[size=18pt]Erase player's name[/size]
Use: This generates a perfectly blank properly terminated name, allowing you to save the game after you do something really game-breaking (Super Glitch, ZZAZZ, 2x2x2x2 after messing with 3906 for a while etc.), or you can just amaze your friends with an unobtainable name.
Statistics: Save #1,2,4 - Worked on the 1st try, Save #3,5 - Worked on the second try
Video: http://www.youtube.com/watch?v=Q2_aczBkpxM#t=322s
Prerequisites:
- Access to Cerulean City.
- A Pokemon meeting very specific moveset requirements:
  a) It needs to have a Super Glitch as a 4th move,
  b) Its three moves besides the Super Glitch have to contain 28 characters in total
    (for example: BODY SLAM [9 chars], DOUBLESLAP [10 chars], WATER GUN [9 chars])
- Access to the field move Fly
- Balls of steel if you want to save afterwards

Execution:

1. Go to the exact spot shown on the screenshot below (south-west corner of Cerulean City). Open up and close immediately your Pokemon menu while still standing on that spot.

[img]http://i.minus.com/iLUYbTqCI7QX3.PNG[/img]

2. Go into a patch of grass and encounter a wild Pokemon. Again, do not open your start menu while going there.
3. Open up and close your fight menu a few times, then run from the battle.
4. Your name should be now blank. However, it is still unsafe to save your progress.
5. Open up the start menu and select 'SAVE'. Don't freak out. When a glitched yes/no box appears, press B to cancel out.
6. You should end up in a glitch city. Fly away anywhere and you're now free to save. Saving is even recommended, as glitched trainers will now also appear instead of normal ones, and reloading the game will fix this problem. It shouldn't erase your game, I saved on 4 files (wasn't brave enough to do this on a cart) and the game was perfectly fine.

Screenshots from all 5 tested saves:
[img]http://i.minus.com/iX6rsueTFRLyD.png[/img]

[size=18pt]100% TMTRAINER[/size]
Use: Has no real use; It is here just to show how you can make Super Glitches predictable.
Statistics: Worked on all 5 tested saves on the first try.
Video: http://www.youtube.com/watch?v=Q2_aczBkpxM#t=474s
Prerequisites:
- A Pokemon with Super Glitch, obviously.

Execution:

1. Encounter a wild Pokemon.
2. Open your Pokemon menu (in-battle) and close it shortly afterwards.
3. Open the fight menu and select (don't have to use) the Super Glitch move.
4. TMTRAINER 100% guaranteed. If it doesn't work, back out, open your Pokemon menu again, go back and try again.

Screenshots from all 5 tested saves:
[img]http://i.minus.com/iBvprE7rzE79S.png[/img]

[size=18pt]Catch a level 82 Hitmonchan with (almost) infinite HP[/size]
Use: Making your way through E4, trolling people on link battles, having a partner for your 'Mew Smash'
Statistics: Save #1: 3 tries, Save #2: 1 tries, Save #3: 5 tries, Save #4: 7 tries, Save #5: 4 tries
Video: http://www.youtube.com/watch?v=Q2_aczBkpxM#t=525s
Prerequisites:
- Access to Celadon City.
- A Pokemon meeting very specific moveset requirements:
  a) It needs to have a Super Glitch as a 4th move,
  b) Its three moves besides the Super Glitch have to contain 28 characters in total
    (for example: BODY SLAM [9 chars], DOUBLESLAP [10 chars], WATER GUN [9 chars])
- Access to Route 14

Execution:
 
1. Go to the exact spot shown on the screenshot below (Route 14's northmost field of grass). Open up and close immediately your Pokemon menu while still standing on that spot.

[img]http://i.minus.com/ibo4RK25H1yPg1.PNG[/img]

2. Optional step: Save your game. This will help you out as you may need a few tries to get this to work. After reloading the save you have to open your Pokemon menu again to rewrite your screen data, just saying (testers have been shouting LOLZ IT DOESNT WORK!!!1 while they forgot about opening the Pokemon menu after reloading the save).
3. Go find a wild Pokemon
4. Open the fight menu and continuously try to select the Super Glitch move. It will eventually change its type to either the name of last trainer battled, or a blank space.
5. Press B to exit out. You should end up fighting a Pokemon named with a bunch of player name characters. If it crashes, you failed - try again.
6. Open your item menu and use anything you're not supposed to (a bicycle or something). It should say your name followed by usual "not the time to use that". If your name is glitched, you failed - try again.
7. Throw all the Pokeballs. After you succeed, the game will state you caught a Hitmonchan. Congratulations!

Note: A nice side effect is the fact your Super Glitcher (LM4 or whatever monstrosity you use) gains infinite HP too. Another not so nice side effect is that both Hitmonchan and Glitcher gain status ailments, and healing them in a Pokemon Center will get rid of their amazing HP. You may need to use a full heal or something.

Screenshots from all 5 tested saves:
[img]http://i.minus.com/ibbIs6iUNZNpjJ.png[/img]

Some other remarks:
- I already have another interesting idea: Super Glitch name, and the Old Man trick. Could be very interesting.
- Sadly, all presented glitches (with exception of the first part of Harmless Super Glitch trick) do not work in Yellow. Newer versions handle battle screens a little bit differently, not allowing me to carry overworld screen data to a battle. However, the way of manipulating Super Glitch's written values remains the same. Maybe someone will find a workaround soon.
- All this stuff is experimental. I am not responsible for your lost save files, you try this at your own risk.
- This is my first GCL publication, don't rage very hard if I made some mistakes.

And that's all so far. But it isn't the end. I'm pretty sure either the people will come up with something amazing, or I will find some more stuff soon. I see a rosy future ahead for Super Glitch and its possibilities, my findings are only the beginning.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: camper
Date: 2013-04-02 09:23:52
Did you try the Cooltrainer move? Is there any relation between that move and Super Glitch?

Also, in the video around 09:55, I noticed the wild Bellsprout's HP bar keeps changing. Is that normal?

The TMTRAINER effect trick has some use, like catching Missingno. in the Diglett's Cave.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: Torchickens
Date: 2013-04-02 09:44:58
Wow, excellent work!

Some time ago, by chance I found a trick that makes your name all 00 characters except for the 11th character which becomes 18h but gives you 25 Pokémon.

The steps were as follows:

1) Level up a L M 4 (hex:C6) to Level 24. (addendum: LM4's first move is Hypnosis). Replace the second move with Super Glitch (hex:BE)
2) Deposit every Pokémon except L M 4
3) Enter a battle and choose Fight. If all attacks underneath the first move are hidden, you've triggered the glitch. If other attacks under the first move are visible, you need to press B and enter the fight menu again until they become invisible.
4) Run from the battle.
5) You now have 25 Pokémon and your name has become blank.

Video

For some reason, that glitch causes the ID of the second Pokémon to decrease every 4 steps, so by walking enough steps, I could make it underflow to 255 and this let me open the Pokémon menu without a freeze/deposit Pokémon underneath it.

I didn't realize the length of the move names known by the Pokémon affect the glitch. The first move my LM4 knew was Hypnosis (which is 8 characters + the 4E). If I repeat the glitch with Doubleslap (10 characters +4E), the first two letters of my name become 08h and 08h instead and the number of Pokémon in the party (D163) become 00.

Since the number of Pokémon is 00, exiting and entering a battle causes the 'wild appeared' glitch to happen.

[img]http://i.minus.com/jOhRTYvpHPzlS.png[/img]

Also for some reason, capturing the wild Pokémon or selecting 'save' causes the dialogue boxes to change from North/West. I checked the box-set address $D12C that you found and the value got changed to 01.

[img]http://i.minus.com/jbsESALw7kiPwJ.png[/img]

Thanks to your work, I now know one of the reasons why I had to deposit Pokémon from the PC was because of the glitchy effects depending on what was on the screen. I still had to deposit Pokémon though to get exact same effects. I don't know why.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: TheZZAZZGlitch
Date: 2013-04-02 10:55:24
Reply time!

Did you try the Cooltrainer move? Is there any relation between that move and Super Glitch?


Well, the Cooltrainer move is something I like to call "half of a Super Glitch". It can't corrupt anything beyond $D0E1 because the moveset loading routine is programmed to display any index 0 moves as "–". But this programming does not apply to the actual move (not moveset) loading routine, which tries to request a name for move 0 anyway. Because it's a standard "subtract 1, check if 0, jump if not" loop, game tries to load move index 256 and reads beyond the move database, causing all the Super Glitch effects in battle.

Also, in the video around 09:55, I noticed the wild Bellsprout's HP bar keeps changing. Is that normal?


That's just video compression, the HP bar does not move in reality.

The TMTRAINER effect trick has some use, like catching Missingno. in the Diglett's Cave.


Never knew it was possible. Thanks for letting me know.

@Torchickens: Yeah, I watched this before, and your video inspired me to publish all this research.

Thanks to your work, I now know one of the reasons why I had to deposit Pokémon from the PC was because of the glitchy effects depending on what was on the screen. I still had to deposit Pokémon though to get exact same effects. I don't know why.


You do not need to deposit at all! You just need to open the PC and close it. Because again, all the game cares about is what was on the screen. Your trick relies on the fact that opening the PC refreshes the screen copy on $CD6D, and Pokemon Center map has a quite nice number of 0 tiles. This causes those effects to happen, and it has nothing to do with depositing.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: Torchickens
Date: 2013-04-02 12:52:09

@Torchickens: Yeah, I watched this before, and your video inspired me to publish all this research.


That's nice to know, I'm glad you found it useful. :)


You do not need to deposit at all! You just need to open the PC and close it. Because again, all the game cares about is what was on the screen. Your trick relies on the fact that opening the PC refreshes the screen copy on $CD6D, and Pokemon Center map has a quite nice number of 0 tiles. This causes those effects to happen, and it has nothing to do with depositing.


Ah, thanks. The screen-copy begins at $CD81 right? Memory viewer says the screen-copy is the same as long as you press A to open the PC. I think I know what I was doing wrong now. I viewed the Pokémon menu instead of opening the PC.

Viewing the Pokémon menu gave me this:

[img]http://i.minus.com/jbzdWj54iEgdSw.png[/img]

Instead of this:

[img]http://i.minus.com/jiPJ28kwV7A2k.png[/img]

The data is copied from address $CD6D, the buffer for move loading subroutine. And it is copied to $D0E1, the moveset buffer if you activate Super Glitch by viewing stats/learning a move/opening the fight menu, or to $CF4B if you activate Super Glitch by selecting/using it in battle. The buffer overflow causes a huge number of bytes from $CD6D to be copied to either $D0E1 or $CF4B.


If I'm understanding this right, basically the game copies more than the first 20 bytes from $CD6D, including copied screen data, because the game has now read past the 'move name table' to get Super Glitch's name, and there is no terminating $50 in those 20 bytes?

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: TheZZAZZGlitch
Date: 2013-04-02 14:00:27
If I'm understanding this right, basically the game copies more than the first 20 bytes from $CD6D, including copied screen data, because the game has now read past the 'move name table' to get Super Glitch's name, and there is no terminating $50 in those 20 bytes?


Exactly.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: OwnageMuch
Date: 2013-04-02 17:47:32
Brilliant read! I'm sure there's still more to be found, too! I'd be willing to risk my blue cart save if necessary for the advancement of this project, if there's anything you want me to test on it.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: Torchickens
Date: 2013-04-03 10:00:30
Here are some notes:

The copy of the screen starts at the top-left most corner and works down to the to the bottom-east most corner, going one horizontal line at a time.

Take this example:

[img]http://i.minus.com/jbfkpFVRfv9k7E.png[/img]

The first 10 tiles are the grass tiles, 52h, 52h, 52h, then the top-left corner of the start menu (79h), then it goes 7Ah, 7Ah, 7Ah, 7Ah, 7Ah, 7Ah, 7Ah, 7Ah, 7Bh.

We're now on to the next line which starts with the 52h grass tiles again.

The copy of the screen appears to start from $CD81 and finishes at $CEE8. Unfortunately I don't know what the second copy is though? (the glitchy one in TheZZAZZGlitch's Pokémon Mansion screenshot)

If Super Glitch is the first move, the corruption takes place exactly 20 bytes after $D0E1 ($D0F5). The game will write these 360 bytes, and the copied screen data finishes at D2FC.

Here are a list of useful memory addresses ranging from D0F5-D2FC:

D119: Teleport/Dig/Rope to room modifier - reverts back when the battle ends :/
D11E: Starter Pokémon
D127: Current enemy level - gets reverted back unfortunately if you catch the Pokémon, reverts back when you do the Ditto glitch, too.
D12B: Is enemy Trainer a Link Battle Trainer?
D12C: Current box-set
D13C: No wild battles?
D141: Game Corner Prize Slot 1 Price
D142: ''''
D143: Game Corner Prize Slot 2 Price
D144: ''''
D145: Game Corner Prize Slot 3 Price
D146: ''''
D158-D162: Player's name
D163: Number of Pokémon in Party
D164-D2FC: Pokémon
D2F7 - Own 1-8
D2F8 - Own 9-16
D2F9 - Own 17-24
D2FA - Own 25-32
D2FB - Own 33-40
D2FC - Own 41-48

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: Stackout
Date: 2013-04-06 14:15:16
A simple buffer overflow? I should have realised myself that some part of Super Glitch smashed the stack.

I guess something about trainers FB, FC, FE and FF cause a buffer overflow too.

(also, I wonder if every invalid roster of every trainer should be documented?)

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: camper
Date: 2013-04-07 00:52:10

I guess something about trainers FB, FC, FE and FF cause a buffer overflow too.

I think it's the winning money (99h 99h).

(also, I wonder if every invalid roster of every trainer should be documented?)

Only the rosters after Lance 01h are invalid.
The other "invalid" rosters are actually valid rosters from another trainer class.
e.g. Prof. Oak has 3 valid rosters, and Chief has none. Therefore Prof. Oak 04h draws data from the Scientist class roster 01h instead.
Agatha Ultima = Agatha 07h = Lance 06h = Channeler 17h = Lorelei 18h, since there are 16 Channeler rosters.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: Kelvinv
Date: 2014-05-13 00:26:09
I'm sorry for bumping this topic, but I want to know if there also is a fix for the super glitch-like items.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: camper
Date: 2014-05-13 09:16:00
The tile in Celadon makes it completely safe. Also any screen with the $50 tile (lower-left part of a bush in the main map) in the first few rows.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: Addri Trainer
Date: 2014-05-15 07:36:23
Now I just saw the image of North / West, I went something like talking to Oak ZZAZZ with glitch activated:
[img]http://i.gyazo.com/28ffcd5847739ecb37d501bd402a38ce.png[/img]

Instead of giving me a nickname for Pikachu and instead put Yes / No put me North / West. Someone knows why that happens?

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: Torchickens
Date: 2014-05-15 08:04:14

Now I just saw the image of North / West, I went something like talking to Oak ZZAZZ with glitch activated:
[img]http://i.gyazo.com/28ffcd5847739ecb37d501bd402a38ce.png[/img]

Instead of giving me a nickname for Pikachu and instead put Yes / No put me North / West. Someone knows why that happens?


The ZZAZZ glitch changes many values to hex:99, with the amount of addresses affected depending on the Trainers' potential win money (it caps at 9999 but this is actually a cause of the glitch, see this). At address $D12C is the box-set ID; the ZZAZZ glitch may change this to a glitch box-set with the value $99, but I haven't seen this as North/West.

Did you try viewing a Super Glitch move? North/West is value 01, and it is possible for Super Glitch to write that value to $D12C.

Re: Making "Super Glitch" moves useful (Red/Blue/Green)

Posted by: pokechu22
Date: 2014-05-15 17:36:52

Now I just saw the image of North / West, I went something like talking to Oak ZZAZZ with glitch activated:
[img]http://i.gyazo.com/28ffcd5847739ecb37d501bd402a38ce.png[/img]

Instead of giving me a nickname for Pikachu and instead put Yes / No put me North / West. Someone knows why that happens?


What happened when you chose "North" or "West"? 

Those message boxes are interesting; especially with the screen wrapping. 

It is important to note that in cases where the "Yes/no" message box would appear, the game doesn't try to set the value for what will appear.  It assumes that it will be set to "Yes/no", and if it isn't, it will display whatever value is there.