Fixed for slot menus + some cleanup (nw)

This commit is contained in:
Miodrag Milanovic 2012-06-05 18:17:31 +00:00
parent fd37f1c877
commit dbe8b7f762
5 changed files with 13 additions and 18 deletions

View File

@ -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); 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 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; }; 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 input_device_default *input_ports_defaults() const { return m_input_defaults; }
const void *default_config() const { return m_default_config; } const void *default_config() const { return m_default_config; }

View File

@ -252,7 +252,7 @@ bool emu_options::add_slot_options(bool isfirst)
entry[0].name = slot->device().tag() + 1; entry[0].name = slot->device().tag() + 1;
entry[0].description = NULL; entry[0].description = NULL;
entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE; 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); add_entries(entry, true);
added = true; added = true;

View File

@ -1285,9 +1285,9 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag)
fprintf(m_output, "\t\t\t<slotoption"); fprintf(m_output, "\t\t\t<slotoption");
fprintf(m_output, " name=\"%s\"", xml_normalize_string(intf[i].name)); fprintf(m_output, " name=\"%s\"", xml_normalize_string(intf[i].name));
fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname())); fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname()));
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, " default=\"yes\"");
} }
fprintf(m_output, "/>\n"); fprintf(m_output, "/>\n");

View File

@ -80,7 +80,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
const char *selval = options.value(owner.tag()+1); const char *selval = options.value(owner.tag()+1);
bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT); bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT);
if (!is_selected_driver || !options.exists(owner.tag()+1)) 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) 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)) 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); 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); device_t *new_dev = device_add(&owner, intf[i].name, intf[i].devtype, is_default ? slot->default_clock() : 0);
found = true; found = true;

View File

@ -180,14 +180,8 @@ void ui_menu_main::populate()
slot_interface_iterator slotiter(machine().root_device()); slot_interface_iterator slotiter(machine().root_device());
if (slotiter.first() != NULL) if (slotiter.first() != NULL)
{ {
bool display = false; /* add slot info menu */
for (const device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next()) item_append("Slot Devices", NULL, 0, (void *)SLOT_DEVICES);
{
if (slot->fixed()) continue;
display = true;
}
/* add image info menu */
if (display) item_append("Slot Devices", NULL, 0, (void *)SLOT_DEVICES);
} }
network_interface_iterator netiter(machine().root_device()); network_interface_iterator netiter(machine().root_device());
@ -458,11 +452,12 @@ void ui_menu_slot_devices::populate()
slot_interface_iterator iter(machine().root_device()); slot_interface_iterator iter(machine().root_device());
for (device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next()) 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 */ /* record the menu item */
const char *title = get_slot_device(slot); 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(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
item_append("Reset", 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; ioport_field *field = (ioport_field *)selectedref;
dip_descriptor *dip; dip_descriptor *dip;
if (field==NULL || field->first_diplocation() == NULL) if (field!=NULL && field->first_diplocation() == NULL)
return; return;
/* add borders */ /* add borders */