Added support for multiple comma separated interfaces for device (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2012-03-29 07:01:13 +00:00
parent e0ec7b1467
commit a2591e4206
4 changed files with 29 additions and 10 deletions

View File

@ -189,7 +189,7 @@ int cli_frontend::execute(int argc, char **argv)
const char *interface = image->image_interface();
if (interface != NULL)
{
if (!strcmp(interface, swpart->interface_))
if (softlist_contain_interface(interface, swpart->interface_))
{
const char *option = m_options.value(image->brief_instance_name());
// mount only if not already mounted

View File

@ -1300,7 +1300,7 @@ void software_list_find_approx_matches(software_list_device *swlistdev, software
software_info *candidate = swinfo;
software_part *part = software_find_part(swinfo, NULL, NULL);
if ((interface==NULL || !strcmp(interface, part->interface_)) && (is_software_compatible(part, swlistdev)))
if ((interface==NULL || softlist_contain_interface(interface, part->interface_)) && (is_software_compatible(part, swlistdev)))
{
/* pick the best match between driver name and description */
@ -1436,7 +1436,7 @@ const software_part *software_find_part(const software_info *sw, const char *par
{
if ( interface )
{
if ( !strcmp(interface, part->interface_) )
if ( softlist_contain_interface(interface, part->interface_) )
{
break;
}
@ -1452,7 +1452,7 @@ const software_part *software_find_part(const software_info *sw, const char *par
/* No specific partname supplied, find the first match based on interface */
if ( interface )
{
if ( !strcmp(interface, part->interface_) )
if ( softlist_contain_interface(interface, part->interface_) )
{
break;
}
@ -1787,7 +1787,7 @@ bool load_software_part(emu_options &options, device_image_interface *image, con
const char *interface = req_image->image_interface();
if (interface != NULL)
{
if (!strcmp(interface, req_software_part_ptr->interface_))
if (softlist_contain_interface(interface, req_software_part_ptr->interface_))
{
const char *option = options.value(req_image->brief_instance_name());
// mount only if not already mounted
@ -1899,7 +1899,7 @@ bool swinfo_has_multiple_parts(const software_info *swinfo, const char *interfac
for (const software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
{
if (strcmp(interface, swpart->interface_) == 0)
if (softlist_contain_interface(interface, swpart->interface_))
count++;
}
return (count > 1) ? true : false;
@ -2048,3 +2048,21 @@ void software_list_device::device_validity_check(validity_checker &valid) const
software_list_close(list);
}
}
bool softlist_contain_interface(const char *interface, const char *part_interface)
{
bool result = FALSE;
astring interfaces(interface);
char *intf = strtok((char*)interfaces.cstr(),",");
while (intf != NULL)
{
if (!strcmp(intf, part_interface))
{
result = TRUE;
break;
}
intf = strtok (NULL, ",");
}
return result;
}

View File

@ -201,4 +201,5 @@ const char *software_get_default_slot(const machine_config &config, emu_options
bool is_software_compatible(const software_part *swpart, const software_list_device *swlist);
bool swinfo_has_multiple_parts(const software_info *swinfo, const char *interface);
bool softlist_contain_interface(const char *interface, const char *part_interface);
#endif

View File

@ -39,7 +39,7 @@ void ui_menu_software_parts::populate()
{
for (const software_part *swpart = software_find_part(info, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
{
if (strcmp(interface, swpart->interface_) == 0)
if (softlist_contain_interface(interface, swpart->interface_))
{
software_part_menu_entry *entry = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry));
// check if the available parts have specific part_id to be displayed (e.g. "Map Disc", "Bonus Disc", etc.)
@ -126,7 +126,7 @@ ui_menu_software_list::entry_info *ui_menu_software_list::append_software_entry(
// check if at least one of the parts has the correct interface and add a menu entry only in this case
for (const software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
{
if ((strcmp(interface, swpart->interface_) == 0) && is_software_compatible(swpart, swlist))
if ((softlist_contain_interface(interface, swpart->interface_)) && is_software_compatible(swpart, swlist))
{
entry_updated = TRUE;
// allocate a new entry
@ -335,7 +335,7 @@ void ui_menu_software::populate()
for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
{
const software_part *part = software_find_part(swinfo, NULL, NULL);
if (strcmp(interface,part->interface_)==0) {
if (softlist_contain_interface(interface,part->interface_)) {
found = true;
}
}
@ -361,7 +361,7 @@ void ui_menu_software::populate()
for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
{
const software_part *part = software_find_part(swinfo, NULL, NULL);
if (strcmp(interface,part->interface_)==0) {
if (softlist_contain_interface(interface,part->interface_)) {
found = true;
}
}