mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-14 05:53:47 -06:00
feat: read pico-8 launchers of rocknix, retrobat
ROCKNIX's start_pico8.sh runs pico8_64 or pico8_dyn from /storage/roms/pico-8 and RetroBat's Pico8 generator runs pico8.exe from its pico8 emulator folder. Both are recorded as exec records, read from the scripts at the revisions the platform files pin.
This commit is contained in:
1 parent
6a9700489d
commit
b5ee4ab09e
7 files changed
+216
No files matched your search
@@ -51,6 +51,7 @@ SOURCE_FILES = (
|
||||
f"{GENERATORS}/OpenMSX.Generator.cs",
|
||||
f"{GENERATORS}/PSXMame.Generator.cs",
|
||||
f"{GENERATORS}/Pcsx2.Generator.cs",
|
||||
f"{GENERATORS}/Pico8.Generator.cs",
|
||||
f"{GENERATORS}/PortsLauncher.Configuration.cs",
|
||||
f"{GENERATORS}/Project64.Generator.cs",
|
||||
f"{GENERATORS}/Raine.Generator.cs",
|
||||
@@ -2968,6 +2969,44 @@ def xroar(sources: dict[str, Source]) -> list[Record]:
|
||||
return _covered(src, records)
|
||||
|
||||
|
||||
def pico8(sources: dict[str, Source]) -> list[Record]:
|
||||
"""The PICO-8 binary the generator runs, from an emulator folder.
|
||||
|
||||
AppConfig.GetFullPath names a folder of the RetroBat install
|
||||
(emulatorLauncher.cfg, else emulators/<key>): the binary is never
|
||||
looked up in the BIOS tree.
|
||||
"""
|
||||
src = sources[f"{GENERATORS}/Pico8.Generator.cs"]
|
||||
folder = src.find(r'string path = AppConfig\.GetFullPath\("(\w+)"\);', "pico8 folder")
|
||||
exe = src.find(
|
||||
r'string exe = Path\.Combine\(path, "([^"]+)"\);', "binary path", folder.end()
|
||||
)
|
||||
check = src.find(r"if \(!File\.Exists\(exe\)\)\s*return null;", "binary check", exe.end())
|
||||
run = src.find(r"FileName = exe,\s*WorkingDirectory = path,", "binary run", check.end())
|
||||
return [
|
||||
_record(
|
||||
"pico8",
|
||||
"standalone",
|
||||
"fixed_name",
|
||||
[exe.group(1)],
|
||||
source_ref(
|
||||
(
|
||||
src.path,
|
||||
[
|
||||
src.lines(folder.start(), folder.end()),
|
||||
src.lines(exe.start(), check.end()),
|
||||
src.lines(run.start(), run.end()),
|
||||
],
|
||||
)
|
||||
),
|
||||
case_insensitive=True,
|
||||
search_dir=f"<AppConfig.GetFullPath(\"{folder.group(1)}\")>",
|
||||
passes_to="exec",
|
||||
fails_when_missing="returns no process when the binary is absent",
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
def snes9x(sources: dict[str, Source]) -> list[Record]:
|
||||
src = sources[f"{GENERATORS}/Snes9x.Generator.cs"]
|
||||
entry = src.find(rf'\{{ "([^"]+)", (Path\.Combine\({_BIOS_ROOT}\)) \}}', "bios folder entry")
|
||||
@@ -3236,6 +3275,7 @@ EXTRACTORS: tuple[Callable[[dict[str, Source]], list[Record]], ...] = (
|
||||
option_paths,
|
||||
pcsx2,
|
||||
pcsx2_libretro,
|
||||
pico8,
|
||||
psx_cascades,
|
||||
psxmame,
|
||||
raine,
|
||||
|
||||
@@ -575,6 +575,47 @@ def armsx2(tree: RepoTree) -> list[Launcher]:
|
||||
|
||||
|
||||
# Start scripts whose ln -s commands put a BIOS path where the emulator reads.
|
||||
def pico8(tree: RepoTree) -> list[Launcher]:
|
||||
"""The PICO-8 binary start_pico8.sh executes, outside /storage/roms/bios.
|
||||
|
||||
The script picks the binary by HW_ARCH, pico8_64 on aarch64 and
|
||||
pico8_dyn on any other, and runs it from GAME_DIR, or from
|
||||
GAME_DIR/${HW_ARCH} when that folder exists.
|
||||
"""
|
||||
path = f"{STANDALONE}/pico-8/scripts/start_pico8.sh"
|
||||
script = Script(path, tree.read(path))
|
||||
game_line, game = script.find(r'^\s*GAME_DIR="([^"$]+)"', "GAME_DIR assignment")
|
||||
case_line, _ = script.find(r"^\s*case \$\{HW_ARCH\} in", "case on HW_ARCH")
|
||||
arch_line, arch = script.find(r"^\s*(\w+)\)", "HW_ARCH branch", case_line + 1)
|
||||
first_line, first = script.find(r'STATIC_BIN="([^"$]+)"', "binary of the first branch", arch_line)
|
||||
other_line, _ = script.find(r"^\s*\*\)", "default HW_ARCH branch", first_line)
|
||||
rest_line, rest = script.find(r'STATIC_BIN="([^"$]+)"', "binary of the default branch", other_line)
|
||||
sub_line, _ = script.find(
|
||||
r'if \[ -d "\$\{GAME_DIR\}/\$\{HW_ARCH\}" \]', "per-architecture launch folder"
|
||||
)
|
||||
end_line, _ = script.find(r"^\s*fi\b", "end of the launch folder test", sub_line)
|
||||
run_line, _ = script.find(r"^\s*\$\{LAUNCH_DIR\}/\$\{STATIC_BIN\} ", "binary run")
|
||||
return [
|
||||
Launcher(
|
||||
emulator="pico-8",
|
||||
build="standalone",
|
||||
kind="fixed_name",
|
||||
names=[first.group(1), rest.group(1)],
|
||||
source_ref=source_ref([(path, {
|
||||
game_line, case_line, arch_line, first_line, other_line, rest_line,
|
||||
*range(sub_line, end_line + 1), run_line,
|
||||
})]),
|
||||
search_dir=game.group(1).rstrip("/"),
|
||||
passes_to="exec",
|
||||
fails_when_missing=False,
|
||||
depends_on_option=(
|
||||
f"HW_ARCH {arch.group(1)} runs {first.group(1)}, any other {rest.group(1)}, "
|
||||
f"from {game.group(1).rstrip('/')}/${{HW_ARCH}} when that folder exists"
|
||||
),
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
LINK_SCRIPTS = (
|
||||
("drastic", f"{STANDALONE}/drastic-sa/scripts/start_drastic.sh"),
|
||||
("dolphin", f"{STANDALONE}/dolphin-sa/scripts/start_dolphin_gc.sh"),
|
||||
@@ -679,6 +720,7 @@ EXTRACTORS: tuple[Callable[[RepoTree], list[Launcher]], ...] = (
|
||||
yabasanshiro,
|
||||
duckstation,
|
||||
armsx2,
|
||||
pico8,
|
||||
patched_directories,
|
||||
links,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user