From 827972b810b474eb501a3b4c74c8cbd8a82eac6f Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 13 May 2017 15:55:26 +0100 Subject: [PATCH] Config: Extract ConfigLocation --- Source/Core/Core/CMakeLists.txt | 1 + Source/Core/Core/Config/Config.cpp | 25 +++++++++++++++++++ Source/Core/Core/Config/Config.h | 21 ++++++++++++++++ .../Core/ConfigLoaders/GameConfigLoader.cpp | 17 +++---------- Source/Core/Core/Core.vcxproj | 12 +++++++++ Source/Core/Core/Core.vcxproj.filters | 2 ++ 6 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 Source/Core/Core/Config/Config.cpp create mode 100644 Source/Core/Core/Config/Config.h 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 + +#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 + +#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 GetGameIniFilenames(const std::string& id, u16 revision) { @@ -40,20 +43,6 @@ static std::vector 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, 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 @@ + + + $(IntDir)/%(RelativeDir)/ + + + + + $(IntDir)/%(RelativeDir)/ + + @@ -46,6 +56,7 @@ + @@ -297,6 +308,7 @@ + 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 @@ ConfigLoader + @@ -1486,6 +1487,7 @@ ConfigLoader +