Config: Extract ConfigLocation
This commit is contained in:
parent
5d6074f157
commit
827972b810
|
@ -25,6 +25,7 @@ set(SRCS
|
||||||
Boot/Boot_ELF.cpp
|
Boot/Boot_ELF.cpp
|
||||||
Boot/Boot_WiiWAD.cpp
|
Boot/Boot_WiiWAD.cpp
|
||||||
Boot/ElfReader.cpp
|
Boot/ElfReader.cpp
|
||||||
|
Config/Config.cpp
|
||||||
ConfigLoaders/BaseConfigLoader.cpp
|
ConfigLoaders/BaseConfigLoader.cpp
|
||||||
ConfigLoaders/GameConfigLoader.cpp
|
ConfigLoaders/GameConfigLoader.cpp
|
||||||
ConfigLoaders/MovieConfigLoader.cpp
|
ConfigLoaders/MovieConfigLoader.cpp
|
||||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -18,10 +18,13 @@
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
|
#include "Core/Config/Config.h"
|
||||||
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
||||||
|
|
||||||
namespace ConfigLoaders
|
namespace ConfigLoaders
|
||||||
{
|
{
|
||||||
|
using ConfigLocation = Config::ConfigLocation;
|
||||||
|
|
||||||
// Returns all possible filenames in ascending order of priority
|
// Returns all possible filenames in ascending order of priority
|
||||||
static std::vector<std::string> GetGameIniFilenames(const std::string& id, u16 revision)
|
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;
|
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 = {
|
static std::map<std::pair<std::string, std::string>, ConfigLocation> ini_to_location = {
|
||||||
// Core
|
// Core
|
||||||
{{"Core", "CPUThread"}, {Config::System::Main, "Core", "CPUThread"}},
|
{{"Core", "CPUThread"}, {Config::System::Main, "Core", "CPUThread"}},
|
||||||
|
|
|
@ -35,6 +35,16 @@
|
||||||
<Import Project="..\..\VSProps\PCHUse.props" />
|
<Import Project="..\..\VSProps\PCHUse.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<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>
|
<ItemGroup>
|
||||||
<ClCompile Include="ActionReplay.cpp" />
|
<ClCompile Include="ActionReplay.cpp" />
|
||||||
<ClCompile Include="Analytics.cpp" />
|
<ClCompile Include="Analytics.cpp" />
|
||||||
|
@ -46,6 +56,7 @@
|
||||||
<ClCompile Include="Boot\Boot_ELF.cpp" />
|
<ClCompile Include="Boot\Boot_ELF.cpp" />
|
||||||
<ClCompile Include="Boot\Boot_WiiWAD.cpp" />
|
<ClCompile Include="Boot\Boot_WiiWAD.cpp" />
|
||||||
<ClCompile Include="Boot\ElfReader.cpp" />
|
<ClCompile Include="Boot\ElfReader.cpp" />
|
||||||
|
<ClCompile Include="Config\Config.cpp" />
|
||||||
<ClCompile Include="ConfigLoaders\BaseConfigLoader.cpp" />
|
<ClCompile Include="ConfigLoaders\BaseConfigLoader.cpp" />
|
||||||
<ClCompile Include="ConfigLoaders\GameConfigLoader.cpp" />
|
<ClCompile Include="ConfigLoaders\GameConfigLoader.cpp" />
|
||||||
<ClCompile Include="ConfigLoaders\MovieConfigLoader.cpp" />
|
<ClCompile Include="ConfigLoaders\MovieConfigLoader.cpp" />
|
||||||
|
@ -297,6 +308,7 @@
|
||||||
<ClInclude Include="Boot\Boot_DOL.h" />
|
<ClInclude Include="Boot\Boot_DOL.h" />
|
||||||
<ClInclude Include="Boot\ElfReader.h" />
|
<ClInclude Include="Boot\ElfReader.h" />
|
||||||
<ClInclude Include="Boot\ElfTypes.h" />
|
<ClInclude Include="Boot\ElfTypes.h" />
|
||||||
|
<ClInclude Include="Config\Config.h" />
|
||||||
<ClInclude Include="ConfigLoaders\BaseConfigLoader.h" />
|
<ClInclude Include="ConfigLoaders\BaseConfigLoader.h" />
|
||||||
<ClInclude Include="ConfigLoaders\GameConfigLoader.h" />
|
<ClInclude Include="ConfigLoaders\GameConfigLoader.h" />
|
||||||
<ClInclude Include="ConfigLoaders\MovieConfigLoader.h" />
|
<ClInclude Include="ConfigLoaders\MovieConfigLoader.h" />
|
||||||
|
|
|
@ -853,6 +853,7 @@
|
||||||
<ClCompile Include="ConfigLoaders\NetPlayConfigLoader.cpp">
|
<ClCompile Include="ConfigLoaders\NetPlayConfigLoader.cpp">
|
||||||
<Filter>ConfigLoader</Filter>
|
<Filter>ConfigLoader</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Config\Config.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="BootManager.h" />
|
<ClInclude Include="BootManager.h" />
|
||||||
|
@ -1486,6 +1487,7 @@
|
||||||
<ClInclude Include="ConfigLoaders\NetPlayConfigLoader.h">
|
<ClInclude Include="ConfigLoaders\NetPlayConfigLoader.h">
|
||||||
<Filter>ConfigLoader</Filter>
|
<Filter>ConfigLoader</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Config\Config.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="CMakeLists.txt" />
|
<Text Include="CMakeLists.txt" />
|
||||||
|
|
Loading…
Reference in New Issue