From a400c011a96197281e205d265c267ecd915fb597 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 7 May 2017 14:40:12 +1000 Subject: 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. --- src/frontend/mame/ui/submenu.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/frontend/mame/ui/submenu.cpp') 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), -- cgit v1.2.3