#!/bin/bash ## configuration # proton executable _proton=echo # default prefix dir if STEAM_COMPAT_DATA_PATH not set _pfx=${XDG_DATA_HOME:-~/.local/share}/proton-pfx # default dxvk state cache path if not set, could be compatible with dxvk-cache-pool application _cachepath=${XDG_CACHE_HOME:-~/.cache}/dxvk-cache-pool # default appid if STEAM_COMPAT_DATA_PATH or SteamAppId not set nor given as an argument _appid=0 # default mode of execution if not given as an argument _mode=waitforexitandrun # default steam install path (don't worry, you still don't need steam) _steam=${XDG_DATA_HOME:-~/.local/share}/Steam ## functions set_env() { # Proton now cares about steam install - it wants to update the tracked files according to installed steam. # While this makes no sense in standalone, we need to set *some* path even if does not exists. if [ -z ${STEAM_COMPAT_CLIENT_INSTALL_PATH+x} ]; then export STEAM_COMPAT_CLIENT_INSTALL_PATH=${_steam} >&2 echo "ProtonLauncher[$$] INFO: empty STEAM_COMPAT_CLIENT_INSTALL_PATH set to ${STEAM_COMPAT_CLIENT_INSTALL_PATH}" fi if ! [ -d "${STEAM_COMPAT_CLIENT_INSTALL_PATH}" ]; then >&2 echo "ProtonLauncher[$$] WARN: directory ${STEAM_COMPAT_CLIENT_INSTALL_PATH} does not exist" fi # No data path to prefix? Let's set the default path. We want to include the AppId in the path like steam. if [ -z ${STEAM_COMPAT_DATA_PATH+x} ]; then export STEAM_COMPAT_DATA_PATH=${_pfx}/${SteamAppId:-${_appid}} >&2 echo "ProtonLauncher[$$] INFO: empty STEAM_COMPAT_DATA_PATH set to ${STEAM_COMPAT_DATA_PATH}" elif ! [ "${SteamGameId}" -ge 0 ] 2>/dev/null && ! [ "${SteamAppId}" -ge 0 ] 2>/dev/null && ! [ "$(basename "${STEAM_COMPAT_DATA_PATH}")" -ge 0 ] 2>/dev/null; then export SteamAppId=${_appid} >&2 echo "ProtonLauncher[$$] INFO: empty SteamAppId set to ${SteamAppId}" fi # If the prefix path does not exist yet, we will create it. if ! [ -d "${STEAM_COMPAT_DATA_PATH}" ]; then install -d "${STEAM_COMPAT_DATA_PATH}" || exit 1 >&2 echo "ProtonLauncher[$$] INFO: directory ${STEAM_COMPAT_DATA_PATH} created" fi # DXVK state cache path not given, we will use a default. if [ -z ${DXVK_STATE_CACHE_PATH+x} ]; then export DXVK_STATE_CACHE_PATH=${_cachepath} >&2 echo "ProtonLauncher[$$] INFO: empty DXVK_STATE_CACHE_PATH set to ${_cachepath}" fi # If the state cache path does not exist yet, we will create it. if ! [ -d "${DXVK_STATE_CACHE_PATH}" ]; then install -d "${DXVK_STATE_CACHE_PATH}" || exit 1 >&2 echo "ProtonLauncher[$$] INFO: directory ${DXVK_STATE_CACHE_PATH} created" fi # Placeholder in case we need the workaround again when tracked_files missing if ! [ -f "${STEAM_COMPAT_DATA_PATH}"/tracked_files ]; then if [ -f "${STEAM_COMPAT_DATA_PATH}"/version ]; then >&2 echo "ProtonLauncher[$$] WARN: file ${STEAM_COMPAT_DATA_PATH}/tracked_files missing! Please report to AUR maintainer" fi fi # argument -e was provided, so summarize the relevant env we set so far. if [ "${_printenv}" == "true" ] 2>/dev/null; then print_env; fi } print_usage() { cat </dev/null; then # start proton with given arguments, compatible with standard proton invocation set_env "${_proton}" "${@}" else # first arg is a positive signed int, thus the appid export SteamAppId="$1" #export SteamGameId="$1" >&2 echo "ProtonLauncher[$$] INFO: forcing SteamAppId to $1" set_env "${_proton}" "${_mode}" "${@:2}" fi ;; esac