From e0092bfc22d4059e3a1515ae942c76608f7596c4 Mon Sep 17 00:00:00 2001 From: Lukas Cone Date: Sat, 28 Sep 2024 23:20:55 +0200 Subject: [PATCH] make_arc add sloppy hash detection --- toolset/arc_conv/make_arc.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/toolset/arc_conv/make_arc.cpp b/toolset/arc_conv/make_arc.cpp index d74f1d5..ad0a54e 100644 --- a/toolset/arc_conv/make_arc.cpp +++ b/toolset/arc_conv/make_arc.cpp @@ -106,9 +106,22 @@ struct ArcMakeContext : AppPackContext { return; } + uint32 hash = 0; + if (hashes.size() > 1) { - printwarning("Skipped (multiple classes from extension): " << path); - return; + for (auto &h : hashes) { + if (revil::GetExtension(h, settings.title, settings.platform) == + extension) { + if (hash) { + printwarning("Skipped (multiple classes from extension): " << path); + return; + } + + hash = h; + } + } + } else { + hash = hashes.front(); } auto noExt = path.substr(0, extPos); @@ -168,7 +181,7 @@ struct ArcMakeContext : AppPackContext { auto &streamStore = tStream->streamStore; AFile curFile; curFile.offset = streamStore.Tell(); - curFile.hash = hashes.front(); + curFile.hash = hash; curFile.uSize = streamSize; curFile.path = noExt;