From ea4afbfc54319b6fb4d0f4546da048bf68bdad3b Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 9 May 2023 01:29:08 -0400 Subject: [PATCH] config: Don't merge the maps Me shooting myself in the foot 3 days in advance. --- src/yuzu/configuration/config.cpp | 19 ++++++++++--------- src/yuzu/configuration/config.h | 2 -- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 08aa20859..28c606f5e 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -19,10 +19,6 @@ namespace FS = Common::FS; Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type), global{config_type == ConfigType::GlobalConfig} { - - settings_map = Settings::values.linkage.by_category; - settings_map.merge(UISettings::values.linkage.by_category); - Initialize(config_name); } @@ -1311,14 +1307,22 @@ const std::string& Config::GetConfigFilePath() const { return qt_config_loc; } +static auto FindRelevantList(Settings::Category category) { + auto& map = Settings::values.linkage.by_category; + if (map.contains(category)) { + return Settings::values.linkage.by_category[category]; + } + return UISettings::values.linkage.by_category[category]; +} + void Config::ReadCategory(Settings::Category category) { - const auto& settings = settings_map[category]; + const auto& settings = FindRelevantList(category); std::for_each(settings.begin(), settings.end(), [&](const auto& setting) { ReadSettingGeneric(setting); }); } void Config::WriteCategory(Settings::Category category) { - const auto& settings = settings_map[category]; + const auto& settings = FindRelevantList(category); std::for_each(settings.begin(), settings.end(), [&](const auto& setting) { WriteSettingGeneric(setting); }); } @@ -1346,11 +1350,8 @@ void Config::ReadSettingGeneric(Settings::BasicSetting* const setting) { void Config::WriteSettingGeneric(Settings::BasicSetting* const setting) const { if (!setting->Save()) { - LOG_DEBUG(Frontend, "Skipping \"{}\" marked for not saving", setting->GetLabel()); return; } - LOG_DEBUG(Frontend, "Saving {} setting \"{}\"...", global ? "global" : "custom", - setting->GetLabel()); const QVariant value = QVariant::fromValue(QString::fromStdString(setting->ToString())); const QVariant default_value = QVariant::fromValue(QString::fromStdString(setting->DefaultToString())); diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index ec748bf0c..553a82295 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h @@ -204,8 +204,6 @@ private: void ReadSettingGeneric(Settings::BasicSetting* const setting); void WriteSettingGeneric(Settings::BasicSetting* const setting) const; - std::map> settings_map; - const ConfigType type; std::unique_ptr qt_config; std::string qt_config_loc;