summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-02-18 06:18:45 +1100
committer Vas Crabb <vas@vastheman.com>2023-02-18 06:18:45 +1100
commitd4589e0b29d6085072ff635d87c3d95c21813a58 (patch)
treec0d3283ecdd99bd380fc155f4e09b7f4bd573116 /src/frontend/mame/ui
parent20d7135179ffe9959f4bfb759a0e5735b7aaaf15 (diff)
Input refactoring:
osd/modules/input, emu/inpttype.cpp: Made most default joystick assignments supplied by input modules. Input modules take available controls into consideration when generating default assignments. emu/inpttype.ipp: Added a separate "Back" UI input separate from Cancel. You may want an easier to hit combination for moving to the previous menu than for exiting or cancelling input. They both default to Escape. emu/inpttype.ipp: Added a UI Help control. Currently only used by analog inputs menu emu/inpttype.h: Moved I/O port field type enum to its own header and sorted UI controls so they appear in a more logical order. ui: Don't use UI Select to restore defaults - people should be getting used to the UI Clear input by now. UI Select cycles multi-value items instead. ui/inputmap.cpp: Don't use immediate cancel to cycle between clearing and restoring default assignment (use UI Clear instead). osd: Reduced the number of files needing to include the dreaded emu.h. Got some implementation out of headers.
Diffstat (limited to 'src/frontend/mame/ui')
-rw-r--r--src/frontend/mame/ui/analogipt.cpp46
-rw-r--r--src/frontend/mame/ui/auditmenu.cpp8
-rw-r--r--src/frontend/mame/ui/auditmenu.h2
-rw-r--r--src/frontend/mame/ui/confswitch.cpp26
-rw-r--r--src/frontend/mame/ui/dirmenu.cpp2
-rw-r--r--src/frontend/mame/ui/filecreate.cpp35
-rw-r--r--src/frontend/mame/ui/filecreate.h1
-rw-r--r--src/frontend/mame/ui/filesel.h2
-rw-r--r--src/frontend/mame/ui/inputmap.cpp17
-rw-r--r--src/frontend/mame/ui/menu.cpp12
-rw-r--r--src/frontend/mame/ui/menu.h2
-rw-r--r--src/frontend/mame/ui/pluginopt.cpp5
-rw-r--r--src/frontend/mame/ui/pluginopt.h2
-rw-r--r--src/frontend/mame/ui/quitmenu.cpp4
-rw-r--r--src/frontend/mame/ui/selector.h2
-rw-r--r--src/frontend/mame/ui/selmenu.cpp24
-rw-r--r--src/frontend/mame/ui/simpleselgame.cpp2
-rw-r--r--src/frontend/mame/ui/simpleselgame.h2
-rw-r--r--src/frontend/mame/ui/sliders.cpp1
-rw-r--r--src/frontend/mame/ui/state.cpp4
-rw-r--r--src/frontend/mame/ui/swlist.h2
-rw-r--r--src/frontend/mame/ui/ui.cpp4
-rw-r--r--src/frontend/mame/ui/viewgfx.cpp2
23 files changed, 132 insertions, 75 deletions
diff --git a/src/frontend/mame/ui/analogipt.cpp b/src/frontend/mame/ui/analogipt.cpp
index ed0daf0b152..fde76f47173 100644
--- a/src/frontend/mame/ui/analogipt.cpp
+++ b/src/frontend/mame/ui/analogipt.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "ui/analogipt.h"
+#include "ui/textbox.h"
+
#include <algorithm>
#include <iterator>
#include <string>
@@ -19,6 +21,20 @@
namespace ui {
+namespace {
+
+char const HELP_TEXT[] = N_p("menu-analoginput",
+ "Show/hide settings \t\t%1$s\n"
+ "Decrease value \t\t%2$s\n"
+ "Increase value \t\t%3$s\n"
+ "Restore default value \t\t%4$s\n"
+ "Previous device \t\t%5$s\n"
+ "Next device \t\t%6$s\n"
+ "Return to previous menu \t\t%7$s");
+
+} // anonymous namespace
+
+
inline menu_analog::item_data::item_data(ioport_field &f, int t) noexcept
: field(f)
, type(t)
@@ -63,7 +79,7 @@ menu_analog::menu_analog(mame_ui_manager &mui, render_container &container)
, m_hide_menu(false)
{
set_process_flags(PROCESS_LR_REPEAT);
- set_heading(_("Analog Input Adjustments"));
+ set_heading(_("menu-analoginput", "Analog Input Adjustments"));
}
@@ -102,7 +118,7 @@ void menu_analog::custom_render(void *selectedref, float top, float bottom, floa
if (m_hide_menu)
{
if (m_prompt.empty())
- m_prompt = util::string_format(_("Press %s to show menu"), ui().get_general_input_setting(IPT_UI_ON_SCREEN_DISPLAY));
+ m_prompt = util::string_format(_("menu-analoginput", "Press %s to show settings"), ui().get_general_input_setting(IPT_UI_ON_SCREEN_DISPLAY));
draw_text_box(
&m_prompt, &m_prompt + 1,
boxleft, boxright, y - top, y - top + line_height() + (tb_border() * 2.0f),
@@ -221,6 +237,22 @@ void menu_analog::handle(event const *ev)
m_hide_menu = !m_hide_menu;
set_process_flags(PROCESS_LR_REPEAT | (m_hide_menu ? (PROCESS_CUSTOM_NAV | PROCESS_CUSTOM_ONLY) : 0));
}
+ else if (IPT_UI_HELP == ev->iptkey)
+ {
+ stack_push<menu_fixed_textbox>(
+ ui(),
+ container(),
+ _("menu-analoginput", "Analog Input Adjustments Help"),
+ util::string_format(
+ _(HELP_TEXT),
+ ui().get_general_input_setting(IPT_UI_ON_SCREEN_DISPLAY),
+ ui().get_general_input_setting(IPT_UI_LEFT),
+ ui().get_general_input_setting(IPT_UI_RIGHT),
+ ui().get_general_input_setting(IPT_UI_CLEAR),
+ ui().get_general_input_setting(IPT_UI_PREV_GROUP),
+ ui().get_general_input_setting(IPT_UI_NEXT_GROUP),
+ ui().get_general_input_setting(IPT_UI_BACK)));
+ }
else if (m_hide_menu)
{
switch (ev->iptkey)
@@ -386,22 +418,22 @@ void menu_analog::populate()
{
default:
case ANALOG_ITEM_KEYSPEED:
- text = string_format(_("%1$s Increment/Decrement Speed"), field->name());
+ text = string_format(_("menu-analoginput", "%1$s Increment/Decrement Speed"), field->name());
data.cur = settings.delta;
break;
case ANALOG_ITEM_CENTERSPEED:
- text = string_format(_("%1$s Auto-centering Speed"), field->name());
+ text = string_format(_("menu-analoginput", "%1$s Auto-centering Speed"), field->name());
data.cur = settings.centerdelta;
break;
case ANALOG_ITEM_REVERSE:
- text = string_format(_("%1$s Reverse"), field->name());
+ text = string_format(_("menu-analoginput", "%1$s Reverse"), field->name());
data.cur = settings.reverse;
break;
case ANALOG_ITEM_SENSITIVITY:
- text = string_format(_("%1$s Sensitivity"), field->name());
+ text = string_format(_("menu-analoginput", "%1$s Sensitivity"), field->name());
data.cur = settings.sensitivity;
break;
}
@@ -416,7 +448,7 @@ void menu_analog::populate()
// display a message if there are toggle inputs enabled
if (!prev_owner)
- item_append(_("[no analog inputs are enabled]"), FLAG_DISABLE, nullptr);
+ item_append(_("menu-analoginput", "[no analog inputs are enabled]"), FLAG_DISABLE, nullptr);
item_append(menu_item_type::SEPARATOR);
diff --git a/src/frontend/mame/ui/auditmenu.cpp b/src/frontend/mame/ui/auditmenu.cpp
index 61a20ae8bc8..07f55510ec8 100644
--- a/src/frontend/mame/ui/auditmenu.cpp
+++ b/src/frontend/mame/ui/auditmenu.cpp
@@ -127,7 +127,7 @@ void menu_audit::custom_render(void *selectedref, float top, float bottom, float
util::string_format(
_("Cancel audit?\n\nPress %1$s to cancel\nPress %2$s to continue"),
ui().get_general_input_setting(IPT_UI_SELECT),
- ui().get_general_input_setting(IPT_UI_CANCEL)),
+ ui().get_general_input_setting(IPT_UI_BACK)),
text_layout::text_justify::CENTER,
0.5F, 0.5F,
UI_RED_COLOR);
@@ -136,7 +136,7 @@ void menu_audit::custom_render(void *selectedref, float top, float bottom, float
}
-bool menu_audit::custom_ui_cancel()
+bool menu_audit::custom_ui_back()
{
return m_phase != phase::CONFIRMATION;
}
@@ -162,7 +162,7 @@ void menu_audit::handle(event const *ev)
set_process_flags(PROCESS_CUSTOM_ONLY | PROCESS_NOINPUT);
m_phase = phase::AUDIT;
m_fast = ITEMREF_START_FAST == ev->itemref;
- m_prompt = util::string_format(_("Press %1$s to cancel\n"), ui().get_general_input_setting(IPT_UI_CANCEL));
+ m_prompt = util::string_format(_("Press %1$s to cancel\n"), ui().get_general_input_setting(IPT_UI_BACK));
m_future.resize(std::thread::hardware_concurrency());
for (auto &future : m_future)
future = std::async(std::launch::async, [this] () { return do_audit(); });
@@ -185,7 +185,7 @@ void menu_audit::handle(event const *ev)
}
stack_pop();
}
- else if (machine().ui_input().pressed(IPT_UI_CANCEL))
+ else if (machine().ui_input().pressed(IPT_UI_BACK))
{
if (phase::AUDIT == m_phase)
m_phase = phase::CANCELLATION;
diff --git a/src/frontend/mame/ui/auditmenu.h b/src/frontend/mame/ui/auditmenu.h
index 040316edb5b..f0a37f09fba 100644
--- a/src/frontend/mame/ui/auditmenu.h
+++ b/src/frontend/mame/ui/auditmenu.h
@@ -31,7 +31,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
- virtual bool custom_ui_cancel() override;
+ virtual bool custom_ui_back() override;
private:
enum class phase { CONFIRMATION, AUDIT, CANCELLATION };
diff --git a/src/frontend/mame/ui/confswitch.cpp b/src/frontend/mame/ui/confswitch.cpp
index ffeae2fff38..7d6030ce669 100644
--- a/src/frontend/mame/ui/confswitch.cpp
+++ b/src/frontend/mame/ui/confswitch.cpp
@@ -190,17 +190,6 @@ void menu_confswitch::handle(event const *ev)
switch (ev->iptkey)
{
- // if selected, reset to default value
- case IPT_UI_SELECT:
- {
- ioport_field::user_settings settings;
- field.get_user_settings(settings);
- settings.value = field.defvalue();
- field.set_user_settings(settings);
- }
- changed = true;
- break;
-
// left goes to previous setting
case IPT_UI_LEFT:
field.select_previous_setting();
@@ -208,11 +197,26 @@ void menu_confswitch::handle(event const *ev)
break;
// right goes to next setting
+ case IPT_UI_SELECT:
case IPT_UI_RIGHT:
field.select_next_setting();
changed = true;
break;
+ // if cleared, reset to default value
+ case IPT_UI_CLEAR:
+ {
+ ioport_field::user_settings settings;
+ field.get_user_settings(settings);
+ if (field.defvalue() != settings.value)
+ {
+ settings.value = field.defvalue();
+ field.set_user_settings(settings);
+ changed = true;
+ }
+ }
+ break;
+
// trick to get previous group - depend on headings having null reference
case IPT_UI_PREV_GROUP:
{
diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp
index 2f77e98433c..a4000dc68b7 100644
--- a/src/frontend/mame/ui/dirmenu.cpp
+++ b/src/frontend/mame/ui/dirmenu.cpp
@@ -168,7 +168,7 @@ protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
- virtual bool custom_ui_cancel() override { return !m_search.empty(); }
+ virtual bool custom_ui_back() override { return !m_search.empty(); }
private:
virtual void populate() override;
diff --git a/src/frontend/mame/ui/filecreate.cpp b/src/frontend/mame/ui/filecreate.cpp
index 341c19545ba..cf55499ab00 100644
--- a/src/frontend/mame/ui/filecreate.cpp
+++ b/src/frontend/mame/ui/filecreate.cpp
@@ -117,7 +117,7 @@ menu_file_create::menu_file_create(mame_ui_manager &mui, render_container &conta
, m_current_format(nullptr)
{
m_image = image;
- m_ok = true;
+ m_ok = false;
m_filename.reserve(1024);
m_filename = core_filename_extract_base(current_file);
@@ -158,13 +158,22 @@ void menu_file_create::custom_render(void *selectedref, float top, float bottom,
//-------------------------------------------------
+// custom_ui_back - override back handling
+//-------------------------------------------------
+
+bool menu_file_create::custom_ui_back()
+{
+ return (get_selection_ref() == ITEMREF_NEW_IMAGE_NAME) && !m_filename.empty();
+}
+
+
+//-------------------------------------------------
// populate - populates the file creator menu
//-------------------------------------------------
void menu_file_create::populate()
{
std::string buffer;
- const image_device_format *format;
const std::string *new_image_name;
// append the "New Image Name" item
@@ -180,9 +189,10 @@ void menu_file_create::populate()
item_append(_("New Image Name:"), *new_image_name, 0, ITEMREF_NEW_IMAGE_NAME);
// do we support multiple formats?
- if (ENABLE_FORMATS) format = m_image->formatlist().front().get();
- if (ENABLE_FORMATS && (format != nullptr))
+ image_device_format const *const format = ENABLE_FORMATS ? m_image->formatlist().front().get() : nullptr;
+ if (format)
{
+ // FIXME: is this in the right order? It reassigns m_current_format after reading it.
item_append(_("Image Format:"), m_current_format->description(), 0, ITEMREF_FORMAT);
m_current_format = format;
}
@@ -212,31 +222,38 @@ void menu_file_create::handle(event const *ev)
if (tmp_file.find('.') != -1 && tmp_file.find('.') < tmp_file.length() - 1)
{
m_current_file = m_filename;
+ m_ok = true;
stack_pop();
}
else
+ {
ui().popup_time(1, "%s", _("Please enter a file extension too"));
+ }
}
break;
case IPT_UI_PASTE:
- if (get_selection_ref() == ITEMREF_NEW_IMAGE_NAME)
+ if (ev->itemref == ITEMREF_NEW_IMAGE_NAME)
{
if (paste_text(m_filename, &osd_is_valid_filename_char))
- reset(reset_options::REMEMBER_POSITION);
+ ev->item->set_subtext(m_filename + "_");
}
break;
case IPT_SPECIAL:
- if (get_selection_ref() == ITEMREF_NEW_IMAGE_NAME)
+ if (ev->itemref == ITEMREF_NEW_IMAGE_NAME)
{
if (input_character(m_filename, ev->unichar, &osd_is_valid_filename_char))
- reset(reset_options::REMEMBER_POSITION);
+ ev->item->set_subtext(m_filename + "_");
}
break;
case IPT_UI_CANCEL:
- m_ok = false;
+ if ((ev->itemref == ITEMREF_NEW_IMAGE_NAME) && !m_filename.empty())
+ {
+ m_filename.clear();
+ ev->item->set_subtext("_");
+ }
break;
}
}
diff --git a/src/frontend/mame/ui/filecreate.h b/src/frontend/mame/ui/filecreate.h
index 629bd24f3ec..c4ef529168b 100644
--- a/src/frontend/mame/ui/filecreate.h
+++ b/src/frontend/mame/ui/filecreate.h
@@ -49,6 +49,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+ virtual bool custom_ui_back() override;
private:
virtual void populate() override;
diff --git a/src/frontend/mame/ui/filesel.h b/src/frontend/mame/ui/filesel.h
index 71b2b17e3ad..f8968f798c9 100644
--- a/src/frontend/mame/ui/filesel.h
+++ b/src/frontend/mame/ui/filesel.h
@@ -46,7 +46,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
- virtual bool custom_ui_cancel() override { return !m_filename.empty(); }
+ virtual bool custom_ui_back() override { return !m_filename.empty(); }
virtual bool custom_mouse_down() override;
private:
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index 387d3db7423..4fa6ffab25b 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -394,22 +394,12 @@ void menu_input::handle(event const *ev)
if (machine().ui_input().pressed(IPT_UI_CANCEL))
{
- // if UI_CANCEL is pressed, abort
+ // if UI_CANCEL is pressed, abort and abandon changes
pollingitem = nullptr;
set_process_flags(PROCESS_LR_ALWAYS);
- if (!seq_poll->modified() || modified_ticks == osd_ticks())
- {
- // cancelled immediately - toggle between default and none
- record_next = false;
- toggle_none_default(item->seq, starting_seq, *item->defseq);
- seqchangeditem = item;
- }
- else
- {
- // entered something before cancelling - abandon change
- invalidate = true;
- }
+ invalidate = true;
seq_poll.reset();
+ machine().ui_input().reset();
}
else if (seq_poll->poll()) // poll again; if finished, update the sequence
{
@@ -429,6 +419,7 @@ void menu_input::handle(event const *ev)
erroritem = item;
}
seq_poll.reset();
+ machine().ui_input().reset();
}
}
else if (ev && ev->itemref)
diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp
index 69e75563985..1f00a882a9a 100644
--- a/src/frontend/mame/ui/menu.cpp
+++ b/src/frontend/mame/ui/menu.cpp
@@ -950,7 +950,7 @@ void menu::handle_events(uint32_t flags, event &ev)
ev.iptkey = IPT_UI_SELECT;
if (is_last_selected() && m_needs_prev_menu_item)
{
- ev.iptkey = IPT_UI_CANCEL;
+ ev.iptkey = IPT_UI_BACK;
stack_pop();
if (is_special_main_menu())
machine().schedule_exit();
@@ -1029,7 +1029,7 @@ void menu::handle_keys(uint32_t flags, int &iptkey)
{
if (is_last_selected() && m_needs_prev_menu_item)
{
- iptkey = IPT_UI_CANCEL;
+ iptkey = IPT_UI_BACK;
stack_pop();
if (is_special_main_menu())
machine().schedule_exit();
@@ -1038,7 +1038,7 @@ void menu::handle_keys(uint32_t flags, int &iptkey)
}
// UI configure hides the menus
- if (!(flags & PROCESS_NOKEYS) && exclusive_input_pressed(iptkey, IPT_UI_CONFIGURE, 0) && !m_global_state.stack_has_special_main_menu())
+ if (!(flags & PROCESS_NOKEYS) && exclusive_input_pressed(iptkey, IPT_UI_MENU, 0) && !m_global_state.stack_has_special_main_menu())
{
if (is_one_shot())
stack_pop();
@@ -1051,10 +1051,10 @@ void menu::handle_keys(uint32_t flags, int &iptkey)
if (flags & PROCESS_ONLYCHAR)
return;
- // hitting cancel also pops the stack
- if (exclusive_input_pressed(iptkey, IPT_UI_CANCEL, 0))
+ // hitting back also pops the stack
+ if (exclusive_input_pressed(iptkey, IPT_UI_BACK, 0))
{
- if (!custom_ui_cancel())
+ if (!custom_ui_back())
{
stack_pop();
if (is_special_main_menu())
diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h
index 4126fa66cb5..16223ebebd8 100644
--- a/src/frontend/mame/ui/menu.h
+++ b/src/frontend/mame/ui/menu.h
@@ -350,7 +350,7 @@ protected:
void set_process_flags(uint32_t flags) { m_process_flags = flags; }
virtual void handle_events(uint32_t flags, event &ev);
virtual void handle_keys(uint32_t flags, int &iptkey);
- virtual bool custom_ui_cancel() { return false; }
+ virtual bool custom_ui_back() { return false; }
virtual bool custom_mouse_down() { return false; }
virtual bool custom_mouse_scroll(int lines) { return false; }
diff --git a/src/frontend/mame/ui/pluginopt.cpp b/src/frontend/mame/ui/pluginopt.cpp
index 3ad7a2ec2c3..bbf3c447087 100644
--- a/src/frontend/mame/ui/pluginopt.cpp
+++ b/src/frontend/mame/ui/pluginopt.cpp
@@ -103,6 +103,9 @@ void menu_plugin_opt::handle(event const *ev)
case IPT_UI_CLEAR:
key = "clear";
break;
+ case IPT_UI_BACK:
+ key = "back";
+ break;
case IPT_UI_CANCEL:
key = "cancel";
break;
@@ -120,7 +123,7 @@ void menu_plugin_opt::handle(event const *ev)
set_selection(reinterpret_cast<void *>(uintptr_t(*result.second)));
if (result.first)
reset(reset_options::REMEMBER_REF);
- else if (ev && (ev->iptkey == IPT_UI_CANCEL))
+ else if (ev && (ev->iptkey == IPT_UI_BACK))
stack_pop();
}
}
diff --git a/src/frontend/mame/ui/pluginopt.h b/src/frontend/mame/ui/pluginopt.h
index 3779cf130c2..1e947a9ccd3 100644
--- a/src/frontend/mame/ui/pluginopt.h
+++ b/src/frontend/mame/ui/pluginopt.h
@@ -45,7 +45,7 @@ public:
virtual ~menu_plugin_opt();
protected:
- virtual bool custom_ui_cancel() override { return true; }
+ virtual bool custom_ui_back() override { return true; }
private:
virtual void populate() override;
diff --git a/src/frontend/mame/ui/quitmenu.cpp b/src/frontend/mame/ui/quitmenu.cpp
index 29f12143831..cd1fb4ac59b 100644
--- a/src/frontend/mame/ui/quitmenu.cpp
+++ b/src/frontend/mame/ui/quitmenu.cpp
@@ -38,7 +38,7 @@ void menu_confirm_quit::custom_render(void *selectedref, float top, float bottom
"Press %1$s to quit\n"
"Press %2$s to return to emulation"),
ui().get_general_input_setting(IPT_UI_SELECT),
- ui().get_general_input_setting(IPT_UI_CANCEL)),
+ ui().get_general_input_setting(IPT_UI_BACK)),
text_layout::text_justify::CENTER,
0.5f, 0.5f,
UI_RED_COLOR);
@@ -54,7 +54,7 @@ void menu_confirm_quit::handle(event const *ev)
{
if (machine().ui_input().pressed(IPT_UI_SELECT))
machine().schedule_exit();
- else if (machine().ui_input().pressed(IPT_UI_CANCEL))
+ else if (machine().ui_input().pressed(IPT_UI_BACK))
stack_pop();
}
diff --git a/src/frontend/mame/ui/selector.h b/src/frontend/mame/ui/selector.h
index 8d504a42e2d..07528364f4d 100644
--- a/src/frontend/mame/ui/selector.h
+++ b/src/frontend/mame/ui/selector.h
@@ -40,7 +40,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
- virtual bool custom_ui_cancel() override { return !m_search.empty(); }
+ virtual bool custom_ui_back() override { return !m_search.empty(); }
private:
enum { VISIBLE_SEARCH_ITEMS = 200 };
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp
index f24eb7b3581..1a0789bc394 100644
--- a/src/frontend/mame/ui/selmenu.cpp
+++ b/src/frontend/mame/ui/selmenu.cpp
@@ -1450,24 +1450,34 @@ void menu_select_launch::handle_keys(u32 flags, int &iptkey)
return;
}
- if (exclusive_input_pressed(iptkey, IPT_UI_CANCEL, 0))
+ if (exclusive_input_pressed(iptkey, IPT_UI_BACK, 0))
{
if (m_ui_error)
{
// dismiss error
+ return;
}
- else if (!m_search.empty())
+ else if (!is_special_main_menu() && m_search.empty())
+ {
+ // pop the stack if this isn't the root session menu
+ stack_pop();
+ return;
+ }
+ }
+
+ if (exclusive_input_pressed(iptkey, IPT_UI_CANCEL, 0))
+ {
+ if (!m_search.empty())
{
// escape pressed with non-empty search text clears it
m_search.clear();
reset(reset_options::REMEMBER_REF);
}
- else
+ else if (is_special_main_menu())
{
- // otherwise pop the stack
+ // this is the root session menu, exit
stack_pop();
- if (is_special_main_menu())
- machine().schedule_exit();
+ machine().schedule_exit();
}
return;
}
@@ -1779,7 +1789,7 @@ void menu_select_launch::handle_events(u32 flags, event &ev)
}
else if (hover() == HOVER_BACKTRACK)
{
- ev.iptkey = IPT_UI_CANCEL;
+ ev.iptkey = IPT_UI_BACK;
stack_pop();
if (is_special_main_menu())
machine().schedule_exit();
diff --git a/src/frontend/mame/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp
index 9fd0b5bb177..2c1cb28e29a 100644
--- a/src/frontend/mame/ui/simpleselgame.cpp
+++ b/src/frontend/mame/ui/simpleselgame.cpp
@@ -124,7 +124,7 @@ void simple_menu_select_game::handle(event const *ev)
else
{
// handle selections
- switch(ev->iptkey)
+ switch (ev->iptkey)
{
case IPT_UI_SELECT:
inkey_select(*ev);
diff --git a/src/frontend/mame/ui/simpleselgame.h b/src/frontend/mame/ui/simpleselgame.h
index 4f1effa4305..b1f4c1946e3 100644
--- a/src/frontend/mame/ui/simpleselgame.h
+++ b/src/frontend/mame/ui/simpleselgame.h
@@ -31,7 +31,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
- virtual bool custom_ui_cancel() override { return !m_search.empty(); }
+ virtual bool custom_ui_back() override { return !m_search.empty(); }
private:
enum { VISIBLE_GAMES_IN_LIST = 15 };
diff --git a/src/frontend/mame/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp
index e162ebeee1a..db1dbbe7b66 100644
--- a/src/frontend/mame/ui/sliders.cpp
+++ b/src/frontend/mame/ui/sliders.cpp
@@ -99,7 +99,6 @@ void menu_sliders::handle(event const *ev)
break;
// restore default
- case IPT_UI_SELECT:
case IPT_UI_CLEAR:
increment = slider->defval - curvalue;
break;
diff --git a/src/frontend/mame/ui/state.cpp b/src/frontend/mame/ui/state.cpp
index 49412c8a244..a7795c0347b 100644
--- a/src/frontend/mame/ui/state.cpp
+++ b/src/frontend/mame/ui/state.cpp
@@ -262,7 +262,7 @@ void menu_load_save_state_base::handle(event const *ev)
_("Delete saved state %1$s?\nPress %2$s to delete\nPress %3$s to cancel"),
m_confirm_delete->visible_name(),
ui().get_general_input_setting(IPT_UI_SELECT),
- ui().get_general_input_setting(IPT_UI_CANCEL));
+ ui().get_general_input_setting(IPT_UI_BACK));
}
}
else if (!m_confirm_delete)
@@ -396,7 +396,7 @@ void menu_load_save_state_base::handle_keys(uint32_t flags, int &iptkey)
m_keys_released = false;
reset(reset_options::REMEMBER_POSITION);
}
- else if (exclusive_input_pressed(iptkey, IPT_UI_CANCEL, 0))
+ else if (exclusive_input_pressed(iptkey, IPT_UI_BACK, 0))
{
// don't delete it - dismiss the prompt
m_switch_poller.reset();
diff --git a/src/frontend/mame/ui/swlist.h b/src/frontend/mame/ui/swlist.h
index ce50ad2cfae..ab913373115 100644
--- a/src/frontend/mame/ui/swlist.h
+++ b/src/frontend/mame/ui/swlist.h
@@ -65,7 +65,7 @@ public:
virtual ~menu_software_list() override;
protected:
- virtual bool custom_ui_cancel() override { return !m_search.empty(); }
+ virtual bool custom_ui_back() override { return !m_search.empty(); }
private:
struct entry_info
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index 6789686cac7..8f04ae7b980 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -441,7 +441,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
machine().schedule_exit();
return UI_HANDLER_CANCEL;
}
- else if (machine().ui_input().pressed(IPT_UI_CONFIGURE))
+ else if (machine().ui_input().pressed(IPT_UI_MENU))
{
config_menu = true;
return UI_HANDLER_CANCEL;
@@ -1301,7 +1301,7 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
}
// turn on menus if requested
- if (machine().ui_input().pressed(IPT_UI_CONFIGURE))
+ if (machine().ui_input().pressed(IPT_UI_MENU))
{
show_menu();
return 0;
diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp
index 59d3ffbc53f..2fcc0949484 100644
--- a/src/frontend/mame/ui/viewgfx.cpp
+++ b/src/frontend/mame/ui/viewgfx.cpp
@@ -527,7 +527,7 @@ private:
}
// cancel or graphics viewer dismisses the viewer
- if (input.pressed(IPT_UI_CANCEL) || input.pressed(IPT_UI_SHOW_GFX))
+ if (input.pressed(IPT_UI_BACK) || input.pressed(IPT_UI_SHOW_GFX))
return cancel(uistate);
return uistate;