Jump to content

SRAM glitch: Difference between revisions

→‎Save corruption: Changed the description for the frame window. Still need some research on the time window between the visual cues.
>ISSOtm
(Created this. Small edits as of now for me, huh.)
 
(→‎Save corruption: Changed the description for the frame window. Still need some research on the time window between the visual cues.)
 
(17 intermediate revisions by 6 users not shown)
Line 1:
{{Major glitches}}
The '''SRAM glitch''', also known as '''Save corruption glitch''' and '''Save abuse glitch''', is a glitch that allows the player to perform the [[send party Pokémon to a new game]] or [[255 Pokémon glitch]] as soon as they are in their room.
{{PRAMA|save-abuse-glitch}}
The '''SRAM glitch''', also known as the '''save corruption glitch''' or the '''save abuse glitch''', is a method of performing a partial save in {{RBY}} with a [[Reset|hard reset]], such that the party data in the SRAM is carried into the new save file. Most notably, it allows the player to obtain an [[expanded party]] of 255 Pokémon immediately after starting a new game. It also allows the player to [[send party Pokémon to a new game]].
 
The glitch exploits a quirk in the code for saving the game to get a save file with a correct checksum. The necessary timing for the hard reset is very precise (less than 0.1 second), but it is still much easier than getting the correct checksum by chance.
Keep in mind when attempting this glitch, the timing is very precise (a handful of frames, ie less than a quarter of a second), so emulators and savestates are privileged.
 
== Procedure ==
The principle of the glitch is :
=== Clearing the save file ===
# Start a New game
This glitch can be executed at any point in the game, but is most often done at the very start of a new game to access an expanded party. For this purpose, the player needs to clear any existing save files:
# Play as much as you wish, without saving
# Press Up+Select+B on the title screen (not the title menu; it is the screen with the "Pokémon" logo and version name, and can be reached from the title menu by pressing B).
# Begin to save the game
# Choose "Yes" to the "Clear all saved data?" prompt.
# At a very precise moment, power off / reset the console. The timing is version-dependent, making the glitch easier on {{Y}}.
 
Even if the player does not have an existing save file (e.g. on a fresh cart), it is still recommended to clear the save file anyway. Clearing the save file will set the SRAM to all 0xFF bytes, which guarantees that this glitch will give the player an expanded party. On the other hand, the contents of uninitialized SRAM is unpredictable: There is a good chance it will be 0xFF anyway, but it can also be something else. In particular, some emulators initialize the SRAM to 0x00, which means even if this glitch succeeded, it will '''not''' give the player an expanded party.
The cue is to power off / reset after the "Yes/No" dialog box has disappeared, but before the text changes to "Saving..."
 
=== Save corruption ===
Holding START+SELECT+A+B will not work, as the game prevents soft resets while it is saving.
The following steps can be done at any point in the game.
# Open the start menu, and select "Save".
# Select "Yes" in the "Yes/No" dialog box, but at a very precise moment, power off or reset the console.
Holding#* START[[Reset|Soft resetting]] (holding Start+SELECTSelect+A+B) will not work, as the game prevents soft resets while it is saving.
#* The cue istiming to power off /or reset is after the "Yes/No" dialog box has disappeared, but before the text changes to "Now saving..." (Red/Blue) or "Saving..." (Yellow).
#** The time window between those two visual cues is around 20 frames (depending somewhat on the version and the circumstances), but the window to successfully perform this glitch is only 4 frames.
#* Note that on the Game Boy Player the [[reset fadeout delay]] applies, so the player needs to press the reset button earlier accordingly, before the player selects "Yes" by pressing A, and possibly even before the "Yes/No" dialog box appears (this is often the case when speedrunning).
 
If the glitch was successful, a Continue option will be present when the game is started again, andbut the player's party will be replaced by the existing party data in the SRAM. In particular, the player will be able to access their Pokémon screen. Ineven theif casethey ofnever received the 255starter Pokémon glitch,(unless the screenparty willdata lookin likethe itSRAM ishad blank0 Pokémon).
In {{RB}}, the window of opportunity is a few frames only, located right after the box disappears, making the glitch rely more on luck than on timing.
 
There are two ways the glitch can fail:
In {{Y}}, there are more frames where the glitch will be successful, and the window is further away from the Yes/No box disappearing, making the glitch more viable on console.
* When rebooting the game the message "The file data is destroyed!" may appear, which usually indicates the reset happened too early and will remove the Continue option.
* If the Continue option does appear, the player may find their party data unchanged (if the player never received the starter in this game, then the Pokémon screen cannot be accessed), which indicates that either the reset happened too late, or the player didn't set up the SRAM data properly (see [[#Clearing the save file|Clearing the save file]] above).
 
