fix: deliver MAME trees a search setting moves

A tree installed with MAME sits where its search setting points by
default. When a launcher passes the setting, MAME reads the folder it is
given and never the installed copy: RetroBat passes -hash bios/mame/hash
and -sp bios/mame/samples (Mame64.Generator.cs:30, 101, 106-107, 172,
177-178), KNULLI -samplepath /userdata/bios/mame/samples
(mameGenerator.py:129), RetroDECK samplepath $bios_path/mame-sa/samples
(mame/component_prepare.sh:94, 117). A bundled entry whose layout folder a
passed search setting (standalone_pools) binds is now delivered there.

A moved directory entry is found by its layout path and laid out below
the platform's folder, the folder proving nothing about content. A layout
tail two trees answer (MAME's hash/) falls back on the platform's tail. A
file the profile names itself only shadows a tree member of the same build
below the same root.

Manifests: RetroDECK gains the 19 floppy samples in bios/mame-sa/samples/
floppy. RetroBat's hash/ and samples/floppy and KNULLI's samples/floppy
reach the folders the libretro layout already fills, with the same files.
This commit is contained in:
Abdessamad Derraz committed 2026-11-10 14:04:54 +01:00
1 parent 6c41ff95ea
commit bd8cf8ed2c
2 files changed
+82 -5

No files matched your search

+34
View File
@@ -851,6 +851,40 @@ class MameSearchPaths(unittest.TestCase):
e.get("unplaced") == "outside_bios_folder" for e in self.sets(view)
))
def test_a_passed_search_setting_leaves_the_bundled_tree_unread(self) -> None:
# RetroBat passes -hash bios/mame/hash and -sp bios/mame/samples
# (Mame64.Generator.cs:30, 101, 106-107, 172, 177-178), RetroDECK
# writes samplepath $bios_path/mame-sa/samples (component_prepare.sh:94):
# the trees beside the executable are not read, the pack brings them.
for platform, tree, place in (
("retrobat", "hash/", "mame/hash/"),
("retrobat", "floppy/", "mame/samples/floppy/"),
("knulli", "floppy/", "mame/samples/floppy/"),
("retrodeck", "floppy/", "mame-sa/samples/floppy/"),
):
view = standalone_view("mame", platform)
(entry,) = [e for e in view["files"]
if e["name"] == tree and e.get("mode") == "standalone"]
self.assertEqual(entry["standalone_path"], place, platform)
self.assertNotIn("bundled", entry, platform)
# Where no launcher passes the setting, the bundled copy is read.
view = standalone_view("mame", "emudeck")
(entry,) = [e for e in view["files"]
if e["name"] == "hash/" and e.get("mode") == "standalone"]
self.assertTrue(entry.get("bundled"))
def test_a_moved_tree_is_found_by_its_layout_path(self) -> None:
from common import expand_directory_entries, load_database
db = load_database(str(REPO_ROOT / "database.json"))
view = standalone_view("mame", "retrodeck")
(tree,) = [e for e in view["files"]
if e["name"] == "floppy/" and e.get("mode") == "standalone"]
members = expand_directory_entries([tree], db, standalone=True)
self.assertEqual(len(members), 19)
for member in members:
self.assertTrue(member["path"].startswith("mame-sa/samples/floppy/"))
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")