Files
Ludarium-Public/deploy/eden-controller.py
T
Ludarium release export df869819ce
Public source validation / source (push) Successful in 2m16s
Publish Ludarium source
2026-09-03 02:08:58 +02:00

47 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Ludarium Eden (Nintendo Switch) sidecar controller.
Only the Switch-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_EDEN_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_EDEN_SAVE_ROOT", "/config/.local/share/eden")
# Eden keeps Switch save data in its emulated NAND user profile.
SAVE_PATHS = tuple(part.strip()
for part in os.environ.get("LUDARIUM_EDEN_SAVE_PATHS", "").split(",")
if part.strip()) or ("nand/user/save",)
RUNTIME = sidecar.EmulatorRuntime(
name="eden",
process_name="eden",
launch_argv=lambda target: ["/usr/bin/eden", "-f", "-g", str(target)],
games=GAMES,
extensions={".xci", ".nsp"},
hotkeys={"pause-resume": "F4", "fullscreen": "F11"},
save_root=SAVE_ROOT,
save_paths=SAVE_PATHS,
save_mode="native-persistent",
# Eden titles the running game window "eden <title> |"; the emulator's own front-end
# window does not match, so a hotkey cannot reach it if _NET_WM_PID is unavailable.
window_name=r"eden .* \|",
)
def main():
sidecar.serve(RUNTIME, TOKEN)
if __name__ == "__main__":
main()