static int verify_length_and_hash(emu_file *file, const char *name, UINT32 explength, const hash_collection &hashes) { int retVal = 0; if (file==NULL) return 0; /* verify length */ UINT32 actlength = file->size(); if (explength != actlength) { mame_printf_error("%s WRONG LENGTH (expected: %d found: %d)\n", name, explength, actlength); retVal++; } /* If there is no good dump known, write it */ astring tempstr; hash_collection &acthashes = file->hashes(hashes.hash_types(tempstr)); if (hashes.flag(hash_collection::FLAG_NO_DUMP)) { mame_printf_error("%s NO GOOD DUMP KNOWN\n", name); } /* verify checksums */ else if (hashes != acthashes) { /* otherwise, it's just bad */ mame_printf_error("%s WRONG CHECKSUMS:\n", name); dump_wrong_and_correct_checksums(hashes, acthashes); retVal++; } /* If it matches, but it is actually a bad dump, write it */ else if (hashes.flag(hash_collection::FLAG_BAD_DUMP)) { mame_printf_error("%s NEEDS REDUMP\n",name); } return retVal; }
static void verify_length_and_hash(romload_private *romdata, const char *name, UINT32 explength, const hash_collection &hashes) { /* we've already complained if there is no file */ if (romdata->file == NULL) return; /* verify length */ UINT32 actlength = romdata->file->size(); if (explength != actlength) { romdata->errorstring.catprintf("%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength); romdata->warnings++; } /* If there is no good dump known, write it */ astring tempstr; hash_collection &acthashes = romdata->file->hashes(hashes.hash_types(tempstr)); if (hashes.flag(hash_collection::FLAG_NO_DUMP)) { romdata->errorstring.catprintf("%s NO GOOD DUMP KNOWN\n", name); romdata->knownbad++; } /* verify checksums */ else if (hashes != acthashes) { /* otherwise, it's just bad */ romdata->errorstring.catprintf("%s WRONG CHECKSUMS:\n", name); dump_wrong_and_correct_checksums(romdata, hashes, acthashes); romdata->warnings++; } /* If it matches, but it is actually a bad dump, write it */ else if (hashes.flag(hash_collection::FLAG_BAD_DUMP)) { romdata->errorstring.catprintf("%s ROM NEEDS REDUMP\n",name); romdata->knownbad++; } }
void rom_load_manager::verify_length_and_hash(const char *name, UINT32 explength, const hash_collection &hashes) { /* we've already complained if there is no file */ if (m_file == nullptr) return; /* verify length */ UINT32 actlength = m_file->size(); if (explength != actlength) { strcatprintf(m_errorstring, "%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength); m_warnings++; } /* If there is no good dump known, write it */ hash_collection &acthashes = m_file->hashes(hashes.hash_types().c_str()); if (hashes.flag(hash_collection::FLAG_NO_DUMP)) { strcatprintf(m_errorstring, "%s NO GOOD DUMP KNOWN\n", name); m_knownbad++; } /* verify checksums */ else if (hashes != acthashes) { /* otherwise, it's just bad */ strcatprintf(m_errorstring, "%s WRONG CHECKSUMS:\n", name); dump_wrong_and_correct_checksums(hashes, acthashes); m_warnings++; } /* If it matches, but it is actually a bad dump, write it */ else if (hashes.flag(hash_collection::FLAG_BAD_DUMP)) { strcatprintf(m_errorstring, "%s ROM NEEDS REDUMP\n",name); m_knownbad++; } }