diff --git a/lang/chinese.txt b/lang/chinese.txt index 804c924d..832352ca 100644 --- a/lang/chinese.txt +++ b/lang/chinese.txt @@ -1156,3 +1156,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/dutch.txt b/lang/dutch.txt index 823a25b7..52b66928 100644 --- a/lang/dutch.txt +++ b/lang/dutch.txt @@ -574,9 +574,9 @@ GUI_WDCDIALOG="Select Wine debug channels for 'XXX'\n(if both '$GUI_MINUS' and ' BUT_RUN="RUN" GUI_ONETIMERUN="Options to start a custom command" GUI_OTPROTON="One time Proton version" -DESC_OTPROTON="Proton version used for the command, default is the game default" +DESC_OTPROTON="Proton version used for the command, default is the game default - Ignored if the executable is not detected as a Windows executable" GUI_OTEXE="One time command" -DESC_OTEXE="The command which is supposed to be started" +DESC_OTEXE="The command which is supposed to be started, can be either a Windows or Linux executable" GUI_OTARGS="Arguments" DESC_OTARGS="Command line arguments for above command" GUI_OTSAVE="Save" @@ -1156,3 +1156,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/english.txt b/lang/english.txt index 7884010c..7fbbb4b1 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -578,9 +578,9 @@ GUI_WDCDIALOG="Select Wine debug channels for 'XXX'\n(if both '$GUI_MINUS' and ' BUT_RUN="RUN" GUI_ONETIMERUN="Options to start a custom command" GUI_OTPROTON="One time Proton version" -DESC_OTPROTON="Proton version used for the command, default is the game default" +DESC_OTPROTON="Proton version used for the command, default is the game default - Ignored if the executable is not detected as a Windows executable" GUI_OTEXE="One time command" -DESC_OTEXE="The command which is supposed to be started" +DESC_OTEXE="The command which is supposed to be started, can be either a Windows or Linux executable" GUI_OTARGS="Arguments" DESC_OTARGS="Command line arguments for above command" GUI_OTSAVE="Save" @@ -1157,3 +1157,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/englishUK.txt b/lang/englishUK.txt index afda1886..530a4492 100644 --- a/lang/englishUK.txt +++ b/lang/englishUK.txt @@ -574,9 +574,9 @@ GUI_WDCDIALOG="Select Wine debug channels for 'XXX'\n(if both '$GUI_MINUS' and ' BUT_RUN="RUN" GUI_ONETIMERUN="Options to start a custom command" GUI_OTPROTON="One time Proton version" -DESC_OTPROTON="Proton version used for the command, default is the game default" +DESC_OTPROTON="Proton version used for the command, default is the game default - Ignored if the executable is not detected as a Windows executable" GUI_OTEXE="One time command" -DESC_OTEXE="The command which is supposed to be started" +DESC_OTEXE="The command which is supposed to be started, can be either a Windows or Linux executable" GUI_OTARGS="arguments" DESC_OTARGS="Command line arguments for above command" GUI_OTSAVE="Save" @@ -1156,3 +1156,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/french.txt b/lang/french.txt index fb180462..5df8c275 100644 --- a/lang/french.txt +++ b/lang/french.txt @@ -1156,3 +1156,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/german.txt b/lang/german.txt index 2cc31709..2ac9afe9 100644 --- a/lang/german.txt +++ b/lang/german.txt @@ -1158,3 +1158,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/italian.txt b/lang/italian.txt index f498be50..c270a159 100644 --- a/lang/italian.txt +++ b/lang/italian.txt @@ -1156,3 +1156,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/polish.txt b/lang/polish.txt index 7174a55c..9f7236d4 100644 --- a/lang/polish.txt +++ b/lang/polish.txt @@ -1156,3 +1156,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/lang/russian.txt b/lang/russian.txt index 3d9a0100..f1429c68 100644 --- a/lang/russian.txt +++ b/lang/russian.txt @@ -574,9 +574,9 @@ GUI_WDCDIALOG="Select Wine Debug Channels for 'XXX'\n(if both '$GUI_MINUS' and ' BUT_RUN="RUN" GUI_ONETIMERUN="Options to start a custom command" GUI_OTPROTON="One time Proton version" -DESC_OTPROTON="Proton version used for the command, default is the game-default" +DESC_OTPROTON="Proton version used for the command, default is the game default - Ignored if the executable is not detected as a Windows executable" GUI_OTEXE="One time command" -DESC_OTEXE="The command which is supposed to be started" +DESC_OTEXE="The command which is supposed to be started, can be either a Windows or Linux executable" GUI_OTARGS="Arguments" DESC_OTARGS="Command line arguments for above command" GUI_OTSAVE="Save" @@ -1156,3 +1156,5 @@ GUI_DLSTEAMDECKCOMPATINFO="Download Steam Deck compatibility information" DESC_DLSTEAMDECKCOMPATINFO="Fetch Steam Deck compatibility information from Steam - Previously fetched compatibility information will be preserved" GUI_DISABLEVORTEXAUTOUPDATE="Disable Vortex Auto Updates" DESC_DISABLEVORTEXAUTOUPDATE="sets Vortex update channel to 'No automatic updates' which can help prevent breakages - if disabled, will set to stable/beta depending on value of 'USEVORTEXPRERELEASE' checkbox" +GUI_OTRFORCEPROTON="Force Proton with Custom Command" +DESC_OTRFORCEPROTON="force Proton with the current Custom Command, even if SteamTinkerLaunch detects it as a Linux executable" diff --git a/steamtinkerlaunch b/steamtinkerlaunch index b22da56b..6dca605a 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230516-4" +PROGVERS="v14.0.20230522-1" PROGCMD="${0##*/}" SHOSTL="stl" GHURL="https://github.com" @@ -10422,27 +10422,22 @@ function StandaloneProtonGame { touch "$FUPDATE" "$SAPCFG" updateConfigEntry "SAPGAME" "$SAPGAME" "$SAPCFG" - if [ -n "$SAPPROTON" ];then touch "$FUPDATE" updateConfigEntry "SAPPROTON" "$SAPPROTON" "$SAPCFG" fi - if [ -n "$SAP_COMPAT_DATA_PATH" ];then touch "$FUPDATE" updateConfigEntry "SAP_COMPAT_DATA_PATH" "$SAP_COMPAT_DATA_PATH" "$SAPCFG" fi - if [ -n "$SAPEXE" ];then touch "$FUPDATE" updateConfigEntry "SAPEXE" "$SAPEXE" "$SAPCFG" fi - if [ -n "$SAPARGS" ];then touch "$FUPDATE" updateConfigEntry "SAPARGS" "$SAPARGS" "$SAPCFG" fi - if [ -n "$SAPRUN" ];then touch "$FUPDATE" updateConfigEntry "SAPARGS" "$SAPARGS" "$SAPCFG" @@ -10600,199 +10595,226 @@ function setOneTimeRunVars { loadCfg "$METCFG" fi - if [ -n "$WINEPREFIX" ]; then + if [ -n "$WINEPREFIX" ] && [ -d "$WINEPREFIX" ]; then STEAM_COMPAT_DATA_PATH="${WINEPREFIX%/*}" writelog "INFO" "${FUNCNAME[0]} - Found STEAM_COMPAT_DATA_PATH '$STEAM_COMPAT_DATA_PATH'" fi fi + # Since we can use OTR with native Linux games, we just warn when there is no STEAM_COMPAT_DATA_PATH if [ -z "$STEAM_COMPAT_DATA_PATH" ]; then - writelog "ERROR" "${FUNCNAME[0]} - STEAM_COMPAT_DATA_PATH could not be determined" - echo "Could not get Steam compatdata path for AppID '$1'" + writelog "WARN" "${FUNCNAME[0]} - STEAM_COMPAT_DATA_PATH could not be determined - This may mean we're running a native Linux game here, in which case this can be safely ignored." + writelog "WARN" "${FUNCNAME[0]} - If you need to use a Windows executable you'll have to use One-Time Run with a Windows game, or the Windows release of this game." fi } # Called when a user passes arguments for onetimerun function commandlineOneTimeRun { setOneTimeRunVars "$1" - if [ -n "$STEAM_COMPAT_DATA_PATH" ]; then - # Get incoming arguments - OTRUNDIR="$( pwd )" # Default to current script directory - USEEXEDIR=0 - for i in "$@"; do - case $i in - --exe=*) - OTEXE="$( realpath "${i#*=}" )" - shift ;; - --proton=*) - RUNOTPROTON="${i#*=}" - shift ;; - --workingdir=*) - PASSEDRUNDIR="${i#*=}" - if [ -n "$PASSEDRUNDIR" ] && [ -d "$PASSEDRUNDIR" ]; then # Ensure working directory exists - OTRUNDIR="$PASSEDRUNDIR" - fi - shift ;; - --useexedir) - USEEXEDIR=1 - shift ;; - --args=*) - OTARGS="${i#*=}" - shift ;; - --save) - OTSAVE="TRUE" - shift ;; - esac - done + # Get incoming arguments + OTRUNDIR="$( pwd )" # Default to current script directory + USEEXEDIR=0 + OTFORCEPROTON=0 + for i in "$@"; do + case $i in + --exe=*) + OTEXE="$( realpath "${i#*=}" )" + shift ;; + --proton=*) + RUNOTPROTON="${i#*=}" + shift ;; + --workingdir=*) + PASSEDRUNDIR="${i#*=}" + if [ -n "$PASSEDRUNDIR" ] && [ -d "$PASSEDRUNDIR" ]; then # Ensure working directory exists + OTRUNDIR="$PASSEDRUNDIR" + fi + shift ;; + --useexedir) + USEEXEDIR=1 + shift ;; + --args=*) + OTARGS="${i#*=}" + shift ;; + --forceproton) + OTFORCEPROTON=1 + shift ;; + --save) + OTSAVE="TRUE" + shift ;; + esac + done + + # Ensure EXE is given and that directory to run the exe in is valid, and also ensure we have a valid Proton version to run the exe with + if [ -n "$OTEXE" ]; then # Valid executable required (Windows executable or Linux executable/file/etc, not really an EXE for Linux but oh well - Naming is hard!) + if [ "$USEEXEDIR" -eq 1 ]; then # Use EXE dir as working dir + OTRUNDIR="$( dirname "$OTEXE" )" + writelog "INFO" "${FUNCNAME[0]} - Using executable directory '$OTRUNDIR' as working directory" + fi - # Ensure EXE is given and that directory to run the exe in is valid, and also ensure we have a valid Proton version to run the exe with - if [ -n "$OTEXE" ]; then # Valid executable required - if [ "$USEEXEDIR" -eq 1 ]; then # Use EXE dir as working dir - OTRUNDIR="$( dirname "$OTEXE" )" - writelog "INFO" "${FUNCNAME[0]} - Using executable directory '$OTRUNDIR' as working directory" + if [ -d "$OTRUNDIR" ]; then # Working directory needs to be valid + # Don't check executable type if OTFORCEPROTON + if [ "$OTFORCEPROTON" -eq 1 ]; then + ISWINDOWSEXE=1 + else + ISWINDOWSEXE="$(file "$OTEXE" | grep -c "PE32")" # TODO how do things like .bat scripts work here? fi - if [ -d "$OTRUNDIR" ]; then # Working directory needs to be valid + if [ "$ISWINDOWSEXE" -eq 1 ]; then + writelog "INFO" "${FUNCNAME[0]} - Looks like we've got a Windows executable here or the user forced Proton" + # Ensure we have STEAM_COMPAT_DATA_PATH before we try to run a Windows executable + if [ -z "$STEAM_COMPAT_DATA_PATH" ]; then + writelog "ERROR" "${FUNCNAME[0]} - Cannot run Windows executable without a STEAM_COMPAT_DATA_PATH -- Maybe you're using One-Time Run with a native Linux game?" + echo "Cannot run Windows executable without a STEAM_COMPAT_DATA_PATH -- Maybe you're using One-Time Run with a native Linux game?" + return + fi writelog "INFO" "${FUNCNAME[0]} - Trying to find Proton version to launch executable with from given Proton name '$RUNOTPROTON'" RUNOTPROTON="$(getProtPathFromCSV "$RUNOTPROTON")" if [ ! -f "$RUNOTPROTON" ]; then RUNOTPROTON="$(fixProtonVersionMismatch "OTPROTON" "$STLGAMECFG" X)" fi + else + writelog "INFO" "${FUNCNAME[0]} - Given executable detected as native Linux binary, this is usually correct but if this was detected incorrectly you should force Proton!" + fi - # TODO check for native games - # One-Time Run needs support for this generally, so this can be implemented separately + if [ -f "$RUNOTPROTON" ] || [ "$ISWINDOWSEXE" -eq 0 ]; then if [ -f "$RUNOTPROTON" ]; then writelog "INFO" "${FUNCNAME[0]} - Found Proton version '$RUNOTPROTON'" - if [ -z "$OTARGS" ]; then # Set the custom arguments for executable - RUNOTARGS="" - else - mapfile -d " " -t -O "${#RUNOTARGS[@]}" RUNOTARGS < <(printf '%s' "$OTARGS") - writelog "INFO" "${FUNCNAME[0]} - Passing arguments to One-Time Run executable '${OTRUNARGS[*]}'" - fi + else + writelog "INFO" "${FUNCNAME[0]} - Executable is native Linux, no Proton version required." + fi - if [ "$OTSAVE" == "TRUE" ];then # Save one-time settings to game config file -- Really only useful for OneTimeRunGUI - writelog "INFO" "${FUNCNAME[0]} - Saving One time run settings into '$STLGAMECFG'" + if [ -z "$OTARGS" ]; then # Set the custom arguments for executable + RUNOTARGS="" + else + mapfile -d " " -t -O "${#RUNOTARGS[@]}" RUNOTARGS < <(printf '%s' "$OTARGS") + writelog "INFO" "${FUNCNAME[0]} - Passing arguments to One-Time Run executable '${OTRUNARGS[*]}'" + fi + + if [ "$OTSAVE" == "TRUE" ];then # Save one-time settings to game config file -- Really only useful for OneTimeRunGUI + writelog "INFO" "${FUNCNAME[0]} - Saving One time run settings into '$STLGAMECFG'" + # Only save Proton version if we're using a Windows executable, otherwise we don't set a Proton version! + if [ "$ISWINDOWSEXE" -eq 1 ]; then touch "$FUPDATE" updateConfigEntry "OTPROTON" "$OTPROTON" "$STLGAMECFG" + fi + touch "$FUPDATE" + updateConfigEntry "OTEXE" "$OTEXE" "$STLGAMECFG" + touch "$FUPDATE" + updateConfigEntry "OTARGS" "$OTARGS" "$STLGAMECFG" + touch "$FUPDATE" + updateConfigEntry "OTUSEEXEDIR" "$USEEXEDIR" "$STLGAMECFG" + touch "$FUPDATE" + updateConfigEntry "OTFORCEPROTON" "$OTFORCEPROTON" "$STLGAMECFG" + + # If we enable USEEXEDIR, remove the OTRUNDIR value + # If we don't, and OTRUNDIR is a valid path that isn't the default path, write out OTRUNDIR + # + # This is a bit messy and could possibly be improved... + if [ "$USEEXEDIR" -eq 1 ]; then touch "$FUPDATE" - updateConfigEntry "OTEXE" "$OTEXE" "$STLGAMECFG" + updateConfigEntry "OTRUNDIR" "DUMMY" "$STLGAMECFG" + elif [ -d "$OTRUNDIR" ] && ! [ "$OTRUNDIR" == "$( pwd )" ]; then touch "$FUPDATE" - updateConfigEntry "OTARGS" "$OTARGS" "$STLGAMECFG" + updateConfigEntry "OTRUNDIR" "$OTRUNDIR" "$STLGAMECFG" + else touch "$FUPDATE" - updateConfigEntry "OTUSEEXEDIR" "$USEEXEDIR" "$STLGAMECFG" - - # If we enable USEEXEDIR, remove the OTRUNDIR value - # If we don't, and OTRUNDIR is a valid path that isn't the default path, write out OTRUNDIR - # - # This is a bit messy and could possibly be improved... - if [ "$USEEXEDIR" -eq 1 ]; then - touch "$FUPDATE" - updateConfigEntry "OTRUNDIR" "DUMMY" "$STLGAMECFG" - elif [ -d "$OTRUNDIR" ] && ! [ "$OTRUNDIR" == "$( pwd )" ]; then - touch "$FUPDATE" - updateConfigEntry "OTRUNDIR" "$OTRUNDIR" "$STLGAMECFG" - else - touch "$FUPDATE" - updateConfigEntry "OTRUNDIR" "DUMMY" "$STLGAMECFG" - fi + updateConfigEntry "OTRUNDIR" "DUMMY" "$STLGAMECFG" fi - - # Run in subshell to avoid messing with current script paths + fi + + # Run in subshell to avoid messing with current script paths + # TODO notifier (or only show notifier from GUI? or add silent option?) + if [ "$ISWINDOWSEXE" -eq 1 ]; then writelog "INFO" "${FUNCNAME[0]} - Starting '$OTEXE' with '$RUNOTPROTON' with STEAM_COMPAT_DATA_PATH '$STEAM_COMPAT_DATA_PATH' and using working directory '$OTRUNDIR'" writelog "INFO" "${FUNCNAME[0]} - cd \"$OTRUNDIR\" && STEAM_COMPAT_DATA_PATH=\"$STEAM_COMPAT_DATA_PATH\" \"$RUNOTPROTON\" run \"$OTEXE\" \"${RUNOTARGS[*]}\"" (cd "$OTRUNDIR" && STEAM_COMPAT_DATA_PATH="$STEAM_COMPAT_DATA_PATH" "$RUNOTPROTON" run "$OTEXE" "${RUNOTARGS[@]}") else - writelog "ERROR" "${FUNCNAME[0]} - Could not find valid Proton to launch game with" + writelog "INFO" "${FUNCNAME[0]} - Starting Native Linux program '$OTEXE' using working directory '$OTRUNDIR'" + writelog "INFO" "${FUNCNAME[0]} - cd \"$OTRUNDIR\" && \"$OTEXE\" \"${RUNOTARGS[*]}\"" + (cd "$OTRUNDIR" && "$OTEXE" "${RUNOTARGS[@]}") fi else - writelog "WARN" "${FUNCNAME[0]} - Working directory '$OTRUNDIR' is no valid directory -- Cannot continue" + writelog "ERROR" "${FUNCNAME[0]} - Could not find valid Proton to launch custom executable with" fi else - writelog "ERROR" "${FUNCNAME[0]} - One-Time Run EXE is not defined -- Cannot continue" + writelog "WARN" "${FUNCNAME[0]} - Working directory '$OTRUNDIR' is no valid directory -- Cannot continue" fi else - writelog "ERROR" "${FUNCNAME[0]} - STEAM_COMPAT_DATA_PATH could not be determined -- Cannot continue one-time run" + writelog "ERROR" "${FUNCNAME[0]} - One-Time Run command is not defined -- Cannot continue" fi } function OneTimeRunGui { setOneTimeRunVars "$1" - if [ -n "$STEAM_COMPAT_DATA_PATH" ]; then - createProtonList X - export CURWIKI="$PPW/One-Time-Run" - TITLE="${PROGNAME}-${FUNCNAME[0]}" - pollWinRes "$TITLE" - setShowPic - if [ -z "$OTPROTON" ]; then - OTPROTON="$USEPROTON" - fi - - OTCMDS="$("$YAD" --f1-action="$F1ACTION" --image "$SHOWPIC" --image-on-top --window-icon="$STLICON" --form --center --on-top $WINDECO \ - --title="$TITLE" --separator="|" \ - --columns="2" \ - --text="$(spanFont "$GUI_ONETIMERUN" "H")" \ - --field="$GUI_OTPROTON!$DESC_OTPROTON":CB "$(cleanDropDown "${OTPROTON//\"}" "$PROTYADLIST")" \ - --field="$GUI_OTEXE!$DESC_OTEXE":FL "${OTEXE//\"}" \ - --field="$GUI_OTARGS!$DESC_OTARGS" "${OTARGS//\"}"\ - --field="$BUT_RUNWINECFG!$DESC_RUNWINECFG":FBTN "$( realpath "$0" ) runwinecfg" \ - --field="$GUI_OTRCUSTWORKINGDIR!$DESC_OTRCUSTWORKINGDIR":DIR "$OTRUNDIR" \ - --field="$GUI_OTRUSEEXEDIR!$DESC_OTRUSEEXEDIR":CHK "$OTUSEEXEDIR" \ - --field="$GUI_OTSAVE!$DESC_OTSAVE":CHK "FALSE" \ - --field="$BUT_RUNWINETRICKS!$DESC_RUNWINETRICKS":FBTN "$( realpath "$0" ) runwinetricks" \ - --button="$BUT_CAN:0" \ - --button="$BUT_RUNONETIMECMD:2" \ - "$GEOM" - )" - case $? in - # Selected Cancel - 0) { - writelog "INFO" "${FUNCNAME[0]} - Selected '$BUT_CAN' - Exiting" - } - ;; - # Selected Run - 2) { - mapfile -d "|" -t -O "${#OTARR[@]}" OTARR < <(printf '%s' "$OTCMDS") - OTPROTON="${OTARR[0]}" - OTEXE="${OTARR[1]}" - OTARGS="${OTARR[2]}" - # OTARR[3] and OTARR[7] are the WINECFG and WINETRICKS buttons - OTCUSTWORKDIR="${OTARR[4]}" - OTUSEEXEDIR="${OTARR[5]}" - OTSAVE="${OTARR[6]}" - - # Maybe this check could be done better somehow? - if [ "$OTUSEEXEDIR" == "TRUE" ]; then # Use Executable working dir as priority option - if [ "$OTSAVE" == "TRUE" ]; then - writelog "INFO" "${FUNCNAME[0]} - Running One-Time Run with Executable Directory as Working Directory and Save Enabled" - commandlineOneTimeRun "$1" --exe="$OTEXE" --proton="$OTPROTON" --args="$OTARGS" --useexedir --save - else - writelog "INFO" "${FUNCNAME[0]} - Running One-Time Run with Executable Directory as Working Directory" - commandlineOneTimeRun "$1" --exe="$OTEXE" --proton="$OTPROTON" --args="$OTARGS" --useexedir - fi - elif [ -n "$OTCUSTWORKDIR" ]; then # Fallback check if user selected custom path - if [ "$OTSAVE" == "TRUE" ]; then - writelog "INFO" "${FUNCNAME[0]} - Running One-Time Run with Custom Working Directory and Save Enabled" - commandlineOneTimeRun "$1" --exe="$OTEXE" --proton="$OTPROTON" --args="$OTARGS" --workingdir="$OTCUSTWORKDIR" --save - else - writelog "INFO" "${FUNCNAME[0]} - Running One-Time Run with Custom Working Directory and Save Enabled" - commandlineOneTimeRun "$1" --exe="$OTEXE" --proton="$OTPROTON" --args="$OTARGS" --workingdir="$OTCUSTWORKDIR" - fi - else # Don't pass working directory - if [ "$OTSAVE" == "TRUE" ]; then - writelog "INFO" "${FUNCNAME[0]} - Running One-Time Run with Save Enabled" - commandlineOneTimeRun "$1" --exe="$OTEXE" --proton="$OTPROTON" --args="$OTARGS" --save - else - writelog "INFO" "${FUNCNAME[0]} - Running One-Time Run" - commandlineOneTimeRun "$1" --exe="$OTEXE" --proton="$OTPROTON" --args="$OTARGS" - fi - fi - } - ;; - esac - else - writelog "ERROR" "${FUNCNAME[0]} - STEAM_COMPAT_DATA_PATH could not be determined -- Cannot continue one-time run" + createProtonList X + export CURWIKI="$PPW/One-Time-Run" + TITLE="${PROGNAME}-${FUNCNAME[0]}" + pollWinRes "$TITLE" + setShowPic + if [ -z "$OTPROTON" ]; then + OTPROTON="$USEPROTON" fi + + # TODO GUI looks weird because of uneven number of checkboxes, but this will be fixed once we add a checkbox for Steam Linux Runtime as well + OTCMDS="$("$YAD" --f1-action="$F1ACTION" --image "$SHOWPIC" --image-on-top --window-icon="$STLICON" --form --center --on-top $WINDECO \ + --title="$TITLE" --separator="|" \ + --columns="2" \ + --text="$(spanFont "$GUI_ONETIMERUN" "H")" \ + --field="$GUI_OTPROTON!$DESC_OTPROTON":CB "$(cleanDropDown "${OTPROTON//\"}" "$PROTYADLIST")" \ + --field="$GUI_OTEXE!$DESC_OTEXE":FL "${OTEXE//\"}" \ + --field="$GUI_OTARGS!$DESC_OTARGS" "${OTARGS//\"}" \ + --field="$BUT_RUNWINECFG!$DESC_RUNWINECFG":FBTN "$( realpath "$0" ) runwinecfg" \ + --field="$GUI_OTRFORCEPROTON!$DESC_OTRFORCEPROTON":CHK "$OTFORCEPROTON" \ + --field="$GUI_OTRCUSTWORKINGDIR!$DESC_OTRCUSTWORKINGDIR":DIR "$OTRUNDIR" \ + --field="$GUI_OTRUSEEXEDIR!$DESC_OTRUSEEXEDIR":CHK "$OTUSEEXEDIR" \ + --field="$GUI_OTSAVE!$DESC_OTSAVE":CHK "FALSE" \ + --field="$BUT_RUNWINETRICKS!$DESC_RUNWINETRICKS":FBTN "$( realpath "$0" ) runwinetricks" \ + --button="$BUT_CAN:0" \ + --button="$BUT_RUNONETIMECMD:2" \ + "$GEOM" + )" + case $? in + # Selected Cancel + 0) { + writelog "INFO" "${FUNCNAME[0]} - Selected '$BUT_CAN' - Exiting" + } + ;; + # Selected Run + 2) { + mapfile -d "|" -t -O "${#OTARR[@]}" OTARR < <(printf '%s' "$OTCMDS") + + OTPROTON="${OTARR[0]}" + OTEXE="${OTARR[1]}" + OTARGS="${OTARR[2]}" + # OTARR[3] and OTARR[7] are the WINECFG and WINETRICKS buttons + OTFORCEPROTON="${OTARR[4]}" + OTCUSTWORKDIR="${OTARR[5]}" + OTUSEEXEDIR="${OTARR[6]}" + OTSAVE="${OTARR[7]}" + + OTR_FLAGARGS=( --exe="$OTEXE" --proton="$OTPROTON" --args="$OTARGS" ) # Default arguments that we'll always pass (Proton will be ignored if not Windows executable, commandlineOneTimeRun figures that bit out) + + # USEEXEDIR will take priority over custom working dir, cannot use both at the same time either + # Default is script working directory i.e. pwd + if [ "$OTUSEEXEDIR" == "TRUE" ]; then + OTR_FLAGARGS+=( --useexedir ) + elif [ -n "$OTCUSTWORKDIR" ]; then + OTR_FLAGARGS+=( --workingdir="$OTCUSTWORKDIR" ) + fi + + if [ "$OTFORCEPROTON" == "TRUE" ]; then + OTR_FLAGARGS+=( --forceproton ) + fi + + if [ "$OTSAVE" == "TRUE" ]; then + OTR_FLAGARGS+=( --save ) + fi + + commandlineOneTimeRun "$1" "${OTR_FLAGARGS[@]}" + } + ;; + esac } function setOPCustPath { @@ -19933,11 +19955,12 @@ function howto { echo " the path to the one-time exe is required, STL will try to infer the other options" echo " such as Proton version where possible." echo " :" - echo " --exe= Absolute path to the One-Time executable" - echo " --proton= Name of the Proton version to use (see steamtinkerlaunch lp)" + echo " --exe= Absolute path to the One-Time executable (can be Windows or Linux executable)" + echo " --proton= Name of the Proton version to use (see steamtinkerlaunch lp), ignored if not Windows executable" echo " --workingdir= Working directory to launch the executable from" echo " --useexedir Use the same directory as the executable as the working directory (overrides --workingdir)" echo " --args= Arguments to append to the end of the executable launch" + echo " --forceproton Use Proton to run executable even if SteamTinkerLaunch detects doesn't detect it as a Windows executable" echo " --save Save given configuration for use in the One-Time Run GUI for this game in future" echo " play Start game with id directly" echo " proton|p <X> Start and/or create <title> with proton"