diff options
Diffstat (limited to 'src/emu/ui/miscmenu.c')
-rw-r--r-- | src/emu/ui/miscmenu.c | 68 |
1 files changed, 50 insertions, 18 deletions
diff --git a/src/emu/ui/miscmenu.c b/src/emu/ui/miscmenu.c index b304a7f47a6..365cc281f47 100644 --- a/src/emu/ui/miscmenu.c +++ b/src/emu/ui/miscmenu.c @@ -561,11 +561,15 @@ void ui_menu_input_specific::populate() ((field->type() == IPT_OTHER && field->name() != NULL) || machine().ioport().type_group(field->type(), field->player()) != IPG_INVALID)) { input_seq_type seqtype; - UINT16 sortorder; + UINT32 sortorder; /* determine the sorting order */ if (field->type() >= IPT_START1 && field->type() < IPT_ANALOG_LAST) + { sortorder = (field->type() << 2) | (field->player() << 12); + if (strcmp(field->device().tag(), ":")) + sortorder |= 0x10000; + } else sortorder = field->type() | 0xf000; @@ -584,7 +588,7 @@ void ui_menu_input_specific::populate() item->sortorder = sortorder + suborder[seqtype]; item->type = field->is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item->name = name; - item->owner_name = field->used_in_device() ? (field->device().tag() + 1) : NULL; + item->owner_name = field->device().tag(); item->next = itemlist; itemlist = item; @@ -762,8 +766,10 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist) const char *nameformat[INPUT_TYPE_TOTAL] = { 0 }; input_item_data **itemarray, *item; int numitems = 0, curitem; - astring subtext; astring text; + astring subtext; + astring prev_owner; + bool first_entry = true; /* create a mini lookup table for name format based on type */ nameformat[INPUT_TYPE_DIGITAL] = "%s"; @@ -791,13 +797,19 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist) /* generate the name of the item itself, based off the base name and the type */ item = itemarray[curitem]; assert(nameformat[item->type] != NULL); - if (item->owner_name) + + if (strcmp(item->owner_name, prev_owner.cstr()) != 0) { - text.printf("[%s] ", item->owner_name); - text.catprintf(nameformat[item->type], item->name); + if (first_entry) + first_entry = false; + else + item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + text.printf("[root%s]", item->owner_name); + item_append(text, NULL, 0, NULL); + prev_owner.cpy(item->owner_name); } - else - text.printf(nameformat[item->type], item->name); + + text.printf(nameformat[item->type], item->name); /* if we're polling this item, use some spaces with left/right arrows */ if (pollingref == item->ref) @@ -917,6 +929,8 @@ void ui_menu_settings::populate() ioport_field *field; ioport_port *port; dip_descriptor **diplist_tailptr; + astring prev_owner; + bool first_entry = true; /* reset the dip switch tracking */ dipcount = 0; @@ -938,12 +952,20 @@ void ui_menu_settings::populate() flags |= MENU_FLAG_RIGHT_ARROW; /* add the menu item */ - if (field->used_in_device()) - name.cpy("[").cat(field->device().tag() + 1).cat("] ").cat(field->name()); - else - name.cpy(field->name()); + if (strcmp(field->device().tag(), prev_owner.cstr()) != 0) + { + if (first_entry) + first_entry = false; + else + item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + name.printf("[root%s]", field->device().tag()); + item_append(name, NULL, 0, NULL); + prev_owner.cpy(field->device().tag()); + } - item_append(name.cstr(), field->setting_name(), flags, (void *)field); + name.cpy(field->name()); + + item_append(name, field->setting_name(), flags, (void *)field); /* for DIP switches, build up the model */ if (type == IPT_DIPSWITCH && field->first_diplocation() != NULL) @@ -1187,8 +1209,10 @@ void ui_menu_analog::populate() { ioport_field *field; ioport_port *port; - astring subtext; astring text; + astring subtext; + astring prev_owner; + bool first_entry = true; /* loop over input ports and add the items */ for (port = machine().ioport().first_port(); port != NULL; port = port->next()) @@ -1232,10 +1256,18 @@ void ui_menu_analog::populate() analog_item_data *data; UINT32 flags = 0; astring name; - if (field->used_in_device()) - name.cpy("[").cat(field->device().tag() + 1).cat("] ").cat(field->name()); - else - name.cpy(field->name()); + if (strcmp(field->device().tag(), prev_owner.cstr()) != 0) + { + if (first_entry) + first_entry = false; + else + item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + name.printf("[root%s]", field->device().tag()); + item_append(name, NULL, 0, NULL); + prev_owner.cpy(field->device().tag()); + } + + name.cpy(field->name()); /* allocate a data item for tracking what this menu item refers to */ data = (analog_item_data *)m_pool_alloc(sizeof(*data)); |