diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 4fb86daae35..188b71a4314 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -90,6 +90,7 @@ const options_entry cli_options::s_option_entries[] = { CLICOMMAND_LISTSOFTWARE ";lsoft", "0", OPTION_COMMAND, "list known software for the system" }, { CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" }, { CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" }, + { CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" }, { NULL } }; @@ -1434,6 +1435,105 @@ void cli_frontend::getsoftlist(const char *gamename) } +/*------------------------------------------------- + verifysoftlist - verify software list by name +-------------------------------------------------*/ +void cli_frontend::verifysoftlist(const char *gamename) +{ + int_map list_map; + int correct = 0; + int incorrect = 0; + int notfound = 0; + int matched = 0; + + driver_enumerator drivlist(m_options); + media_auditor auditor(drivlist); + + while (drivlist.next()) + { + software_list_device_iterator iter(drivlist.config().root_device()); + for (const software_list_device *swlist = iter.first(); swlist != NULL; swlist = iter.next()) + { + software_list *list = software_list_open(m_options, swlist->list_name(), FALSE, NULL); + if ( list ) + { + if ((mame_strwildcmp(swlist->list_name(),gamename)==0) && list_map.add(swlist->list_name(), 0, false) != TMERR_DUPLICATE) + { + matched++; + + // Get the actual software list contents + software_list_parse( list, NULL, NULL ); + + for ( software_info *swinfo = software_list_find( list, "*", NULL ); swinfo != NULL; swinfo = software_list_find( list, "*", swinfo ) ) + { + media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); + + // if not found, count that and leave it at that + if (summary == media_auditor::NOTFOUND) + { + notfound++; + } + // else display information about what we discovered + else if(summary != media_auditor::NONE_NEEDED) + { + // output the summary of the audit + astring summary_string; + auditor.summarize(swinfo->shortname,&summary_string); + mame_printf_info("%s", summary_string.cstr()); + + // display information about what we discovered + mame_printf_info("romset %s:%s ", swlist->list_name(), swinfo->shortname); + + // switch off of the result + switch (summary) + { + case media_auditor::INCORRECT: + mame_printf_info("is bad\n"); + incorrect++; + break; + + case media_auditor::CORRECT: + mame_printf_info("is good\n"); + correct++; + break; + + case media_auditor::BEST_AVAILABLE: + mame_printf_info("is best available\n"); + correct++; + break; + + default: + break; + } + } + } + } + software_list_close( list ); + } + } + } + + // clear out any cached files + zip_file_cache_clear(); + + // return an error if none found + if (matched == 0) + throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching software lists found for '%s'", gamename); + + // if we didn't get anything at all, display a generic end message + if (matched > 0 && correct == 0 && incorrect == 0) + { + throw emu_fatalerror(MAMERR_MISSING_FILES, "no romsets found for software list \"%s\"!\n", gamename); + } + // otherwise, print a summary + else + { + if (incorrect > 0) + throw emu_fatalerror(MAMERR_MISSING_FILES, "%d romsets found in %d software lists, %d were OK.\n", correct + incorrect, matched, correct); + mame_printf_info("%d romsets found in %d software lists, %d romsets were OK.\n", correct, matched, correct); + } +} + //------------------------------------------------- // romident - identify ROMs by looking for // matches in our internal database @@ -1543,6 +1643,7 @@ void cli_frontend::execute_commands(const char *exename) { CLICOMMAND_VERIFYSOFTWARE, &cli_frontend::verifysoftware }, { CLICOMMAND_ROMIDENT, &cli_frontend::romident }, { CLICOMMAND_GETSOFTLIST, &cli_frontend::getsoftlist }, + { CLICOMMAND_VERIFYSOFTLIST, &cli_frontend::verifysoftlist }, }; // find the command diff --git a/src/emu/clifront.h b/src/emu/clifront.h index a353777e477..14d7be74a48 100644 --- a/src/emu/clifront.h +++ b/src/emu/clifront.h @@ -77,6 +77,7 @@ #define CLICOMMAND_LISTSOFTWARE "listsoftware" #define CLICOMMAND_VERIFYSOFTWARE "verifysoftware" #define CLICOMMAND_GETSOFTLIST "getsoftlist" +#define CLICOMMAND_VERIFYSOFTLIST "verifysoftlist" @@ -126,6 +127,7 @@ public: void verifysamples(const char *gamename = "*"); void romident(const char *filename); void getsoftlist(const char *gamename = "*"); + void verifysoftlist(const char *gamename = "*"); private: // internal helpers