#!/bin/bash # launch-wrapper.sh - TEMPLATE Steam launch-options wrapper. # # Copy into a new / folder and customize. Always starts joyful; # optionally starts a companion input-converter daemon if this game # needs one (see input_converter_daemon.py and its README section on # when a daemon is actually required vs. joyful alone being enough). # Runs the game, cleans up on exit however it happens. # # Steam launch options: /path/to//launch-wrapper.sh %command% # (per-machine, not synced by Steam - re-paste after cloning on a new # machine; keeping the repo checked out at the same path everywhere # keeps the launch-options string itself identical too.) REPO_DIR="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)" JOYFUL_CONFIG="$REPO_DIR/joyful-config.yml" joyful --config "$JOYFUL_CONFIG" & JOYFUL_PID=$! # --- daemon: delete this whole block (and DAEMON_PID below) if this # game doesn't need game-state feedback and joyful alone is enough --- DAEMON_CONFIG="$REPO_DIR/TODO-daemon-config.yaml" python3 "$REPO_DIR/input_converter_daemon.py" --config "$DAEMON_CONFIG" & DAEMON_PID=$! # ---------------------------------------------------------------------- # clean up even if this script gets killed/terminated, not just on normal exit trap 'kill "$JOYFUL_PID" "$DAEMON_PID" 2>/dev/null' EXIT # "$@" is the substituted real launch command (Proton + the game) "$@"