From f3b52c07d74d528a81c818d86c12981a6028f351 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 30 Oct 2017 17:15:21 +0000 Subject: [PATCH] CommandLineParser: Use ConfigLocation --- Source/Core/UICommon/CommandLineParse.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index d76a2052c4..cf47bd8a5c 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -10,7 +10,9 @@ #include #include "Common/Config/Config.h" +#include "Common/StringUtil.h" #include "Common/Version.h" +#include "Core/Config/MainSettings.h" #include "UICommon/CommandLineParse.h" namespace CommandLineParse @@ -23,22 +25,23 @@ public: : ConfigLayerLoader(Config::LayerType::CommandLine) { if (video_backend.size()) - m_values.emplace_back(std::make_tuple("Dolphin", "Core", "GFXBackend", video_backend)); + m_values.emplace_back(std::make_tuple(Config::MAIN_GFX_BACKEND.location, video_backend)); if (audio_backend.size()) m_values.emplace_back( - std::make_tuple("Dolphin", "Core", "DSPHLE", audio_backend == "HLE" ? "True" : "False")); + std::make_tuple(Config::MAIN_DSP_HLE.location, StringFromBool(audio_backend == "HLE"))); // Arguments are in the format of .
.=Value for (const auto& arg : args) { std::istringstream buffer(arg); - std::string system, section, key, value; - std::getline(buffer, system, '.'); + std::string system_str, section, key, value; + std::getline(buffer, system_str, '.'); std::getline(buffer, section, '.'); std::getline(buffer, key, '='); std::getline(buffer, value, '='); - m_values.emplace_back(std::make_tuple(system, section, key, value)); + Config::System system = Config::GetSystemFromName(system_str); + m_values.emplace_back(std::make_tuple(Config::ConfigLocation{system, section, key}, value)); } } @@ -46,9 +49,10 @@ public: { for (auto& value : m_values) { - Config::Section* section = config_layer->GetOrCreateSection( - Config::GetSystemFromName(std::get<0>(value)), std::get<1>(value)); - section->Set(std::get<2>(value), std::get<3>(value)); + const Config::ConfigLocation location = std::get<0>(value); + Config::Section* section = + config_layer->GetOrCreateSection(location.system, location.section); + section->Set(location.key, std::get<1>(value)); } } @@ -58,7 +62,7 @@ public: } private: - std::list> m_values; + std::list> m_values; }; std::unique_ptr CreateParser(ParserOptions options)