feat: follow a clone to its parent set

MAME's search path for a set is the set and every ancestor
(src/emu/driver.cpp:31-38, src/emu/romload.cpp:67-84 at mame0289), so
a clone reads the ROMs it shares with its parent from the parent's
archive. games/arcade/<profile>.json now records, under parents, each
parent game set with ROMs and the clones whose romof chain reaches it
before any BIOS set, and rom_search_sets adds them to what a command
reads. The installer's index leaves them out, as it does the sources.

arcade_parent_importer --all is re-run: every profile gains parents,
and mame0258, mame0278, mame2010, mame2015, mame2016 and fbneo also
gain the sources their committed files lacked.

Manifests, EmuDeck and RetroDECK only: videopac.zip reaches
roms/odyssey2 beside i8244.zip, electron.zip roms/electron, and the 35 parent
sets the profile holds (a7800, apple2e, intv, videopac and others)
reach arcade, consolearcade and mame, the folders whose command starts
any machine. verify --all keeps its severity and status counts.
This commit is contained in:
Abdessamad Derraz committed 2026-11-11 15:21:10 +01:00
1 parent 114afee41b
commit bad9a7f601
16 files changed
+50 -13

No files matched your search

+5
View File
@@ -3618,6 +3618,10 @@ def _rom_search_sets(
if relation is None:
return frozenset()
bios, devices = relation.get("bios") or {}, relation.get("devices") or {}
# A clone reads the ROMs it shares with its parent from the parent's
# archive: the search path is the set and every ancestor
# (src/emu/driver.cpp:31-38, src/emu/romload.cpp:67-84 at mame0289).
parents = relation.get("parents") or {}
sources = relation.get("sources") or {}
members: set[str] = set(machines)
kind, keys = ANY_MACHINE_POPULATIONS.get(system, ("all", ())) if any_machine else ("", ())
@@ -3633,6 +3637,7 @@ def _rom_search_sets(
return kind == "all" or not members.isdisjoint(users)
found = {b for b, users in bios.items() if used(users)}
found |= {p for p, users in parents.items() if used(users)}
found |= {d for d, users in devices.items() if used(users)}
return frozenset(found | members)
+3 -3
View File
@@ -543,10 +543,10 @@ def build_systems(
def build_arcade(directory: Path) -> dict[str, dict]:
if not directory.is_dir():
return {}
# The driver sources place a search path's sets at build time
# (common.rom_search_sets): the installer reads none of them.
# The driver sources and the clone parents place a search path's sets at
# build time (common.rom_search_sets): the installer reads none of them.
return {
path.stem: {k: v for k, v in _load_json(path).items() if k != "sources"}
path.stem: {k: v for k, v in _load_json(path).items() if k not in ("sources", "parents")}
for path in sorted(directory.glob("*.json"))
}
@@ -205,6 +205,7 @@ def build_index(
if n not in bios_names and not e.isdevice and e.runnable and (e.has_roms or e.disks)
}
bios: dict[str, set[str]] = {}
parents: dict[str, set[str]] = {}
devices: dict[str, set[str]] = {}
missing: dict[str, str] = {}
for name, entry in games.items():
@@ -218,6 +219,12 @@ def build_index(
break
if current in bios_names and parent.has_roms:
bios.setdefault(archive(current, current), set()).add(name)
elif current not in bios_names and parent.has_roms:
# A clone's ROM shared with its parent is looked up in the
# parent's archive too: MAME's search path is the set and
# every ancestor (src/emu/driver.cpp:31-38,
# src/emu/romload.cpp:67-84 at mame0289).
parents.setdefault(archive(current, current), set()).add(name)
current = parent.romof
for device in set(entry.devices) & device_roms:
devices.setdefault(device, set()).add(name)
@@ -231,6 +238,7 @@ def build_index(
sources.setdefault(entry.source, set()).add(archive(name, name))
return {
"bios": {k: sorted(v) for k, v in sorted(bios.items())},
"parents": {k: sorted(v) for k, v in sorted(parents.items())},
"devices": {k: sorted(v) for k, v in sorted(devices.items())},
"chd": sorted(n for n, e in games.items() if e.disks),
"missing_parents": dict(sorted(missing.items())),