From 80a5c58c9ca766c0c7305003374bb0f8f591282e Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 13 Oct 2016 12:58:03 -0400 Subject: [PATCH] Parenthesize optional items in input menus --- src/frontend/mame/ui/inputmap.cpp | 4 ++++ src/frontend/mame/ui/inputmap.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp index bf13eb22e84..58f50fbe8d5 100644 --- a/src/frontend/mame/ui/inputmap.cpp +++ b/src/frontend/mame/ui/inputmap.cpp @@ -122,6 +122,7 @@ void menu_input_general::populate() item->defseq = &entry.defseq(seqtype); item->sortorder = sortorder * 4 + suborder[seqtype]; item->type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; + item->is_optional = false; item->name = entry.name(); item->owner_name = nullptr; item->next = itemlist; @@ -199,6 +200,7 @@ void menu_input_specific::populate() item->defseq = &field.defseq(seqtype); item->sortorder = sortorder + suborder[seqtype]; item->type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; + item->is_optional = field.optional(); item->name = field.name(); item->owner_name = field.device().tag(); item->next = itemlist; @@ -420,6 +422,8 @@ void menu_input::populate_and_sort(input_item_data *itemlist) } std::string text = string_format(nameformat[item->type], item->name); + if (item->is_optional) + text = "(" + text + ")"; /* if we're polling this item, use some spaces with left/right arrows */ if (pollingref == item->ref) diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h index 522ea8bd7e9..9acee915025 100644 --- a/src/frontend/mame/ui/inputmap.h +++ b/src/frontend/mame/ui/inputmap.h @@ -55,6 +55,7 @@ protected: const char * owner_name; /* pointer to the name of the owner of the item */ UINT32 sortorder; /* sorting information */ UINT8 type; /* type of port */ + bool is_optional; /* true if this input is considered optional */ }; void populate_and_sort(struct input_item_data *itemlist);