feat: complete retrobat coverage, fix large file resolution

This commit is contained in:
Abdessamad Derraz
2026-03-17 12:58:03 +01:00
parent a443ba74e8
commit 0ffb8cbd0d
29 changed files with 681 additions and 197 deletions

View File

@@ -106,7 +106,12 @@ def resolve_file(file_entry: dict, db: dict, bios_dir: str,
if os.path.exists(local_path):
return local_path, "zip_exact"
# No MD5 specified = any file with that name is acceptable
# Release assets override local files (authoritative large files)
cached = fetch_large_file(name)
if cached:
return cached, "release_asset"
# No MD5 specified = any local file with that name is acceptable
if not md5:
name_matches = db.get("indexes", {}).get("by_name", {}).get(name, [])
for match_sha1 in name_matches:
@@ -115,6 +120,7 @@ def resolve_file(file_entry: dict, db: dict, bios_dir: str,
if os.path.exists(local_path):
return local_path, "exact"
# Name fallback (hash mismatch)
name_matches = db.get("indexes", {}).get("by_name", {}).get(name, [])
for match_sha1 in name_matches:
if match_sha1 in db["files"]:
@@ -122,11 +128,6 @@ def resolve_file(file_entry: dict, db: dict, bios_dir: str,
if os.path.exists(local_path):
return local_path, "hash_mismatch"
# Last resort: try downloading from large-files release
cached = fetch_large_file(name)
if cached:
return cached, "release_asset"
return None, "not_found"