52 lines
2.1 KiB
Python
52 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Ludarium Dolphin (GameCube and Wii) sidecar controller.
|
|
|
|
Only the Dolphin-specific runtime identity lives here; the bounded HTTP control surface,
|
|
path validation, display resolution and process supervision are shared with every other
|
|
Ludarium emulator sidecar. See deploy/ludarium_sidecar.py.
|
|
"""
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
import ludarium_sidecar as sidecar
|
|
|
|
TOKEN = os.environ.get("LUDARIUM_DOLPHIN_CONTROL_TOKEN", "")
|
|
GAMES = os.environ.get("LUDARIUM_GAMES_ROOT", "/games")
|
|
# App-owned save directory. Ludarium exports and restores it through the vault; the exact
|
|
# location differs per emulator build, so the operator can override it.
|
|
SAVE_ROOT = os.environ.get("LUDARIUM_DOLPHIN_SAVE_ROOT", "/config/.local/share/dolphin-emu")
|
|
|
|
# Dolphin's profile also holds shader caches and dumps, which dwarf one bounded revision.
|
|
# Only the GameCube memory cards, the Wii NAND and the savestates are captured.
|
|
SAVE_PATHS = tuple(part.strip()
|
|
for part in os.environ.get("LUDARIUM_DOLPHIN_SAVE_PATHS", "").split(",")
|
|
if part.strip()) or ("GC", "Wii", "StateSaves")
|
|
RUNTIME = sidecar.EmulatorRuntime(
|
|
name="dolphin",
|
|
process_name="dolphin-emu",
|
|
launch_argv=lambda target: ["/usr/bin/dolphin-emu", "--batch", "--exec", str(target)],
|
|
games=GAMES,
|
|
extensions={".iso", ".gcm", ".rvz", ".gcz", ".wbfs", ".wia"},
|
|
hotkeys={"pause-resume": "F10", "fullscreen": "alt+Return",
|
|
"save-state": "shift+F1", "load-state": "F1"},
|
|
save_root=SAVE_ROOT,
|
|
save_paths=SAVE_PATHS,
|
|
save_mode="native-and-savestate-persistent",
|
|
# Dolphin's own main window also carries "Dolphin" in its title, so the launched
|
|
# process id is the authoritative match and this pattern is only a bounded fallback.
|
|
window_name="Dolphin",
|
|
# Both source libraries are mounted under one /games root, so the runtime path must
|
|
# name its platform directory. The API only ever emits "gamecube/..." or "wii/...".
|
|
platforms={"gamecube", "wii"},
|
|
)
|
|
|
|
|
|
def main():
|
|
sidecar.serve(RUNTIME, TOKEN)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|