Revert "Remove R77 save logic, make most R77 settings temporary ot exclude them from persistence."

This reverts commit 51f38840e0.
This commit is contained in:
Christian Speckner 2019-05-02 01:10:43 +02:00
parent 882b5a1288
commit ff8b9b41d4
3 changed files with 52 additions and 24 deletions

View File

@ -608,12 +608,10 @@ void Settings::setValue(const string& key, const Variant& value)
void Settings::setPermanent(const string& key, const Variant& value)
{
myPermanentSettings[key] = value;
myTemporarySettings.erase(key);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Settings::setTemporary(const string& key, const Variant& value)
{
myTemporarySettings[key] = value;
myPermanentSettings.erase(key);
}

View File

@ -29,42 +29,42 @@
SettingsR77::SettingsR77()
: Settings()
{
setTemporary("video", "opengles2");
setTemporary("vsync", "true");
setPermanent("video", "opengles2");
setPermanent("vsync", "true");
setTemporary("tia.zoom", "3");
setTemporary("tia.fs_stretch", "false"); // start in 4:3 by default
setPermanent("tia.zoom", "3");
setPermanent("tia.fs_stretch", "false"); // start in 4:3 by default
setTemporary("audio.buffer_size", "6");
setPermanent("audio.buffer_size", "6");
setPermanent("audio.enabled", "1");
setTemporary("audio.fragment_size", "512");
setTemporary("audio.headroom", "5");
setTemporary("audio.preset", "1");
setTemporary("audio.resampling_quality", "2");
setTemporary("audio.sample_rate", "48000");
setPermanent("audio.fragment_size", "512");
setPermanent("audio.headroom", "5");
setPermanent("audio.preset", "1");
setPermanent("audio.resampling_quality", "2");
setPermanent("audio.sample_rate", "48000");
setPermanent("audio.stereo", "0");
setPermanent("audio.volume", "100");
setTemporary("romdir", "/mnt/games");
setTemporary("snapsavedir", "/mnt/stella/snapshots");
setTemporary("snaploaddir", "/mnt/stella/snapshots");
setPermanent("romdir", "/mnt/games");
setPermanent("snapsavedir", "/mnt/stella/snapshots");
setPermanent("snaploaddir", "/mnt/stella/snapshots");
setTemporary("launcherres", "1280x720");
setTemporary("launcherfont", "large");
setTemporary("romviewer", "2");
setTemporary("exitlauncher", "true");
setPermanent("launcherres", "1280x720");
setPermanent("launcherfont", "large");
setPermanent("romviewer", "2");
setPermanent("exitlauncher", "true");
setTemporary("minimal_ui", true);
setTemporary("basic_settings", true);
setPermanent("basic_settings", true);
setPermanent("dev.settings", false);
// record states for 60 seconds
setPermanent("plr.timemachine", true);
setTemporary("plr.tm.size", 60);
setTemporary("plr.tm.uncompressed", 60);
setTemporary("plr.tm.interval", "1s");
setPermanent("plr.tm.size", 60);
setPermanent("plr.tm.uncompressed", 60);
setPermanent("plr.tm.interval", "1s");
setTemporary("threads", "1");
setPermanent("threads", "1");
// all TV effects off by default (aligned to StellaSettingsDialog defaults!)
setPermanent("tv.filter", "1"); // RGB
@ -72,3 +72,30 @@ SettingsR77::SettingsR77()
setPermanent("tv.phosblend", "45"); // level 6
setPermanent("tv.scanlines", "18"); // level 3
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SettingsR77::saveConfigFile(const string& cfgfile) const
{
// Almost no settings can be changed, so we completely disable saving
// most of them. This may also fix reported issues of the config file
// becoming corrupt.
//
// There are currently only a few settings that can be changed
// These will be expanded as more support is added
ofstream out(cfgfile);
if(!out || !out.is_open())
return false;
out << "fullscreen = " << getString("fullscreen") << endl;
out << "lastrom = " << getString("lastrom") << endl;
out << "tia.fs_stretch = " << getString("tia.fs_stretch") << endl;
// out << "keymap = " << getString("keymap") << endl;
// out << "joymap = " << getString("joymap") << endl;
out.flush();
out.close();
system("/bin/fsync /mnt/stella/stellarc&");
return true;
}

View File

@ -35,6 +35,9 @@ class SettingsR77 : public Settings
explicit SettingsR77();
virtual ~SettingsR77() = default;
protected:
bool saveConfigFile(const string& cfgfile) const;
private:
// Following constructors and assignment operators not supported
SettingsR77(const SettingsR77&) = delete;