From 4725ff56d2acaf5e98021bfa2be62c24c90af1ab Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 24 Jan 2016 17:15:26 -0500 Subject: [PATCH] Some more validity checking improvements: - The -validate command now accepts an optional string, validating only matching drivers. This has proven useful for debugging. The default is to validate all drivers as usual. - Devices' names are tracked when validating their auto-finders. --- src/emu/clifront.cpp | 3 ++- src/emu/validity.cpp | 18 ++++++++---------- src/emu/validity.h | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index aa224126a60..05b0ace6116 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -1595,7 +1595,8 @@ void cli_frontend::execute_commands(const char *exename) if (strcmp(m_options.command(), CLICOMMAND_VALIDATE) == 0) { validity_checker valid(m_options); - bool result = valid.check_all(); + const char *sysname = m_options.system_name(); + bool result = valid.check_all_matching((sysname[0] == 0) ? "*" : sysname); if (!result) throw emu_fatalerror(MAMERR_FAILED_VALIDITY, "Validity check failed (%d errors, %d warnings in total)\n", valid.errors(), valid.warnings()); return; diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index f1d685e7cd3..4acc8d991ad 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -184,10 +184,11 @@ void validity_checker::check_shared_source(const game_driver &driver) //------------------------------------------------- -// check_all - check all drivers +// check_all_matching - check all drivers whose +// names match the given string //------------------------------------------------- -bool validity_checker::check_all() +bool validity_checker::check_all_matching(const char *string) { // start by checking core stuff validate_begin(); @@ -210,7 +211,8 @@ bool validity_checker::check_all() // then iterate over all drivers and check them m_drivlist.reset(); while (m_drivlist.next()) - validate_one(m_drivlist.driver()); + if (m_drivlist.matches(string, m_drivlist.driver().name)) + validate_one(m_drivlist.driver()); // cleanup validate_end(); @@ -967,17 +969,13 @@ void validity_checker::validate_devices() device_iterator iter_find(m_current_config->root_device()); for (const device_t *device = iter_find.first(); device != nullptr; device = iter_find.next()) - { - device->findit(true); - } - - // iterate over devices - device_iterator iter(m_current_config->root_device()); - for (const device_t *device = iter.first(); device != nullptr; device = iter.next()) { // track the current device m_current_device = device; + // validate auto-finders + device->findit(true); + // validate the device tag validate_tag(device->basetag()); diff --git a/src/emu/validity.h b/src/emu/validity.h index 5a9ea204f59..66eaffd533b 100644 --- a/src/emu/validity.h +++ b/src/emu/validity.h @@ -46,7 +46,7 @@ public: // operations void check_driver(const game_driver &driver); void check_shared_source(const game_driver &driver); - bool check_all(); + bool check_all_matching(const char *string = "*"); // helpers for devices void validate_tag(const char *tag);