Post subject: Savestates and SRAM behavior
Active player (328)
Joined: 2/23/2005
Posts: 786
Could someone please explain to me the behavior of SRAM when loading states? Is your .SAV file automatically overwritten when you load a state, or does the emulator not touch it until you perform an action that would normally overwrite it (e.g. saving)? Or is the SRAM data stored in RAM somewhere , causing it to APPEAR to be overwritten when loading a state, when it's really not? For some reason, it never seems to behave the way I think it would behave, so I figured I'd ask about it.
Former player
Joined: 4/6/2006
Posts: 462
From my experiences, snes9x's SRAM is immediately overwritten when you load a savestate.
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
It overwrites the SRAM in the emulator's RAM immediately, and sometime later (could be in a few minutes or the next time you reset or exit) it writes that back out to the SRAM file, which is only loaded when starting or resetting the game.
Active player (328)
Joined: 2/23/2005
Posts: 786
Okay. But when, exactly, are changes made to the file? In a few minutes, or next time you reset or exit? Or does it depend on the emulator?
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
Depends on the emulator, but I think that is what Snes9x and VBA do, whenever any of those 3 things happens (including loading another ROM or playing a movie, not including crashing). If you want to edit/replace/inspect the SRAM file, generally you should exit the emulator first and leave it closed until you're done.
Active player (328)
Joined: 2/23/2005
Posts: 786
Mainly I'm concerned about playing though games non-tool assisted (or switching between tool-assisted and non tool-assisted play with the same game). Sometimes I actually want to use the game's original save features and I'm worried about them getting overwritten at unknown times. Maybe some option, such as "Prompt on Overwrite" or "Do not overwrite SRAM after loading state," would be reasonable?
Editor, Expert player (2079)
Joined: 6/15/2005
Posts: 3282
I suggest isolating two ROMs completely, in different folders. One for TAS, one for playing. I have tried to use the same ROM for both TAS and playing, and it has messed me up many times (the playing, not the TAS).
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
You could play using a renamed duplicate of the ROM (similar to what FractalFusion suggested) and/or make a savestate whenever you make an in-game save. The emulator feature closest to what you're looking for would be an option to prevent the SRAM stored in savestates from being loaded at all. That leads to an inconsistent state when you load a savestate, where saved game data will persist into a game that didn't save that data, but presumably you're willing to accept that if you use that option. You're in luck if you use Gens, because it always does that (it forgets to save or load SRAM in savestates, much to my annoyance when I actually want to recover a saved game from a savestate).
Player (206)
Joined: 2/18/2005
Posts: 1451
If you want to have your SRAM data safe, the easiest solution would be to just copy the .srm file in a different folder, or rename it to something else. If you rename it, the emulator will automatically create a new one again when loading the ROM. Later when you need your old srm file, just replace it with the other one, so that it matches the ROM filename again.
See my perfect 100% movie-walkthroughs of the best RPG games on http://www.freewebs.com/saturnsmovies/index.htm Current TAS project (with new videos): Super Metroid Redesign, any% speedrun
Tub
Joined: 6/25/2005
Posts: 1377
for VBA, I used a different approach: I made three directories containing the VBA .exe and each it's own configuration file. The configuration files are all set to use a different save-directory. This way, I can watch movies with the movie configuration, without overwriting my saves from the playing configuration. I can also use the full amount of quicksave-slots for movie bookmarks without limiting the 10 quicksave-slots for playing. my three configurations are: keyboard, gamepad, movie-watching. Maybe you'll want to have another seperate one for your current TAS-project, if you're doing one. this approach works with any emulator that has a seperately configurable save-directory and saves it's settings to a nice configuration file instead of the registry. unfortunately snes9x isn't one of them.
m00