ConfigLoaders: Temporarily not save all settings

This commit is contained in:
MerryMage 2017-05-13 15:59:20 +01:00
parent b3197d8dce
commit 57264022ce
7 changed files with 57 additions and 0 deletions

View File

@ -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

View File

@ -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));

View File

@ -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())

View File

@ -0,0 +1,20 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <algorithm>
#include <vector>
#include "Core/Config/Config.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h"
namespace ConfigLoaders
{
const static std::vector<Config::ConfigLocation> 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

View File

@ -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

View File

@ -59,6 +59,7 @@
<ClCompile Include="Config\Config.cpp" />
<ClCompile Include="ConfigLoaders\BaseConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\GameConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\IsSettingSaveable.cpp" />
<ClCompile Include="ConfigLoaders\MovieConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\NetPlayConfigLoader.cpp" />
<ClCompile Include="ConfigManager.cpp" />
@ -311,6 +312,7 @@
<ClInclude Include="Config\Config.h" />
<ClInclude Include="ConfigLoaders\BaseConfigLoader.h" />
<ClInclude Include="ConfigLoaders\GameConfigLoader.h" />
<ClInclude Include="ConfigLoaders\IsSettingSaveable.h" />
<ClInclude Include="ConfigLoaders\MovieConfigLoader.h" />
<ClInclude Include="ConfigLoaders\NetPlayConfigLoader.h" />
<ClInclude Include="ConfigManager.h" />

View File

@ -853,6 +853,9 @@
<ClCompile Include="ConfigLoaders\NetPlayConfigLoader.cpp">
<Filter>ConfigLoader</Filter>
</ClCompile>
<ClCompile Include="ConfigLoaders\IsSettingSaveable.cpp">
<Filter>ConfigLoader</Filter>
</ClCompile>
<ClCompile Include="Config\Config.cpp" />
</ItemGroup>
<ItemGroup>
@ -1488,6 +1491,9 @@
<Filter>ConfigLoader</Filter>
</ClInclude>
<ClInclude Include="Config\Config.h" />
<ClInclude Include="ConfigLoaders\IsSettingSaveable.h">
<Filter>ConfigLoader</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />