feat: add by_sha256 index, fix reporting attribution

generate_db: add by_sha256 index for O(1) variant lookup.
verify: _find_best_variant uses indexed sha256 instead of O(n) scan.
validation: check_file_validation returns (reason, emulators) tuple,
attributing mismatch only to emulators whose check actually failed.
beetle_psx: remove incorrect size field for ps1_rom.bin (code does
not validate size, swanstation is sole size authority).
This commit is contained in:
Abdessamad Derraz
2026-04-02 00:59:01 +02:00
parent 95b7a9813c
commit 0401d058a1
7 changed files with 7382 additions and 51 deletions

View File

@@ -168,6 +168,7 @@ def build_indexes(files: dict, aliases: dict) -> dict:
by_md5 = {}
by_name = {}
by_crc32 = {}
by_sha256 = {}
by_path_suffix = {}
for sha1, entry in files.items():
@@ -179,6 +180,7 @@ def build_indexes(files: dict, aliases: dict) -> dict:
by_name[name].append(sha1)
by_crc32[entry["crc32"]] = sha1
by_sha256[entry["sha256"]] = sha1
# Path suffix index for regional variant resolution
suffix = _path_suffix(entry["path"])
@@ -208,6 +210,7 @@ def build_indexes(files: dict, aliases: dict) -> dict:
"by_md5": by_md5,
"by_name": by_name,
"by_crc32": by_crc32,
"by_sha256": by_sha256,
"by_path_suffix": by_path_suffix,
}