Main Menu
Main Page
Forums
Recent changes
Random page
Help

Databases
GlitchDex
AttackDex
ItemDex
TrainerDex
TypeDex
UnownDex
More

Major Glitches
Trainer escape glitch
Old man trick
Celebi trick
Select glitches (Japan)
SRAM glitch
CoolTrainer♀ corruption
LOL glitch
Rival LOL glitch
Super Glitch
ZZAZZ glitch
Pomeg corruption glitch (Glitzer Popping)
Tweaking
Elite Four door glitch (Japan)
Pokémon merge glitch
Pokémon cloning
Time Capsule exploit
Arbitrary code execution
Coin Case glitch
More

Other Glitch Categories
Glitches by generation
Glitches between two generations
Japan-only/language specific glitches
Music glitches
Natural glitches
Non-core series glitches
Non-Pokémon glitches
Officially acknowledged glitches
Recurring glitches
Dead glitches

References
Pokémon GameShark codes
The Big HEX List
GB programming
Curiosities
Debugging features
Easter eggs
Error traps
Glitch areas
Glitch myths
Non-glitch exploits
Placeholder texts
Pokémon glitch terminology
Unused content and prerelease information

Useful Tools
8F Helper
GBz80 to Items
Old man trick name generator
PATH (Prama's Advanced Tweaking Heaven)
Save file editors
Special stat/Pokémon converter
Trainer escape Trainer Pokémon finder

Affiliates
Legendary Star Blob 2 (Hakuda)
Pokémon Speedruns wiki
PRAMA Initiative
Become an affiliate!

Search Wiki

 

Search Forums

 

Author Topic: How did a glitch item delete my save file?  (Read 659 times)

0 Members and 1 Guest are viewing this topic.

jfb1337

  • ACE trainer
  • GCLF Member
  • Offline Offline
    • View Profile
How did a glitch item delete my save file?
« on: March 26, 2017, 11:36:57 am »
I was trying to build an 8F script on VC Blue, and accidentally created a glitch item (think it was 0x86). Without really thinking, I clicked on it, and my game crashed into a stripey screen. But when I restarted, the save file was gone - it didn't give any error message or anything, the continue option was just removed from the menu. As far as I'm aware, this can only happen when the player name gets corrupted in SRAM with no terminator. What happened here? Is there any point where the game opens SRAM without closing it? Or did the glitch item open SRAM by itself? This has happened to me before when I used 8F without the correct setup and must have hit an rst 38, but I've also done that before without my save file deleting.

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: How did a glitch item delete my save file?
« Reply #1 on: March 26, 2017, 12:06:31 pm »
SRAM is open when a value $XA (X being any hex digit) is "written" to address range $0000 - $1FFF). This may happen either by writing such a value directly, or incrementing / decrementing a value in ROM. Example : incrementing the byte at $0060 (which is a $D9) will unlock SRAM.

If SRAM is overwritten with junk afterwards, the game may either think the save file is corrupted or simply doesn't exist.
You can get your Pokémon back if you perform the SRAM glitch (without the "Clear saved data ?" part, of course :P), they just will be considered traded Pokémon.
Just make sure never to power off too late : if you get a "the save is destroyed !" message you CAN try again, don't delete saved data.
If you can load your file but cannot access the Pokémon menu afterwards it's over :/
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

jfb1337

  • ACE trainer
  • GCLF Member
  • Offline Offline
    • View Profile
Re: How did a glitch item delete my save file?
« Reply #2 on: June 17, 2017, 07:18:29 pm »
I think I have a hypothesis on what could have happened, but haven't tested this: The item in question could have had a super glitch name, which causes things to be copied stuff from CD6D to CF4B. But if there were NO 0x50 bytes in this range, this would cause it to eventually start reading from where it was written to, causing the entire memory to be hosed, until it wraps around to ROM in which 0x50 byte gets found since it can't be overwritten. This corrupts both the stack and the OAM procedure, either of which can cause unpredictable code to run, which is likely to hit an rst38, possibly after happening to open SRAM, causing it to be hosed.

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: How did a glitch item delete my save file?
« Reply #3 on: June 18, 2017, 06:36:49 am »
The Super Glitch name could have wrecked the whole RAM, especially if you didn't even USE it the item to corrupt everything. Yeah, it could have jumped to a routine that clears SRAM, for example. But if that's what happened, well you've been quite unlucky. FeelsBadMan
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

Torchickens

  • Administrator
  • *****
  • Online Online
  • Gender: Female
    • View Profile
Re: How did a glitch item delete my save file?
« Reply #4 on: June 18, 2017, 07:41:11 am »
I was trying to build an 8F script on VC Blue, and accidentally created a glitch item (think it was 0x86). Without really thinking, I clicked on it, and my game crashed into a stripey screen. But when I restarted, the save file was gone - it didn't give any error message or anything, the continue option was just removed from the menu. As far as I'm aware, this can only happen when the player name gets corrupted in SRAM with no terminator. What happened here? Is there any point where the game opens SRAM without closing it? Or did the glitch item open SRAM by itself? This has happened to me before when I used 8F without the correct setup and must have hit an rst 38, but I've also done that before without my save file deleting.
I think I have a hypothesis on what could have happened, but haven't tested this: The item in question could have had a super glitch name, which causes things to be copied stuff from CD6D to CF4B. But if there were NO 0x50 bytes in this range, this would cause it to eventually start reading from where it was written to, causing the entire memory to be hosed, until it wraps around to ROM in which 0x50 byte gets found since it can't be overwritten. This corrupts both the stack and the OAM procedure, either of which can cause unpredictable code to run, which is likely to hit an rst38, possibly after happening to open SRAM, causing it to be hosed.

