Main Menu
Main Page
Forums
New pages
Recent changes
Random page
Help

Glitches
Arbitrary code execution
Pokémon cloning
Pomeg glitch and Glitzer Popping
Tweaking and voiding
Glitches by generation
Glitch categories

References/Resources
Databases
Disassembly projects
The Big HEX List
Pokémon cheat codes
Pokémon glitch terminology
Useful tools
More

Affiliates
Legendary Star Blob 2 (Hakuda) (日本語/Japanese)
Pokémon Speedruns wiki (English)
PRAMA Initiative (Français/French)
MissingNo. Glitch City (Italiano/Italian)
Become an affiliate!

Technical
Site source code

Search Wiki

 

Search Forums

 

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

0 Members and 1 Guest are viewing this topic.

jfb1337

  • ACE trainer
  • 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)
  • Staff
  • *****
  • 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
  • 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)
  • Staff
  • *****
  • 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 !)

Princess Torchic Owl Lover ☽ ❤

  • Head Administrator
  • *****
  • Online Online
  • Gender: Female
  • Aspiring mother. 🦋 ✿
    • 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.

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿
Here have some free flowers on every post ^^
✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿



(Images © Sanrio, Nintendo, Pokémon, HAL Laboratory)

✿ Hi, I'm Evie. Sex male, and spiritually doesn't believe 'male'/'female' needs to be defined; lives more stereotypically like a woman. Call me whichever pronouns you like. :)

Feel free to contact me here about anything regarding the site.

Forgiveness. I feel that the more people pray to our greatest source/God/mathematical equality for world peace, the more and more it manifests into reality (until our next spiritual death).

Thank you Nyapon for this lovely artwork. :3

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

Princess Torchic Owl Lover ☽ ❤

  • Head Administrator
  • *****
  • Online Online
  • Gender: Female
  • Aspiring mother. 🦋 ✿
    • 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).

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿
Here have some free flowers on every post ^^
✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿



(Images © Sanrio, Nintendo, Pokémon, HAL Laboratory)

✿ Hi, I'm Evie. Sex male, and spiritually doesn't believe 'male'/'female' needs to be defined; lives more stereotypically like a woman. Call me whichever pronouns you like. :)

Feel free to contact me here about anything regarding the site.

Forgiveness. I feel that the more people pray to our greatest source/God/mathematical equality for world peace, the more and more it manifests into reality (until our next spiritual death).

Thank you Nyapon for this lovely artwork. :3

jfb1337

  • ACE trainer
  • 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)
  • Staff
  • *****
  • 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_ »