taisel / GameBoy-Online

JavaScript GameBoy Color emulator.
http://taisel.github.io/GameBoy-Online/
592 stars 174 forks source link

Auto-save the game before pause. #4

Closed jbmorley closed 8 years ago

jbmorley commented 8 years ago

Another small one. Like start, pause now auto-saves.

taisel commented 8 years ago

This isn't necessary, except for multi-threaded emulation and for browsers that misbehave on page unload (looking at you older versions of Opera). IIRC it used to save on page unload and/or when switching the ROM. That being said, it should be save as early as possible when given the chance in case of a user unexpectedly closing their browser by force.

That being said, saving on pause is done in IodineGBA to work around issues I cannot recall at the moment, and the two projects should be merged in user behavior.

jbmorley commented 8 years ago

@taisel Thanks!

As you say, this is mostly to work around badly behaving browsers: I've been unable to find a working background notification when you're a standalone 'web app' in iOS :(.

taisel commented 8 years ago

https://github.com/taisel/GameBoy-Online/blob/master/js/other/gui.js#L320 being the unload handler for autoSave.

jbmorley commented 8 years ago

Interesting. I'll see if that works on iOS standalone... thanks.