From ef920f6bc9fc95caf31b5ca22bd6208de08d8519 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 17 Jun 2024 03:28:48 +0100 Subject: [PATCH] One-Time Run: Default to per-game Proton version if '--proton' is not passed If per-game Proton 'USEPROTON' is empty, we resolve the mismatch using that instead of RUNOTPROTON. Also fixes an issue where One-Time Run did not correctly resolve Proton version mismatches if RUNOTPROTON was blank. --- steamtinkerlaunch | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 3a937242..3a9ea607 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -12225,6 +12225,7 @@ function OneTimeRunReset { # Called when a user passes arguments for onetimerun # TODO a way to use default game Proton version, either if '--proton' is not supplied or if '--proton="default"'? +# TODO add a way to use PROTON_LOG with custom command? function commandlineOneTimeRun { setOneTimeRunVars "$1" # Get incoming arguments @@ -12302,9 +12303,24 @@ function commandlineOneTimeRun { return fi writelog "INFO" "${FUNCNAME[0]} - Trying to find Proton version to launch executable with from given Proton name '$RUNOTPROTON'" + + # If user did not pass '--proton', then use the game's Proton version + if [ -z "$RUNOTPROTON" ]; then + writelog "INFO" "${FUNCNAME[0]} - Did not get RUNOTPROTON from '--proton' option (perhaps this option was omitted?), so using per-game Proton version (USEPROTON) '$USEPROTON'" + RUNOTPROTON="$USEPROTON" + fi + + # TODO does OTPROTON need updated after a Proton version mismatch resolution? RUNOTPROTON="$(getProtPathFromCSV "$RUNOTPROTON")" if [ ! -f "$RUNOTPROTON" ]; then - RUNOTPROTON="$(fixProtonVersionMismatch "OTPROTON" "$STLGAMECFG" X)" # TODO re-check to make sure this is valid? + writelog "INFO" "${FUNCNAME[0]} - RUNOTPROTON '$RUNOTPROTON' could not be found in ProtonCSV -- Attempting to resolve mismatch" + # "1" forces fixProtonVersionMismatch to run even though ISGAME != 2 (ISGAME -eq 2 means Proton game, but ISGAME may not be 2 for One-Time Run, so we force Proton version resolution) + if [ -n "$RUNOTPROTON" ]; then + RUNOTPROTON="$(fixProtonVersionMismatch "RUNOTPROTON" "$STLGAMECFG" "1" X)" + else + writelog "INFO" "${FUNCNAME[0]} - Attemptiing to resolve Proton version mismatch for blank RUNOTPROTON '$RUNOTPROTON' by instead trying to resolve based on USEPROTON '$USEPROTON' which should hopefully not be blank" + RUNOTPROTON="$(fixProtonVersionMismatch "USEPROTON" "$STLGAMECFG" "1" X)" + fi 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!" @@ -19351,7 +19367,8 @@ function getProtonDBRating { } function fixProtonVersionMismatch { - if [ "$ISGAME" -eq 2 ]; then + FORCEPROTONMISMATCHRESOLVE="${3:-0}" # I.e. passed by One-Time Run where "ISGAME -eq 3" + if [ "$ISGAME" -eq 2 ] || [ "$FORCEPROTONMISMATCHRESOLVE" -eq 1 ]; then ORGPROTCAT="$1" MIMAPROT="${!1}"