==Variants==
===255 Pokémon glitch===
{{Main|255 Pokémon glitch}}
By performing the SRAM glitch while the player has no save file, the party data will become whatever is in the SRAM, and is likely to be all 0xFF bytes (in particular, clearing the save file will set the SRAM to all 0xFF). As a result, the player will have 255 Pokémon in the party. When the player opens the party screen, it will appear to show nothing in the party, but the player will be able to scroll the cursor to any of the 255 slots and switch Pokémon around.
 
<!-- Should these be listed on the 255 Pokemon glitch page instead? -->
The easiest glitch to perform is the [[255 Pokémon glitch]] ; you need to have no save file, then perform the SRAM glitch. If a save file exists (a Continue option exists), go to the title screen (not the where the Continue/New Game/Option menu is present) by pressing B if you are in the menu, hold Select and Down, and press B. The game will prompt you to erase the currently present save file. Accept, and perform the aforementioned steps.
The [[expanded party]] can be exploited in many ways. For example:
*Warp to the Safari Zone: Swapping the 3rd Pokémon with the 36th can warp the player to the Safari Zone gate. (discovered by VaeporSage)
*Walk through walls: Swapping Pokémon 62 with 63 allows the player to walk through walls. (discovered by hibiki ganaha)
*[[Expanded item pack]]: Swap Pokémon 9 with Pokémon 10, and then with Pokémon 11. If you want to undo the effects of the [[255 Pokémon glitch]], stand on the right tile of the house's exit mat, and swap Pokémon 187 with Pokémon 178, wait a while{{clarify}}, and press A.
 
===Send party Pokémon to a new game===
The [[send party Pokémon to a new game]] glitch has the only difference that you have to start a new game while a save file from which you wish to import your Pokémon present. However, failing the glitch may render the file unattainable ; if the save file is marked as "destroyed", the glitch still has a slight chance to work if attempted again.
{{Main|Send party Pokémon to a new game}}
If the player starts a new game while a save file already exists, and successfully performs the SRAM glitch, then the party Pokémon from the old save file will appear in the new game.
 
If the glitch fails due to the reset happening too early, then the game will say "The file data is destroyed!", but the saved party Pokémon data is in fact not overwritten. Therefore, if the player starts a new game in this state and try again, they may still be able to retrieve those party Pokémon. (Of course, if the reset happens too late and the save was successful, then the party would be overwritten and unable to be retrieved.)
 
=== Pokémon cloning ===
If the glitch was successful, a Continue option will be present when the game is started again, and the player will be able to access their Pokémon screen. In the case of the 255 Pokémon glitch, the screen will look like it is blank.
{{Main|Pokémon cloning (Generation I)#Save menu method}}
The SRAM glitch can also be performed while a save file from the same playthrough exists, overwriting the player's current party with the party from the old save file. In particular, if the player saves the game, deposits a Pokémon into the Pokémon Storage System, then performs the SRAM glitch successfully, then that Pokémon will exist in both the box and the party, essentially cloned.
 
==Explanation==
There are two ways the glitch can fail : either when rebooting the game the message "the save file is destroyed !" will appear (the reset happened too early) which will remove the Continue option, or a Continue option will appear but the Pokémon screen cannot be accessed (the reset was too late). Attempting the glitch is still possible.
When saving the game in Generation I, the game calls three functions, each only saving a part of it, and the parts are in fact overlapping:
* The first function<ref>[https://github.com/pret/pokered/blob/1dcaede8b5e41dbec9bf3f2b18c77d1b7d2de708/engine/menus/save.asm#L201 The first function for saving the game]</ref> saves everything, ''except the party data''.
* The second function<ref>[https://github.com/pret/pokered/blob/1dcaede8b5e41dbec9bf3f2b18c77d1b7d2de708/engine/menus/save.asm#L234 The second function for saving the game]</ref> only saves the current box data.
* The third function<ref>[https://github.com/pret/pokered/blob/1dcaede8b5e41dbec9bf3f2b18c77d1b7d2de708/engine/menus/save.asm#L254 The third function for saving the game]</ref> saves the party data, the Pokédex data, and (in Yellow) Pikachu's happiness and mood.
Besides being used for a full save, the third function is also used after trading a Pokémon in the Cable Club. Presumably at least one of the first two functions is also intended to be used somewhere else, but they don't seem to be in the final game.
 
The importance of having three functions is that all three functions will compute a checksum from the full save data on the SRAM, and write it to the SRAM. When performing a full save, the first function would result in an inconsistent save file, and checksum it. At this point, if the player resets the game, the save file would be considered valid by the game since the checksum is correct.
 
Furthermore, the second function would then save the current box data to the SRAM, which takes a significant number of frames, but actually does nothing because the current box data is already saved by the first function. Therefore, during this period, the checksum on the SRAM will remain valid, resulting in a relatively large time window for the hard reset.
 
==References==
<references />
[[Category:Generation I glitches]]
Cookies help us deliver our services. By using our services, you agree to our use of cookies.