fix: refuse an archive holding no declared member

_holding_members kept every same-named copy when the best held nothing,
so galgames.zip, a lone assembler listing, resolved by name for mame,
groovymame and mame4droid-2024, and awbios.zip for mame4droid. Such a
copy now resolves as hash_mismatch.

mame2003_plus declared its contents by name only, while fileio.c:1031-1040
loads a member by CRC when the name is absent. The 61 members now carry
the CRC their driver declares, so stvbios, megatech and the six ZN sets
keep matching the archives the collection holds.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 10:14:09 +02:00
1 parent 604ab3371b
commit 5004c4d8d5
3 files changed
+77 -1

No files matched your search

+14
View File
@@ -316,6 +316,20 @@ class AnArchiveRankedByWhatItHolds(unittest.TestCase):
for name in ("epr-21330.ic27", "epr-21332.ic27")]}
self.assertEqual(self._resolve(entry, db), "bios/MAME/hod2bios.zip")
def test_a_copy_holding_no_declared_member_is_not_the_archive(self):
"""galgames.zip held only an assembler listing and none of the six
ROMs MAME declares: the name step served it as the BIOS set."""
from common import resolve_local_file
db = self._db([("bios/MAME/hod2bios.zip", ["listing.lst"])])
entry = {"name": "hod2bios.zip", "contents": [
{"name": name, "crc32": format(zlib.crc32(self.roms[name]), "08x")}
for name in ("epr-21330.ic27", "epr-21332.ic27")]}
path, status = resolve_local_file(entry, db)
self.assertEqual(status, "hash_mismatch")
self.assertEqual(Path(path).relative_to(self.root).as_posix(),
"bios/MAME/hod2bios.zip")
def test_without_a_layout_a_superset_primary_wins(self):
db = self._db([("bios/Arcade/hod2bios.zip", ["epr-21330.ic27"]),
("bios/MAME/hod2bios.zip", list(self.roms))])