diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 5caf9dc882..e5ba06faac 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -28,6 +28,7 @@ set(SRCS Config/Config.cpp ConfigLoaders/BaseConfigLoader.cpp ConfigLoaders/GameConfigLoader.cpp + ConfigLoaders/IsSettingSaveable.cpp ConfigLoaders/MovieConfigLoader.cpp ConfigLoaders/NetPlayConfigLoader.cpp Debugger/Debugger_SymbolMap.cpp diff --git a/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp index 42f66de233..25cb3f358b 100644 --- a/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp @@ -16,6 +16,7 @@ #include "Core/Config/Config.h" #include "Core/ConfigLoaders/BaseConfigLoader.h" +#include "Core/ConfigLoaders/IsSettingSaveable.h" namespace ConfigLoaders { @@ -80,7 +81,12 @@ public: IniFile::Section* ini_section = ini.GetOrCreateSection(section_name); for (const auto& value : section_values) + { + if (!IsSettingSaveable({system.first, section->GetName(), value.first})) + continue; + ini_section->Set(value.first, value.second); + } } ini.Save(File::GetUserPath(mapping->second)); diff --git a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp index 56aa711b59..05544c303a 100644 --- a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp @@ -20,6 +20,7 @@ #include "Core/Config/Config.h" #include "Core/ConfigLoaders/GameConfigLoader.h" +#include "Core/ConfigLoaders/IsSettingSaveable.h" namespace ConfigLoaders { @@ -382,6 +383,9 @@ void INIGameConfigLayerLoader::Save(Config::Layer* config_layer) { for (const auto& value : section->GetValues()) { + if (!IsSettingSaveable({system.first, section->GetName(), value.first})) + continue; + const auto ini_location = GetINILocationFromConfig({system.first, section->GetName(), value.first}); if (ini_location.first.empty() && ini_location.second.empty()) diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp new file mode 100644 index 0000000000..1cd3da88d2 --- /dev/null +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -0,0 +1,20 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include +#include + +#include "Core/Config/Config.h" +#include "Core/ConfigLoaders/IsSettingSaveable.h" + +namespace ConfigLoaders +{ +const static std::vector s_setting_saveable{}; + +bool IsSettingSaveable(const Config::ConfigLocation& config_location) +{ + return std::find(s_setting_saveable.begin(), s_setting_saveable.end(), config_location) != + s_setting_saveable.end(); +} +} // namespace ConfigLoader diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.h b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.h new file mode 100644 index 0000000000..86a7939c5d --- /dev/null +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.h @@ -0,0 +1,18 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +namespace Config +{ +struct ConfigLocation; +} + +namespace ConfigLoaders +{ +// This is a temporary function that allows for both the new and old configuration +// systems to co-exist without trampling on each other while saving. +// This function shall be removed when the old configuration system retires. +bool IsSettingSaveable(const Config::ConfigLocation& config_location); +} // namespace ConfigLoader diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index 615d2c7857..d1c648a78d 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -59,6 +59,7 @@ + @@ -311,6 +312,7 @@ + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index f390cd99b3..8f9a620aa8 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -853,6 +853,9 @@ ConfigLoader + + ConfigLoader + @@ -1488,6 +1491,9 @@ ConfigLoader + + ConfigLoader +