summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/submenu.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-07 14:40:12 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-07 14:40:12 +1000
commita400c011a96197281e205d265c267ecd915fb597 (patch)
tree68bb8b132d9c8dea4e587c22db6b32c6ece08b73 /src/frontend/mame/ui/submenu.cpp
parent1970bcfab8103d41ce65bffa7933d19eda1f1b19 (diff)
Revert "Overhaul to how MAME handles options (#2260)"
This reverts commit 536990e77b49ccc50ef275bfbf1018cc29c16154. Conflicts: src/frontend/mame/mame.cpp Sorry, but this change was half-baked. It breaks a lot of existing functionality and clearly hasn't been tested in more than a tiny subset of use cases. Please play this work back onto your own branch, and test it before submitting another PR.
Diffstat (limited to 'src/frontend/mame/ui/submenu.cpp')
-rw-r--r--src/frontend/mame/ui/submenu.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp
index ab18a5a5a95..5a8cb83cd8b 100644
--- a/src/frontend/mame/ui/submenu.cpp
+++ b/src/frontend/mame/ui/submenu.cpp
@@ -240,7 +240,8 @@ void submenu::handle()
{
case OPTION_BOOLEAN:
changed = true;
- sm_option.options->set_value(sm_option.name, !strcmp(sm_option.entry->value(),"1") ? "0" : "1", OPTION_PRIORITY_CMDLINE);
+ sm_option.options->set_value(sm_option.name, !strcmp(sm_option.entry->value(),"1") ? "0" : "1", OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option.entry->mark_changed();
break;
case OPTION_INTEGER:
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
@@ -248,7 +249,8 @@ void submenu::handle()
changed = true;
int i_cur = atoi(sm_option.entry->value());
(menu_event->iptkey == IPT_UI_LEFT) ? i_cur-- : i_cur++;
- sm_option.options->set_value(sm_option.name, i_cur, OPTION_PRIORITY_CMDLINE);
+ sm_option.options->set_value(sm_option.name, i_cur, OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option.entry->mark_changed();
}
break;
case OPTION_FLOAT:
@@ -258,19 +260,17 @@ void submenu::handle()
f_cur = atof(sm_option.entry->value());
if (sm_option.entry->has_range())
{
- const char *minimum = sm_option.entry->minimum();
- const char *maximum = sm_option.entry->maximum();
- f_step = atof(minimum);
+ f_step = atof(sm_option.entry->minimum());
if (f_step <= 0.0f) {
- int pmin = getprecisionchr(minimum);
- int pmax = getprecisionchr(maximum);
+ int pmin = getprecisionchr(sm_option.entry->minimum());
+ int pmax = getprecisionchr(sm_option.entry->maximum());
tmptxt = '1' + std::string((pmin > pmax) ? pmin : pmax, '0');
f_step = 1 / atof(tmptxt.c_str());
}
}
else
{
- int precision = getprecisionchr(sm_option.entry->default_value().c_str());
+ int precision = getprecisionchr(sm_option.entry->default_value());
tmptxt = '1' + std::string(precision, '0');
f_step = 1 / atof(tmptxt.c_str());
}
@@ -279,7 +279,8 @@ void submenu::handle()
else
f_cur += f_step;
tmptxt = string_format("%g", f_cur);
- sm_option.options->set_value(sm_option.name, tmptxt.c_str(), OPTION_PRIORITY_CMDLINE);
+ sm_option.options->set_value(sm_option.name, tmptxt.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option.entry->mark_changed();
}
break;
case OPTION_STRING:
@@ -292,11 +293,10 @@ void submenu::handle()
v_cur = sm_option.value[--cur_value];
else
v_cur = sm_option.value[++cur_value];
- sm_option.options->set_value(sm_option.name, v_cur.c_str(), OPTION_PRIORITY_CMDLINE);
+ sm_option.options->set_value(sm_option.name, v_cur.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option.entry->mark_changed();
}
break;
- default:
- break;
}
break;
default:
@@ -391,7 +391,7 @@ void submenu::populate(float &customtop, float &custombottom)
break;
case OPTION_STRING:
{
- std::string v_cur(sm_option->entry->value());
+ std::string const v_cur(sm_option->entry->value());
int const cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
arrow_flags = get_arrow_flags(0, int(unsigned(sm_option->value.size() - 1)), cur_value);
item_append(_(sm_option->description),