Config: Extract ConfigLocation

This commit is contained in:
MerryMage 2017-05-13 15:55:26 +01:00
parent 5d6074f157
commit 827972b810
6 changed files with 64 additions and 14 deletions

View File

@ -25,6 +25,7 @@ set(SRCS
Boot/Boot_ELF.cpp
Boot/Boot_WiiWAD.cpp
Boot/ElfReader.cpp
Config/Config.cpp
ConfigLoaders/BaseConfigLoader.cpp
ConfigLoaders/GameConfigLoader.cpp
ConfigLoaders/MovieConfigLoader.cpp

View File

@ -0,0 +1,25 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <tuple>
#include "Core/Config/Config.h"
namespace Config
{
bool ConfigLocation::operator==(const ConfigLocation& other) const
{
return std::tie(system, section, key) == std::tie(other.system, other.section, other.key);
}
bool ConfigLocation::operator!=(const ConfigLocation& other) const
{
return !(*this == other);
}
bool ConfigLocation::operator<(const ConfigLocation& other) const
{
return std::tie(system, section, key) < std::tie(other.system, other.section, other.key);
}
} // namespace Config

View File

@ -0,0 +1,21 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <string>
#include "Common/Config/Enums.h"
namespace Config
{
struct ConfigLocation
{
System system;
std::string section;
std::string key;
bool operator==(const ConfigLocation& other) const;
bool operator!=(const ConfigLocation& other) const;
bool operator<(const ConfigLocation& other) const;
};
} // namespace Config

View File

@ -18,10 +18,13 @@
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Core/Config/Config.h"
#include "Core/ConfigLoaders/GameConfigLoader.h"
namespace ConfigLoaders
{
using ConfigLocation = Config::ConfigLocation;
// Returns all possible filenames in ascending order of priority
static std::vector<std::string> GetGameIniFilenames(const std::string& id, u16 revision)
{
@ -40,20 +43,6 @@ static std::vector<std::string> GetGameIniFilenames(const std::string& id, u16 r
return filenames;
}
struct ConfigLocation
{
Config::System system;
std::string section;
std::string key;
bool operator==(const ConfigLocation& other) const
{
return std::tie(system, section, key) == std::tie(other.system, other.section, other.key);
}
bool operator!=(const ConfigLocation& other) const { return !operator==(other); }
};
static std::map<std::pair<std::string, std::string>, ConfigLocation> ini_to_location = {
// Core
{{"Core", "CPUThread"}, {Config::System::Main, "Core", "CPUThread"}},

View File

@ -35,6 +35,16 @@
<Import Project="..\..\VSProps\PCHUse.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ActionReplay.cpp" />
<ClCompile Include="Analytics.cpp" />
@ -46,6 +56,7 @@
<ClCompile Include="Boot\Boot_ELF.cpp" />
<ClCompile Include="Boot\Boot_WiiWAD.cpp" />
<ClCompile Include="Boot\ElfReader.cpp" />
<ClCompile Include="Config\Config.cpp" />
<ClCompile Include="ConfigLoaders\BaseConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\GameConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\MovieConfigLoader.cpp" />
@ -297,6 +308,7 @@
<ClInclude Include="Boot\Boot_DOL.h" />
<ClInclude Include="Boot\ElfReader.h" />
<ClInclude Include="Boot\ElfTypes.h" />
<ClInclude Include="Config\Config.h" />
<ClInclude Include="ConfigLoaders\BaseConfigLoader.h" />
<ClInclude Include="ConfigLoaders\GameConfigLoader.h" />
<ClInclude Include="ConfigLoaders\MovieConfigLoader.h" />

View File

@ -853,6 +853,7 @@
<ClCompile Include="ConfigLoaders\NetPlayConfigLoader.cpp">
<Filter>ConfigLoader</Filter>
</ClCompile>
<ClCompile Include="Config\Config.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="BootManager.h" />
@ -1486,6 +1487,7 @@
<ClInclude Include="ConfigLoaders\NetPlayConfigLoader.h">
<Filter>ConfigLoader</Filter>
</ClInclude>
<ClInclude Include="Config\Config.h" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />