Previous 199869 Revisions Next

r18499 Saturday 13th October, 2012 at 09:38:43 UTC by Wilbert Pol
clifront.c: Added verifysoftlist command for verifying software availability for separate software lists.  [Wilbert Pol]
[src/emu]clifront.c clifront.h

trunk/src/emu/clifront.c
r18498r18499
9090   { CLICOMMAND_LISTSOFTWARE ";lsoft", "0",       OPTION_COMMAND,    "list known software for the system" },
9191   { CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0",     OPTION_COMMAND,    "verify known software for the system" },
9292   { CLICOMMAND_GETSOFTLIST ";glist",  "0",       OPTION_COMMAND,    "retrieve software list by name" },
93   { CLICOMMAND_VERIFYSOFTLIST ";vlist", "0",     OPTION_COMMAND,    "verify software list by name" },
9394   { NULL }
9495};
9596
r18498r18499
14341435}
14351436
14361437
1438/*-------------------------------------------------
1439    verifysoftlist - verify software list by name
1440-------------------------------------------------*/
1441void cli_frontend::verifysoftlist(const char *gamename)
1442{
1443   int_map list_map;
1444   int correct = 0;
1445   int incorrect = 0;
1446   int notfound = 0;
1447   int matched = 0;
1448
1449   driver_enumerator drivlist(m_options);
1450   media_auditor auditor(drivlist);
1451
1452   while (drivlist.next())
1453   {
1454      software_list_device_iterator iter(drivlist.config().root_device());
1455      for (const software_list_device *swlist = iter.first(); swlist != NULL; swlist = iter.next())
1456      {
1457         software_list *list = software_list_open(m_options, swlist->list_name(), FALSE, NULL);
1458         if ( list )
1459         {
1460            if ((mame_strwildcmp(swlist->list_name(),gamename)==0) && list_map.add(swlist->list_name(), 0, false) != TMERR_DUPLICATE)
1461            {
1462               matched++;
1463
1464               // Get the actual software list contents
1465               software_list_parse( list, NULL, NULL );
1466
1467               for ( software_info *swinfo = software_list_find( list, "*", NULL ); swinfo != NULL; swinfo = software_list_find( list, "*", swinfo ) )
1468               {
1469                  media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST);
1470
1471                  // if not found, count that and leave it at that
1472                  if (summary == media_auditor::NOTFOUND)
1473                  {
1474                     notfound++;
1475                  }
1476                  // else display information about what we discovered
1477                  else if(summary != media_auditor::NONE_NEEDED)
1478                  {
1479                     // output the summary of the audit
1480                     astring summary_string;
1481                     auditor.summarize(swinfo->shortname,&summary_string);
1482                     mame_printf_info("%s", summary_string.cstr());
1483
1484                     // display information about what we discovered
1485                     mame_printf_info("romset %s:%s ", swlist->list_name(), swinfo->shortname);
1486
1487                     // switch off of the result
1488                     switch (summary)
1489                     {
1490                        case media_auditor::INCORRECT:
1491                           mame_printf_info("is bad\n");
1492                           incorrect++;
1493                           break;
1494
1495                        case media_auditor::CORRECT:
1496                           mame_printf_info("is good\n");
1497                           correct++;
1498                           break;
1499
1500                        case media_auditor::BEST_AVAILABLE:
1501                           mame_printf_info("is best available\n");
1502                           correct++;
1503                           break;
1504
1505                        default:
1506                           break;
1507                     }
1508                  }
1509               }
1510            }
1511            software_list_close( list );
1512         }
1513      }
1514   }
1515
1516   // clear out any cached files
1517   zip_file_cache_clear();
1518
1519   // return an error if none found
1520   if (matched == 0)
1521      throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching software lists found for '%s'", gamename);
1522
1523   // if we didn't get anything at all, display a generic end message
1524   if (matched > 0 && correct == 0 && incorrect == 0)
1525   {
1526      throw emu_fatalerror(MAMERR_MISSING_FILES, "no romsets found for software list \"%s\"!\n", gamename);
1527   }
1528   // otherwise, print a summary
1529   else
1530   {
1531      if (incorrect > 0)
1532         throw emu_fatalerror(MAMERR_MISSING_FILES, "%d romsets found in %d software lists, %d were OK.\n", correct + incorrect, matched, correct);
1533      mame_printf_info("%d romsets found in %d software lists, %d romsets were OK.\n", correct, matched, correct);
1534   }
1535}
1536
14371537//-------------------------------------------------
14381538//  romident - identify ROMs by looking for
14391539//  matches in our internal database
r18498r18499
15431643      { CLICOMMAND_VERIFYSOFTWARE,   &cli_frontend::verifysoftware },
15441644      { CLICOMMAND_ROMIDENT,      &cli_frontend::romident },
15451645      { CLICOMMAND_GETSOFTLIST,   &cli_frontend::getsoftlist },
1646      { CLICOMMAND_VERIFYSOFTLIST,   &cli_frontend::verifysoftlist },
15461647   };
15471648
15481649   // find the command
trunk/src/emu/clifront.h
r18498r18499
7777#define CLICOMMAND_LISTSOFTWARE         "listsoftware"
7878#define CLICOMMAND_VERIFYSOFTWARE      "verifysoftware"
7979#define CLICOMMAND_GETSOFTLIST         "getsoftlist"
80#define CLICOMMAND_VERIFYSOFTLIST      "verifysoftlist"
8081
8182
8283
r18498r18499
126127   void verifysamples(const char *gamename = "*");
127128   void romident(const char *filename);
128129   void getsoftlist(const char *gamename = "*");
130   void verifysoftlist(const char *gamename = "*");
129131
130132private:
131133   // internal helpers

Previous 199869 Revisions Next


© 1997-2024 The MAME Team