diff --git a/platforms/_shared.yml b/platforms/_shared.yml index 96043049..9d27a273 100644 --- a/platforms/_shared.yml +++ b/platforms/_shared.yml @@ -195,8 +195,11 @@ shared_groups: destination: quasi88/N88EXT3.ROM required: true md5: "fc4b76a402ba501e6ba6de4b3e8b4273" - # Alternative naming from libretro docs (lowercase, _N suffix) - # ref: quasi88/src/libretro.c — core accepts both conventions + # N88EXT0-3.ROM above are the mkII SR extension ROMs that match N88.ROM + # (MAME pc8801mk2sr: 710a63ec, c0bd2aa6, af2b6efa, 7713c519). The core + # reads N88EXTn.ROM before n88_n.rom (src/LIBRETRO/libretro.c:109-112), + # so they win over the n88_n.rom dumps System.dat pairs with that main ROM, + # which come from other models (n88_0 61984bab is the original PC-8801's). - name: n88_0.rom destination: quasi88/n88_0.rom required: false diff --git a/platforms/retroarch.yml b/platforms/retroarch.yml index 61c6efe6..ed29e31c 100644 --- a/platforms/retroarch.yml +++ b/platforms/retroarch.yml @@ -1552,7 +1552,7 @@ systems: docs: "https://docs.libretro.com/library/np2kai/" includes: - np2kai - nec---pc-8801: + nec-pc-88: files: - name: n88_0.rom destination: quasi88/n88_0.rom @@ -1645,6 +1645,11 @@ systems: native_system: NEC - PC-8801 native_path: quasi88/n88knj2.rom native_id: NEC - PC-8801 + core: quasi88 + manufacturer: NEC + docs: "https://docs.libretro.com/library/quasi88/" + includes: + - quasi88 nec-pc-fx: files: - name: fx-scsi.rom @@ -2005,7 +2010,7 @@ systems: core: desmume manufacturer: Nintendo docs: "https://docs.libretro.com/library/desmume/" - nintendo---nintendo-dsi: + nintendo-dsi: files: - name: dsi_bios7.bin destination: dsi_bios7.bin @@ -2367,7 +2372,7 @@ systems: size: 1024 native_system: Phillips - Videopac+ native_id: Phillips - Videopac+ - philips---cd-i: + philips-cdi: files: - name: cdimono1.zip destination: cdimono1.zip @@ -4721,12 +4726,6 @@ systems: core: scummvm manufacturer: Various docs: "https://docs.libretro.com/library/scummvm/" - nec-pc-88: - includes: - - quasi88 - core: quasi88 - manufacturer: NEC - docs: "https://docs.libretro.com/library/quasi88/" xrick: files: - name: data.zip diff --git a/scripts/scraper/libretro_scraper.py b/scripts/scraper/libretro_scraper.py index a81e4530..585bef7c 100644 --- a/scripts/scraper/libretro_scraper.py +++ b/scripts/scraper/libretro_scraper.py @@ -60,6 +60,7 @@ SYSTEM_SLUG_MAP = { "Mattel - Intellivision": "mattel-intellivision", "Microsoft - MSX": "microsoft-msx", "NEC - PC Engine - TurboGrafx 16 - SuperGrafx": "nec-pc-engine", + "NEC - PC-8801": "nec-pc-88", "NEC - PC-98": "nec-pc-98", "NEC - PC-FX": "nec-pc-fx", "Nintendo - Famicom Disk System": "nintendo-fds", @@ -69,12 +70,14 @@ SYSTEM_SLUG_MAP = { "Nintendo - Gameboy Color": "nintendo-gbc", "Nintendo - Nintendo 64DD": "nintendo-64dd", "Nintendo - Nintendo DS": "nintendo-ds", + "Nintendo - Nintendo DSi": "nintendo-dsi", "Nintendo - Nintendo Entertainment System": "nintendo-nes", "Nintendo - Pokemon Mini": "nintendo-pokemon-mini", "Nintendo - Satellaview": "nintendo-satellaview", "Nintendo - SuFami Turbo": "nintendo-sufami-turbo", "Nintendo - Super Game Boy": "nintendo-sgb", "Nintendo - Super Nintendo Entertainment System": "nintendo-snes", + "Philips - CD-i": "philips-cdi", "Phillips - Videopac+": "philips-videopac", "SNK - NeoGeo CD": "snk-neogeo-cd", "ScummVM": "scummvm", @@ -259,12 +262,6 @@ class Scraper(BaseScraper): # shared groups in _shared.yml. The includes directive is resolved # at load time by load_platform_config(). EXTRA_SYSTEMS = { - "nec-pc-88": { - "includes": ["quasi88"], - "core": "quasi88", - "manufacturer": "NEC", - "docs": "https://docs.libretro.com/library/quasi88/", - }, # ref: Vircon32/libretro.c -virtual console, single BIOS "vircon32": { "files": [ @@ -470,6 +467,7 @@ class Scraper(BaseScraper): # Verified in fuse-libretro/src/compat/paths.c -core searches # system/ flat, not fuse/ subfolder. Docs are wrong on this. SYSTEM_SHARED_GROUPS = { + "nec-pc-88": ["quasi88"], "nec-pc-98": ["np2kai"], "sharp-x68000": ["keropi"], "sega-saturn": ["kronos"], diff --git a/tests/test_libretro_slugs.py b/tests/test_libretro_slugs.py new file mode 100644 index 00000000..1b52ce12 --- /dev/null +++ b/tests/test_libretro_slugs.py @@ -0,0 +1,48 @@ +"""Scraped system ids are slugs the profiles know. + +The libretro scraper filed System.dat's PC-8801, DSi and CD-i under +`nec---pc-8801`, `nintendo---nintendo-dsi` and `philips---cd-i`, fallback +slugs no profile declares. Target filtering kept the DSi BIOS in packs for +hardware without a DSi core, and PC-8801 survived only as a hand-added +duplicate system carrying the quasi88 group. +""" + +from __future__ import annotations + +import sys +import unittest +from pathlib import Path + +import yaml + +REPO_ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(REPO_ROOT / "scripts")) + + +class ScrapedSystemIdsAreSlugs(unittest.TestCase): + def test_no_fallback_slug(self): + for path in sorted((REPO_ROOT / "platforms").glob("*.yml")): + data = yaml.safe_load(path.read_text(encoding="utf-8")) or {} + systems = data.get("systems") if isinstance(data, dict) else None + for sys_id in systems or {}: + with self.subTest(platform=path.stem, system=sys_id): + self.assertNotIn("---", str(sys_id)) + + def test_pc88_keeps_the_mk2sr_extension_set(self): + """System.dat pairs the mkII SR main ROM with other models' extensions. + + The quasi88 group supplies N88EXT0-3.ROM, which the core reads first + (src/LIBRETRO/libretro.c:109-112) and which match that main ROM. + """ + from common import load_platform_config + + config = load_platform_config("retroarch", str(REPO_ROOT / "platforms")) + names = { + f.get("name") for f in config["systems"]["nec-pc-88"].get("files", []) + } + for name in ("N88EXT0.ROM", "N88EXT1.ROM", "N88EXT2.ROM", "N88EXT3.ROM"): + self.assertIn(name, names) + + +if __name__ == "__main__": + unittest.main()