diff options
| author | MerryMage <MerryMage@users.noreply.github.com> | 2017-05-13 15:55:26 +0100 |
|---|---|---|
| committer | MerryMage <MerryMage@users.noreply.github.com> | 2017-06-03 18:11:55 +0100 |
| commit | 827972b810b474eb501a3b4c74c8cbd8a82eac6f (patch) | |
| tree | 1701f82c8b1191c3a6f7a5369c14b61758863b07 /Source/Core | |
| parent | 5d6074f157b48f39a9cd65c6a757d84022b44857 (diff) | |
Config: Extract ConfigLocation
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | Source/Core/Core/Config/Config.cpp | 25 | ||||
| -rw-r--r-- | Source/Core/Core/Config/Config.h | 21 | ||||
| -rw-r--r-- | Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp | 17 | ||||
| -rw-r--r-- | Source/Core/Core/Core.vcxproj | 12 | ||||
| -rw-r--r-- | Source/Core/Core/Core.vcxproj.filters | 2 |
6 files changed, 64 insertions, 14 deletions
diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 2712a9f951..5caf9dc882 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -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 diff --git a/Source/Core/Core/Config/Config.cpp b/Source/Core/Core/Config/Config.cpp new file mode 100644 index 0000000000..9814199304 --- /dev/null +++ b/Source/Core/Core/Config/Config.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 diff --git a/Source/Core/Core/Config/Config.h b/Source/Core/Core/Config/Config.h new file mode 100644 index 0000000000..c3cbba3666 --- /dev/null +++ b/Source/Core/Core/Config/Config.h @@ -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 diff --git a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp index ecf19eecbb..56aa711b59 100644 --- a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp @@ -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"}}, diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index a13c4ea09c..615d2c7857 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -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" /> diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index 8dee1673d1..f390cd99b3 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -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" /> |
