diff options
Diffstat (limited to 'src/frontend/mame/audit.cpp')
-rw-r--r-- | src/frontend/mame/audit.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/frontend/mame/audit.cpp b/src/frontend/mame/audit.cpp index a33dd4bb52a..cbc6a67c30b 100644 --- a/src/frontend/mame/audit.cpp +++ b/src/frontend/mame/audit.cpp @@ -563,3 +563,81 @@ media_auditor::audit_record::audit_record(const char *name, media_type type) , m_shared_device(nullptr) { } + + + +// MESSUI - only report problems that the user can fix +media_auditor::summary media_auditor::winui_summarize(const char *name, std::string *output) +{ + if (m_record_list.empty()) + return NONE_NEEDED; + + // loop over records + summary overall_status = CORRECT; + for (audit_record const &record : m_record_list) + { + summary best_new_status = INCORRECT; + + // skip anything that's fine + if ( (record.substatus() == audit_substatus::GOOD) + || (record.substatus() == audit_substatus::GOOD_NEEDS_REDUMP) + || (record.substatus() == audit_substatus::NOT_FOUND_NODUMP) + || (record.substatus() == audit_substatus::FOUND_NODUMP) + ) + continue; + + // output the game name, file name, and length (if applicable) + //if (output) + { + output->append(string_format("%-12s: %s", name, record.name())); + if (record.expected_length() > 0) + output->append(string_format(" (%d bytes)", record.expected_length())); + output->append(" - "); + } + + // use the substatus for finer details + switch (record.substatus()) + { + case audit_substatus::FOUND_NODUMP: + if (output) output->append("NO GOOD DUMP KNOWN\n"); + best_new_status = BEST_AVAILABLE; + break; + + case audit_substatus::FOUND_BAD_CHECKSUM: + if (output) + { + output->append("INCORRECT CHECKSUM:\n"); + output->append(string_format("EXPECTED: %s\n", record.expected_hashes().macro_string().c_str())); + output->append(string_format(" FOUND: %s\n", record.actual_hashes().macro_string().c_str())); + } + break; + + case audit_substatus::FOUND_WRONG_LENGTH: + if (output) output->append(string_format("INCORRECT LENGTH: %d bytes\n", record.actual_length())); + break; + + case audit_substatus::NOT_FOUND: + if (output) + { + device_t *shared_device = record.shared_device(); + if (shared_device == NULL) + output->append("NOT FOUND\n"); + else + output->append(string_format("NOT FOUND (%s)\n", shared_device->shortname())); + } + break; + + case audit_substatus::NOT_FOUND_OPTIONAL: + if (output) output->append("NOT FOUND BUT OPTIONAL\n"); + best_new_status = BEST_AVAILABLE; + break; + + default: + break; + } + + // downgrade the overall status if necessary + overall_status = (std::max)(overall_status, best_new_status); + } + return overall_status; +} |