diff --git a/Source/Core/DolphinQt/Config/GameConfigWidget.cpp b/Source/Core/DolphinQt/Config/GameConfigWidget.cpp index a702c90f84..3ab83c11ff 100644 --- a/Source/Core/DolphinQt/Config/GameConfigWidget.cpp +++ b/Source/Core/DolphinQt/Config/GameConfigWidget.cpp @@ -219,30 +219,19 @@ void GameConfigWidget::ConnectWidgets() } void GameConfigWidget::LoadCheckBox(QCheckBox* checkbox, const std::string& section, - const std::string& key) + const std::string& key, bool reverse) { bool checked; - if (key == "FastDiscSpeed") - { - if (m_gameini_local.GetOrCreateSection(section)->Get("FastDiscSpeed", &checked)) - return checkbox->setCheckState(!checked ? Qt::Checked : Qt::Unchecked); + if (m_gameini_local.GetOrCreateSection(section)->Get(key, &checked)) + return checkbox->setCheckState(checked ^ reverse ? Qt::Checked : Qt::Unchecked); - if (m_gameini_default.GetOrCreateSection(section)->Get("FastDiscSpeed", &checked)) - return checkbox->setCheckState(!checked ? Qt::Checked : Qt::Unchecked); - } - else - { - if (m_gameini_local.GetOrCreateSection(section)->Get(key, &checked)) - return checkbox->setCheckState(checked ? Qt::Checked : Qt::Unchecked); - - if (m_gameini_default.GetOrCreateSection(section)->Get(key, &checked)) - return checkbox->setCheckState(checked ? Qt::Checked : Qt::Unchecked); - } + if (m_gameini_default.GetOrCreateSection(section)->Get(key, &checked)) + return checkbox->setCheckState(checked ^ reverse ? Qt::Checked : Qt::Unchecked); checkbox->setCheckState(Qt::PartiallyChecked); } void GameConfigWidget::SaveCheckBox(QCheckBox* checkbox, const std::string& section, - const std::string& key) + const std::string& key, bool reverse) { // Delete any existing entries from the local gameini if checkbox is undetermined. // Otherwise, write the current value to the local gameini if the value differs from the default @@ -256,13 +245,7 @@ void GameConfigWidget::SaveCheckBox(QCheckBox* checkbox, const std::string& sect return; } - bool checked = checkbox->checkState() == Qt::Checked; - - if (key == "FastDiscSpeed") - { - m_gameini_local.GetOrCreateSection(section)->Set(key, !checked); - return; - } + bool checked = (checkbox->checkState() == Qt::Checked) ^ reverse; if (m_gameini_default.Exists(section, key)) { @@ -293,7 +276,7 @@ void GameConfigWidget::LoadSettings() LoadCheckBox(m_enable_mmu, "Core", "MMU"); LoadCheckBox(m_enable_fprf, "Core", "FPRF"); LoadCheckBox(m_sync_gpu, "Core", "SyncGPU"); - LoadCheckBox(m_enable_fast_disc, "Core", "FastDiscSpeed"); + LoadCheckBox(m_enable_fast_disc, "Core", "FastDiscSpeed", true); LoadCheckBox(m_use_dsp_hle, "Core", "DSPHLE"); std::string determinism_mode; @@ -343,7 +326,7 @@ void GameConfigWidget::SaveSettings() SaveCheckBox(m_enable_mmu, "Core", "MMU"); SaveCheckBox(m_enable_fprf, "Core", "FPRF"); SaveCheckBox(m_sync_gpu, "Core", "SyncGPU"); - SaveCheckBox(m_enable_fast_disc, "Core", "FastDiscSpeed"); + SaveCheckBox(m_enable_fast_disc, "Core", "FastDiscSpeed", true); SaveCheckBox(m_use_dsp_hle, "Core", "DSPHLE"); int determinism_num = m_deterministic_dual_core->currentIndex(); diff --git a/Source/Core/DolphinQt/Config/GameConfigWidget.h b/Source/Core/DolphinQt/Config/GameConfigWidget.h index 44ae2375f5..7eda19cdc5 100644 --- a/Source/Core/DolphinQt/Config/GameConfigWidget.h +++ b/Source/Core/DolphinQt/Config/GameConfigWidget.h @@ -35,8 +35,10 @@ private: void LoadSettings(); void SaveSettings(); - void SaveCheckBox(QCheckBox* checkbox, const std::string& section, const std::string& key); - void LoadCheckBox(QCheckBox* checkbox, const std::string& section, const std::string& key); + void SaveCheckBox(QCheckBox* checkbox, const std::string& section, const std::string& key, + bool reverse = false); + void LoadCheckBox(QCheckBox* checkbox, const std::string& section, const std::string& key, + bool reverse = false); QString m_gameini_sys_path; QString m_gameini_local_path;