#!/bin/bash # launch-wrapper.sh - starts joyful + switch_sync, runs the game, # cleans up when it exits (however it exits). # # Steam launch options: /path/to/space-engineers/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" SYNC_CONFIG="$REPO_DIR/switch_sync-config.yaml" joyful --config "$JOYFUL_CONFIG" & JOYFUL_PID=$! python3 "$REPO_DIR/switch_sync.py" --config "$SYNC_CONFIG" & SYNC_PID=$! # clean up even if this script gets killed/terminated, not just on normal exit trap 'kill "$JOYFUL_PID" "$SYNC_PID" 2>/dev/null' EXIT # "$@" is the substituted real launch command (Proton + the game) "$@"