mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-18 15:47:51 -06:00
fix: read MAME's sets through its search paths
MAME splits rompath, samplepath, hashpath and pluginspath on semicolons and tries each directory in turn (src/emu/fileio.cpp:53-58, 330-392, src/emu/emuopts.cpp:44-46, 53). The launcher records spell those lists with the game's own folder in them, which handed_directories skipped: - RetroBat passes -rp bios;<rom directory> (Mame64.Generator.cs:93-96) and -rompath bios/psxmame/bios;<rom directory> to pSxMAME (PSXMame.Generator.cs:38-48). - KNULLI passes -rompath <romDirname>;/userdata/bios/mame;/userdata/bios (mameGenerator.py:116-122). - RetroPie writes rompath $romdir/mame;$romdir/arcade;$biosdir/mame (mame.sh:133). A semicolon list now gives each directory but the game's folder. A pool that already lists the folder the files take keeps them there, and a pool standing for the whole layout holds its files, never its folders. The MAME profile names its sets at the top of the rompath and its search settings as pools, pSxMAME its sets and rompath. RetroBat's -sp and -hash records split on `bool hbmame = emulator == "hbmame"` (Mame64.Generator.cs:30): bios/mame/samples for mame64, bios/hbmame/samples for hbmame. Manifests: RetroBat gains the 12 pSxMAME sets in psxmame/bios and drops samples/bbc.zip, read by nobody, which mame/samples/bbc.zip already serves. KNULLI drops the same copy. RetroPie gains the 1427 MAME sets in BIOS/mame, the root copies staying for the libretro cores. EmuDeck names samples/bbc.zip as read outside the BIOS folder. RetroDECK's samplepath is $bios_path/mame-sa/samples (mame/component_prepare.sh:94, 117): bbc.zip moves there from bios/samples/. Its MAME runs with the -rompath ES-DE passes, %GAMEDIR%;%ROMPATH%/<system>, so the standalone sets are named as read outside the BIOS folder and the root copies stay for the libretro core. The 1427 sets of RetroBat, KNULLI and EmuDeck stay at the BIOS root, listed in their rompath. No file of any manifest is lost.
This commit is contained in:
1 parent
5e13f11e3f
commit
6947df629a
7 files changed
+1665
-22
No files matched your search
@@ -807,5 +807,57 @@ class DolphinUserDirectory(unittest.TestCase):
|
||||
self.assertEqual(ipl.get("unplaced"), "outside_bios_folder")
|
||||
|
||||
|
||||
class MameSearchPaths(unittest.TestCase):
|
||||
"""MAME reads each semicolon-separated search path in turn
|
||||
(src/emu/fileio.cpp:53-58, 330-392)."""
|
||||
|
||||
def sets(self, view: dict) -> list[dict]:
|
||||
return [e for e in view["files"] if e.get("category") == "bios_zip"]
|
||||
|
||||
def test_retrobat_keeps_the_sets_at_the_bios_root(self) -> None:
|
||||
# -rp bios;<rom directory> (Mame64.Generator.cs:93-96).
|
||||
view = standalone_view("mame", "retrobat")
|
||||
sets = self.sets(view)
|
||||
self.assertGreater(len(sets), 1000)
|
||||
for entry in sets:
|
||||
self.assertEqual(entry["standalone_path"], entry["name"])
|
||||
self.assertNotIn("unplaced", entry)
|
||||
(bbc,) = [e for e in view["files"] if e["name"] == "bbc.zip"]
|
||||
# -sp bios/mame/samples, hbmame's folder being another record
|
||||
# (Mame64.Generator.cs:30, 101, 106-107).
|
||||
self.assertEqual(bbc["standalone_path"], "mame/samples/bbc.zip")
|
||||
|
||||
def test_knulli_keeps_the_root_listed_after_bios_mame(self) -> None:
|
||||
# -rompath <romDirname>;/userdata/bios/mame;/userdata/bios (mameGenerator.py:116-122).
|
||||
view = standalone_view("mame", "knulli")
|
||||
self.assertTrue(all(e["standalone_path"] == e["name"] for e in self.sets(view)))
|
||||
(bbc,) = [e for e in view["files"] if e["name"] == "bbc.zip"]
|
||||
self.assertEqual(bbc["standalone_path"], "mame/samples/bbc.zip")
|
||||
|
||||
def test_retropie_moves_the_sets_to_bios_mame(self) -> None:
|
||||
# rompath $romdir/mame;$romdir/arcade;$biosdir/mame (mame.sh:133).
|
||||
view = standalone_view("mame", "retropie")
|
||||
self.assertTrue(all(
|
||||
e["standalone_path"] == "mame/" + e["name"] for e in self.sets(view)
|
||||
))
|
||||
|
||||
def test_retrodeck_reads_samples_in_mame_sa(self) -> None:
|
||||
# samplepath $bios_path/mame-sa/samples (mame/component_prepare.sh:94, 117).
|
||||
view = standalone_view("mame", "retrodeck")
|
||||
(bbc,) = [e for e in view["files"] if e["name"] == "bbc.zip"]
|
||||
self.assertEqual(bbc["standalone_path"], "mame-sa/samples/bbc.zip")
|
||||
# ES-DE hands -rompath %GAMEDIR%;%ROMPATH%/<system>: no BIOS folder.
|
||||
self.assertTrue(all(
|
||||
e.get("unplaced") == "outside_bios_folder" for e in self.sets(view)
|
||||
))
|
||||
|
||||
def test_psxmame_reads_bios_psxmame_bios(self) -> None:
|
||||
# -rompath bios/psxmame/bios;<rom directory> (PSXMame.Generator.cs:38-48).
|
||||
view = standalone_view("psxmame", "retrobat")
|
||||
self.assertTrue(view["files"])
|
||||
for entry in view["files"]:
|
||||
self.assertEqual(entry["standalone_path"], "psxmame/bios/" + entry["name"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -33,6 +33,7 @@ from common import ( # noqa: E402
|
||||
system_file_index,
|
||||
)
|
||||
from launchers import ( # noqa: E402
|
||||
SEARCHED_FILES,
|
||||
bound_path,
|
||||
handed_directories,
|
||||
normalize_handle,
|
||||
@@ -205,7 +206,38 @@ class SearchLists(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
bind(config(passes("emu", "$roms_path/coco:$bios_path/xroar", "xroar.conf rompath")),
|
||||
[], {"rompath": ""}),
|
||||
{"": ("", "xroar")},
|
||||
{SEARCHED_FILES: ("", "xroar")},
|
||||
)
|
||||
|
||||
def test_a_semicolon_list_leaves_out_the_game_folder(self) -> None:
|
||||
# MAME splits its search paths on semicolons (src/emu/fileio.cpp:53-58).
|
||||
found = handed_directories(config(passes(
|
||||
"emu", "<romDirname>;/userdata/bios/mame;/userdata/bios", "command line -rompath",
|
||||
)))
|
||||
self.assertEqual([h.folder for h in found], ["mame", ""])
|
||||
found = handed_directories(config(passes(
|
||||
"emu", "bios;<rom directory>", "command line -rp bios;<rom directory>",
|
||||
)))
|
||||
self.assertEqual([(h.folder, "-rp" in h.handles) for h in found], [("", True)])
|
||||
|
||||
def test_a_list_holding_the_files_folder_keeps_them_there(self) -> None:
|
||||
# KNULLI lists bios/mame before bios: the sets at the root stay.
|
||||
cfg = config(passes(
|
||||
"emu", "<romDirname>;/userdata/bios/mame;/userdata/bios", "command line -rompath",
|
||||
))
|
||||
cfg["systems"] = {"x": {"files": [{"name": "a.rom", "destination": "mame/a.rom"}]}}
|
||||
self.assertEqual(bind(cfg, [], {"-rompath": ""}), {SEARCHED_FILES: ("", "")})
|
||||
# Without the root, the first folder of the BIOS tree.
|
||||
cfg = config(passes("emu", "$romdir/mame;$biosdir/mame", "rompath in mame.ini"))
|
||||
self.assertEqual(bind(cfg, [], {"rompath": ""}), {SEARCHED_FILES: ("", "mame")})
|
||||
|
||||
def test_a_whole_layout_list_holds_files_not_folders(self) -> None:
|
||||
found = {SEARCHED_FILES: ("", "mame")}
|
||||
self.assertEqual(bound_path("neogeo.zip", found), ("", "mame/neogeo.zip"))
|
||||
self.assertIsNone(bound_path("samples/bbc.zip", found))
|
||||
self.assertEqual(
|
||||
bound_path("samples/bbc.zip", {**found, "samples": ("", "mame-sa/samples")}),
|
||||
("", "mame-sa/samples/bbc.zip"),
|
||||
)
|
||||
|
||||
def test_a_drive_letter_is_one_directory(self) -> None:
|
||||
@@ -241,11 +273,11 @@ class PerSystem(unittest.TestCase):
|
||||
POOLS = {"-rompath": ""}
|
||||
|
||||
def test_the_system_record_wins_for_its_system(self) -> None:
|
||||
self.assertEqual(bind(self.CFG, [], self.POOLS, ("coco",)), {"": ("", "coco")})
|
||||
self.assertEqual(bind(self.CFG, [], self.POOLS, ("coco",)), {SEARCHED_FILES: ("", "coco")})
|
||||
|
||||
def test_another_system_keeps_the_generic_record(self) -> None:
|
||||
self.assertEqual(bind(self.CFG, [], self.POOLS, ("dragon32",)), {"": ("", "dragon")})
|
||||
self.assertEqual(bind(self.CFG, [], self.POOLS), {"": ("", "dragon")})
|
||||
self.assertEqual(bind(self.CFG, [], self.POOLS, ("dragon32",)), {SEARCHED_FILES: ("", "dragon")})
|
||||
self.assertEqual(bind(self.CFG, [], self.POOLS), {SEARCHED_FILES: ("", "dragon")})
|
||||
|
||||
def test_native_names_are_read_as_our_ids(self) -> None:
|
||||
cfg = {
|
||||
@@ -270,7 +302,7 @@ class PerSystem(unittest.TestCase):
|
||||
[("dragon", ["dragon64"]), ("trs80coco", ["coco"])],
|
||||
)
|
||||
self.assertEqual(bind(cfg, [], self.POOLS | {"-rompath": ""}, ("coco",)),
|
||||
{"": ("", "trs80coco")})
|
||||
{SEARCHED_FILES: ("", "trs80coco")})
|
||||
self.assertEqual(bind(cfg, [], {"-rompath": ""}, ("dragon32",)), {})
|
||||
|
||||
def test_an_entry_is_launched_for_the_system_that_declares_its_name(self) -> None:
|
||||
|
||||
Reference in new issue
Block a user