diff options
author | Eugene Sandulenko | 2019-08-26 21:31:35 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:35 +0200 |
commit | abbe16bf011739fae32d0fd9f23d551d20f472c7 (patch) | |
tree | 3310ca757264399e3ee40f13eceab513edc1c7b4 /engines | |
parent | 32969d3d7e3ead8f86cdb6028b109abdcefa4591 (diff) | |
download | scummvm-rg350-abbe16bf011739fae32d0fd9f23d551d20f472c7.tar.gz scummvm-rg350-abbe16bf011739fae32d0fd9f23d551d20f472c7.tar.bz2 scummvm-rg350-abbe16bf011739fae32d0fd9f23d551d20f472c7.zip |
HDB: Do not write config on every launch
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/menu.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp index 33e07d59a1..8e20653cdf 100644 --- a/engines/hdb/menu.cpp +++ b/engines/hdb/menu.cpp @@ -310,22 +310,27 @@ bool Menu::init() { } void Menu::readConfig() { + bool needFlush = false; + if (ConfMan.hasKey(CONFIG_MSTONE7)) { g_hdb->setStarsMonkeystone7(ConfMan.getInt(CONFIG_MSTONE7)); } else { ConfMan.setInt(CONFIG_MSTONE7, STARS_MONKEYSTONE_7_FAKE); + needFlush = true; } if (ConfMan.hasKey(CONFIG_MSTONE14)) { g_hdb->setStarsMonkeystone14(ConfMan.getInt(CONFIG_MSTONE14)); } else { ConfMan.setInt(CONFIG_MSTONE14, STARS_MONKEYSTONE_14_FAKE); + needFlush = true; } if (ConfMan.hasKey(CONFIG_MSTONE21)) { g_hdb->setStarsMonkeystone21(ConfMan.getInt(CONFIG_MSTONE21)); } else { ConfMan.setInt(CONFIG_MSTONE21, STARS_MONKEYSTONE_21_FAKE); + needFlush = true; } if (ConfMan.hasKey(CONFIG_KEY_UP)) { @@ -333,6 +338,7 @@ void Menu::readConfig() { g_hdb->_input->assignKey(0, _keyAssignUp); } else { ConfMan.setInt(CONFIG_KEY_UP, _keyAssignUp); + needFlush = true; } if (ConfMan.hasKey(CONFIG_KEY_DOWN)) { @@ -340,6 +346,7 @@ void Menu::readConfig() { g_hdb->_input->assignKey(1, _keyAssignDown); } else { ConfMan.setInt(CONFIG_KEY_DOWN, _keyAssignDown); + needFlush = true; } if (ConfMan.hasKey(CONFIG_KEY_LEFT)) { @@ -347,6 +354,7 @@ void Menu::readConfig() { g_hdb->_input->assignKey(2, _keyAssignLeft); } else { ConfMan.setInt(CONFIG_KEY_LEFT, _keyAssignLeft); + needFlush = true; } if (ConfMan.hasKey(CONFIG_KEY_RIGHT)) { @@ -354,6 +362,7 @@ void Menu::readConfig() { g_hdb->_input->assignKey(3, _keyAssignRight); } else { ConfMan.setInt(CONFIG_KEY_RIGHT, _keyAssignRight); + needFlush = true; } if (ConfMan.hasKey(CONFIG_KEY_USE)) { @@ -361,6 +370,7 @@ void Menu::readConfig() { g_hdb->_input->assignKey(4, _keyAssignUse); } else { ConfMan.setInt(CONFIG_KEY_USE, _keyAssignUse); + needFlush = true; } if (ConfMan.hasKey(CONFIG_CHEAT)) { @@ -368,7 +378,8 @@ void Menu::readConfig() { debug("Cheating enabled"); } - ConfMan.flushToDisk(); + if (needFlush) + ConfMan.flushToDisk(); } void Menu::writeConfig() { |