From 8bd63c8f814352e834abf8f0481ab91973e2bd9b Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Mon, 26 Jan 2015 10:18:37 +0100 Subject: ui: slight improvement on device input ordering + small cleanup. nw. the ordering is still not optimal, imho, but at least if you launch SMS with a lphaser and a paddle you don't get anymore their input mixed in the menu. I will probably get back to this after next release. --- src/emu/ui/inputmap.c | 12 +++++++----- src/emu/ui/sliders.c | 9 ++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/emu/ui/inputmap.c b/src/emu/ui/inputmap.c index 42e723eba2d..7f3b7942691 100644 --- a/src/emu/ui/inputmap.c +++ b/src/emu/ui/inputmap.c @@ -154,10 +154,9 @@ ui_menu_input_specific::ui_menu_input_specific(running_machine &machine, render_ void ui_menu_input_specific::populate() { input_item_data *itemlist = NULL; - ioport_field *field; - ioport_port *port; int suborder[SEQ_TYPE_TOTAL]; astring tempstring; + int port_count = 0; /* create a mini lookup table for sort order based on sequence type */ suborder[SEQ_TYPE_STANDARD] = 0; @@ -165,8 +164,10 @@ void ui_menu_input_specific::populate() suborder[SEQ_TYPE_INCREMENT] = 2; /* iterate over the input ports and add menu items */ - for (port = machine().ioport().first_port(); port != NULL; port = port->next()) - for (field = port->first_field(); field != NULL; field = field->next()) + for (ioport_port *port = machine().ioport().first_port(); port != NULL; port = port->next()) + { + port_count++; + for (ioport_field *field = port->first_field(); field != NULL; field = field->next()) { const char *name = field->name(); @@ -182,7 +183,7 @@ void ui_menu_input_specific::populate() { sortorder = (field->type() << 2) | (field->player() << 12); if (strcmp(field->device().tag(), ":")) - sortorder |= 0x10000; + sortorder |= (port_count & 0xfff) * 0x10000; } else sortorder = field->type() | 0xf000; @@ -212,6 +213,7 @@ void ui_menu_input_specific::populate() } } } + } /* sort and populate the menu in a standard fashion */ populate_and_sort(itemlist); diff --git a/src/emu/ui/sliders.c b/src/emu/ui/sliders.c index c9db7b247eb..db2d7c28fb5 100644 --- a/src/emu/ui/sliders.c +++ b/src/emu/ui/sliders.c @@ -130,11 +130,10 @@ void ui_menu_sliders::handle() void ui_menu_sliders::populate() { - const slider_state *curslider; astring tempstring; - /* add all sliders */ - for (curslider = machine().ui().get_slider_list(); curslider != NULL; curslider = curslider->next) + /* add UI sliders */ + for (const slider_state *curslider = machine().ui().get_slider_list(); curslider != NULL; curslider = curslider->next) { INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE); UINT32 flags = 0; @@ -148,8 +147,8 @@ void ui_menu_sliders::populate() break; } - /* add all sliders */ - for (curslider = (slider_state*)machine().osd().get_slider_list(); curslider != NULL; curslider = curslider->next) + /* add OSD sliders */ + for (const slider_state *curslider = (slider_state*)machine().osd().get_slider_list(); curslider != NULL; curslider = curslider->next) { INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE); UINT32 flags = 0; -- cgit v1.2.3