TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.19k stars 384 forks source link

Feature - Autosave BizHawk settings option. #2455

Open dart193 opened 4 years ago

dart193 commented 4 years ago

It is completely fine that sometimes things do not go too well and BizHawk crashes for whatever reason. The problem is that unless you manually save settings or close BizHawk normally, all the settings that were changed are lost upon crash if you did not saved manually via config menu.

My suggestion is to add an option autosave settings option so that users who change settings frequently and are not very lucky with crashes do not have to worry about such issue.

nattthebear commented 4 years ago

Autosave every 5 minutes? Or maybe right after settings are changed? I think autosaving at the moment of the crash is right out -- I wouldn't want to assume anything is still functioning at that point.

This idea is kind of dangerous because the user could get into a non-viable config situation and then be completely screwed when that setting is saved. Of course, Bizhawk could also crash less, that would be nice.

YoshiRulz commented 2 years ago

How about when EmuHawk starts up successfully, it copies the config to config.known-good.json? Then we're free to autosave however frequently. To determine whether it's started up successfully, we could have something like this in MainForm:

Load += (_, _) =>
{
    if (RomPassedOnCLI || AutoloadRecentRomIsEnabled)
    {
        EmuClient.RomLoaded += () =>
        {
            Task.Run(() =>
            {
                await Task.Delay(TimeSpan.FromSeconds(3));
                BackupConfig();
            });
        };
    }
    else
    {
        Task.Run(() =>
        {
            await Task.Delay(TimeSpan.FromSeconds(3));
            BackupConfig();
        });
    }
};

Loading either NullHawk or the desired core, then waiting 3 s of realtime.