feat: read Batocera's MAME search paths

Batocera starts MAME with -rompath <romDirname>;/userdata/bios/mame;
/userdata/bios, /userdata/roms/mame and the softlist folder added for
MESS systems, and -samplepath, -artpath and -crosshairpath below
/userdata/bios/mame (generators/mame/mameGenerator.py:129-143, 189 at
batocera-43.1, MAME_BIOS in mamePaths.py). No extractor read that
generator. It now goes through the generic reader KNULLI uses for its fork
of the same file, keeping the command line search settings: the
Macintosh boot disk the command names is a file.

Rescraped at batocera-43.1: the six records are the only change.

Manifests: Batocera drops samples/bbc.zip at the BIOS root, read by
neither build. mame/samples/bbc.zip, which its list declares, serves both.
The sets stay at the BIOS root, which the rompath lists.
This commit is contained in:
Abdessamad Derraz committed 2026-11-10 14:05:10 +01:00
1 parent 83e901a5d4
commit 409578e20e
4 files changed
+124 -1

No files matched your search

+8
View File
@@ -885,6 +885,14 @@ class MameSearchPaths(unittest.TestCase):
("mame/samples/floppy/", "roms"))
self.assertNotIn("bundled", tree)
def test_batocera_keeps_the_sets_at_the_root_and_samples_in_bios_mame(self) -> None:
# -rompath <romDirname>;/userdata/bios/mame;/userdata/bios and
# -samplepath /userdata/bios/mame/samples (mameGenerator.py:129-142).
view = standalone_view("mame", "batocera")
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_a_moved_tree_is_found_by_its_layout_path(self) -> None:
from common import expand_directory_entries, load_database
+40
View File
@@ -529,6 +529,46 @@ OPENMSX_FILEPOOL = ''' def generate(self, system, rom):
file.write("filepool add -path /userdata/bios/openmsx -types system_rom -position 2\\n")'''
MAME = f"{GENERATORS}/mame/mameGenerator.py"
MAME_PATHS = f"{GENERATORS}/mame/mamePaths.py"
MAME_HEAD = """from __future__ import annotations
from ...batoceraPaths import BIOS
from .mamePaths import MAME_BIOS
class MameGenerator:
def generate(self, system, rom, playersControllers, metadata, guns, wheels, gameResolution):"""
MAME_COMMAND = """ if messMode == -1:
commandArray += [ "-rompath", f"{romDirname};{MAME_BIOS};{BIOS}" ]"""
MAME_SAMPLES = """ commandArray += [ "-samplepath", MAME_BIOS / "samples" ]"""
MAME_BOOT = """ if boot_disk:
bootDisk = f"/userdata/bios/{boot_disk}.img"
commandArray += [ bootType, bootDisk ]"""
class MameSearchPaths(unittest.TestCase):
"""mameGenerator.py:129-142 at batocera-43.1: -rompath and -samplepath."""
def test_the_command_line_search_paths_are_recorded(self):
from scraper.batocera_launchers import search_paths
cg = configgen({
MAME: placed({1: MAME_HEAD, 129: MAME_COMMAND, 142: MAME_SAMPLES, 378: MAME_BOOT}),
MAME_PATHS: "from ...batoceraPaths import BIOS\nMAME_BIOS = BIOS / 'mame'\n",
})
records = [r.entry() for r in search_paths(cg)]
self.assertEqual(
[(r["emulator"], r["search_dir"], r["passes_to"], r.get("depends_on_option"))
for r in records],
[
("mame", "<romDirname>;/userdata/bios/mame;/userdata/bios",
"command line -rompath", "messMode == -1"),
("mame", "/userdata/bios/mame/samples", "command line -samplepath", None),
],
)
self.assertEqual(records[0]["source_ref"], f"{MAME}:129-130")
# The boot disk the command names is a file, no search path.
self.assertFalse([r for r in records if "boot_disk" in r["search_dir"]])
class ConfigDirectories(unittest.TestCase):
"""A BIOS directory written into the emulator's config, at batocera-43.1."""