mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-12 21:13:49 -06:00
fix: place xroar ROMs in each rompath
XRoar reads a ROM by name from the directories of rompath. The entries
take their file name as path, relative to ~/.xroar/roms or
${prefix}/share/xroar/roms, and rompath and -rompath are declared as
search lists.
Batocera records its rompath line, Recalbox -rompath bios/<system>
(the placeholder its extractor already writes), RetroBat its -rompath
as two records, bios/dragon and bios/coco for coco. An entry whose
name the platform list does not declare follows the launch its
profile system is listed under: Recalbox lists mc10.rom under
trs80coco, so alice.rom is read there.
Batocera ROMs move from the BIOS root to bios/xroar, Recalbox ROMs to
bios/dragon and bios/trs80coco, RetroBat ROMs to bios/dragon and
bios/coco. RetroDECK and RetroPie keep them at the BIOS root.
This commit is contained in:
1 parent
e6dbbe69ed
commit
8ec0c5482c
13 files changed
+279
-19
No files matched your search
+14
-1
@@ -2945,9 +2945,22 @@ def platform_layouts(
|
||||
profile.get("standalone_directories") or profile.get("standalone_pools")
|
||||
) and any(h.systems and h.emulator in names for h in _handed(standalone_cores))
|
||||
index = system_file_index(standalone_cores) if per_system else {}
|
||||
# A profile system the platform launches under a system of its own, as
|
||||
# its list says for one entry, is launched there for every entry:
|
||||
# Recalbox lists mc10.rom under trs80coco, so alice.rom is read there.
|
||||
family: dict[str, set[str]] = {}
|
||||
for f in (profile.get("files") or []) if per_system else []:
|
||||
if isinstance(f, dict):
|
||||
own = entry_launch_systems(f, {})
|
||||
for system in own:
|
||||
family.setdefault(system, set()).update(entry_launch_systems(f, index) - own)
|
||||
|
||||
def bindings_of(entry: dict) -> dict[str, tuple[str, str]]:
|
||||
systems = entry_launch_systems(entry, index) if per_system else frozenset()
|
||||
systems = frozenset()
|
||||
if per_system:
|
||||
systems = entry_launch_systems(entry, index)
|
||||
if systems == entry_launch_systems(entry, {}):
|
||||
systems = systems.union(*(family.get(s, set()) for s in systems))
|
||||
if systems not in by_systems:
|
||||
by_systems[systems] = standalone_bindings_for(
|
||||
emu_name, profile, standalone_cores, systems
|
||||
|
||||
@@ -399,8 +399,9 @@ class HandedDirectory:
|
||||
|
||||
|
||||
# The placeholder a launcher record writes for the system it is launched
|
||||
# for: Recalbox passes -rompath os.path.join(BIOS, args.system) to XRoar.
|
||||
SYSTEM_PLACEHOLDER = "{system}"
|
||||
# for, as Recalbox's extractor spells it: Recalbox passes XRoar -rompath
|
||||
# os.path.join(BIOS, args.system).
|
||||
SYSTEM_PLACEHOLDER = "<system>"
|
||||
|
||||
|
||||
def native_systems(config: dict) -> dict[str, str]:
|
||||
@@ -442,7 +443,7 @@ def handed_directories(config: dict) -> list[HandedDirectory]:
|
||||
describing several directories in prose names no single one. A search
|
||||
path (XRoar's rompath) gives each of its directories, in order. A record
|
||||
naming systems applies to those systems only, and one whose search_dir
|
||||
holds {system} gives one directory per system the platform declares.
|
||||
holds <system> gives one directory per system the platform declares.
|
||||
"""
|
||||
base = str(config.get("base_destination") or "bios")
|
||||
natives = native_systems(config)
|
||||
|
||||
@@ -901,8 +901,8 @@ def environment_directories(cg: Configgen) -> list[Launcher]:
|
||||
|
||||
# Generators that hand the emulator a /userdata/bios directory through its
|
||||
# configuration: a line written to the file it reads (openMSX's script.tcl
|
||||
# filepool entries) or a key saved to it.
|
||||
CONFIG_DIRECTORY_GENERATORS = ("openmsx.openmsxGenerator",)
|
||||
# filepool entries, xroar.conf rompath) or a key saved to it.
|
||||
CONFIG_DIRECTORY_GENERATORS = ("openmsx.openmsxGenerator", "xroar.xroarGenerator")
|
||||
|
||||
|
||||
def config_directories(
|
||||
|
||||
@@ -39,6 +39,7 @@ CORES = f"{GENERATORS}/libretro/libretroCores.py"
|
||||
LIBRETRO_GENERATOR = f"{GENERATORS}/libretro/libretroGenerator.py"
|
||||
HATARI = f"{GENERATORS}/hatari/hatariGenerator.py"
|
||||
GSPLUS = f"{GENERATORS}/gsplus/gsplusGenerator.py"
|
||||
XROAR = f"{GENERATORS}/xroar/xroarGenerator.py"
|
||||
AMIBERRY_GENERATOR = f"{GENERATORS}/amiberry/amiberryGenerator.py"
|
||||
AMIBERRY_KICKSTARTS = f"{GENERATORS}/amiberry/amiberryKickstarts.py"
|
||||
AMIBERRY_SUBSYSTEMS = f"{GENERATORS}/amiberry/amiberrySubSystems.py"
|
||||
@@ -52,7 +53,7 @@ MUPEN_CONFIG = f"{GENERATORS}/mupen/mupenConfig.py"
|
||||
SOURCE_FILES = (
|
||||
FILES_MODULE, LAUNCHER, RETROARCH, CORES, LIBRETRO_GENERATOR, HATARI, GSPLUS,
|
||||
AMIBERRY_KICKSTARTS, AMIBERRY_SUBSYSTEMS, AMIBERRY_CONFIG, PCSX2, DOLPHIN, XEMU,
|
||||
MUPEN_CONFIG,
|
||||
MUPEN_CONFIG, XROAR,
|
||||
)
|
||||
|
||||
# Recalbox's system.ini runs every libretro core as `emulator = libretro`:
|
||||
@@ -1171,8 +1172,32 @@ def core_file_options(cg: Configgen, directories: list[Launcher]) -> list[Launch
|
||||
return launchers
|
||||
|
||||
|
||||
def xroar(cg: Configgen) -> list[Launcher]:
|
||||
"""-rompath os.path.join(recalboxFiles.BIOS, args.system) on the command line."""
|
||||
src = cg.source(XROAR)
|
||||
generate = src.function("generate")
|
||||
# args.system is the ES system name, as self.system.Name is elsewhere.
|
||||
env = {**cg.env(src, generate), "args.system": SYSTEM_PLACEHOLDER}
|
||||
found = [
|
||||
(flag, value)
|
||||
for node in ast.walk(generate)
|
||||
if isinstance(node, ast.List)
|
||||
for flag, value in zip(node.elts, node.elts[1:])
|
||||
if isinstance(flag, ast.Constant) and flag.value == "-rompath"
|
||||
]
|
||||
if len(found) != 1:
|
||||
src.fail(f"expected one -rompath on the command line, found {len(found)}")
|
||||
flag, value = found[0]
|
||||
directory = cg.bios_dir(spell(value, env), src, "-rompath")
|
||||
return [Launcher(
|
||||
emulator=cg.emulator(XROAR), build="standalone", kind="passes_path", names=[],
|
||||
search_dir=directory, passes_to="command line -rompath",
|
||||
source_ref=src.ref([(flag.lineno, value.end_lineno)]),
|
||||
)]
|
||||
|
||||
|
||||
STANDALONE: tuple[Callable[[Configgen], list[Launcher]], ...] = (
|
||||
hatari, gsplus, amiberry, pcsx2, xemu, mupen64plus,
|
||||
hatari, gsplus, amiberry, pcsx2, xemu, mupen64plus, xroar,
|
||||
)
|
||||
LIBRETRO: tuple[Callable[[Configgen], list[Launcher]], ...] = (
|
||||
core_assets, hatari_libretro, content_files,
|
||||
|
||||
@@ -2976,7 +2976,11 @@ def xroar(sources: dict[str, Source]) -> list[Record]:
|
||||
found = _argument_paths(src, "xroar", "standalone")
|
||||
if not found:
|
||||
raise LauncherPatternMissing(src.path, "rompath argument")
|
||||
records = [_with_conditions(record, conditions) for record, conditions in found]
|
||||
records = [
|
||||
split
|
||||
for record, conditions in found
|
||||
for split in _per_system(src, _with_conditions(record, conditions))
|
||||
]
|
||||
line = src.find(r'string (\w+) = ("rompath (?:[^"\\\n]|\\.)*");', "config rompath line")
|
||||
written = _unescape(line.group(2)[1:-1])
|
||||
relative = re.fullmatch(r'rompath "(.*)"', written)
|
||||
@@ -3003,6 +3007,37 @@ def xroar(sources: dict[str, Source]) -> list[Record]:
|
||||
return _covered(src, records)
|
||||
|
||||
|
||||
_SYSTEM_BRANCH = re.compile(r'(\S+), or (\S+) when system == "([\w.-]+)"')
|
||||
|
||||
|
||||
def _per_system(src: Source, record: Record) -> list[Record]:
|
||||
"""A directory chosen by the system, one record per choice.
|
||||
|
||||
`romPath = <a>; if (system == "coco") romPath = <b>;` renders as "<a>, or
|
||||
<b> when system == "coco"": <b> is passed for that system, <a> for every
|
||||
other one.
|
||||
"""
|
||||
rendered = str(record.get("search_dir", ""))
|
||||
branch = _SYSTEM_BRANCH.fullmatch(rendered)
|
||||
if branch is None:
|
||||
if " or " in rendered:
|
||||
raise LauncherPatternMissing(src.path, f"directory choice {rendered!r}")
|
||||
return [record]
|
||||
default, chosen, system = branch.groups()
|
||||
flag = str(record["passes_to"]).removesuffix(rendered).strip()
|
||||
out = []
|
||||
for directory, systems in ((default, None), (chosen, [system])):
|
||||
split = {k: v for k, v in record.items() if k != "source_ref"}
|
||||
split.update(
|
||||
names=list(record["names"]), search_dir=directory, passes_to=f"{flag} {directory}"
|
||||
)
|
||||
if systems:
|
||||
split["systems"] = systems
|
||||
split["source_ref"] = record["source_ref"]
|
||||
out.append(split)
|
||||
return out
|
||||
|
||||
|
||||
def pico8(sources: dict[str, Source]) -> list[Record]:
|
||||
"""The PICO-8 binary the generator runs, from an emulator folder.
|
||||
|
||||
|
||||
Reference in new issue
Block a user