Previous 199869 Revisions Next

r20781 Wednesday 6th February, 2013 at 21:18:00 UTC by Tafoid
clifront.c:  [Peter Ferrie]
- Faster enumeration during -verifyroms



comment:
The diff is large because of the addition of a set of {}.
The real change is actually only a single line, to perform the
secondary auditing only if the first audit was (potentially)
incomplete because of a special name or wildcards.
[src/emu]clifront.c

trunk/src/emu/clifront.c
r20780r20781
811811      }
812812   }
813813
814   driver_enumerator dummy_drivlist(m_options);
815   int_map device_map;
816   while (dummy_drivlist.next())
814   if (!matched || strchr(gamename, '*') || strchr(gamename, '?'))
817815   {
818      machine_config &config = dummy_drivlist.config();
819      device_iterator iter(config.root_device());
820      for (device_t *dev = iter.first(); dev != NULL; dev = iter.next())
816      driver_enumerator dummy_drivlist(m_options);
817      int_map device_map;
818      while (dummy_drivlist.next())
821819      {
822         if (dev->owner() != NULL && (*(dev->shortname()) != 0) && dev->rom_region() != NULL && (device_map.add(dev->shortname(), 0, false) != TMERR_DUPLICATE)) {
823            if (mame_strwildcmp(gamename, dev->shortname()) == 0)
824            {
825               matched++;
826
827               // audit the ROMs in this set
828               media_auditor::summary summary = auditor.audit_device(dev, AUDIT_VALIDATE_FAST);
829
830               // if not found, count that and leave it at that
831               if (summary == media_auditor::NOTFOUND)
832                  notfound++;
833               // else display information about what we discovered
834               else if (summary != media_auditor::NONE_NEEDED)
820         machine_config &config = dummy_drivlist.config();
821         device_iterator iter(config.root_device());
822         for (device_t *dev = iter.first(); dev != NULL; dev = iter.next())
823         {
824            if (dev->owner() != NULL && (*(dev->shortname()) != 0) && dev->rom_region() != NULL && (device_map.add(dev->shortname(), 0, false) != TMERR_DUPLICATE)) {
825               if (mame_strwildcmp(gamename, dev->shortname()) == 0)
835826               {
836                  // output the summary of the audit
837                  astring summary_string;
838                  auditor.summarize(dev->shortname(),&summary_string);
839                  mame_printf_info("%s", summary_string.cstr());
827                  matched++;
840828
841                  // display information about what we discovered
842                  mame_printf_info("romset %s ", dev->shortname());
829                  // audit the ROMs in this set
830                  media_auditor::summary summary = auditor.audit_device(dev, AUDIT_VALIDATE_FAST);
843831
844                  // switch off of the result
845                  switch (summary)
832                  // if not found, count that and leave it at that
833                  if (summary == media_auditor::NOTFOUND)
834                     notfound++;
835                  // else display information about what we discovered
836                  else if (summary != media_auditor::NONE_NEEDED)
846837                  {
847                     case media_auditor::INCORRECT:
848                        mame_printf_info("is bad\n");
849                        incorrect++;
850                        break;
838                     // output the summary of the audit
839                     astring summary_string;
840                     auditor.summarize(dev->shortname(),&summary_string);
841                     mame_printf_info("%s", summary_string.cstr());
851842
852                     case media_auditor::CORRECT:
853                        mame_printf_info("is good\n");
854                        correct++;
855                        break;
843                     // display information about what we discovered
844                     mame_printf_info("romset %s ", dev->shortname());
856845
857                     case media_auditor::BEST_AVAILABLE:
858                        mame_printf_info("is best available\n");
859                        correct++;
860                        break;
846                     // switch off of the result
847                     switch (summary)
848                     {
849                        case media_auditor::INCORRECT:
850                           mame_printf_info("is bad\n");
851                           incorrect++;
852                           break;
861853
862                     default:
863                        break;
854                        case media_auditor::CORRECT:
855                           mame_printf_info("is good\n");
856                           correct++;
857                           break;
858
859                        case media_auditor::BEST_AVAILABLE:
860                           mame_printf_info("is best available\n");
861                           correct++;
862                           break;
863
864                        default:
865                           break;
866                     }
864867                  }
865868               }
866869            }
867870         }
868      }
869871
870      slot_interface_iterator slotiter(config.root_device());
871      for (const device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next())
872      {
873         const slot_interface* intf = slot->get_slot_interfaces();
874         for (int i = 0; intf && intf[i].name != NULL; i++)
872         slot_interface_iterator slotiter(config.root_device());
873         for (const device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next())
875874         {
876            astring temptag("_");
877            temptag.cat(intf[i].name);
878            device_t *dev = const_cast<machine_config &>(config).device_add(&config.root_device(), temptag.cstr(), intf[i].devtype, 0);
875            const slot_interface* intf = slot->get_slot_interfaces();
876            for (int i = 0; intf && intf[i].name != NULL; i++)
877            {
878               astring temptag("_");
879               temptag.cat(intf[i].name);
880               device_t *dev = const_cast<machine_config &>(config).device_add(&config.root_device(), temptag.cstr(), intf[i].devtype, 0);
879881
880            // notify this device and all its subdevices that they are now configured
881            device_iterator subiter(*dev);
882            for (device_t *device = subiter.first(); device != NULL; device = subiter.next())
883               if (!device->configured())
884                  device->config_complete();
882               // notify this device and all its subdevices that they are now configured
883               device_iterator subiter(*dev);
884               for (device_t *device = subiter.first(); device != NULL; device = subiter.next())
885                  if (!device->configured())
886                     device->config_complete();
885887
886            if (device_map.add(dev->shortname(), 0, false) != TMERR_DUPLICATE) {
887               if (mame_strwildcmp(gamename, dev->shortname()) == 0)
888               {
889                  matched++;
890                  if (dev->rom_region() != NULL)
888               if (device_map.add(dev->shortname(), 0, false) != TMERR_DUPLICATE) {
889                  if (mame_strwildcmp(gamename, dev->shortname()) == 0)
891890                  {
892                     // audit the ROMs in this set
893                     media_auditor::summary summary = auditor.audit_device(dev, AUDIT_VALIDATE_FAST);
894
895                     // if not found, count that and leave it at that
896                     if (summary == media_auditor::NOTFOUND)
897                        notfound++;
898
899                     // else display information about what we discovered
900                     else if(summary != media_auditor::NONE_NEEDED)
891                     matched++;
892                     if (dev->rom_region() != NULL)
901893                     {
902                        // output the summary of the audit
903                        astring summary_string;
904                        auditor.summarize(dev->shortname(),&summary_string);
905                        mame_printf_info("%s", summary_string.cstr());
894                        // audit the ROMs in this set
895                        media_auditor::summary summary = auditor.audit_device(dev, AUDIT_VALIDATE_FAST);
906896
907                        // display information about what we discovered
908                        mame_printf_info("romset %s ", dev->shortname());
897                        // if not found, count that and leave it at that
898                        if (summary == media_auditor::NOTFOUND)
899                           notfound++;
909900
910                        // switch off of the result
911                        switch (summary)
901                        // else display information about what we discovered
902                        else if(summary != media_auditor::NONE_NEEDED)
912903                        {
913                           case media_auditor::INCORRECT:
914                              mame_printf_info("is bad\n");
915                              incorrect++;
916                              break;
904                           // output the summary of the audit
905                           astring summary_string;
906                           auditor.summarize(dev->shortname(),&summary_string);
907                           mame_printf_info("%s", summary_string.cstr());
917908
918                           case media_auditor::CORRECT:
919                              mame_printf_info("is good\n");
920                              correct++;
921                              break;
909                           // display information about what we discovered
910                           mame_printf_info("romset %s ", dev->shortname());
922911
923                           case media_auditor::BEST_AVAILABLE:
924                              mame_printf_info("is best available\n");
925                              correct++;
926                              break;
912                           // switch off of the result
913                           switch (summary)
914                           {
915                              case media_auditor::INCORRECT:
916                                 mame_printf_info("is bad\n");
917                                 incorrect++;
918                                 break;
927919
928                           default:
929                              break;
920                              case media_auditor::CORRECT:
921                                 mame_printf_info("is good\n");
922                                 correct++;
923                                 break;
924
925                              case media_auditor::BEST_AVAILABLE:
926                                 mame_printf_info("is best available\n");
927                                 correct++;
928                                 break;
929
930                              default:
931                                 break;
932                           }
930933                        }
931934                     }
932935                  }
933936               }
937
938               const_cast<machine_config &>(config).device_remove(&config.root_device(), temptag.cstr());
939               global_free(dev);
934940            }
935
936            const_cast<machine_config &>(config).device_remove(&config.root_device(), temptag.cstr());
937            global_free(dev);
938941         }
939942      }
940943   }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team