mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 15:31:17 +01:00
CommandLineParser: Use ConfigLocation
This commit is contained in:
parent
e331a76176
commit
f3b52c07d7
@ -10,7 +10,9 @@
|
|||||||
#include <OptionParser.h>
|
#include <OptionParser.h>
|
||||||
|
|
||||||
#include "Common/Config/Config.h"
|
#include "Common/Config/Config.h"
|
||||||
|
#include "Common/StringUtil.h"
|
||||||
#include "Common/Version.h"
|
#include "Common/Version.h"
|
||||||
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "UICommon/CommandLineParse.h"
|
#include "UICommon/CommandLineParse.h"
|
||||||
|
|
||||||
namespace CommandLineParse
|
namespace CommandLineParse
|
||||||
@ -23,22 +25,23 @@ public:
|
|||||||
: ConfigLayerLoader(Config::LayerType::CommandLine)
|
: ConfigLayerLoader(Config::LayerType::CommandLine)
|
||||||
{
|
{
|
||||||
if (video_backend.size())
|
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())
|
if (audio_backend.size())
|
||||||
m_values.emplace_back(
|
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 <System>.<Section>.<Key>=Value
|
// Arguments are in the format of <System>.<Section>.<Key>=Value
|
||||||
for (const auto& arg : args)
|
for (const auto& arg : args)
|
||||||
{
|
{
|
||||||
std::istringstream buffer(arg);
|
std::istringstream buffer(arg);
|
||||||
std::string system, section, key, value;
|
std::string system_str, section, key, value;
|
||||||
std::getline(buffer, system, '.');
|
std::getline(buffer, system_str, '.');
|
||||||
std::getline(buffer, section, '.');
|
std::getline(buffer, section, '.');
|
||||||
std::getline(buffer, key, '=');
|
std::getline(buffer, key, '=');
|
||||||
std::getline(buffer, value, '=');
|
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)
|
for (auto& value : m_values)
|
||||||
{
|
{
|
||||||
Config::Section* section = config_layer->GetOrCreateSection(
|
const Config::ConfigLocation location = std::get<0>(value);
|
||||||
Config::GetSystemFromName(std::get<0>(value)), std::get<1>(value));
|
Config::Section* section =
|
||||||
section->Set(std::get<2>(value), std::get<3>(value));
|
config_layer->GetOrCreateSection(location.system, location.section);
|
||||||
|
section->Set(location.key, std::get<1>(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +62,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<std::tuple<std::string, std::string, std::string, std::string>> m_values;
|
std::list<std::tuple<Config::ConfigLocation, std::string>> m_values;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<optparse::OptionParser> CreateParser(ParserOptions options)
|
std::unique_ptr<optparse::OptionParser> CreateParser(ParserOptions options)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user