chore: merge redump, mame and fbneo data fixes

This commit is contained in:
Abdessamad Derraz committed 2026-11-03 15:35:29 +01:00
commit c90c43fd46
28 files changed
+2971 -369

No files matched your search

+32
View File
@@ -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):
+15
View File
@@ -134,6 +134,21 @@ class TestRedumpScraper(unittest.TestCase):
["/static/bios/Nintendo%20GC.dat", "/static/bios/Sony%20PSX.dat"],
)
def test_discover_bios_routes(self):
html = (
'<td><a href="/bios/XBOX">Datfile</a></td>'
'<td><a href="/bios/GC">Datfile</a></td>'
'<td><a href="/bios/PSX">Datfile</a></td>'
'<td><a href="/bios/PS2">Datfile</a></td>'
'<td><a href="/bios/PSX">Datfile</a></td>'
'<td><a href="/datfile/psx">Datfile</a></td>'
'<td><a href="/bios/">Index</a></td>'
)
self.assertEqual(
discover_bios_datfiles(html),
["/bios/GC", "/bios/PS2", "/bios/PSX", "/bios/XBOX"],
)
def test_parse_redump_dat(self):
name, version, entries = parse_redump_dat(LOGIQX_MACHINE_FIXTURE)
self.assertEqual(name, "Sony - PlayStation - BIOS Images")
-1
View File
@@ -32,7 +32,6 @@ UNLINKED: dict[str, str] = {
# several systems' files or not reviewed as the system's own. The
# heading names the program, not the system.
"capcom-cps3": "Arcade > FBNeo",
"cps3": "Arcade > Arcade holds one CPS-3 set among every board's",
"commanderx16": "Arcade > Arcade",
"dark-forces-ii": "Game Engines > OpenJKDF2",
"fpinball": "Other > future-pinball-fploader",
+57 -2
View File
@@ -16,8 +16,8 @@ from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO_ROOT / "scripts"))
from common import SYSTEM_ALIASES, load_emulator_profiles # noqa: E402
from packextras import _slug_for # noqa: E402
from common import SYSTEM_ALIASES, _norm_system_id, load_emulator_profiles # noqa: E402
from packextras import _names_content, _slug_for # noqa: E402
class ProfilesSpellEachMachineOnce(unittest.TestCase):
@@ -35,6 +35,61 @@ class ProfilesSpellEachMachineOnce(unittest.TestCase):
self.assertEqual(sorted(set(found)), [])
class PlatformNamesReachTheProfileSystem(unittest.TestCase):
"""Folder and system names a platform gives a machine, joined to the
profile that runs it there. Each pair fell back to the whole profile in
a survey of the rom folders of 38 setups, the two spellings not meeting
once normalized."""
# (name a platform uses, profile running it there)
PAIRS = [
("apple-iigs", "mame"),
("apple2gs", "gsplus-legacy"),
("astrocde", "mame"),
("astrocade", "mame"),
("creativision", "mame"),
("gamepocketcomputer", "mame"),
("nintendo-sgb", "bsnes"),
("nintendo-sgb", "mesen-s"),
("capcom-cps1", "fbalpha2012_cps1"),
("capcom-cps2", "fbalpha2012_cps2"),
("capcom-cps3", "fbalpha2012_cps3"),
("capcom-cps1", "fbalpha2012"),
("igs-pgm", "fbalpha2012"),
]
def test_each_name_meets_a_system_of_its_profile(self):
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
unmet = [
f"{name} -> {emulator}"
for name, emulator in self.PAIRS
if _norm_system_id(name)
not in {_norm_system_id(str(s)) for s in profiles[emulator].get("systems", [])}
]
self.assertEqual(unmet, [])
def test_both_spellings_normalize_alike(self):
for alias, canonical in SYSTEM_ALIASES.items():
with self.subTest(alias=alias):
self.assertEqual(_norm_system_id(alias), _norm_system_id(canonical))
class AFoldedClaimKeepsItsProof(unittest.TestCase):
"""One spelling per machine folds bsnes-hd's SGB1.sfc onto bsnes's: the
entry still pins the bytes, so it is placed before nSide's SGB1.sfc/
tree and the file keeps its path."""
def test_a_hash_on_a_folded_claim_counts(self):
entry = {
"name": "SGB1.sfc", "md5": None, "sha1": None,
"other_claims": [{"name": "SGB1.sfc", "md5": "b15ddb15721c657d82c5bab6db982ee9"}],
}
self.assertTrue(_names_content(entry))
def test_names_alone_name_no_content(self):
self.assertFalse(_names_content({"name": "SGB1.sfc", "other_claims": [{"name": "SGB1.sfc"}]}))
class AFileGoesToItsOwnSystemFolder(unittest.TestCase):
PROFILES = {"picodrive": {"systems": ["sega-game-gear", "sega-megacd"]}}
SYSTEMS = {"sega-game-gear", "sega-mega-cd"}