mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 01:27:52 -06:00
chore: merge the MAME ES-DE search paths
This commit is contained in:
commit
157d60691d
25 files changed
+20031
-66
No files matched your search
@@ -1148,6 +1148,113 @@ class MameOnRetroDeckRomPaths(unittest.TestCase):
|
||||
self.assertEqual(places["stvbios.zip"] - {"arcade", "mame", "consolearcade"}, {"stv"})
|
||||
|
||||
|
||||
class LibretroMameOnEsdeRomPaths(unittest.TestCase):
|
||||
"""ES-DE hands the libretro MAME core a command line as its content,
|
||||
with -rompath "%GAMEDIRRAW%;%ROMPATH%/<system>" after the machine. The
|
||||
core passes it to MAME after its own <system>/mame/bios, and the later
|
||||
value wins (retro_init.cpp:580-597, 902-940, options.cpp:260-276)."""
|
||||
|
||||
def test_the_rom_folders_file_records_the_core(self) -> None:
|
||||
with (REPO_ROOT / "platforms" / "romfolders" / "retrodeck.yml").open() as f:
|
||||
rows = yaml.safe_load(f)["folders"]
|
||||
found = {r["folder"]: s for r in rows for s in r.get("searched_by") or []
|
||||
if s.get("core") == "mame"}
|
||||
self.assertEqual(len(found), 21)
|
||||
self.assertEqual(found["apple2"]["machines"], ["apple2e"])
|
||||
self.assertEqual(found["atari7800"]["reads"], ["atari7800"])
|
||||
self.assertEqual(found["atari7800"]["emulator"], "retroarch")
|
||||
|
||||
def test_sets_also_land_in_the_folder_the_command_names(self) -> None:
|
||||
# RetroDECK's roms/ sits beside bios/ in the install tree.
|
||||
for platform, read in (("retrodeck", ("", "roms/gamate/gamate.zip")),
|
||||
("emudeck", ("roms", "gamate/gamate.zip"))):
|
||||
view = libretro_view("mame", platform)
|
||||
places = {(e.get("root") or "", e["path"]) for e in view["files"]
|
||||
if e["name"] == "gamate.zip"}
|
||||
self.assertEqual(places, {("", "mame/bios/gamate.zip"), read}, platform)
|
||||
|
||||
|
||||
class StandaloneMameOnEmuDeck(unittest.TestCase):
|
||||
"""EmuDeck writes mame.ini rompath roms/arcade;bios;bios/mame
|
||||
(emuDeckMAME.sh:66-68), read when Steam ROM Manager starts MAME with no
|
||||
-rompath (tools/launchers/mame.sh). ES-DE's commands pass their own."""
|
||||
|
||||
def test_a_set_keeps_its_ini_place_and_gains_the_command_folder(self) -> None:
|
||||
view = standalone_view("mame", "emudeck")
|
||||
places = {(e.get("root") or "", e["standalone_path"]) for e in view["files"]
|
||||
if e["name"] == "adam.zip"}
|
||||
self.assertIn(("", "adam.zip"), places)
|
||||
self.assertIn(("roms", "adam/adam.zip"), places)
|
||||
|
||||
|
||||
class EveryCoreAFolderOffers(unittest.TestCase):
|
||||
"""AmberELEC's es_systems.cfg, EmuELEC's es_systems.json and ROCKNIX's
|
||||
add_emu_core calls offer several cores per folder, the user's choice
|
||||
starting any of them."""
|
||||
|
||||
def test_the_rom_folders_files_record_the_offers(self) -> None:
|
||||
for setup, folder, core in (("amberelec", "arcade", "mame2010"),
|
||||
("emuelec", "arcade", "mame2010"),
|
||||
("rocknix", "arcade", "mame2010")):
|
||||
with (REPO_ROOT / "platforms" / "romfolders" / f"{setup}.yml").open() as f:
|
||||
rows = {r["folder"]: r for r in yaml.safe_load(f)["folders"]}
|
||||
self.assertIn(core, {o["core"] for o in rows[folder].get("offers") or []}, setup)
|
||||
|
||||
def test_an_offered_core_reads_its_sets_in_that_folder(self) -> None:
|
||||
for platform in ("amberelec", "rocknix"):
|
||||
view = libretro_view("mame2010", platform)
|
||||
folders = {e["path"].split("/")[0] for e in view["files"]
|
||||
if e.get("category") == "bios_zip" and e.get("layout_path")}
|
||||
self.assertIn("arcade", folders, platform)
|
||||
|
||||
|
||||
def platform_manifest(platform: str) -> dict:
|
||||
from common import load_database
|
||||
|
||||
db = load_database(str(REPO_ROOT / "database.json"))
|
||||
with redirect_stdout(io.StringIO()):
|
||||
return generate_manifest(
|
||||
platform, str(REPO_ROOT / "platforms"), db, str(REPO_ROOT / "bios"),
|
||||
str(REPO_ROOT / "platforms" / "_registry.yml"),
|
||||
emulators_dir=str(REPO_ROOT / "emulators"), offline=True,
|
||||
)
|
||||
|
||||
|
||||
class ArchiveSharedByOfferedCores(unittest.TestCase):
|
||||
"""One path holds one file: several cores reading an archive in one roms
|
||||
folder get the copy of the core the folder starts by default, then the
|
||||
copy serving the most of them."""
|
||||
|
||||
def test_the_default_core_copy_takes_the_folder(self) -> None:
|
||||
# EmuELEC's arcade folder starts MAME 2003-Plus by default
|
||||
# (es_systems.json:82), AdvanceMAME reads its sets there too.
|
||||
(entry,) = [f for f in platform_manifest("emuelec")["files"]
|
||||
if f["dest"] == "arcade/neogeo.zip"]
|
||||
self.assertEqual(entry["cores"], ["mame2003_plus"])
|
||||
self.assertTrue(entry["repo_path"].endswith("neogeo.zip.74df3258"))
|
||||
others = {c for a in entry.get("alternatives", []) for c in a["cores"]}
|
||||
self.assertIn("advancemame", others)
|
||||
|
||||
def test_offered_cores_join_the_default_one(self) -> None:
|
||||
# AmberELEC's arcade folder starts MAME 2003-Plus and offers MAME
|
||||
# 2000, 2010, 2015 and 2016 (es_systems.cfg:116-150).
|
||||
(entry,) = [f for f in platform_manifest("amberelec")["files"]
|
||||
if f["dest"] == "arcade/neogeo.zip"]
|
||||
self.assertEqual(entry["cores"], ["mame2003_plus"])
|
||||
self.assertTrue(entry["repo_path"].endswith("neogeo.zip.74df3258"))
|
||||
others = {c for a in entry.get("alternatives", []) for c in a["cores"]}
|
||||
self.assertLessEqual({"mame2000", "mame2010", "mame2015", "mame2016"}, others)
|
||||
|
||||
def test_the_copy_serving_most_cores_wins_without_a_default(self) -> None:
|
||||
# RetroDECK's cps folders start the libretro MAME core, whose sets are
|
||||
# in mame/bios. Of the cores reading nss.zip in cps1, MAME 2003-Plus
|
||||
# alone lists members, and only its copy holds them.
|
||||
(entry,) = [f for f in platform_manifest("retrodeck")["files"]
|
||||
if f["dest"] == "roms/cps1/nss.zip"]
|
||||
self.assertEqual(entry["cores"], ["mame2003_plus"])
|
||||
self.assertTrue(entry["repo_path"].endswith("nss.zip.cba0bd8c"))
|
||||
|
||||
|
||||
class MacBootDisksOnKnulli(unittest.TestCase):
|
||||
def test_the_hard_records_bind(self) -> None:
|
||||
# mameGenerator.py and libretroMAMEConfig.py pass the boot disk as
|
||||
|
||||
@@ -133,6 +133,13 @@ class EsXmlFormat(unittest.TestCase):
|
||||
self.assertEqual(rows["psx"]["board_defaults"]["rk3326"]["core"], "duckstation")
|
||||
self.assertNotIn("board_defaults", rows["mame"])
|
||||
|
||||
def test_every_core_the_system_lists_is_offered(self) -> None:
|
||||
self.assertEqual(self.rows["psx"]["offers"], [
|
||||
{"emulator": "retroarch", "core": "pcsx_rearmed"},
|
||||
{"emulator": "retroarch", "core": "swanstation"}])
|
||||
# A default alone is no choice.
|
||||
self.assertNotIn("offers", self.rows["mame"])
|
||||
|
||||
def test_source_ref_points_at_the_name_line(self) -> None:
|
||||
self.assertEqual(self.rows["psx"]["source_ref"], "os es_systems.cfg:4")
|
||||
self.assertEqual(self.rows["advision"]["source_ref"], "os es_systems.cfg:20")
|
||||
@@ -173,6 +180,11 @@ class ElecConfFormat(unittest.TestCase):
|
||||
"DEVICE=RK3326": {"core": "pcsx_rearmed", "emulator": "retroarch",
|
||||
"source_ref": "os package.mk:11"}})
|
||||
|
||||
def test_a_core_under_every_branch_is_offered_unconditionally(self) -> None:
|
||||
self.assertEqual(self.rows["psx"]["offers"], [
|
||||
{"emulator": "retroarch", "core": "pcsx_rearmed", "source_ref": "os package.mk:11,16"},
|
||||
{"emulator": "retroarch", "core": "swanstation", "source_ref": "os package.mk:12,15"}])
|
||||
|
||||
def test_unconditional_default(self) -> None:
|
||||
self.assertEqual(self.rows["3do"]["core"], "opera")
|
||||
self.assertEqual(self.rows["3do"]["source_ref"],
|
||||
@@ -207,12 +219,24 @@ class EsdeFormat(unittest.TestCase):
|
||||
self.assertNotIn("any_machine", tano)
|
||||
self.assertEqual(tano["source_ref"], "os es_systems.xml:20")
|
||||
|
||||
def test_the_game_itself_as_machine_and_libretro_left_out(self) -> None:
|
||||
(arcade,) = self.rows["arcade"]["searched_by"]
|
||||
self.assertEqual(arcade["emulator"], "mame")
|
||||
self.assertTrue(arcade["any_machine"])
|
||||
self.assertNotIn("machines", arcade)
|
||||
def test_the_game_itself_as_machine(self) -> None:
|
||||
libretro, standalone = self.rows["arcade"]["searched_by"]
|
||||
self.assertEqual(standalone["emulator"], "mame")
|
||||
self.assertNotIn("core", standalone)
|
||||
self.assertTrue(standalone["any_machine"])
|
||||
self.assertNotIn("machines", standalone)
|
||||
self.assertNotIn("searched_by", self.rows["psx"])
|
||||
# The libretro core reads the -rompath of the command line it is
|
||||
# handed as content (retro_init.cpp execute_game_cmd).
|
||||
self.assertEqual((libretro["emulator"], libretro["core"]), ("retroarch", "mame"))
|
||||
self.assertEqual(libretro["reads"], ["arcade"])
|
||||
self.assertTrue(libretro["any_machine"])
|
||||
self.assertEqual(libretro["source_ref"], "os es_systems.xml:27")
|
||||
|
||||
def test_each_command_offers_its_emulator(self) -> None:
|
||||
self.assertEqual(self.rows["arcade"]["offers"], [
|
||||
{"emulator": "retroarch", "core": "mame", "source_ref": "os es_systems.xml:27"},
|
||||
{"emulator": "mame", "core": "mame", "source_ref": "os es_systems.xml:28"}])
|
||||
|
||||
def test_first_command_without_alternative(self) -> None:
|
||||
rows = by_folder(scrape("esde", "esde", {"systems": {"source": "os", "path": "es_systems.xml"}}))
|
||||
|
||||
Reference in new issue
Block a user