Autosave

retrorepair
Posts: 108
Joined: Sun May 24, 2020 9:06 pm

Re: Autosave

Unread post by retrorepair »

It was more directed toward the general populous and my rapidly declining patience with it, but since you are willing to explore this, let's do it.

RE games which use SRAM as expansion RAM, which games are these? I'd wager it's limited to NES and other systems of this generation and since SRAM backup is handled per core maybe some exceptions can be made as opposed to being the rule? Are there a lot of games which do this?

Do any SNES games do this?

Do Megadrive/Genesis games do this?

I'm certain no AES games will.

MVS backup RAM I don't believe is suitable for autosave unless the vector is narrowed to the data and skips the RTC.

I've actually been doing some testing with SNES games and monitored when they write to SRAM (using the LED as a guide) and I've yet to find a SNES game which would cause an issue. I've compiled a test build of the SNES core that I've modified to save as soon as SRAM has changed and so far, again, no issues.

I understand that writing to the SD during a power cycle lends itself to corruption, but doesn't any write to SD?

wesclemens
Posts: 1
Joined: Mon May 25, 2020 2:48 am

Re: Autosave

Unread post by wesclemens »

Isn't this a problem with the SNES directly? If I was to power cycle a real console while it was in the middle of writing to the SRAM wouldn't it be corrupted.

Also, doesn't all the same corner cases exists when the menu is open? (e.g. if I opened the menu while the SRAM was being written.)

Maybe, the last 3 saves can be preserved to the SD card this way if the latest save is corrupted you could recover from one of the older.

User avatar
bootsector
Posts: 61
Joined: Sun May 24, 2020 6:58 pm

Re: Autosave

Unread post by bootsector »

What I do here so I never have issues with lost/corrupted saves:

- Make sure autosave is ON in cores
- Wnen finish playing and saving in-game, open OSD then perform a cold reboot (select reboot option, keeping it pressed)
- Turn MiSTer off

Performing a cold reboot ensures (save) file buffers are flushed to SD card.

User avatar
MottZilla
Posts: 21
Joined: Mon May 25, 2020 6:36 am

Re: Autosave

Unread post by MottZilla »

NES is the primary system where battery backed SRAM also gets used for general expansion RAM. SNES already has a very large amount of RAM so the relatively small amount in a cartridge would be unlikely to be used for anything other than data backup. However it's possible a hack could steal some unused portion for this purpose so I wouldn't rule it out.

Genesis is in the same boat as the SNES, very little is added and the base system has far more so it seems unlikely to be used for other purposes.

MVS/AES is probably well behaved but I am not sure.

Compiling a list is a good idea.

Optiroc
Posts: 9
Joined: Sun May 24, 2020 7:29 pm

Re: Autosave

Unread post by Optiroc »

SNES hacks commonly use cartridge RAM as scratchpad, especially for custom text rendering in translation hacks.

bry111
Posts: 7
Joined: Tue Jul 21, 2020 12:31 am

Re: Autosave

Unread post by bry111 »

There are definitely SNES games that cartridge SRAM as work RAM. At least a few special chip games.

SD2SNES / FXPak Pro explicitly checksums ROMS (since firmware 1.9.0) to detect whether it's known to use part of its SRAM as work RAM, and if so only checks for changes to a game-specific subset of SRAM to determine whether there are changes worth saving.

The current list of games it checks for (across various revisions/regions, even a couple translation hacks) is
  • Yoshi's Island
  • Super Mario RPG
  • Kirby Super Star
  • Kirby's Dreamland 3
  • Marvelous
It's not ideal to have game-specific handling, but maybe they figured it would be only a little extra work to reduce SD card wear for some fairly popular games.

retrorepair
Posts: 108
Joined: Sun May 24, 2020 9:06 pm

Re: Autosave

Unread post by retrorepair »

I may work on a list then. It will likely require a fair bit of testing so may take a while.

If I can find the time, I will also add the exact memory vector to be used only for save for these games, if possible.

My bet is though that these exceptions will be in the vast minority.

jlancaster86
Posts: 1
Joined: Sat Jun 27, 2020 1:33 pm

Re: Autosave

Unread post by jlancaster86 »

If it does come down to adding game-specific overrides, maybe it would be best to keep those contained in an XML file (or even a basic text file listing file hashes) to prevent the overrides from having to be coded into the cores themselves.

Post Reply