Add image verification

"Verify Dump" is now removed, now both hash calculation
and image verification are done in one step.
After a successful hash calculation, the button is replaced with
a "Search on Redump.org" button that opens a web browser
on Redump's search page.
This commit is contained in:
Silent 2021-10-23 16:56:54 +02:00
commit 85ea9a629a
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
8 changed files with 311 additions and 54 deletions

View file

@ -82,6 +82,17 @@ std::string HashToString(const Hash& hash)
hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]);
}
std::optional<Hash> HashFromString(const std::string_view& str) {
auto decoded = StringUtil::DecodeHex(str);
if (decoded && decoded->size() == std::tuple_size_v<Hash>)
{
Hash result;
std::copy(decoded->begin(), decoded->end(), result.begin());
return result;
}
return std::nullopt;
}
bool GetImageHash(CDImage* image, Hash* out_hash,
ProgressCallback* progress_callback /*= ProgressCallback::NullProgressCallback*/)
{