From cb7700a59476d7d252cb20c5246e22713ad97f52 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 11 Nov 2026 14:57:12 +0100 Subject: [PATCH] fix: read AdvanceMAME's dir_rom list on RetroPie RetroPie writes dir_rom $romdir/mame-advmame:$romdir/arcade into the rc of each AdvanceMAME build (advmame.sh:100, configure_advmame being called by the 1.4 and 0.94 modules too). _search_list_in_roms split every list on ';', so the line was dropped and the sets landed at the BIOS root, where no build reads them. Each program's separator is now read from its own code: AdvanceMAME strtoks dir_rom on file_dir_separator(), ':' on Linux, in the three builds RetroPie ships (advance/linux/file.c:138-141, advance/osd/ fileio.c:696-699 at 96237a5, 685-688 at advancemame-1.4, 640-643 in advancemame-0.94.0). MAME splits on ';' (src/emu/fileio.cpp:56, 64, 112 at mame0289). RetroPie is rescraped at 427e762: the three passes_path records are its only change. advmame, advmame-1.4 and advmame-0.94 carry a retropie config_reads for dir_rom, read at the build RetroPie installs (96237a5, the tag advancemame-1.4 its tarball matches, the 0.94.0 tarball). The 1.4 and 0.94 profiles gain the dir_rom pool and a path for each set, and 0.94 a pin_build on rp_module_repo. Manifests: on RetroPie 55 sets of the three builds move from the BIOS root to roms/mame-advmame, the first folder of the list, which every game started from either folder reads. Seven archives other cores share stay at the root for them. No other platform changes. verify --all keeps its severity and status counts. --- emulators/advmame-0.94.yml | 42 +++++++++++++++++++++++++++ emulators/advmame-1.4.yml | 38 ++++++++++++++++++++++++ emulators/advmame.yml | 9 ++++++ platforms/retropie.yml | 27 +++++++++++++++++ scripts/scraper/retropie_launchers.py | 21 +++++++++++--- tests/test_launcher_placement.py | 20 +++++++++++++ tests/test_launchers_retropie.py | 32 ++++++++++++++++++++ 7 files changed, 185 insertions(+), 4 deletions(-) diff --git a/emulators/advmame-0.94.yml b/emulators/advmame-0.94.yml index 5e3d38983..c917fdc18 100644 --- a/emulators/advmame-0.94.yml +++ b/emulators/advmame-0.94.yml @@ -12,6 +12,20 @@ version_basis: artifact: "advancemame-0.94.0.tar.gz" mame_version: "0.94" display_name: "Arcade (AdvanceMAME 0.94)" +pin_build: + - platform: retropie + repo: "https://github.com/RetroPie/RetroPie-Setup" + revision: "427e76216633591861791cfb28807ac1039c5ea8" + path: "scriptmodules/emulators/advmame-0.94.sh" + variable: rp_module_repo + value: "file $__archive_url/advancemame-0.94.0.tar.gz" +config_reads: + - file: "advmame-0.94.rc" + platforms: [retropie] + source_ref: "advance/osd/emu.c:704-708, 732-745" + keys: + - key: "dir_rom" + source_ref: "advance/osd/fileio.c:72-86, 631-656, 746-786" mode: standalone cores: @@ -45,6 +59,9 @@ systems: - imax-macs - arcade +standalone_pools: + dir_rom: "" + notes: | AdvanceMAME 0.94.0, the MAME 0.94 core (src/version.c:1) under the Advance video, input and sound layer. The source is the release tarball that @@ -176,6 +193,7 @@ files: # SNK Neo Geo MVS - name: neogeo.zip + path: "neogeo.zip" required: true category: bios_zip system: snk-neogeo-mvs @@ -243,6 +261,7 @@ files: # IGS PGM - name: pgm.zip + path: "pgm.zip" required: true category: bios_zip system: igs-pgm @@ -266,6 +285,7 @@ files: # Sega ST-V - name: stvbios.zip + path: "stvbios.zip" required: true category: bios_zip system: sega-stv @@ -312,6 +332,7 @@ files: # Sega Mega Play - name: megaplay.zip + path: "megaplay.zip" required: true category: bios_zip system: sega-megaplay @@ -333,6 +354,7 @@ files: # Sega Mega-Tech - name: megatech.zip + path: "megatech.zip" required: true category: bios_zip system: sega-megatech @@ -346,6 +368,7 @@ files: # DECO Cassette System - name: decocass.zip + path: "decocass.zip" required: true category: bios_zip system: deco-cassette @@ -398,6 +421,7 @@ files: # Nintendo PlayChoice-10 - name: playch10.zip + path: "playch10.zip" required: true category: bios_zip system: nintendo-playch10 @@ -442,6 +466,7 @@ files: # Nintendo Super System - name: nss.zip + path: "nss.zip" required: true category: bios_zip system: nintendo-nss @@ -465,6 +490,7 @@ files: # Super Kaneko Nova System - name: skns.zip + path: "skns.zip" required: true category: bios_zip system: super-kaneko-nova @@ -495,6 +521,7 @@ files: # Konami System GX - name: konamigx.zip + path: "konamigx.zip" required: true category: bios_zip system: konami-gx @@ -508,6 +535,7 @@ files: # Konami Baby Phoenix/GV System - name: konamigv.zip + path: "konamigv.zip" required: true category: bios_zip system: konami-gv @@ -521,6 +549,7 @@ files: # Century Electronics CVS - name: cvs.zip + path: "cvs.zip" required: true category: bios_zip system: century-cvs @@ -544,6 +573,7 @@ files: # Capcom ZN1 - name: cpzn1.zip + path: "cpzn1.zip" required: true category: bios_zip system: capcom-zn1 @@ -556,6 +586,7 @@ files: # Capcom ZN2 - name: cpzn2.zip + path: "cpzn2.zip" required: true category: bios_zip system: capcom-zn2 @@ -568,6 +599,7 @@ files: # Tecmo TPS - name: tps.zip + path: "tps.zip" required: true category: bios_zip system: tecmo-tps @@ -580,6 +612,7 @@ files: # Taito FX1 - name: taitofx1.zip + path: "taitofx1.zip" required: true category: bios_zip system: taito-fx1 @@ -592,6 +625,7 @@ files: # Eighting/Raizing PS Arcade 95 - name: psarc95.zip + path: "psarc95.zip" required: true category: bios_zip system: eighting-zn1 @@ -604,6 +638,7 @@ files: # Atlus PSX - name: atluspsx.zip + path: "atluspsx.zip" required: true category: bios_zip system: atlus-zn1 @@ -616,6 +651,7 @@ files: # Atari PSX - name: atpsx.zip + path: "atpsx.zip" required: true category: bios_zip system: atari-zn1 @@ -628,6 +664,7 @@ files: # Acclaim PSX - name: acpsx.zip + path: "acpsx.zip" required: true category: bios_zip system: acclaim-zn1 @@ -640,6 +677,7 @@ files: # SNK Hyper Neo Geo 64 - name: hng64.zip + path: "hng64.zip" required: true category: bios_zip system: hyper-neogeo64 @@ -663,6 +701,7 @@ files: # Arcadia Systems - name: ar_bios.zip + path: "ar_bios.zip" required: true category: bios_zip system: arcadia-systems @@ -730,6 +769,7 @@ files: # Exidy Max-A-Flex - name: maxaflex.zip + path: "maxaflex.zip" required: true category: bios_zip system: exidy-maxaflex @@ -753,6 +793,7 @@ files: # Brezzasoft Crystal System - name: crysbios.zip + path: "crysbios.zip" required: true category: bios_zip system: brezzasoft-crystal @@ -765,6 +806,7 @@ files: # I'Max Multi Amenity Cassette System - name: macsbios.zip + path: "macsbios.zip" required: true category: bios_zip system: imax-macs diff --git a/emulators/advmame-1.4.yml b/emulators/advmame-1.4.yml index db2d0f0d5..50c0a9072 100644 --- a/emulators/advmame-1.4.yml +++ b/emulators/advmame-1.4.yml @@ -21,6 +21,15 @@ version_basis: distance: 0 mame_version: "0.106" display_name: "Arcade (AdvanceMAME 1.4)" +config_reads: + - file: "advmame-1.4.rc" + platforms: [retropie] + revision: "237ca5c898e51e1b7a70ce52bccf008aa722e924" + revision_from: "advancemame-1.4.tar.gz, which RetroPie scriptmodules/emulators/advmame-1.4.sh:16 installs at 427e762, holds the src/ and advance/ trees of the tag advancemame-1.4" + source_ref: "advance/osd/emu.c:710-714, 738-751" + keys: + - key: "dir_rom" + source_ref: "advance/osd/fileio.c:72-86, 676-701, 791-831" mode: standalone cores: @@ -55,6 +64,9 @@ systems: - arcade - barcrest-mpu4 +standalone_pools: + dir_rom: "" + notes: | AdvanceMAME 1.4, the MAME 0.106 core (src/version.c:12) under the Advance video, input and sound layer. RetroPie builds the release tarball @@ -161,6 +173,7 @@ files: # SNK Neo Geo MVS - name: neogeo.zip + path: "neogeo.zip" required: true category: bios_zip system: snk-neogeo-mvs @@ -228,6 +241,7 @@ files: # IGS PGM - name: pgm.zip + path: "pgm.zip" required: true category: bios_zip system: igs-pgm @@ -251,6 +265,7 @@ files: # Sega ST-V - name: stvbios.zip + path: "stvbios.zip" required: true category: bios_zip system: sega-stv @@ -307,6 +322,7 @@ files: # Sega Mega Play - name: megaplay.zip + path: "megaplay.zip" required: true category: bios_zip system: sega-megaplay @@ -328,6 +344,7 @@ files: # Sega Mega-Tech - name: megatech.zip + path: "megatech.zip" required: true category: bios_zip system: sega-megatech @@ -341,6 +358,7 @@ files: # DECO Cassette System - name: decocass.zip + path: "decocass.zip" required: true category: bios_zip system: deco-cassette @@ -393,6 +411,7 @@ files: # Nintendo PlayChoice-10 - name: playch10.zip + path: "playch10.zip" required: true category: bios_zip system: nintendo-playch10 @@ -444,6 +463,7 @@ files: # Nintendo Super System - name: nss.zip + path: "nss.zip" required: true category: bios_zip system: nintendo-nss @@ -472,6 +492,7 @@ files: # Super Kaneko Nova System - name: skns.zip + path: "skns.zip" required: true category: bios_zip system: super-kaneko-nova @@ -507,6 +528,7 @@ files: # Konami System GX - name: konamigx.zip + path: "konamigx.zip" required: true category: bios_zip system: konami-gx @@ -520,6 +542,7 @@ files: # Konami Baby Phoenix/GV System - name: konamigv.zip + path: "konamigv.zip" required: true category: bios_zip system: konami-gv @@ -533,6 +556,7 @@ files: # Century Electronics CVS - name: cvs.zip + path: "cvs.zip" required: true category: bios_zip system: century-cvs @@ -556,6 +580,7 @@ files: # Capcom ZN1 - name: cpzn1.zip + path: "cpzn1.zip" required: true category: bios_zip system: capcom-zn1 @@ -568,6 +593,7 @@ files: # Capcom ZN2 - name: cpzn2.zip + path: "cpzn2.zip" required: true category: bios_zip system: capcom-zn2 @@ -580,6 +606,7 @@ files: # Tecmo TPS - name: tps.zip + path: "tps.zip" required: true category: bios_zip system: tecmo-tps @@ -592,6 +619,7 @@ files: # Taito FX1 - name: taitofx1.zip + path: "taitofx1.zip" required: true category: bios_zip system: taito-fx1 @@ -604,6 +632,7 @@ files: # Eighting/Raizing PS Arcade 95 - name: psarc95.zip + path: "psarc95.zip" required: true category: bios_zip system: eighting-zn1 @@ -616,6 +645,7 @@ files: # Atlus PSX - name: atluspsx.zip + path: "atluspsx.zip" required: true category: bios_zip system: atlus-zn1 @@ -628,6 +658,7 @@ files: # Atari PSX - name: atpsx.zip + path: "atpsx.zip" required: true category: bios_zip system: atari-zn1 @@ -640,6 +671,7 @@ files: # Acclaim PSX - name: acpsx.zip + path: "acpsx.zip" required: true category: bios_zip system: acclaim-zn1 @@ -652,6 +684,7 @@ files: # SNK Hyper Neo Geo 64 - name: hng64.zip + path: "hng64.zip" required: true category: bios_zip system: hyper-neogeo64 @@ -675,6 +708,7 @@ files: # Arcadia Systems - name: ar_bios.zip + path: "ar_bios.zip" required: true category: bios_zip system: arcadia-systems @@ -742,6 +776,7 @@ files: # Exidy Max-A-Flex - name: maxaflex.zip + path: "maxaflex.zip" required: true category: bios_zip system: exidy-maxaflex @@ -765,6 +800,7 @@ files: # Brezzasoft Crystal System - name: crysbios.zip + path: "crysbios.zip" required: true category: bios_zip system: brezzasoft-crystal @@ -777,6 +813,7 @@ files: # I'Max Multi Amenity Cassette System - name: macsbios.zip + path: "macsbios.zip" required: true category: bios_zip system: imax-macs @@ -795,6 +832,7 @@ files: # Barcrest MPU4 Video - name: bctvidbs.zip + path: "bctvidbs.zip" required: true category: bios_zip system: barcrest-mpu4 diff --git a/emulators/advmame.yml b/emulators/advmame.yml index 08d2684ea..0c1679bd9 100644 --- a/emulators/advmame.yml +++ b/emulators/advmame.yml @@ -21,6 +21,15 @@ pin_build: path: "scriptmodules/emulators/advmame.sh" variable: rp_module_repo value: "git https://github.com/amadvance/advancemame" +config_reads: + - file: "advmame.rc" + platforms: [retropie] + revision: "96237a5f97a61bb9ae424536dc4223de26afce04" + revision_from: "the profile pin, the branch tip (RetroPie scriptmodules/emulators/advmame.sh:16, 39-41 at 427e762)" + source_ref: "advance/osd/emu.c:763-766, 788-800" + keys: + - key: "dir_rom" + source_ref: "advance/osd/fileio.c:72-86, 687-712, 798-829" mode: standalone cores: diff --git a/platforms/retropie.yml b/platforms/retropie.yml index f63b8e80e..73c517318 100644 --- a/platforms/retropie.yml +++ b/platforms/retropie.yml @@ -325,6 +325,15 @@ launchers: kind: package names: [] source_ref: "scriptmodules/emulators/advmame-0.94.sh:12, 16, scriptmodules/emulators/advmame.sh:147-148" +- emulator: advmame-0.94 + package: advmame-0.94 + build: standalone + kind: passes_path + names: [] + search_dir: "$romdir/mame-advmame:$romdir/arcade" + passes_to: dir_rom in $md_conf_root/mame-advmame/$md_id.rc + fails_when_missing: false + source_ref: "scriptmodules/emulators/advmame.sh:100" - emulator: advmame-1.4 package: advmame-1.4 repo: file $__archive_url/advancemame-1.4.tar.gz @@ -335,6 +344,15 @@ launchers: kind: package names: [] source_ref: "scriptmodules/emulators/advmame-1.4.sh:12, 16, scriptmodules/emulators/advmame.sh:147-148" +- emulator: advmame-1.4 + package: advmame-1.4 + build: standalone + kind: passes_path + names: [] + search_dir: "$romdir/mame-advmame:$romdir/arcade" + passes_to: dir_rom in $md_conf_root/mame-advmame/$md_id.rc + fails_when_missing: false + source_ref: "scriptmodules/emulators/advmame.sh:100" - emulator: advmame package: advmame repo: "git https://github.com/amadvance/advancemame" @@ -345,6 +363,15 @@ launchers: kind: package names: [] source_ref: "scriptmodules/emulators/advmame.sh:12, 16, 147-148" +- emulator: advmame + package: advmame + build: standalone + kind: passes_path + names: [] + search_dir: "$romdir/mame-advmame:$romdir/arcade" + passes_to: dir_rom in $md_conf_root/mame-advmame/$md_id.rc + fails_when_missing: false + source_ref: "scriptmodules/emulators/advmame.sh:100" - emulator: ags package: ags repo: "git https://github.com/adventuregamestudio/ags.git release-3.6.0" diff --git a/scripts/scraper/retropie_launchers.py b/scripts/scraper/retropie_launchers.py index e6462323c..ceb3eee99 100644 --- a/scripts/scraper/retropie_launchers.py +++ b/scripts/scraper/retropie_launchers.py @@ -473,15 +473,26 @@ class Scripts: return results -def _search_list_in_roms(event: "Event") -> bool: +# The character each program splits a search list on, read in its code. +# AdvanceMAME strtoks dir_rom on file_dir_separator(), ':' on Linux, in all +# three builds RetroPie ships (advance/linux/file.c:138-141 and +# advance/osd/fileio.c:696-699 at 96237a5, 685-688 at advancemame-1.4, +# 640-643 in advancemame-0.94.0.tar.gz). MAME's path_iterator splits on ';' +# whatever the system (src/emu/fileio.cpp:56, 64, 112 at mame0289). +LIST_SEPARATORS = {"advmame": ":", "advmame-0.94": ":", "advmame-1.4": ":"} +DEFAULT_LIST_SEPARATOR = ";" + + +def _search_list_in_roms(event: "Event", separator: str = DEFAULT_LIST_SEPARATOR) -> bool: """An iniSet whose value is a list of folders below the roms root. One folder alone is where a program writes (cfg_directory, nvram_directory - and the others MAME's mame.ini sets): a list is where it searches. + and the others MAME's mame.ini sets): a list is where it searches, split + on the separator the program reads it with. """ if len(event.words) < 3 or len(event.words[2]) != 1: return False - parts = [p for p in event.words[2][0].split(";") if p] + parts = [p for p in event.words[2][0].split(separator) if p] return len(parts) > 1 and all( p.startswith(ROMDIR + "/") or p.startswith("${romdir}/") for p in parts ) @@ -567,7 +578,9 @@ class PackageReader: if command == "iniSet" and not _mentions_bios(event.raw): # A search path below the roms root: MAME reads its samples from # samplepath $romdir/mame/samples;$romdir/arcade/samples. - if _search_list_in_roms(event): + if _search_list_in_roms( + event, LIST_SEPARATORS.get(self.package.id, DEFAULT_LIST_SEPARATOR) + ): self._ini_set(event) return if not _mentions_bios(event.raw): diff --git a/tests/test_launcher_placement.py b/tests/test_launcher_placement.py index 63ad0a9c6..0d128f3e4 100644 --- a/tests/test_launcher_placement.py +++ b/tests/test_launcher_placement.py @@ -1209,6 +1209,26 @@ class EveryCoreAFolderOffers(unittest.TestCase): self.assertIn("arcade", folders, platform) +class AdvanceMameOnRetroPie(unittest.TestCase): + """RetroPie writes dir_rom $romdir/mame-advmame:$romdir/arcade into each + AdvanceMAME build's rc (advmame.sh:100), the list the code splits on ':' + (advance/linux/file.c:138-141).""" + + def test_the_sets_go_to_the_first_folder_searched(self) -> None: + config = load_platform_config("retropie", str(REPO_ROOT / "platforms")) + profiles = load_emulator_profiles(str(REPO_ROOT / "emulators")) + tags = standalone_set(config) + for emu in ("advmame", "advmame-1.4", "advmame-0.94"): + with self.subTest(emu=emu): + placed = [ + (f.get("root"), f.get("standalone_path")) + for view, standalone in platform_layouts(emu, profiles[emu], tags) + if standalone + for f in view["files"] if isinstance(f, dict) and f["name"] == "neogeo.zip" + ] + self.assertEqual(placed, [("roms", "mame-advmame/neogeo.zip")]) + + class CoreOfferedOnSomeBoards(unittest.TestCase): """ROCKNIX writes some add_emu_core calls under a `case "${DEVICE}"` branch (emulators/package.mk:188 offers uae4arm for amiga on the devices diff --git a/tests/test_launchers_retropie.py b/tests/test_launchers_retropie.py index 1e194179a..d035724f3 100644 --- a/tests/test_launchers_retropie.py +++ b/tests/test_launchers_retropie.py @@ -278,6 +278,38 @@ class IniSearchLists(unittest.TestCase): self.assertFalse([r for r in found if "hash" in str(r.get("search_dir"))]) +ADVMAME = module("advmame", """ + function configure_advmame() { + iniConfig " " "" "$md_conf_root/mame-advmame/$md_id.rc" + iniSet "dir_rom" "$romdir/mame-advmame:$romdir/arcade" + iniSet "dir_artwork" "$romdir/mame-advmame/artwork" + addEmulator 1 "$md_id" "arcade" "$md_inst/bin/advmame %BASENAME%" + addSystem "arcade" + } +""", 95) + + +class AdvanceMameSearchList(unittest.TestCase): + """AdvanceMAME splits dir_rom on ':' (advance/linux/file.c:138-141, + advance/osd/fileio.c:696-699), and advmame.sh:100 lists two folders.""" + + def test_a_colon_list_below_the_roms_root_is_a_search_path(self): + found = [r for r in records({f"{EMULATORS}/advmame.sh": ADVMAME}, "advmame") + if r["kind"] == "passes_path"] + self.assertEqual( + [(r["search_dir"], r["passes_to"].split(" in ")[0]) for r in found], + [("$romdir/mame-advmame:$romdir/arcade", "dir_rom")], + ) + + def test_mame_does_not_read_a_colon_as_a_separator(self): + from scraper.retropie_launchers import LIST_SEPARATORS + + self.assertNotIn("mame", LIST_SEPARATORS) + self.assertEqual( + {LIST_SEPARATORS[p] for p in ("advmame", "advmame-0.94", "advmame-1.4")}, {":"} + ) + + class CommandLines(unittest.TestCase): def test_sdltrs_passes_one_rom_per_machine(self): found = records({f"{EMULATORS}/sdltrs.sh": SDLTRS}, "sdltrs")