This is exactly what happens. For this reasons it's always a good idea to only do menu scrolling with the B button and to only select unterminated name glitch items when a 0x50 tile is on the screen.
Hello. I actually identify as gender questioning, but nowadays feel more firmly that I identify as female. My sex is male but I like to express myself as female.  She/her pronouns, please.


Thank you Aeriixion for the cute sprite above! :) Roelof also made different variations of the sprite (which I animated).

Contact:

Email Youtube Twitter
Skype: Torchickens
Bulbapedia Starfy Wiki

Beyond all philosophies are the things that go best for you; what makes you feel content. It's important to always follow your heart, so unless you feel perfectly happy about it don't just follow something because it is popular, fits a style or is conventional. Sometimes you may reach a point you're not sure who you are, but as things settle I'm convinced things do work out in time.

camper

  • aka GlitcherRed, azum4roll
  • Member+
  • *
  • Offline Offline
  • Gender: Male
  • 975642dx║'r DExsfoF▓1 error.
    • View Profile
Re: How did a glitch item delete my save file?
« Reply #5 on: June 18, 2017, 08:29:17 pm »
I think it's much easier to have your save wiped in the VC version.
Youtube
 

Guess where this is?

TheZZAZZGlitch

  • Distinguished Member
  • *
  • Offline Offline
  • Gender: Male
  • Unknown opcode fc at 801a
    • View Profile
Re: How did a glitch item delete my save file?
« Reply #6 on: June 19, 2017, 01:00:02 am »
Yeah, save wipes with rst 38 crashes are really common on VC (I once erased my save by accident too).
This makes me think that the VC doesn't emulate SRAM locking at all.

People tend to corrupt their saves because they save right before trying out glitches, for safety. But this actually causes the game to switch to SRAM bank 1, which contains save data. So if some wrong code manages to later unlock SRAM (which might not be even necessary, since it always seems unlocked on VC) and overwrite its contents, the save data is gone.

It's a good idea to view any non-glitch Pokemon's stats before doing anything potentially game-crashing. This causes the game to switch to SRAM bank 0, which doesn't contain any important data. So even if something goes wrong and SRAM is overwritten, nothing bad will happen. The bad code would have needed to not only unlock the SRAM somehow, but also switch to bank 1/2, which is highly unlikely.
« Last Edit: June 19, 2017, 01:09:16 am by TheZZAZZGlitch »
qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF

Torchickens

  • Administrator
  • *****
  • Online Online
  • Gender: Female
    • View Profile
Re: How did a glitch item delete my save file?
« Reply #7 on: June 19, 2017, 07:21:05 am »
Hmm, I don't know if it is something unrelated but when I use the offgao memory editor on VC Yellow and Red A000-BFFF appears to be filled with FF, which may suggest that the SRAM is locked.

Me too though, save wipes seem to be a lot more common to me on VC (which is why I thank Wack0 for encouraging me to switch to custom firmware to restore save files).
Hello. I actually identify as gender questioning, but nowadays feel more firmly that I identify as female. My sex is male but I like to express myself as female.  She/her pronouns, please.


Thank you Aeriixion for the cute sprite above! :) Roelof also made different variations of the sprite (which I animated).

Contact:

Email Youtube Twitter
Skype: Torchickens
Bulbapedia Starfy Wiki

Beyond all philosophies are the things that go best for you; what makes you feel content. It's important to always follow your heart, so unless you feel perfectly happy about it don't just follow something because it is popular, fits a style or is conventional. Sometimes you may reach a point you're not sure who you are, but as things settle I'm convinced things do work out in time.

jfb1337

  • ACE trainer
  • GCLF Member
  • Offline Offline
    • View Profile
Re: How did a glitch item delete my save file?
« Reply #8 on: June 19, 2017, 02:13:40 pm »
Come to think about it I've never had a save wipe on BGB except when I deliberately opened SRAM to try to get a save wipe, but I've had at least 3 or 4 save wipes on VC. So it's possible that SRAM isn't properly or at all.

I just checked with my offgao mem editor and A000-BFFF was all FF. But when I looked at a sprite to open bank 0, and checked again and there was data there. From A858 onwards was alternating 00 39, and before that was actual data.
Then I saved, and it was back to all FF again.
Then I manually opened SRAM by incrementing a byte ending in 9 somewhere in ROM, and there was data up until B524 after which was 0039, which was also there before A598. I tried manually opening and closing it a few times, which seemed to work as expected, though one time it seemed to take 2 attempts to actually get it to close: could be something interesting (closing SRAM sometimes fails??) or could just be that I didn't actually write something when I thought I did. Edit: Most likely explanations is just that I wrote to the wrong part of ROM. Anyway, my thumb is now tired from holding the select button so much.
« Last Edit: June 19, 2017, 02:30:49 pm by jfb1337 »

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: How did a glitch item delete my save file?
« Reply #9 on: June 20, 2017, 04:14:56 am »
The area of ROM that enables SRAM is 0000-1FFF. Might explain.
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

Crystal_

  • Distinguished Member
  • *
  • Offline Offline
  • 39 00 39 00 39 00 39 00
    • View Profile
Re: How did a glitch item delete my save file?
« Reply #10 on: June 20, 2017, 06:23:18 pm »
The thing is, VC is far more prone to being corrupted due to the fact that unknown opcodes or invalid stops don't halt the game like they do in a real GB/C. So in VC the game will usually run around for longer, and is more likely to corrupt (open) SRAM or to trigger a fatal rst 38 in the process. That said, a rst 38 shouldn't be able to change the SRAM bank so as TheZZAZZGlitch said making sure that SRAM bank 0 is loaded before doing anything dangerous is a good idea.
« Last Edit: June 20, 2017, 06:25:55 pm by Crystal_ »