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

What Are The Reasons Behind The Merge Glitch? - Page 1

What Are The Reasons Behind The Merge Glitch?

Posted by: rinlingyo2016
Date: 2017-02-13 19:29:31
Do we know why the merge glitch works? (http://glitchcity.info/wiki/Pok%C3%A9mon_merge_glitch) Does it have to do with how glitch pokemon with an index number of 255 (e.g. Charizard 'M) are read as a "stop" command? (venturebeat.com/2011/12/07/the-7-freakiest-pokemon-redblueyellow-glitches/ see section "Charizard 'M")
Any thoughts are appreciated. Thanks!

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Yeniaul
Date: 2017-02-13 21:25:49
The answer is most likely YES. I bet ISSOtm or Torchickens can and will clarify, though.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Unused Trainer
Date: 2017-02-14 06:07:21
Yes this is a very good question.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Torchickens
Date: 2017-02-14 10:47:23

Do we know why the merge glitch works? (http://glitchcity.info/wiki/Pok%C3%A9mon_merge_glitch) Does it have to do with how glitch pokemon with an index number of 255 (e.g. Charizard 'M) are read as a "stop" command? (venturebeat.com/2011/12/07/the-7-freakiest-pokemon-redblueyellow-glitches/ see section "Charizard 'M")
Any thoughts are appreciated. Thanks!



The answer is most likely YES. I bet ISSOtm or Torchickens can and will clarify, though.


Yeah, I think the roots of the Pokémon merge glitch are similar to item stack duplication glitch (http://glitchcity.info/wiki/Item_stack_duplication_glitch). I haven't taken a look at the routines involved but know this shifting occurs in multiple glitches like remaining HP glitch and other box data shift glitches, bad clone glitch.

The game encounters an FF and shifts back all the data before it.

Consider you have the stored Pokémon:

Bulbasaur
Pidgey
Cancel

;and the structure (http://datacrystal.romhacking.net/wiki/Pok%C3%A9mon_Red/Blue:RAM_map#Stored_Pok.C3.A9mon) of the stored Pokémon list goes like: Pokémon 1, Pokémon 2 (… Pokémon 20).

Bulbasaur is the first Pokémon so withdrawing it causes the shifting to occur. Pokémon 2 becomes Pokémon 1 and Pokémon 2 becomes Cancel.

It seems the problem is related to when you perform the Pokémon merge glitch you are withdrawing above a FF, which is considered as a Cancel and causes problems due to how the game shifts bytes before it.

(e.g. in

Bulbasaur
Cancel
Mewtwo
Pidgey

We withdraw Bulbasaur and Mewtwo hybridizes with FF/Cancel and Pidgey hybridizes with Mewtwo.)

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: ISSOtm
Date: 2017-02-15 09:08:30
You are right when you say "this comes from $FF meaning STOP to the game".
Basically, the game has two separate lists for boxed Pokémon. A list of IDs (identifying which Pokémon is in which slot) and a list of data (saving each Pokémon's data, including another ID byte as well as EVs, stats, attacks and other stuff you may or not witness on the STATS screen.
The problem is the way the game handles withdrawing a Pokémon. Here it is in pseudo-code :

1. Decrement the number of Pokémon in the box
2. Start at the ID of the withdrawn Pokémon
2.1. Copy the following ID to the current ID
2.2. Move forwards 1 ID
2.3. Repeat unless we copied $FF (usually what "terminates" the ID list)
3. Copy data for all Pokémon following the withdrawn Pokémon back by "one data".

Under normal conditions, this is flawless. However, by having as $FF before the "true" Cancel, the first copy terminates earlier than intened - but the second doesn't. Which means data structures will be passed around from Pokémon to Pokémon following the $FF, effectively "merging" them. You also know why one of the "merged" Pokémon is a $FF hybrid, because the game doesn't clear the $FF ID it copied.

The reason this gives unstable hybrids is that both IDs (the "donor" is the ID in the ID list, the "recipient" is the copy in the data list) don't match anymore, and because different parts of the game's code use either of these for convenience reasons (for example, in battle, only the recipient byte can be used, whereas TMs and HMs use the donor byte to check for a mon's learnpool)


Also, I'm wondering if someone ever tried merging in the party ? It should work, too.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Yeniaul
Date: 2017-02-15 09:57:42
See? I was right. Torchickens and ISSOtm will and did clarify.
Nice job, guys. High-quality, as usual.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Torchickens
Date: 2017-02-15 10:41:58
Thanks, though ISSOtm's explanation was a lot better than mine.

The glitch works with party depositing/giving to Day Care and this was documented before but is a bit obscure.
[img]http://i.imgur.com/Mn4oZfH.gif[/img][img]http://i.imgur.com/PjAxxwH.gif[/img]

In fact you can do that in Generation II as well.
https://www.youtube.com/watch?v=KPiJStUldjI

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: ISSOtm
Date: 2017-02-15 11:38:14

Thanks, though ISSOtm's explanation was a lot better than mine.
Hehe, thanks !


In fact you can do that in Generation II as well.
https://www.youtube.com/watch?v=KPiJStUldjI

Not surprising, Gen II's engine is mostly based off Gen I (minus a SHIT TON of bugs :D)

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Torchickens
Date: 2017-02-15 12:48:19


Thanks, though ISSOtm's explanation was a lot better than mine.
Hehe, thanks !


In fact you can do that in Generation II as well.
https://www.youtube.com/watch?v=KPiJStUldjI

Not surprising, Gen II's engine is mostly based off Gen I (minus a s**t TON of bugs :D)


You're welcome. :) Yeah, thinking about it you could probably port over the bad clone glitch. You can kind of do this with the variations of the box byte shift glitch (e.g. remaining HP glitch) but if you removed the only FF terminator for species byte 1 from your party, bypassed the zero maximum HP freeze it might work in the party as well.

Edit: You can, yay! Make the first FF after D16D/C and give Pokémon 1 a HP modulo 256 of your choice, then deposit twice. Your Pokémon will become the same ID as the HP modulo 256 when you take it into Day Care and out. So I wonder if this can be abused with Super Glitch like international fossil conversion glitch.

Edit 2: I did it with a special Super Glitch method that I might show off tomorrow, requiring the glitch item 9F to fix Glitch Cities and three Pokémon with Super Glitch.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Yeniaul
Date: 2017-02-15 20:09:14
I feel jealous now as I'm only riding the information flow and can't contribute to it. And my ear Kleenex just fell out. Shit.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: ISSOtm
Date: 2017-02-16 06:16:37
From all the really cool shit I've been seeing around these times, I'd say :

Find a cool idea
Try to do it
Don't give up, find resources and ask people
Post it on the interwebs
Grow up
Look back at it
"Not F*ING bad
my dudes"

Since you're riding the flow you should have resources on "how to do it". Go on then.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: rinlingyo2016
Date: 2017-03-19 18:07:27
Thank you for your thorough answers :)

I think I understand:
A shifting needs to occur when taking Pokemon out of the box. Everything is shifted above the Cancel button since Cancel should be at the end of the list. However, when we have a Pokemon in the box like Charizard 'M, he's read as the Cancel button, so glitchy things happen to the Pokemon below him. It's as if the game is trying to shift the Pokemon found below Cancel, but it doesn't know how to do it properly, so they become partially shifted and merged together.

We plan to cover the merge glitch at our Pokemon Glitches panel, so I think this is how I'll explain the gist of why the glitch works, and I'll refer them here if anyone wants more detailed explantions.

Re: What Are The Reasons Behind The Merge Glitch?

Posted by: Krys3000
Date: 2017-03-20 02:33:19
I believe indeed it is very important to explain the glitches for those who would like to understand them. This is why on PRAMA we always try to write an optionnal "technical explanation" section for every single page we write. When I personally don't know something about a 1G glitch, I usually ask ISSOtm since he's the team expert for these. Otherwise I ask here or I annoy Torchickens :D

Well those pages are in French obviously but if you need something that we wrote you could probably Google translate or just ask! We might wanna add a similar feature here for the glitches in the wiki that still requires explanation.