feat: file mame device sets by their machines

The -listxml names, for every machine, its parent (romof), the devices of its default configuration (device_ref) and the cards its slots offer (slotoption). A machine takes the system of the first set on its romof chain a written entry lists, and passes it to each device it can instantiate. A device set reached from one system gets system:, from several the new per-entry systems:, from none neither, and keeps serving every system of the profile. The gap report, the core extras and slots read the entry's own systems, so generate_pack --system and the installer pick by them.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 11:33:39 +02:00
1 parent 7ae3a63fad
commit 56e8cbe046
14 files changed
+604 -27

No files matched your search

+18 -5
View File
@@ -1785,16 +1785,29 @@ def profiles_for_systems(
return matching
def entry_system_ids(entry: dict, profile: dict) -> list[str]:
"""Systems a profile entry serves.
The entry's own `system:`, else its own `systems:` (a MAME device set
the machines of several systems load), else every system of its
profile.
"""
own = entry.get("system")
if own:
return [str(own)]
listed = entry.get("systems") or profile.get("systems") or []
return [str(sid) for sid in listed]
def entry_serves_systems(entry: dict, profile: dict, system_ids: list[str]) -> bool:
"""Whether a profile entry belongs to one of the systems, spelled either way.
The entry's own `system:` decides. One without it serves every system
of its profile, the rule a platform pack applies to core extras.
The entry's own `system:` or `systems:` decides. One without either
serves every system of its profile, the rule a platform pack applies to
core extras.
"""
own = entry.get("system")
systems = [own] if own else profile.get("systems", [])
wanted = {_norm_system_id(sid) for sid in system_ids}
return bool(wanted & {_norm_system_id(str(sid)) for sid in systems})
return bool(wanted & {_norm_system_id(sid) for sid in entry_system_ids(entry, profile)})
def select_emulator_profiles(