//------------------------------------------------- // compute_status - compute a detailed status // based on the information we have //------------------------------------------------- void compute_status(audit_record record, rom_entry rom, bool found) { // if not found, provide more details if (!found) { // no good dump if (record.expected_hashes().flag(util.hash_collection.FLAG_NO_DUMP)) { record.set_status(audit_record.audit_status.STATUS_NOT_FOUND, audit_record.audit_substatus.SUBSTATUS_NOT_FOUND_NODUMP); } // optional ROM else if (romload_global.ROM_ISOPTIONAL(rom)) { record.set_status(audit_record.audit_status.STATUS_NOT_FOUND, audit_record.audit_substatus.SUBSTATUS_NOT_FOUND_OPTIONAL); } // just plain old not found else { record.set_status(audit_record.audit_status.STATUS_NOT_FOUND, audit_record.audit_substatus.SUBSTATUS_NOT_FOUND); } } // if found, provide more details else { // length mismatch if (record.expected_length() != record.actual_length()) { record.set_status(audit_record.audit_status.STATUS_FOUND_INVALID, audit_record.audit_substatus.SUBSTATUS_FOUND_WRONG_LENGTH); } // found but needs a dump else if (record.expected_hashes().flag(util.hash_collection.FLAG_NO_DUMP)) { record.set_status(audit_record.audit_status.STATUS_GOOD, audit_record.audit_substatus.SUBSTATUS_FOUND_NODUMP); } // incorrect hash else if (record.expected_hashes() != record.actual_hashes()) { record.set_status(audit_record.audit_status.STATUS_FOUND_INVALID, audit_record.audit_substatus.SUBSTATUS_FOUND_BAD_CHECKSUM); } // correct hash but needs a redump else if (record.expected_hashes().flag(util.hash_collection.FLAG_BAD_DUMP)) { record.set_status(audit_record.audit_status.STATUS_GOOD, audit_record.audit_substatus.SUBSTATUS_GOOD_NEEDS_REDUMP); } // just plain old good else { record.set_status(audit_record.audit_status.STATUS_GOOD, audit_record.audit_substatus.SUBSTATUS_GOOD); } } }
// internal helpers void audit_regions(Func <rom_entry, Pointer <rom_entry>, audit_record> do_audit, rom_entry region, out size_t found, out size_t required) //template <typename T> void audit_regions(T do_audit, const rom_entry *region, std::size_t &found, std::size_t &required); { throw new emu_unimplemented(); }