Re: Gen III: Access Pokémon beyond the sixth slot sub-glitches.
Posted by: jfb1337
Date: 2017-04-06 12:53:31
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.
In some instructions for pomeg corruption I see that a specific 4th move is required. What does this 4th move do, and why does it differ between regions?
Really stupid question, but could someone explain how data substructures work? The guides on bulbapedia make no sense to me… :'(
also, how do you get a bag egg to battle? :???:
Outside of the Pokémon IDentifiant (PID), Trainer IDentifiant (TID), Pokémon's nickname, and Trainer's name, most of the Pokémon's data is separated into 4 groups called substructures.
Each one of these substructures contains certain parts of the Pokémon's data in a certain order.
They are called : Growth - Attacks - EVs & Contest stats - Miscellanous
For example, the Attacks substructure contains in that order : Move 1 identifiant - Move 2 identifiant - Move 3 identifiant - Move 4 identifiant - Move 1 PPs - Move 2 PPs - Move 3 PPs - Move 4 PPs
Each one of these substructures is 96 bits long (or 12 bytes, or 6 words, or 3 double-words).
But all of this data isn't stored as is, it is crypted when stored into the RAM and decrypted when the game wants to use it to check/use some values (like calculating a Pokémon's stats).
In Gen 3, the encryption is made of two mechanics :
- The order of the 4 substructures is given by the PID modulo 24 (there are 24 ways to sort 4 different elements)
- The game takes all the hexadecimal words that make the substructures and computes their sum.
The first 4 hexadecimal characters of this sum (called checksum) is stored on another part of the Pokémon's data.
Then, the game goes through every hexadecimal double-word that is contained in the substructures and modifies them with the formula : encrypted double-word = word xor TID xor PID (XoR being a logical operation)
Thus, if you corrupt the data in the substructures directly, the checksum will be invalid and the corruption will fail (the Pokémon will turn into a Bad Egg as soon as the game computes the checksum again and finds the difference with the stored checksum).
However, if you corrupt the Pokémon's PID, you will change the order of the substructures.
So when the game will look at the Pokémon's data after the corruption, he will incorrectly read the substructures and this is where we can get very cool stuff.
(example : Growth substructure being read over the Attacks substructure, so the species of the corrupted Pokémon is read over the identifiant of the first move of the Pokémon before it corruption )
Since the PID is also used in the encryption of the substructures data, that PID corruption needs to meet a certain criteria in order to not affect that encryption.
But thankfully, one of the two possible ways to corrupt data with Pomeg Glitch meets this criteria.
Getting a Bad Egg (or an Egg/empty slot) to the battle is the matter of forcing the game to send a Pokémon from a certain party slot to the battle, even though that Pokémon is not supposed to be sent to the battle.
To do that, we exploit an oversight in the code that doesn't refresh the value "Party slot of the currently fighting Pokémon" from one battle to another if the party is fully KO.
Thus, the procedure looks like this :
- Make a wild battle and send a valid Pokémon to the fight (let's say from the 3rd party slot)
- Perform Pomeg Glitch to have a fully KO party
- Place a Bad Egg/Egg to the 3rd party slot (or leave it empty by depositing a Pokémon to the PC before killing the whole party)
- Make another battle (since the party is fully KO, the Pokémon in the 3rd party slot will be forced to the fight)
Bootstrap (animation script):
Item $D103 x3860
Item $FF0E x2048
Set any memory address to anything:
Item $[byte to write]20 x18689
Item $7008 x48624
Item $[address, 3rd byte][address, 4th byte] x$[address, 1st byte][address, 2nd byte]
Hey, i think i just discovered a glitch move that might be interesting
I was trying to get TheZZAZZGlitch's arbitrary code execution move (0x27A2) but it gave me this move instead. Idk if i failed the EV's or if the move's id is different on French versions…
0) Start everything on Emerald.
1) Obtain a Glitch Move with an Animation Pointer that points towards PC Pokémon Data.
2) Manipulate the data of a PC Pokémon to make the bootstrap of the code. (Bootstrap Pokémon)
This Bootstrap Pokémon will either redirect the code to PC Items, Pyramid Bag Items (Emerald only), or PC Pokémon Data (RS mainly).
Pomeg Glitch is used to manipulate the data of the Pokémon.
3) Generate many Glitch Items with Pomeg Glitch.
4) Use a sub-glitch to deposit these Glitch Items in Pyramid Bag in order to write the rest of the code in Pyramid Bag Items. (Pyramid Bag Items)
or
4) Deposit these Glitch Items in the PC and use a sub-glitch to make their quantities overflow and manipulate them in order to write the rest of the code in PC Items. (PC Items)
or
4) Train/Glitch a Pokémon to store the rest of the code in PC Pokémon Data. (PC Pokémon Data).
5) Train and clone some Pokémon.
Transfer everything you need on the version you want (FrLg or another Emerald).
Turn the Animations On.
6) Use a method that allows you to check if the current DMA pattern is the required one for the ACE you want.
7) Use the ACE Glitch Move.
8 ) Profit.
Even though the move's name is short, the name the game uses when the move is used in battle is longer (I don't really know where he pulls the other name off)
I'm currently trying to learn glitch moves 0xFFFF and 0x3FFF to a Smeargle so that i can corrupt them into a full 31 set of IV's
But for some reasons 0xFFFF, despite being a normal, damage-dealing move, is impossible to Sketch. Sketch will simply fail if you try to use it to get this move. As for 0x3FFF, the game softlocks as soon as the enemy Ditto tries to use it, for some reason. It doesn't freeze, as i'm still able to reset, but it softlocks.
Does anyone know a way around either of these issues ? With a lucky RNG and Type 8 corruption (the best one if used well imo) i'm able to obtain basically any pokemon with any moveset, and shiny to top it off. I really wish i could corrupt the IV's as well.