From c13dd1446be251f6dc278dbd537a6783da9db43d Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 24 Jun 2021 23:52:57 +1000 Subject: frontend: On input mapping menus, use UI left/right to switch between setting and appending to an input sequence. --- src/frontend/mame/ui/inputmap.cpp | 10 ++++++++-- src/frontend/mame/ui/menu.cpp | 6 +++--- src/frontend/mame/ui/menu.h | 13 +++++++------ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp index 5b63ec0bc0f..1f07a0d098d 100644 --- a/src/frontend/mame/ui/inputmap.cpp +++ b/src/frontend/mame/ui/inputmap.cpp @@ -224,7 +224,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom) if (!data.empty()) populate_sorted(customtop, custombottom); else - item_append(_("This machine has no input map."), FLAG_DISABLE, nullptr); + item_append(_("This machine has no configurable inputs."), FLAG_DISABLE, nullptr); item_append(menu_item_type::SEPARATOR); } @@ -335,7 +335,7 @@ void menu_input::handle() bool invalidate = false; // process the menu - const event *const menu_event = process((pollingitem != nullptr) ? PROCESS_NOKEYS : 0); + const event *const menu_event = process(pollingitem ? PROCESS_NOKEYS : PROCESS_LR_ALWAYS); if (pollingitem) { // if we are polling, handle as a special case @@ -413,6 +413,12 @@ void menu_input::handle() record_next = false; seqchangeditem = &item; break; + + case IPT_UI_LEFT: // flip between set and append + case IPT_UI_RIGHT: // not very discoverable, but with the prompt it isn't opaque + if (record_next || !item.seq.empty()) + record_next = !record_next; + break; } // if the selection changed, reset the "record next" flag diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index c53736b2ab4..8eb1eab47c9 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -995,7 +995,7 @@ void menu::handle_keys(uint32_t flags, int &iptkey) } // bail out - if ((flags & PROCESS_ONLYCHAR)) + if (flags & PROCESS_ONLYCHAR) return; // hitting cancel also pops the stack @@ -1010,8 +1010,8 @@ void menu::handle_keys(uint32_t flags, int &iptkey) validate_selection(1); // swallow left/right keys if they are not appropriate - bool ignoreleft = ((selected_item().flags & FLAG_LEFT_ARROW) == 0); - bool ignoreright = ((selected_item().flags & FLAG_RIGHT_ARROW) == 0); + bool ignoreleft = !(flags & PROCESS_LR_ALWAYS) && !(selected_item().flags & FLAG_LEFT_ARROW); + bool ignoreright = !(flags & PROCESS_LR_ALWAYS) && !(selected_item().flags & FLAG_RIGHT_ARROW); if ((m_items[0].flags & FLAG_UI_DATS)) ignoreleft = ignoreright = false; diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 8cd0057fc58..bb99e84f0ad 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -139,12 +139,13 @@ protected: // flags to pass to process enum { - PROCESS_NOKEYS = 1, - PROCESS_LR_REPEAT = 2, - PROCESS_CUSTOM_ONLY = 4, - PROCESS_ONLYCHAR = 8, - PROCESS_NOINPUT = 16, - PROCESS_NOIMAGE = 32 + PROCESS_NOKEYS = 1 << 0, + PROCESS_LR_ALWAYS = 1 << 1, + PROCESS_LR_REPEAT = 1 << 2, + PROCESS_CUSTOM_ONLY = 1 << 3, + PROCESS_ONLYCHAR = 1 << 4, + PROCESS_NOINPUT = 1 << 5, + PROCESS_NOIMAGE = 1 << 6 }; // options for reset -- cgit v1.2.3