Skip to content

Commit

Permalink
One-Time Run: Default to per-game Proton version if '--proton' is not…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
sonic2kk committed Jun 17, 2024
1 parent 19fd787 commit ef920f6
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!"
Expand Down Expand Up @@ -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}"

Expand Down

0 comments on commit ef920f6

Please sign in to comment.