mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 18:11:16 +01:00
Since 4.9.0 a multi-file archive's RomFile carries a composite digest streamed across every entry, with per-member digests kept alongside in archive_members. Hasheous and Playmatch read their lookup digests straight off that record, but both databases index a multi-file archive by its largest internal member, so those ROMs stopped matching and fell back to filename matching. Add RomFile.lookup_hashes, which decides which digests a ROM database is queried with: a CHD's embedded disc-data SHA-1, else the largest archive member, else the file's own. Hasheous and Playmatch both read it. ScreenScraper deliberately stays on the composite, since its jeuInfos lookup falls back to romnom. Playmatch also picked its file with the first one that had bytes, unfiltered by is_top_level. iter_files is a bare os.walk with no sort and Rom.files has no order_by, so a multi-disc folder ROM was identified by an arbitrary file that could differ between machines scanning the same library. Select the largest top-level file instead, as Hasheous and ScreenScraper do, with a path tie-break for determinism. This half is pre-existing rather than a 4.9.0 regression, but leaving it would keep multi-disc folder ROMs failing on Playmatch. The manual-match suggestion shares that selection, and no longer falls back to the ROM-level composite: contributing nothing to a public index beats contributing a hash of no single file. Existing libraries need no re-hash; archive_members has been populated since 4.9.0, so a rescan is enough. Fixes #3742 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>