mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: file mame sets under their systems
934 of the 1,563 mame.yml entries named no system and so served every system of the profile: each MAME-run system's set was the whole profile. The 65 BIOS root sets written by hand take the system groovymame.yml gives the same 0.289 archive (sega-systemsp, konami-gx, taito-gnet and 41 more ids, added to systems:). The 19 XaviX sets take tvgames, the directory MAME keeps xavix.cpp in. They seed the device walk. mame_hash_scraper --devices files a device set under arcade when a machine no entry places loads it: MAME starts such a machine from its set name, as an arcade folder passes it. 1,106 of the 1,254 device sets now carry arcade, alone or beside the systems of their placed machines. qsound, ym2413 and ym2608, written by hand, take the same answer. Left without a system: 41 device sets no machine of the listxml instantiates (a software list slot selects them), and the hash/, plugins/ and floppy/ trees every machine reads.
This commit is contained in:
1 parent
5cb4db61d8
commit
ae8aae8469
4 files changed
+2392
-198
No files matched your search
+2319
-195
File diff suppressed because it is too large.
Load diff
@@ -272,6 +272,33 @@ def attribute_systems(
|
||||
return {name: sorted(found) for name, found in systems.items()}
|
||||
|
||||
|
||||
def device_systems(
|
||||
machines: dict[str, MachineLinks],
|
||||
seeds: dict[str, str],
|
||||
fallback: str,
|
||||
) -> dict[str, list[str]]:
|
||||
"""Systems whose machines can load each set, unplaced machines under *fallback*.
|
||||
|
||||
attribute_systems files a set under the systems of the machines a seed
|
||||
places. A machine no seed places (a computer no platform runs through
|
||||
this profile, a game outside every BIOS family) still loads its devices,
|
||||
and MAME starts it from its set name, the way an arcade folder passes a
|
||||
game: it counts as a machine of *fallback*. A set only such machines
|
||||
load (an Amiga keyboard, an ISA card) then goes under *fallback* alone,
|
||||
and a set both kinds load (ym2413, for the CoCo and for arcade games)
|
||||
under both. A set no runnable machine of the release instantiates keeps
|
||||
no system: the document never names its machine.
|
||||
"""
|
||||
if not fallback:
|
||||
return attribute_systems(machines, seeds)
|
||||
unplaced = {
|
||||
name: fallback
|
||||
for name, links in machines.items()
|
||||
if not links.isdevice and not _seed_system(name, machines, seeds)
|
||||
}
|
||||
return attribute_systems(machines, {**seeds, **unplaced})
|
||||
|
||||
|
||||
def platform_seeds(
|
||||
stated: Iterable[tuple[str, str]],
|
||||
machines: dict[str, MachineLinks],
|
||||
|
||||
@@ -48,6 +48,7 @@ from .mame_devices import (
|
||||
attribute_softlists,
|
||||
attribute_systems,
|
||||
default_floppy_samples,
|
||||
device_systems,
|
||||
drive_form_factor,
|
||||
floppy_drives,
|
||||
floppy_sample_systems,
|
||||
@@ -70,6 +71,9 @@ _CLONE_DIR = _ROOT / "tmp" / f"mame-{os.getpid()}"
|
||||
_EMULATORS_DIR = _ROOT / "emulators"
|
||||
_PLATFORMS_DIR = _ROOT / "platforms"
|
||||
_FLOPPY_SOURCE = "src/devices/imagedev/floppy.cpp"
|
||||
# Where a device set goes when only machines no seed places load it: MAME
|
||||
# starts such a machine from its set name, as an arcade folder passes one.
|
||||
UNPLACED_SYSTEM = "arcade"
|
||||
_REPO_URL = "https://github.com/mamedev/mame.git"
|
||||
_STALE_HOURS = 24
|
||||
|
||||
@@ -570,9 +574,14 @@ def _merge_devices(args: argparse.Namespace) -> None:
|
||||
stated, conflicts = platform_seeds(
|
||||
_platform_archives(), machines, profile.get("systems") or [], written
|
||||
)
|
||||
systems = attribute_systems(machines, {**stated, **written})
|
||||
seeds = {**stated, **written}
|
||||
systems = attribute_systems(machines, seeds)
|
||||
listed = profile.get("systems") or []
|
||||
filed = device_systems(
|
||||
machines, seeds, UNPLACED_SYSTEM if UNPLACED_SYSTEM in listed else ""
|
||||
)
|
||||
for set_name, device in devices.items():
|
||||
device["systems"] = systems.get(set_name, [])
|
||||
device["systems"] = filed.get(set_name, [])
|
||||
report = merge_mame_devices(str(profile_path), devices, write=not args.dry_run)
|
||||
|
||||
shipped = upstream.list_directory(repo, commit, "hash", upstream.CACHE_DIR)
|
||||
@@ -602,10 +611,12 @@ def _merge_devices(args: argparse.Namespace) -> None:
|
||||
for set_name in report["conflict"]:
|
||||
print(f" ! {set_name}.zip is listed under another category, left as written")
|
||||
by_count = Counter(len(device["systems"]) for device in devices.values())
|
||||
fallen = sum(1 for device in devices.values() if UNPLACED_SYSTEM in device["systems"])
|
||||
print(
|
||||
f" systems: {by_count[1]} sets under one system, "
|
||||
f"{sum(n for k, n in by_count.items() if k > 1)} under several, "
|
||||
f"{by_count[0]} loaded by no placed machine "
|
||||
f"{fallen} of them under {UNPLACED_SYSTEM} (loaded by machines no entry places), "
|
||||
f"{by_count[0]} instantiated by no machine of the release "
|
||||
"(they serve every system of the profile)"
|
||||
)
|
||||
print(
|
||||
|
||||
@@ -32,6 +32,7 @@ from scripts.scraper.mame_devices import (
|
||||
attribute_softlists,
|
||||
attribute_systems,
|
||||
default_floppy_samples,
|
||||
device_systems,
|
||||
drive_form_factor,
|
||||
find_rom_block,
|
||||
floppy_drives,
|
||||
@@ -500,6 +501,37 @@ class DeviceSetsFollowTheMachinesThatLoadThem(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class MachinesNoEntryPlacesCountUnderArcade(unittest.TestCase):
|
||||
"""MAME starts any machine from its set name: a machine no seed places
|
||||
is one an arcade folder can pass it, so its devices go under arcade."""
|
||||
|
||||
def test_a_set_only_unplaced_machines_load(self):
|
||||
systems = device_systems(_release().machines, SEEDS, "arcade")
|
||||
# ibm5150 is no system of the profile, and pc_kbd only it loads.
|
||||
self.assertEqual(systems["pc_kbd"], ["arcade"])
|
||||
|
||||
def test_a_set_both_kinds_load_keeps_both(self):
|
||||
# aes is placed by no seed and loads ym2610, as the MVS does.
|
||||
systems = device_systems(_release().machines, SEEDS, "arcade")
|
||||
self.assertEqual(systems["ym2610"], ["arcade", "snk-neogeo-mvs"])
|
||||
self.assertEqual(systems["a2diskii"], ["apple2gs"])
|
||||
self.assertEqual(systems["cart_dev"], ["snk-neogeo-mvs"])
|
||||
|
||||
def test_a_set_no_machine_instantiates_keeps_none(self):
|
||||
machines = {
|
||||
**_release().machines,
|
||||
"orphan": MachineLinks("", True, ()),
|
||||
}
|
||||
systems = device_systems(machines, SEEDS, "arcade")
|
||||
self.assertNotIn("orphan", systems)
|
||||
|
||||
def test_no_fallback_listed_is_attribute_systems(self):
|
||||
machines = _release().machines
|
||||
self.assertEqual(
|
||||
device_systems(machines, SEEDS, ""), attribute_systems(machines, SEEDS)
|
||||
)
|
||||
|
||||
|
||||
class TheMergeWritesTheSystems(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
Reference in new issue
Block a user