View unanswered posts | View active topics It is currently Wed Apr 24, 2019 7:58 pm



This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Question about saving. 
Author Message
Reply with quote
Post Question about saving.
A few days ago I realized that bsnes does not write changes to a game's srm file until the game has been unloaded. If possible, I would like to recompile bsnes so that it writes changes to the file shortly after a game saves. I'm unsure of whether there is a technical reason for this behaviour, or if it's just a design preference.

After looking through the source a bit I found the function which saves the file; now I would like to modify the code which interprets the snes save call to include this, but I'm not sure how to find it.

Is it possible to do this, and if so, can someone point me in the right direction?


Wed Apr 08, 2009 6:02 pm
Reply with quote
Post 
Not a good idea to save on # of RAM writes, hard to say when a transmission finishes. I'd recommend doing it every few minutes or so.

src/ui_qt/main.cpp:Application::main:
Code:
...
  while(terminate == false) {
    ...

    //add this
    static time_t delta = time(0);
    if((int)(time(0) - delta) > 180) {  //save every 3 minutes
      //call Cartridge::save_ram()-like function
      //eg as in Cartridge::unload_normal()
      //won't work here since these functions are private
      //if(cart.ram) save_file(get_filename(cart.filename, "srm", snes.config.path.save), cart.ram, cart.ram_size);
      delta = time(0);
    }

    supressScreenSaver();
  }


Since it's requested, I'll add it in a future release.


Wed Apr 08, 2009 6:56 pm
Lurker

Joined: Tue Apr 10, 2007 4:30 pm
Posts: 152
Location: Sweden
Reply with quote
Post 
Doesn't most emulators just save after a certain period of save memory inactivity?
If the game hasn't written to the save area in a sec, it is most definitely done writing to it.


Thu Apr 09, 2009 9:20 am
Profile WWW
Reply with quote
Post 
That works, thanks byuu! :)


Thu Apr 09, 2009 7:43 pm
"God"

Joined: Tue Jul 27, 2004 11:24 pm
Posts: 1128
Reply with quote
Post 
do you have to explicitly flush memory mapped files?

_________________
Does [Kevin] Smith masturbate with steel wool too?

- Yes, but don’t change the subject.


Fri Apr 10, 2009 8:10 am
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.