chore: merge the last MAME fixes

This commit is contained in:
Abdessamad Derraz committed 2026-11-11 15:23:57 +01:00
commit 3bebf75da5
77 files changed
+2424 -327

No files matched your search

@@ -205,6 +205,7 @@ def build_index(
if n not in bios_names and not e.isdevice and e.runnable and (e.has_roms or e.disks)
}
bios: dict[str, set[str]] = {}
parents: dict[str, set[str]] = {}
devices: dict[str, set[str]] = {}
missing: dict[str, str] = {}
for name, entry in games.items():
@@ -218,6 +219,12 @@ def build_index(
break
if current in bios_names and parent.has_roms:
bios.setdefault(archive(current, current), set()).add(name)
elif current not in bios_names and parent.has_roms:
# A clone's ROM shared with its parent is looked up in the
# parent's archive too: MAME's search path is the set and
# every ancestor (src/emu/driver.cpp:31-38,
# src/emu/romload.cpp:67-84 at mame0289).
parents.setdefault(archive(current, current), set()).add(name)
current = parent.romof
for device in set(entry.devices) & device_roms:
devices.setdefault(device, set()).add(name)
@@ -231,6 +238,7 @@ def build_index(
sources.setdefault(entry.source, set()).add(archive(name, name))
return {
"bios": {k: sorted(v) for k, v in sorted(bios.items())},
"parents": {k: sorted(v) for k, v in sorted(parents.items())},
"devices": {k: sorted(v) for k, v in sorted(devices.items())},
"chd": sorted(n for n, e in games.items() if e.disks),
"missing_parents": dict(sorted(missing.items())),
+17 -4
View File
@@ -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):