From dbe8b7f762f85452f2caf5dbf510d45df1a1979d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 5 Jun 2012 18:17:31 +0000 Subject: [PATCH] Fixed for slot menus + some cleanup (nw) --- src/emu/dislot.h | 2 +- src/emu/emuopts.c | 2 +- src/emu/info.c | 4 ++-- src/emu/mconfig.c | 4 ++-- src/emu/uimain.c | 19 +++++++------------ 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/emu/dislot.h b/src/emu/dislot.h index 4cc355f92a9..7b56f1995e1 100644 --- a/src/emu/dislot.h +++ b/src/emu/dislot.h @@ -56,7 +56,7 @@ public: static void static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input, const void *default_config, UINT32 default_clock, bool fixed); const slot_interface* get_slot_interfaces() const { return m_slot_interfaces; }; - const char * get_default_card(const machine_config &config, emu_options &options) const { return m_default_card; }; + const char * get_default_card() const { return m_default_card; }; virtual const char * get_default_card_software(const machine_config &config, emu_options &options) { return NULL; }; const input_device_default *input_ports_defaults() const { return m_input_defaults; } const void *default_config() const { return m_default_config; } diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 2a0b8ff2196..46fba5eee93 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -252,7 +252,7 @@ bool emu_options::add_slot_options(bool isfirst) entry[0].name = slot->device().tag() + 1; entry[0].description = NULL; entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE; - entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card(config,*this) : NULL; + entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card() : NULL; add_entries(entry, true); added = true; diff --git a/src/emu/info.c b/src/emu/info.c index fb2a8b770e4..c62dfc18c09 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -1285,9 +1285,9 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) fprintf(m_output, "\t\t\tshortname())); - if (slot->get_default_card(m_drivlist.config(), m_drivlist.options())) + if (slot->get_default_card()) { - if (strcmp(slot->get_default_card(m_drivlist.config(), m_drivlist.options()),intf[i].name)==0) + if (strcmp(slot->get_default_card(),intf[i].name)==0) fprintf(m_output, " default=\"yes\""); } fprintf(m_output, "/>\n"); diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index d74b7907a01..226031d031e 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -80,7 +80,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) const char *selval = options.value(owner.tag()+1); bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT); if (!is_selected_driver || !options.exists(owner.tag()+1)) - selval = slot->get_default_card(*this, options); + selval = slot->get_default_card(); if (selval != NULL && strlen(selval) != 0) { @@ -91,7 +91,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) { if ((!intf[i].internal) || (isdefault && intf[i].internal)) { - const char *def = slot->get_default_card(*this, options); + const char *def = slot->get_default_card(); bool is_default = (def != NULL && strcmp(def, selval) == 0); device_t *new_dev = device_add(&owner, intf[i].name, intf[i].devtype, is_default ? slot->default_clock() : 0); found = true; diff --git a/src/emu/uimain.c b/src/emu/uimain.c index 1df866a3265..248f1eea4d9 100644 --- a/src/emu/uimain.c +++ b/src/emu/uimain.c @@ -180,14 +180,8 @@ void ui_menu_main::populate() slot_interface_iterator slotiter(machine().root_device()); if (slotiter.first() != NULL) { - bool display = false; - for (const device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next()) - { - if (slot->fixed()) continue; - display = true; - } - /* add image info menu */ - if (display) item_append("Slot Devices", NULL, 0, (void *)SLOT_DEVICES); + /* add slot info menu */ + item_append("Slot Devices", NULL, 0, (void *)SLOT_DEVICES); } network_interface_iterator netiter(machine().root_device()); @@ -458,11 +452,12 @@ void ui_menu_slot_devices::populate() slot_interface_iterator iter(machine().root_device()); for (device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next()) { - // do no display fixed slots - if (slot->fixed()) continue; /* record the menu item */ const char *title = get_slot_device(slot); - item_append(slot->device().tag()+1, strcmp(title,"")==0 ? "------" : title, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)slot); + // do no display fixed slots + if (slot->fixed()) title = slot->get_default_card(); + + item_append(slot->device().tag()+1, strcmp(title,"")==0 ? "------" : title, slot->fixed() ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)slot); } item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); item_append("Reset", NULL, 0, NULL); @@ -1182,7 +1177,7 @@ void ui_menu_settings_dip_switches::custom_render(void *selectedref, float top, ioport_field *field = (ioport_field *)selectedref; dip_descriptor *dip; - if (field==NULL || field->first_diplocation() == NULL) + if (field!=NULL && field->first_diplocation() == NULL) return; /* add borders */