summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/frontend/mame/mameopts.cpp10
-rw-r--r--src/lib/util/options.cpp9
-rw-r--r--src/lib/util/options.h2
3 files changed, 13 insertions, 8 deletions
diff --git a/src/frontend/mame/mameopts.cpp b/src/frontend/mame/mameopts.cpp
index e3aed3d751e..10f8a50ce3a 100644
--- a/src/frontend/mame/mameopts.cpp
+++ b/src/frontend/mame/mameopts.cpp
@@ -220,18 +220,22 @@ bool mame_options::parse_command_line(emu_options &options, std::vector<std::str
auto value_specifier = [&softlist_opts, &args, &error_string](emu_options &options, const std::string &arg)
{
// first find within the command line
- std::string arg_value = options.pluck_from_command_line(args, arg);
+ std::string arg_value;
+ bool success = options.pluck_from_command_line(args, arg, arg_value);
// next try to find within softlist-specified options
- if (arg_value.empty())
+ if (!success)
{
auto iter = softlist_opts.find(arg);
if (iter != softlist_opts.end())
+ {
arg_value = iter->second;
+ success = true;
+ }
}
// did we find something?
- if (!arg_value.empty())
+ if (success)
options.set_value(arg.c_str(), arg_value.c_str(), OPTION_PRIORITY_MAXIMUM, error_string);
};
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp
index a7d59dee105..3f255188625 100644
--- a/src/lib/util/options.cpp
+++ b/src/lib/util/options.cpp
@@ -486,7 +486,7 @@ bool core_options::parse_ini_file(util::core_file &inifile, int priority, int ig
// value from within a command line
//-------------------------------------------------
-std::string core_options::pluck_from_command_line(std::vector<std::string> &args, const std::string &optionname)
+bool core_options::pluck_from_command_line(std::vector<std::string> &args, const std::string &optionname, std::string &result)
{
// find this entry within the options (it is illegal to call this with a non-existant option
// so we assert if not present)
@@ -504,7 +504,6 @@ std::string core_options::pluck_from_command_line(std::vector<std::string> &args
}
// find each of the targets in the argv array
- std::string result;
for (int i = 1; i < args.size() - 1; i++)
{
auto const iter = std::find_if(
@@ -519,10 +518,12 @@ std::string core_options::pluck_from_command_line(std::vector<std::string> &args
// remove this arguments from the list
auto const pos = std::next(args.begin(), i);
args.erase(pos, std::next(pos, 2));
- break;
+ return true;
}
}
- return result;
+
+ result.clear();
+ return false;
}
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index ccbb24b1225..b8a8aa8f9c8 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -149,7 +149,7 @@ public:
// parsing/input
bool parse_command_line(std::vector<std::string> &args, int priority, std::string &error_string);
bool parse_ini_file(util::core_file &inifile, int priority, int ignore_priority, std::string &error_string);
- std::string pluck_from_command_line(std::vector<std::string> &args, const std::string &name);
+ bool pluck_from_command_line(std::vector<std::string> &args, const std::string &name, std::string &result);
// reverting
void revert(int priority_hi = OPTION_PRIORITY_MAXIMUM, int priority_lo = OPTION_PRIORITY_DEFAULT);