Previous 15994 Revisions Next

r14822 Thursday 29th March, 2012 at 07:05:24 UTC by Miodrag Milanović
Added support for multiple comma separated interfaces for device (no whatsnew)
[src/emu]clifront.c softlist.c softlist.h uiswlist.c

src/emu/clifront.c
r14821r14822
189189                              const char *interface = image->image_interface();
190190                              if (interface != NULL)
191191                              {
192                                 if (!strcmp(interface, swpart->interface_))
192                                 if (softlist_contain_interface(interface, swpart->interface_))
193193                                 {
194194                                    const char *option = m_options.value(image->brief_instance_name());
195195                                    // mount only if not already mounted
src/emu/uiswlist.c
r14821r14822
3939{
4040   for (const software_part *swpart = software_find_part(info, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
4141   {
42      if (strcmp(interface, swpart->interface_) == 0)
42      if (softlist_contain_interface(interface, swpart->interface_))
4343      {
4444         software_part_menu_entry *entry = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry));
4545         // check if the available parts have specific part_id to be displayed (e.g. "Map Disc", "Bonus Disc", etc.)
r14821r14822
126126   // check if at least one of the parts has the correct interface and add a menu entry only in this case
127127   for (const software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
128128   {
129      if ((strcmp(interface, swpart->interface_) == 0) && is_software_compatible(swpart, swlist))
129      if ((softlist_contain_interface(interface, swpart->interface_)) && is_software_compatible(swpart, swlist))
130130      {
131131         entry_updated = TRUE;
132132         // allocate a new entry
r14821r14822
335335            for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
336336            {
337337               const software_part *part = software_find_part(swinfo, NULL, NULL);
338               if (strcmp(interface,part->interface_)==0) {
338               if (softlist_contain_interface(interface,part->interface_)) {
339339                  found = true;
340340               }
341341            }
r14821r14822
361361            for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
362362            {
363363               const software_part *part = software_find_part(swinfo, NULL, NULL);
364               if (strcmp(interface,part->interface_)==0) {
364               if (softlist_contain_interface(interface,part->interface_)) {
365365                  found = true;
366366               }
367367            }
src/emu/softlist.c
r14821r14822
13001300      software_info *candidate = swinfo;
13011301
13021302      software_part *part = software_find_part(swinfo, NULL, NULL);
1303      if ((interface==NULL || !strcmp(interface, part->interface_)) && (is_software_compatible(part, swlistdev)))
1303      if ((interface==NULL || softlist_contain_interface(interface, part->interface_)) && (is_software_compatible(part, swlistdev)))
13041304      {
13051305
13061306         /* pick the best match between driver name and description */
r14821r14822
14361436            {
14371437               if ( interface )
14381438               {
1439                  if ( !strcmp(interface, part->interface_) )
1439                  if ( softlist_contain_interface(interface, part->interface_) )
14401440                  {
14411441                     break;
14421442                  }
r14821r14822
14521452            /* No specific partname supplied, find the first match based on interface */
14531453            if ( interface )
14541454            {
1455               if ( !strcmp(interface, part->interface_) )
1455               if ( softlist_contain_interface(interface, part->interface_) )
14561456               {
14571457                  break;
14581458               }
r14821r14822
17871787                  const char *interface = req_image->image_interface();
17881788                  if (interface != NULL)
17891789                  {
1790                     if (!strcmp(interface, req_software_part_ptr->interface_))
1790                     if (softlist_contain_interface(interface, req_software_part_ptr->interface_))
17911791                     {
17921792                        const char *option = options.value(req_image->brief_instance_name());
17931793                        // mount only if not already mounted
r14821r14822
18991899
19001900   for (const software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
19011901   {
1902      if (strcmp(interface, swpart->interface_) == 0)
1902      if (softlist_contain_interface(interface, swpart->interface_))
19031903         count++;
19041904   }
19051905   return (count > 1) ? true : false;
r14821r14822
20482048      software_list_close(list);
20492049   }
20502050}
2051
2052bool softlist_contain_interface(const char *interface, const char *part_interface)
2053{
2054    bool result = FALSE;
2055
2056   astring interfaces(interface);
2057   char *intf = strtok((char*)interfaces.cstr(),",");
2058   while (intf != NULL)
2059   {
2060      if (!strcmp(intf, part_interface))
2061        {
2062            result = TRUE;
2063            break;
2064        }
2065      intf = strtok (NULL, ",");
2066   }
2067    return result;
2068}
src/emu/softlist.h
r14821r14822
201201bool is_software_compatible(const software_part *swpart, const software_list_device *swlist);
202202bool swinfo_has_multiple_parts(const software_info *swinfo, const char *interface);
203203
204bool softlist_contain_interface(const char *interface, const char *part_interface);
204205#endif

Previous 15994 Revisions Next


© 1998-2018 The MESS Team