MiSTer-devel / NES_MiSTer

GNU General Public License v3.0
174 stars 75 forks source link

How does autosave decide which games to run on? #361

Closed Davey-Hughes closed 1 year ago

Davey-Hughes commented 1 year ago

My main goal is to get autosaving working on the Super Mario Bros. Practice Rom. Autosave on this core works in the games that you'd expect (Zelda 1 & 2, Metroid FDS, etc), however autosave does not work in the SMB Practice Rom. If I turn off autosave and manually save backup RAM, then the RAM is saved and that .sav file is automatically loaded.

Another romhack on the SMB 1 ROM, Super Mario Unlimited, does autosave properly. However the biggest difference between the games that do autosave properly and the SMB Practice Rom is the former have actual save game slots (a la Zelda 1), whereas the SMB Practice Rom just persists some values like settings and level records. Any ideas? Or is there somewhere I can manually configure the core to autosave on certain ROMs?

Kitrinx commented 1 year ago

Autosave uses the NES header to determine if the game saves or not, then watches for writes to the save ram area to determine if a save has been written or not.

Davey-Hughes commented 1 year ago

That makes sense. I tried reading on the NES 2.0 header spec for info but I'm still not sure where the relevant part is. Could you point me to what part of the header I might have to modify to indicate that the game has "saves"?

EDIT: Oh is it the "battery" and other non-volatile memory present flag?

Davey-Hughes commented 1 year ago

Ah that indeed was it. I figured it must be something with the header but I guess my reading comprehension before making this issue wasn't good enough. Thanks for the help and hopefully this resolved issue can help others in the future.

Davey-Hughes commented 1 year ago

Interestingly, I think the SMB practice ROM sets this byte, but I guess in the patched ROM I made it wasn't set.