fix: settle gaps by slot and size as verify does

This commit is contained in:
Abdessamad Derraz committed 2026-10-16 14:07:23 +02:00
1 parent b173a2a851
commit be7a357999
6 files changed
+142 -58

No files matched your search

+5 -34
View File
@@ -73,6 +73,7 @@ from nativemode import (
reads_file_contents,
)
from validation import (
declaration_settles,
existence_discrepancy,
destination_owners,
validated_choice,
@@ -414,40 +415,10 @@ def _candidate_verdict(
return "settled"
if outside_gap_scope(file_entry, is_standalone):
return "skip"
if not include_all:
# A platform declaring the name the core reads has met the
# requirement where the declaration fills the entry's own slot,
# whose content the slot arbitration decides, or elsewhere at a size
# the core accepts: the builder copies that file to the core's path.
# Galaksija's 4 KiB ROM1.BIN does not stand for DOSBox's 32 KiB SC-55
# one. The builder copies nothing for an alias, so an alias answers
# only where the core reads it: quasi88 reads n88sub.rom or disk.rom
# in quasi88/, and System.dat names quasi88/disk.rom. RetroDECK's
# root MSX.ROM is not CLK's MSX/MSX.ROM, and RetroBat's 16 KiB MSX
# DISK.ROM at the root is not the 256-byte Disk II ROM gsplus also
# accepts as c600.rom. The archive answers by its name.
if file_entry.get("archive") in declared_names:
return "settled"
slot = sanitize_pack_path(dest or fname).lower()
directory = slot if dest.endswith("/") else slot.rpartition("/")[0]
for name in (fname, *file_entry.get("aliases", [])):
if name not in declared_names:
continue
if not isinstance(declared_names, Mapping):
return "settled"
if name == fname:
if any(
where == slot or name_match_size_ok(file_entry, size)
for size, where in declared_names[name]
):
return "settled"
continue
read_at = f"{directory}/{name}".lower() if directory else name.lower()
if any(
where == read_at and name_match_size_ok(file_entry, size)
for size, where in declared_names[name]
):
return "settled"
if not include_all and declaration_settles(
file_entry, fname, declared_names, dest
):
return "settled"
return "keep"