From 9b8e4b8a022d29711a005b02155463d302ec278c Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sat, 16 Sep 2023 23:05:24 +0100 Subject: [PATCH 01/19] Add Non-Steam Game: Add text-based VDF interaction functions --- steamtinkerlaunch | 136 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 135 insertions(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index f5c827a3..f7b2f828 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230916-2" +PROGVERS="v14.0.20230917-1" PROGCMD="${0##*/}" SHOSTL="stl" GHURL="https://github.com" @@ -22018,6 +22018,140 @@ function injectGdb { fi } +### BEGIN TEXT-BASED VDF INTERACTION FUNCTIONS +## +## This was written for Blush (https://github.com/sonic2kk/blush/) as part of the research on how to implement #905 +## The code is pretty much the same but with variable names adapted to the SteamTinkerLaunch "convention" +## The code on Blush exists so this code can be used by others outside of SteamTinkerLaunch more easily + +## Generate string of [[:space:]] to represent indentation in VDF file, useful for searching +function generateVdfIndentString { + SPACETYPE="${2:-\t}" # Type of space, expected values could be '\t' (for writing) or '[[:space:]]' (for searching) + + printf "%.0s${SPACETYPE}" $(seq 1 "$1") +} + +## Attempt to get the indentation level of the first occurance of a given VDF block +function guessVdfIndent { + BLOCKNAME="$( safequoteVdfBlockName "$1" )" # Block to check the indentation level on + VDF="$2" + + grep -i "${BLOCKNAME}" "$VDF" | awk '{print gsub(/\t/,"")}' +} + +## Surround a VDF block name with quotes if it doesn't have any +function safequoteVdfBlockName { + QUOTEDBLOCKNAME="$1" + if ! [[ $QUOTEDBLOCKNAME == \"* ]]; then + QUOTEDBLOCKNAME="\"$QUOTEDBLOCKNAME\"" + fi + + echo "$QUOTEDBLOCKNAME" +} + +## Use sed to grab a section of a given VDF file based on its indentation level +function getVdfSection { + STARTPATTERN="$( safequoteVdfBlockName "$1" )" + ENDPATTERN="${2:-\}}" # Default end pattern to end of block + INDENT="$3" + VDF="$4" + + if [ -z "$INDENT" ]; then + INDENT="$(( $( guessVdfIndent "$STARTPATTERN" "$VDF" ) ))" + fi + + INDENTSTR="$( generateVdfIndentString "$INDENT" "[[:space:]]" )" + INDENTEDSTARTPATTERN="${INDENTSTR}${STARTPATTERN}" + INDENTEDENDPATTERN="${INDENTSTR}${ENDPATTERN}" + + sed -n "/${INDENTEDSTARTPATTERN}/I,/^${INDENTEDENDPATTERN}/I p" "$VDF" +} + +## Check if a VDF block (block_name) already exists inside a parent block (search_block) +## Ex: search_block "CompatToolMapping" for a specific block_name "22320" +function checkVdfSectionAlreadyExists { + SEARCHBLOCK="$( safequoteVdfBlockName "${1:-\"}" )" # Default to the first quotation, should be the start VDF file + BLOCKNAME="$( safequoteVdfBlockName "$2" )" # Block name to search for + VDF="$3" + + if [ -z "$BLOCKNAME" ]; then + writelog "ERROR" "${FUNCNAME[0]} - BLOCKNAME was not provided, skipping..." + return + fi + + SEARCHBLOCKVDFSECTION="$( getVdfSection "$SEARCHBLOCK" "" "" "$VDF" )" + if [ -z "$SEARCHBLOCKVDFSECTION" ]; then + return 0 + fi + + printf "%s" "$SEARCHBLOCKVDFSECTION" > "/tmp/tmp.vdf" + getVdfSection "$BLOCKNAME" "" "" "/tmp/tmp.vdf" | grep -iq "$BLOCKNAME" +} + +## Create entry in given VDF block with matching indentation (Case-INsensitive) +## Appends to bottom of target block by default, but can optionally append to the top instead +## +## This doesn't support adding nested entries, at least not very easily +function createVdfEntry { + VDF="$1" # Absolute path to VDF to insert into + PARENTBLOCKNAME="$( safequoteVdfBlockName "$2" )" # Block to start from, e.g. "CompatToolMapping" + NEWBLOCKNAME="$( safequoteVdfBlockName "$3" )" # Name of new block, e.g. "" + POSITION="${4:-bottom}" # POSITION to insert into, can be either top/bottom -- Bottom by default + + ## Ensure no duplicates are written out + if checkVdfSectionAlreadyExists "$PARENTBLOCKNAME" "$NEWBLOCKNAME" "$VDF"; then + # echo "Block already exists, skipping..." + writelog "SKIP" "${FUNCNAME[0]} - Block '$NEWBLOCKNAME' already exists in parent block '$PARENTBLOCKNAME' - Skipping" + return + fi + + ## Create array from args, skip first four to get array of key/value pairs for VDF block + NEWBLOCKVALUES=("${@:5}") + NEWBLOCKVALUESDELIM="!" + + ## Calculate indents for new block (one more than PARENTBLOCKNAME indent) + BASETABAMOUNT="$(( $( guessVdfIndent "${PARENTBLOCKNAME}" "$VDF" ) + 1 ))" + BLOCKTABAMOUNT="$(( BASETABAMOUNT + 1 ))" + + ## Tab amounts represented as string + BASETABSTR="$( generateVdfIndentString "$BASETABAMOUNT" )" + BLOCKTABSTR="$( generateVdfIndentString "$BLOCKTABAMOUNT" )" + + ## Calculations for line numbers + PARENTBLOCKLENGTH="$( getVdfSection "$PARENTBLOCKNAME" "" "" "$VDF" | wc -l )" + BLOCKLINESTART="$( grep -in "${PARENTBLOCKNAME}" "$VDF" | cut -d ':' -f1 | xargs )" + + TOPOFBLOCK="$(( BLOCKLINESTART + 1 ))" + BOTTOMOFBLOCK="$(( BLOCKLINESTART + PARENTBLOCKLENGTH - 2 ))" + + ## Decide which line to insert new block into + INSERTLINE="${BOTTOMOFBLOCK}" + if [[ "${POSITION,,}" == "top" ]]; then + INSERTLINE="${TOPOFBLOCK}" + fi + + ## Build new VDF entry string + ## Maybe this could be a separate function at some point, that generates a VDF string from the input array? + NEWBLOCKSTR="${BASETABSTR}${NEWBLOCKNAME}\n" # Add tab + block name + NEWBLOCKSTR+="${BASETABSTR}{\n" # Add tab + opening brace + for i in "${NEWBLOCKVALUES[@]}"; do + ## Cut string in array at delimiter and store them as key/val + NEWBLOCKDATA_KEY="$( echo "$i" | cut -d "${NEWBLOCKVALUESDELIM}" -f1 )" + NEWBLOCKDATA_VAL="$( echo "$i" | cut -d "${NEWBLOCKVALUESDELIM}" -f2 )" + + NEWBLOCKDATA_KEY="$( safequoteVdfBlockName "$NEWBLOCKDATA_KEY" )" + NEWBLOCKDATA_VAL="$( safequoteVdfBlockName "$NEWBLOCKDATA_VAL" )" + + NEWBLOCKSTR+="${BLOCKTABSTR}${NEWBLOCKDATA_KEY}" # Add tab + key + NEWBLOCKSTR+="\t\t${NEWBLOCKDATA_VAL}\n" # Add tab + val + newline + done + NEWBLOCKSTR+="${BASETABSTR}}" # Add tab + closing brace + + ## Write out new string to calculated line in VDF file + sed -i "${INSERTLINE}a\\${NEWBLOCKSTR}" "$VDF" +} +### END TEXT-BASED VDF INTERACTION FUNCTIONS + function startSettings { FUSEID "$1" From 0035b859f4334606472eb0d71a93cb5ac99a2239 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sat, 16 Sep 2023 23:19:53 +0100 Subject: [PATCH 02/19] Add Non-Steam Game: Initial skeleton UI for selecting compatibility tool --- lang/english.txt | 2 ++ steamtinkerlaunch | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lang/english.txt b/lang/english.txt index c3082cf3..2e78adc7 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1211,3 +1211,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game" diff --git a/steamtinkerlaunch b/steamtinkerlaunch index f7b2f828..8a47ef0c 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22291,6 +22291,7 @@ function addNonSteamGameGui { --field=" $GUI_SGATENFOOT!$DESC_SGATENFOOT ('NOSTGTENFOOT')":FL "${NOSTGTENFOOT/#-/ -}" \ --field=" $GUI_SGASETACTION!$DESC_SGASETACTION ('NOSTGSETACTION')":CB "$( cleanDropDown "copy" "$SGASETACTIONS" )" \ --field="$(spanFont "$GUI_NOSTGPROPS" "H")":LBL " " \ + --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "Proton-stl" "Proton-stl!proton_8!proton_7" )" \ --field=" $GUI_NOSTGLAOP!$DESC_NOSTGLAOP ('NOSTGLAOP')" "${NOSTGLAOP/#-/ -}" \ --field=" $GUI_NOSTTAGS!$DESC_NOSTTAGS ('NOSTTAGS')":CBE "$(cleanDropDown "${NOSTTAGS/#-/ -}" "$VALIDTAGS")" \ --field=" $GUI_NOSTGHIDE!$DESC_NOSTGHIDE ('NOSTGHIDE')":CHK "${NOSTGHIDE/#-/ -}" \ @@ -22324,12 +22325,13 @@ function addNonSteamGameGui { NOSTGTENFOOT="${NSGSETARR[10]}" NOSTGSETACTION="${NSGSETARR[11]}" # NSGSETARR[12] is Properties heading - NOSTGLAOP="${NSGSETARR[13]}" - NOSTTAGS="${NSGSETARR[14]}" - NOSTGHIDE="$( retBool "${NSGSETARR[15]}" )" - NOSTGADC="$( retBool "${NSGSETARR[16]}" )" - NOSTGAO="$( retBool "${NSGSETARR[17]}" )" - NOSTGVR="$( retBool "${NSGSETARR[18]}" )" + NOSTCOMPATTOOL="${NSGSETARR[13]}" + NOSTGLAOP="${NSGSETARR[14]}" + NOSTTAGS="${NSGSETARR[15]}" + NOSTGHIDE="$( retBool "${NSGSETARR[16]}" )" + NOSTGADC="$( retBool "${NSGSETARR[17]}" )" + NOSTGAO="$( retBool "${NSGSETARR[18]}" )" + NOSTGVR="$( retBool "${NSGSETARR[19]}" )" ## Arguments here like -hr, -lg, etc are made to match setGameArt writelog "INFO" "${FUNCNAME[0]} - addNonSteamGame -an=\"$NOSTGAPPNAME\" -ep=\"$NOSTGEXEPATH\" -sd=\"$NOSTGSTDIR\" -ip=\"$NOSTGICONPATH\" -lo=\"$NOSTGLAOP\" -hd=\"$NOSTGHIDE\" -adc=\"$NOSTGADC\" -ao=\"$NOSTGAO\" -vr=\"$NOSTGVR\" -t=\"$NOSTTAGS\" -hr=\"$NOSTGHERO\" -lg=\"$NOSTGLOGO\" -ba=\"$NOSTGBOXART\" -tf=\"$NOSTGTENFOOT\" \"--${NOSTGSETACTION}\"" From 2a5716ae813e233701f34f02594604fb946b023a Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sat, 16 Sep 2023 23:40:27 +0100 Subject: [PATCH 03/19] Add Non-Steam Game: More UI work for Non-Steam Game Compatibility Tool --- steamtinkerlaunch | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 8a47ef0c..c3ab30a2 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22291,7 +22291,7 @@ function addNonSteamGameGui { --field=" $GUI_SGATENFOOT!$DESC_SGATENFOOT ('NOSTGTENFOOT')":FL "${NOSTGTENFOOT/#-/ -}" \ --field=" $GUI_SGASETACTION!$DESC_SGASETACTION ('NOSTGSETACTION')":CB "$( cleanDropDown "copy" "$SGASETACTIONS" )" \ --field="$(spanFont "$GUI_NOSTGPROPS" "H")":LBL " " \ - --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "Proton-stl" "Proton-stl!proton_8!proton_7" )" \ + --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "$NON" "$NON!Proton-stl!proton_8!proton_7" )" \ --field=" $GUI_NOSTGLAOP!$DESC_NOSTGLAOP ('NOSTGLAOP')" "${NOSTGLAOP/#-/ -}" \ --field=" $GUI_NOSTTAGS!$DESC_NOSTTAGS ('NOSTTAGS')":CBE "$(cleanDropDown "${NOSTTAGS/#-/ -}" "$VALIDTAGS")" \ --field=" $GUI_NOSTGHIDE!$DESC_NOSTGHIDE ('NOSTGHIDE')":CHK "${NOSTGHIDE/#-/ -}" \ @@ -22333,9 +22333,13 @@ function addNonSteamGameGui { NOSTGAO="$( retBool "${NSGSETARR[18]}" )" NOSTGVR="$( retBool "${NSGSETARR[19]}" )" + ## TODO the Non-Steam compatibility tool option will need reworked + ## We will need to pass "pretty" proton names matching the other Proton dropdowns + ## We'll then need a way to map this to the internal compatibility tool names + ## Arguments here like -hr, -lg, etc are made to match setGameArt - writelog "INFO" "${FUNCNAME[0]} - addNonSteamGame -an=\"$NOSTGAPPNAME\" -ep=\"$NOSTGEXEPATH\" -sd=\"$NOSTGSTDIR\" -ip=\"$NOSTGICONPATH\" -lo=\"$NOSTGLAOP\" -hd=\"$NOSTGHIDE\" -adc=\"$NOSTGADC\" -ao=\"$NOSTGAO\" -vr=\"$NOSTGVR\" -t=\"$NOSTTAGS\" -hr=\"$NOSTGHERO\" -lg=\"$NOSTGLOGO\" -ba=\"$NOSTGBOXART\" -tf=\"$NOSTGTENFOOT\" \"--${NOSTGSETACTION}\"" - addNonSteamGame -an="$NOSTGAPPNAME" -ep="$NOSTGEXEPATH" -sd="$NOSTGSTDIR" -ip="$NOSTGICONPATH" -lo="$NOSTGLAOP" -hd="$NOSTGHIDE" -adc="$NOSTGADC" -ao="$NOSTGAO" -vr="$NOSTGVR" -t="$NOSTTAGS" -hr="$NOSTGHERO" -lg="$NOSTGLOGO" -ba="$NOSTGBOXART" -tf="$NOSTGTENFOOT" "--${NOSTGSETACTION}" + writelog "INFO" "${FUNCNAME[0]} - addNonSteamGame -an=\"$NOSTGAPPNAME\" -ep=\"$NOSTGEXEPATH\" -sd=\"$NOSTGSTDIR\" -ip=\"$NOSTGICONPATH\" -lo=\"$NOSTGLAOP\" -hd=\"$NOSTGHIDE\" -adc=\"$NOSTGADC\" -ao=\"$NOSTGAO\" -vr=\"$NOSTGVR\" -t=\"$NOSTTAGS\" -ct=\"$NOSTCOMPATTOOL\" -hr=\"$NOSTGHERO\" -lg=\"$NOSTGLOGO\" -ba=\"$NOSTGBOXART\" -tf=\"$NOSTGTENFOOT\" \"--${NOSTGSETACTION}\"" + addNonSteamGame -an="$NOSTGAPPNAME" -ep="$NOSTGEXEPATH" -sd="$NOSTGSTDIR" -ip="$NOSTGICONPATH" -lo="$NOSTGLAOP" -hd="$NOSTGHIDE" -adc="$NOSTGADC" -ao="$NOSTGAO" -vr="$NOSTGVR" -t="$NOSTTAGS" -ct="$NOSTCOMPATTOOL" -hr="$NOSTGHERO" -lg="$NOSTGLOGO" -ba="$NOSTGBOXART" -tf="$NOSTGTENFOOT" "--${NOSTGSETACTION}" fi ;; esac @@ -22452,6 +22456,8 @@ function addNonSteamGame { -stllo=*|--stllaunchoption=*) NOSTSTLLO="${i#*=}" shift ;; + -ct=*|--compatibilitytool=*) + NOSTCOMPATTOOL="${i#*=}" ## Mostly lifted+shifted from setGameArt -hr=*|--hero=*) NOSTGHERO="${i#*=}" # _hero.png -- Banner used on game screen, logo goes on top of this @@ -22523,6 +22529,7 @@ function addNonSteamGame { writelog "INFO" "${FUNCNAME[0]} - Allow Overlay: '${NOSTAO}'" writelog "INFO" "${FUNCNAME[0]} - OpenVR: '${NOSTVR}'" writelog "INFO" "${FUNCNAME[0]} - Tags: '${NOSTTAGS}'" + writelog "INFO" "${FUNCNAME[0]} - Compatibility Tool: '${NOSTCOMPATTOOL}'" ## Artwork logging -- These will be blank if no artwork is passed, that's OK writelog "INFO" "${FUNCNAME[0]} - Hero Artwork: '${NOSTGHERO}'" writelog "INFO" "${FUNCNAME[0]} - Logo Artwork: '${NOSTGLOGO}'" @@ -22613,6 +22620,11 @@ function addNonSteamGame { setGameArt "$NOSTAIDGRID" --hero="$NOSTGHERO" --logo="$NOSTGLOGO" --boxart="$NOSTGBOXART" --tenfoot="$NOSTGTENFOOT" "$SGACOPYMETHOD" + if [ -n "$NOSTCOMPATTOOL" ]; then + writelog "INFO" "${FUNCNAME[0]} - Adding selected compatibility tool '$NOSTCOMPATTOOL' for Non-Stteam Game..." + # TODO call function to write out to config VDF + fi + writelog "INFO" "${FUNCNAME[0]} - Finished adding new $NSGA" fi From c0e36f19a9e84b14dc76a1c4c0f494464ad572b9 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sat, 16 Sep 2023 23:52:07 +0100 Subject: [PATCH 04/19] Add Non-Steam Game: Initial logic for writing out chosen compat tool to config.vdf --- steamtinkerlaunch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index c3ab30a2..bb5b5022 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22458,6 +22458,7 @@ function addNonSteamGame { shift ;; -ct=*|--compatibilitytool=*) NOSTCOMPATTOOL="${i#*=}" + shift ;; ## Mostly lifted+shifted from setGameArt -hr=*|--hero=*) NOSTGHERO="${i#*=}" # _hero.png -- Banner used on game screen, logo goes on top of this @@ -22622,7 +22623,8 @@ function addNonSteamGame { if [ -n "$NOSTCOMPATTOOL" ]; then writelog "INFO" "${FUNCNAME[0]} - Adding selected compatibility tool '$NOSTCOMPATTOOL' for Non-Stteam Game..." - # TODO call function to write out to config VDF + NSGVDFVALS=( "name!${NOSTCOMPATTOOL}" "config!" "priority!250" ) + createVdfEntry "$CFGVDF" "CompatToolMapping" "$NOSTAIDGRID" "bottom" "${NSGVDFVALS[@]}" fi writelog "INFO" "${FUNCNAME[0]} - Finished adding new $NSGA" From 0ee7690dfd1408bf6259f4530893306d97ec1218 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 00:20:12 +0100 Subject: [PATCH 05/19] Add Non-Steam Game: Logging and checks/catches before writing out the VDF file --- steamtinkerlaunch | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index bb5b5022..97504601 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230917-1" +PROGVERS="v14.0.20230917-2 (nonsteam-setcompattool)" PROGCMD="${0##*/}" SHOSTL="stl" GHURL="https://github.com" @@ -22024,6 +22024,8 @@ function injectGdb { ## The code is pretty much the same but with variable names adapted to the SteamTinkerLaunch "convention" ## The code on Blush exists so this code can be used by others outside of SteamTinkerLaunch more easily +## TODO !!we need more logging for these functions!! + ## Generate string of [[:space:]] to represent indentation in VDF file, useful for searching function generateVdfIndentString { SPACETYPE="${2:-\t}" # Type of space, expected values could be '\t' (for writing) or '[[:space:]]' (for searching) @@ -22337,6 +22339,11 @@ function addNonSteamGameGui { ## We will need to pass "pretty" proton names matching the other Proton dropdowns ## We'll then need a way to map this to the internal compatibility tool names + ## Makes sure we ignore none compatibility tool + if [[ "$NOSTCOMPATTOOL" = "$NON" ]]; then + NOSTCOMPATTOOL="" + fi + ## Arguments here like -hr, -lg, etc are made to match setGameArt writelog "INFO" "${FUNCNAME[0]} - addNonSteamGame -an=\"$NOSTGAPPNAME\" -ep=\"$NOSTGEXEPATH\" -sd=\"$NOSTGSTDIR\" -ip=\"$NOSTGICONPATH\" -lo=\"$NOSTGLAOP\" -hd=\"$NOSTGHIDE\" -adc=\"$NOSTGADC\" -ao=\"$NOSTGAO\" -vr=\"$NOSTGVR\" -t=\"$NOSTTAGS\" -ct=\"$NOSTCOMPATTOOL\" -hr=\"$NOSTGHERO\" -lg=\"$NOSTGLOGO\" -ba=\"$NOSTGBOXART\" -tf=\"$NOSTGTENFOOT\" \"--${NOSTGSETACTION}\"" addNonSteamGame -an="$NOSTGAPPNAME" -ep="$NOSTGEXEPATH" -sd="$NOSTGSTDIR" -ip="$NOSTGICONPATH" -lo="$NOSTGLAOP" -hd="$NOSTGHIDE" -adc="$NOSTGADC" -ao="$NOSTGAO" -vr="$NOSTGVR" -t="$NOSTTAGS" -ct="$NOSTCOMPATTOOL" -hr="$NOSTGHERO" -lg="$NOSTGLOGO" -ba="$NOSTGBOXART" -tf="$NOSTGTENFOOT" "--${NOSTGSETACTION}" @@ -22457,6 +22464,9 @@ function addNonSteamGame { NOSTSTLLO="${i#*=}" shift ;; -ct=*|--compatibilitytool=*) + ## TODO stricter logic here about which compatibility tools we accept? + ## Maybe we need a dedicated method to check/map NOSTCOMPATTOOL? + ## Since this part is called from the commandline we should be careful about what we write out, and do some parsing+mapping NOSTCOMPATTOOL="${i#*=}" shift ;; ## Mostly lifted+shifted from setGameArt @@ -22622,9 +22632,14 @@ function addNonSteamGame { setGameArt "$NOSTAIDGRID" --hero="$NOSTGHERO" --logo="$NOSTGLOGO" --boxart="$NOSTGBOXART" --tenfoot="$NOSTGTENFOOT" "$SGACOPYMETHOD" if [ -n "$NOSTCOMPATTOOL" ]; then - writelog "INFO" "${FUNCNAME[0]} - Adding selected compatibility tool '$NOSTCOMPATTOOL' for Non-Stteam Game..." - NSGVDFVALS=( "name!${NOSTCOMPATTOOL}" "config!" "priority!250" ) - createVdfEntry "$CFGVDF" "CompatToolMapping" "$NOSTAIDGRID" "bottom" "${NSGVDFVALS[@]}" + if [ ! -f "$CFGVDF" ]; then + writelog "SKIP" "${FUNCNAME[0]} - No Config VDF found at '$CFGVDF' -- Unable to set compatibility tool for Non-Steam Game, skipping" + else + writelog "INFO" "${FUNCNAME[0]} - Adding selected compatibility tool '$NOSTCOMPATTOOL' for Non-Stteam Game" + NSGVDFVALS=( "name!${NOSTCOMPATTOOL}" "config!" "priority!250" ) + createVdfEntry "$CFGVDF" "CompatToolMapping" "$NOSTAIDGRID" "" "${NSGVDFVALS[@]}" + writelog "INFO" "${FUNCNAME[0]} - Finished adding Non-Steam Game compatibility tool to '$CFGVDF'" + fi fi writelog "INFO" "${FUNCNAME[0]} - Finished adding new $NSGA" From f8c34058a04e755afc273675d7c0e14a521fee20 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 03:27:52 +0100 Subject: [PATCH 06/19] Add Non-Steam Game: Update helpscreen --- steamtinkerlaunch | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 97504601..a6719492 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230917-2 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230917-3 (nonsteam-setcompattool)" PROGCMD="${0##*/}" SHOSTL="stl" GHURL="https://github.com" @@ -20593,15 +20593,16 @@ function howto { echo " -adc=|--allowdesktopconf= Allow Desktop Conf - optional" echo " -ao=|--allowoverlay= Allow Overlay - optional" echo " -vr=|--openvr= OpenVR - optional*" - echo " -t=|--tags= Tags - quoted, comma-separated" - echo " -stllo|--stllaunchoption Use '${PROGCMD} %command%' as Launch Option" - echo " -hr=|--hero= Hero Art path - Banner used on the Game Screen (3840x1240 recommended)" - echo " -lg=|--logo= Logo Art path - Logo that gets displayed on Game Screen (16:9 recommended)" - echo " -ba=|--boxart= Box Art path - Cover art used in the library (600x900 recommended)" - echo " -tf=|--tenfoot= Tenfoot Art path - Small banner used for recently played game in library (600x350 recommended)" - echo " --copy Copy art files to Steam Grid folder" - echo " --link Symlink art files to Steam Grid folder" - echo " --move Move art files to Steam Grid folder" + echo " -t=|--tags= Tags - quoted, comma-separated - optional" + echo " -stllo|--stllaunchoption Use '${PROGCMD} %command%' as Launch Option - optional" + echo " -ct=|--compatibilitytool= Specify the name of the compatibility tool to use - optional" + echo " -hr=|--hero= Hero Art path - Banner used on the Game Screen (3840x1240 recommended) - optional" + echo " -lg=|--logo= Logo Art path - Logo that gets displayed on Game Screen (16:9 recommended) - optional" + echo " -ba=|--boxart= Box Art path - Cover art used in the library (600x900 recommended) - optional" + echo " -tf=|--tenfoot= Tenfoot Art path - Small banner used for recently played game in library (600x350 recommended) - optional" + echo " --copy Copy art files to Steam Grid folder (default) - optional" + echo " --link Symlink art files to Steam Grid folder - optional" + echo " --move Move art files to Steam Grid folder - optional" echo " backup Backup found '$STUS' files" echo " (for 'SteamAppID' or 'all')" echo " block Opens the category Block selection menu" From 1b38d31430b82b5878c67f784b73e7e77187ea8a Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 03:34:41 +0100 Subject: [PATCH 07/19] Add Non-Steam Game: Add more logging --- steamtinkerlaunch | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index a6719492..d917edc5 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22025,8 +22025,6 @@ function injectGdb { ## The code is pretty much the same but with variable names adapted to the SteamTinkerLaunch "convention" ## The code on Blush exists so this code can be used by others outside of SteamTinkerLaunch more easily -## TODO !!we need more logging for these functions!! - ## Generate string of [[:space:]] to represent indentation in VDF file, useful for searching function generateVdfIndentString { SPACETYPE="${2:-\t}" # Type of space, expected values could be '\t' (for writing) or '[[:space:]]' (for searching) @@ -22067,6 +22065,8 @@ function getVdfSection { INDENTEDSTARTPATTERN="${INDENTSTR}${STARTPATTERN}" INDENTEDENDPATTERN="${INDENTSTR}${ENDPATTERN}" + writelog "INFO" "${FUNCNAME[0]} - Searching for VDF block with name '$STARTPATTERN' in VDF file '$VDF'" + sed -n "/${INDENTEDSTARTPATTERN}/I,/^${INDENTEDENDPATTERN}/I p" "$VDF" } @@ -22084,6 +22084,7 @@ function checkVdfSectionAlreadyExists { SEARCHBLOCKVDFSECTION="$( getVdfSection "$SEARCHBLOCK" "" "" "$VDF" )" if [ -z "$SEARCHBLOCKVDFSECTION" ]; then + writelog "WARN" "${FUNCNAME[0]} - Could not find VDF section with name '$SEARCHBLOCK' in VDF file '$VDF' -- Skipping" return 0 fi @@ -22108,6 +22109,8 @@ function createVdfEntry { return fi + writelog "INFO" "${FUNCNAME[0]} - Creating VDF data block to append to '$PARENTBLOCKNAME'" + ## Create array from args, skip first four to get array of key/value pairs for VDF block NEWBLOCKVALUES=("${@:5}") NEWBLOCKVALUESDELIM="!" @@ -22127,10 +22130,13 @@ function createVdfEntry { TOPOFBLOCK="$(( BLOCKLINESTART + 1 ))" BOTTOMOFBLOCK="$(( BLOCKLINESTART + PARENTBLOCKLENGTH - 2 ))" - ## Decide which line to insert new block into - INSERTLINE="${BOTTOMOFBLOCK}" + ## Decide which line to insert new block into (uses if/else for ease of logging) if [[ "${POSITION,,}" == "top" ]]; then INSERTLINE="${TOPOFBLOCK}" + writelog "INFO" "${FUNCNAME[0]} - Will insert new block into top of '$PARENTBLOCKNAME' VDF section" + else + INSERTLINE="${BOTTOMOFBLOCK}" + writelog "INFO" "${FUNCNAME[0]} - Will insert new block into bottom of '$PARENTBLOCKNAME' VDF section" fi ## Build new VDF entry string @@ -22150,6 +22156,9 @@ function createVdfEntry { done NEWBLOCKSTR+="${BASETABSTR}}" # Add tab + closing brace + writelog "INFO" "${FUNCNAME[0]} - Generated VDF block string '$NEWBLOCKSTR'" + writelog "INFO" "${FUNCNAME[0]} - Writing out VDF block string to VDF file at '$VDF'" + ## Write out new string to calculated line in VDF file sed -i "${INSERTLINE}a\\${NEWBLOCKSTR}" "$VDF" } From 265948359d212974bd0761d4011b57b22146d1f5 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 16:46:57 +0100 Subject: [PATCH 08/19] Add Non-Steam Game: Get Internal Compatibility Tool Name from Proton Name --- steamtinkerlaunch | 123 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 121 insertions(+), 2 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index d917edc5..b750abf8 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,8 +6,9 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230917-3 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230918-1 (nonsteam-setcompattool)" PROGCMD="${0##*/}" +PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" GHURL="https://github.com" AGHURL="https://api.github.com" @@ -2384,6 +2385,110 @@ function fillProtonCSV { fi } +## Get internal name for a Proton version, first by checking for a 'compatibilitytool.vdf' file in its root directory, then for a Proton version file +## Right now this is only used by addNonSteamGame +## TODO at some point maybe we should store this in the ProtonCSV as well? Then the format would be 'versionfilename;protonpath;internalname' +function getProtonInternalName { + ## Tools are not necessarily guaranteed to have this comment, but I checked several and they all had it: + ## - SteamTinkerLaunch (naturally) + ## - All GE-Proton8 releases + ## - Standard Proton-tkg releases + ## - Luxtorpeda + ## + ## Steam Linux Runtime 1.0 (scout) / Native Linux Steam Linux Runtime is identified as 'steamlinuxruntime' + ## No idea where the Steam Client gets this from, maybe it's just hardcoded, I couldn't find a string anywhere in the SteamLinuxRuntime installation folder or the 'appmanifest_1070560.acf' + function getProtonInternalNameVdf { + CTVPATH="$1" + if [ -f "$CTVPATH" ]; then + grep -i "// internal" "$CTVPATH" | sed 's-// Internal name of this tool--' | xargs + else + writelog "WARN" "${FUNCNAME[0]} - Could not find compatibilitytool.vdf file for Proton version at '$CTVPATH'" + echo "" + fi + } + + ## Get the Proton version version text file + function getProtonInternalNameVersionFile { + PPVPATH="$1" + if [ -f "$PPV" ]; then + awk '{print $2}' < "$PPV" + else + writelog "WARN" "${FUNCNAME[0]} - Could not find Proton version file at '$PPVPATH'" + fi + } + + ## Check if the path provided is for a Valve Proton version, by making some assumptions around the directory structure + function checkIsValveProton { + VPP="$1" # Valve Proton Path + + writelog "INFO" "${FUNCNAME[0]} - Checking if Proton version at '$VPP' is a Valve Proton version" + if [ -d "$VPP/dist" ] && [ ! -f "$VPP/$CTVDF" ]; then + writelog "INFO" "${FUNCNAME[0]} - Looks like we have a Valve Proton release here" + return 0 + else + writelog "INFO" "${FUNCNAME[0]} - Doesn't look like a Valve Proton release, no 'dist' folder in the Proton path and we have a '$CTVDF'" + return 1 + fi + } + + ## Build the Valve Proton internal name based on its version + some hardcoding for Experimental and Hotfix + function getValveProtonInternalName { + BASEPRTNAM="$1" + INTPROTNAM="proton_" + FINALINTPROTNAM="" + + writelog "INFO" "${FUNCNAME[0]} - Building Proton version internal name using version information" + PRTVERS="$( echo "${BASEPRTNAM%-*}" | cut -d '-' -f2 )" # Turn proton-8.0-3c into proton-8.0, then into 8.0 + + PRTMAJORVERS="$( echo "$PRTVERS" | cut -d '.' -f1 )" # Get minor version e.g. '8' from '8.0', '4' from '4.11' + PRTMINORVERS="$( echo "$PRTVERS" | cut -d '.' -f2 )" # Get minor version e.g. '0' from '8.0', '11' from '4.11' + + ## If minor vers > 0, we need to include it in the internal name -- Defaults to just major version + INTPROTVERSUFFIX="${PRTMAJORVERS}" + if [ "$PRTMINORVERS" -gt 0 ]; then + INTPROTVERSUFFIX+="${PRTMINORVERS}" + fi + + FINALINTPROTNAM="${INTPROTNAM}${INTPROTVERSUFFIX}" + + writelog "INFO" "${FUNCNAME[0]} - Final Internal Proton name for given Proton name '$BASEPRTNAM' string is '$FINALINTPROTNAM'" + echo "$FINALINTPROTNAM" + } + + PROTCSVSTR="$1" + + PRTVERS="$( echo "$PROTCSVSTR" | cut -d ';' -f1 )" + PRTPATH="$( echo "$PROTCSVSTR" | cut -d ';' -f2 )" + PRTPATHDIR="$( dirname "$PRTPATH" )" + + CTVDFPA="$PRTPATHDIR/$CTVDF" + PPV="$PRTPATHDIR/version" + + INTPROTNAME="$( getProtonInternalNameVdf "$CTVDFPA" )" # First attempt to get the internal name from compatibilitytool.vdf + if [ -n "$INTPROTNAME" ]; then + writelog "INFO" "${FUNCNAME[0]} - Got Proton Internal name '$INTPROTNAME' from '$CTVDFPA'" + echo "$INTPROTNAME" + elif [[ $PRTVERS == experimental* ]]; then # Experimental hardcode + writelog "INFO" "${FUNCNAME[0]} - Looks like we have Proton Experimental -- Hardcoding internal name 'proton_experimental'" + echo "proton_experimental" + elif [[ $PRTVERS == hotfix* ]]; then # Hotfix hardcode + writelog "INFO" "${FUNCNAME[0]} - Looks like we have Proton Hotfix here -- Hardcoding internal name to 'proton_hotfix'" + echo "proton_hotfix" + else + writelog "INFO" "${FUNCNAME[0]} - Could not get internal Proton name for '$PRTVERS' from '$CTVDF' - Maybe it didn't have this file" + writelog "INFO" "${FUNCNAME[0]} - Checking if we have a Valve Proton version here to build the internal name from" + + if checkIsValveProton "$PRTPATHDIR"; then + writelog "INFO" "${FUNCNAME[0]} - Seems we have a Valve Proton version, building internal name manually" + getValveProtonInternalName "$PRTVERS" + else + writelog "INFO" "${FUNCNAME[0]} - Doesn't seem like we have a Valve Proton version" + writelog "INFO" "${FUNCNAME[0]} - Still could not find Proton internal name from '$CTVDF' - Giving up and falling back to the Proton version, some tools use this as their internal name" + echo "$PRTVERS" + fi + fi +} + function printProtonArr { printf "%s\n" "${ProtonCSV[@]//\"/}" } @@ -22262,6 +22367,20 @@ function addNonSteamGameGui { NOSTGSTDIR="${NOSTGEXEPATH%/*}" fi + ## Generate list of internal Proton names + ## TODO in future, store this in ProtonCSV? + INTPROTNAMSARR=("$NON") + for PROTVERNAM in "${ProtonCSV[@]}"; do + INTPROTNAMSARR+=("$( getProtonInternalName "$PROTVERNAM" )") + done + + # These two have to be hardcoded + INTPROTNAMSARR+=("steamlinuxruntime") # Native Steam Linux Runtime + INTPROTNAMSARR+=("$PROGINTERNALPROTNAME") # SteamTinkerLaunch as compat tool + + # Create '!' delimited string + INTPROTNAMS="$(printf "!%s\n" "${INTPROTNAMSARR[@]//\"/}" | sort -u | cut -d ';' -f1 | tr -d '\n' | sed "s:^!::" | sed "s:!$::")" + # icon default if grep -q "^NOSTEAMSTLDEF=\"1\"" "$STLDEFGLOBALCFG"; then NOSTGICONPATH="$STLICON" @@ -22303,7 +22422,7 @@ function addNonSteamGameGui { --field=" $GUI_SGATENFOOT!$DESC_SGATENFOOT ('NOSTGTENFOOT')":FL "${NOSTGTENFOOT/#-/ -}" \ --field=" $GUI_SGASETACTION!$DESC_SGASETACTION ('NOSTGSETACTION')":CB "$( cleanDropDown "copy" "$SGASETACTIONS" )" \ --field="$(spanFont "$GUI_NOSTGPROPS" "H")":LBL " " \ - --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "$NON" "$NON!Proton-stl!proton_8!proton_7" )" \ + --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "$NON" "$INTPROTNAMS" )" \ --field=" $GUI_NOSTGLAOP!$DESC_NOSTGLAOP ('NOSTGLAOP')" "${NOSTGLAOP/#-/ -}" \ --field=" $GUI_NOSTTAGS!$DESC_NOSTTAGS ('NOSTTAGS')":CBE "$(cleanDropDown "${NOSTTAGS/#-/ -}" "$VALIDTAGS")" \ --field=" $GUI_NOSTGHIDE!$DESC_NOSTGHIDE ('NOSTGHIDE')":CHK "${NOSTGHIDE/#-/ -}" \ From 272d908ca5206145baf239d2eb1b1c4f2a3b6fc5 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 21:19:23 +0100 Subject: [PATCH 09/19] Add Non-Steam Game: Display Compatibility Tools Accessible To Steam On Dropdown --- lang/english.txt | 2 +- steamtinkerlaunch | 64 +++++++++++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/lang/english.txt b/lang/english.txt index 2e78adc7..338607cc 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1212,4 +1212,4 @@ GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" GUI_NOSTGCOMPATTOOL="Compatibility Tool" -DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/steamtinkerlaunch b/steamtinkerlaunch index b750abf8..715d15c4 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230918-1 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230918-3 (nonsteam-setcompattool)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" @@ -2426,7 +2426,7 @@ function getProtonInternalName { writelog "INFO" "${FUNCNAME[0]} - Looks like we have a Valve Proton release here" return 0 else - writelog "INFO" "${FUNCNAME[0]} - Doesn't look like a Valve Proton release, no 'dist' folder in the Proton path and we have a '$CTVDF'" + writelog "INFO" "${FUNCNAME[0]} - Doesn't look like a Valve Proton release, directory structure doesn't match" return 1 fi } @@ -22366,20 +22366,6 @@ function addNonSteamGameGui { NOSTGAPPNAME="${NOSTGEXEPATH##*/}" NOSTGSTDIR="${NOSTGEXEPATH%/*}" fi - - ## Generate list of internal Proton names - ## TODO in future, store this in ProtonCSV? - INTPROTNAMSARR=("$NON") - for PROTVERNAM in "${ProtonCSV[@]}"; do - INTPROTNAMSARR+=("$( getProtonInternalName "$PROTVERNAM" )") - done - - # These two have to be hardcoded - INTPROTNAMSARR+=("steamlinuxruntime") # Native Steam Linux Runtime - INTPROTNAMSARR+=("$PROGINTERNALPROTNAME") # SteamTinkerLaunch as compat tool - - # Create '!' delimited string - INTPROTNAMS="$(printf "!%s\n" "${INTPROTNAMSARR[@]//\"/}" | sort -u | cut -d ';' -f1 | tr -d '\n' | sed "s:^!::" | sed "s:!$::")" # icon default if grep -q "^NOSTEAMSTLDEF=\"1\"" "$STLDEFGLOBALCFG"; then @@ -22405,6 +22391,28 @@ function addNonSteamGameGui { TITLE="${PROGNAME}-$NSGA" pollWinRes "$TITLE" + # Generate list of Proton versions excluding Proton versions only available to SteamTinkerLaunch + # May cause problems with symlinked Proton versions, unsure, unusual case anyway + NSGPROTLIST=("$NON") + for STLKNOWNPROT in "${ProtonCSV[@]}"; do + STLKNOWNPROTNAM="$( echo "$STLKNOWNPROT" | cut -d ';' -f1 )" + STLKNOWNPROTPATH="$( echo "$STLKNOWNPROT" | cut -d ';' -f2 )" + + STLKNOWNPROTDIR="$( dirname "$STLKNOWNPROTPATH" )" + if [[ $STLKNOWNPROTDIR = $STLCFGDIR* ]]; then + writelog "SKIP" "${FUNCNAME[0]} - Proton version '$STLKNOWNPROTNAM' is in SteamTinkerLaunch config directory at '$STLKNOWNPROTPATH' -- This is not known by Steam, so skipping" + elif [[ $STLKNOWNPROTDIR = $CUSTPROTEXTDIR* ]] && [[ $CUSTPROTEXTDIR != $STEAMCOMPATOOLS ]]; then + writelog "INFO" "${FUNCNAME[0]} - Proton version '$STLKNOWNPROTNAM' is in SteamTinkerLaunch Custom Proton dir '$CUSTPROTEXTDIR' on path '$STLKNOWNPROTPATH' -- This path is not the Steam Compatibility Tool directory and so is not known by Steam, so skipping" + else + writelog "INFO" "${FUNCNAME[0]} - Proton version '$STLKNOWNPROTNAM' looks like it should be known by Steam as it is not in any SteamTinkerLaunch-specific folders on path '$STLKNOWNPROTPATH'" + NSGPROTLIST+=("$STLKNOWNPROTNAM") + fi + done + NSGPROTLIST+=("steamlinuxruntime") + NSGPROTLIST+=("$PROGINTERNALPROTNAME") + + NSGPROTYADLIST="$(printf "!%s\n" "${NSGPROTLIST[@]//\"/}" | sort -u | cut -d ';' -f1 | tr -d '\n' | sed "s:^!::" | sed "s:!$::")" + ## Language strings for artwork section were re-used from setGameArt NSGSET="$("$YAD" --f1-action="$F1ACTION" --window-icon="$STLICON" --form --center --on-top "$WINDECO" \ --title="$TITLE" --separator="|" \ @@ -22422,7 +22430,7 @@ function addNonSteamGameGui { --field=" $GUI_SGATENFOOT!$DESC_SGATENFOOT ('NOSTGTENFOOT')":FL "${NOSTGTENFOOT/#-/ -}" \ --field=" $GUI_SGASETACTION!$DESC_SGASETACTION ('NOSTGSETACTION')":CB "$( cleanDropDown "copy" "$SGASETACTIONS" )" \ --field="$(spanFont "$GUI_NOSTGPROPS" "H")":LBL " " \ - --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "$NON" "$INTPROTNAMS" )" \ + --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "$NON" "$NSGPROTYADLIST" )" \ --field=" $GUI_NOSTGLAOP!$DESC_NOSTGLAOP ('NOSTGLAOP')" "${NOSTGLAOP/#-/ -}" \ --field=" $GUI_NOSTTAGS!$DESC_NOSTTAGS ('NOSTTAGS')":CBE "$(cleanDropDown "${NOSTTAGS/#-/ -}" "$VALIDTAGS")" \ --field=" $GUI_NOSTGHIDE!$DESC_NOSTGHIDE ('NOSTGHIDE')":CHK "${NOSTGHIDE/#-/ -}" \ @@ -22464,10 +22472,6 @@ function addNonSteamGameGui { NOSTGAO="$( retBool "${NSGSETARR[18]}" )" NOSTGVR="$( retBool "${NSGSETARR[19]}" )" - ## TODO the Non-Steam compatibility tool option will need reworked - ## We will need to pass "pretty" proton names matching the other Proton dropdowns - ## We'll then need a way to map this to the internal compatibility tool names - ## Makes sure we ignore none compatibility tool if [[ "$NOSTCOMPATTOOL" = "$NON" ]]; then NOSTCOMPATTOOL="" @@ -22593,10 +22597,20 @@ function addNonSteamGame { NOSTSTLLO="${i#*=}" shift ;; -ct=*|--compatibilitytool=*) - ## TODO stricter logic here about which compatibility tools we accept? - ## Maybe we need a dedicated method to check/map NOSTCOMPATTOOL? - ## Since this part is called from the commandline we should be careful about what we write out, and do some parsing+mapping - NOSTCOMPATTOOL="${i#*=}" + ## Get path based on passed name from ProtonCSV, then build argument needed for getProtonInternalName + NOSTCOMPATTOOL="" + NOSTCOMPATTOOLNAME="${i#*=}" + if [ -n "$NOSTCOMPATTOOLNAME" ]; then + NOSTCOMPATTOOLPATH="$( getProtPathFromCSV "$NOSTCOMPATTOOLNAME" )" + + if [ -n "$NOSTCOMPATTOOLPATH" ]; then + NOSTCOMPATTOOL="$( getProtonInternalName "${NOSTCOMPATTOOLNAME};${NOSTCOMPATTOOLPATH}" )" + else + writelog "SKIP" "${FUNCNAME[0]} - Could not get Proton path for given Compatibility Tool '$NOSTCOMPATTOOLNAME' from ProtonCSV -- Skipping" + fi + else + writelog "SKIP" "${FUNCNAME[0]} - Compatibility Tool name argument was passed, but was empty '$NOSTCOMPATTOOLNAME' -- Skipping" + fi shift ;; ## Mostly lifted+shifted from setGameArt -hr=*|--hero=*) From a19b3a67c8957eb173f94f7446627975d1fa50c1 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 21:26:28 +0100 Subject: [PATCH 10/19] Add Non-Steam Game: Use NOSTCOMPATTOOLNAME as compatibility tool internal name if passed on commandline --- steamtinkerlaunch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 715d15c4..e716fa61 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22606,7 +22606,9 @@ function addNonSteamGame { if [ -n "$NOSTCOMPATTOOLPATH" ]; then NOSTCOMPATTOOL="$( getProtonInternalName "${NOSTCOMPATTOOLNAME};${NOSTCOMPATTOOLPATH}" )" else - writelog "SKIP" "${FUNCNAME[0]} - Could not get Proton path for given Compatibility Tool '$NOSTCOMPATTOOLNAME' from ProtonCSV -- Skipping" + # i.e. if 'luxtorpeda' was passed, we don't have a path for this, so simply trust the user + writelog "SKIP" "${FUNCNAME[0]} - Could not get Proton path for given Compatibility Tool '$NOSTCOMPATTOOLNAME' from ProtonCSV -- Simply assuming this internal name is valid and not known to SteamTinkerLaunch" + NOSTCOMPATTOOL="$NOSTCOMPATTOOLNAME" fi else writelog "SKIP" "${FUNCNAME[0]} - Compatibility Tool name argument was passed, but was empty '$NOSTCOMPATTOOLNAME' -- Skipping" From a3c156546a3b5748ae7bcfc642cb9f500e59dab3 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 21:29:48 +0100 Subject: [PATCH 11/19] shellcheck fixes --- steamtinkerlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index e716fa61..262bc837 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22401,7 +22401,7 @@ function addNonSteamGameGui { STLKNOWNPROTDIR="$( dirname "$STLKNOWNPROTPATH" )" if [[ $STLKNOWNPROTDIR = $STLCFGDIR* ]]; then writelog "SKIP" "${FUNCNAME[0]} - Proton version '$STLKNOWNPROTNAM' is in SteamTinkerLaunch config directory at '$STLKNOWNPROTPATH' -- This is not known by Steam, so skipping" - elif [[ $STLKNOWNPROTDIR = $CUSTPROTEXTDIR* ]] && [[ $CUSTPROTEXTDIR != $STEAMCOMPATOOLS ]]; then + elif [[ $STLKNOWNPROTDIR = $CUSTPROTEXTDIR* ]] && [[ $CUSTPROTEXTDIR != "$STEAMCOMPATOOLS" ]]; then writelog "INFO" "${FUNCNAME[0]} - Proton version '$STLKNOWNPROTNAM' is in SteamTinkerLaunch Custom Proton dir '$CUSTPROTEXTDIR' on path '$STLKNOWNPROTPATH' -- This path is not the Steam Compatibility Tool directory and so is not known by Steam, so skipping" else writelog "INFO" "${FUNCNAME[0]} - Proton version '$STLKNOWNPROTNAM' looks like it should be known by Steam as it is not in any SteamTinkerLaunch-specific folders on path '$STLKNOWNPROTPATH'" From 5deab4701e9fca40949c775c0332cbc3c93b988b Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 21:56:21 +0100 Subject: [PATCH 12/19] Add Non-Steam Game: Add logic to back up VDF file before writing out to it --- steamtinkerlaunch | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 262bc837..019ddeb8 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22130,6 +22130,39 @@ function injectGdb { ## The code is pretty much the same but with variable names adapted to the SteamTinkerLaunch "convention" ## The code on Blush exists so this code can be used by others outside of SteamTinkerLaunch more easily +function backupVdfFile { + ORGVDFNAME="$1" + + VDFBASENAME="$(basename "$ORGVDFNAME")" + VDFDIRNAME="$(dirname "$ORGVDFNAME")" + + VDFNAME="${VDFBASENAME%%.*}" + VDFEXT="${VDFBASENAME##*.}" + BACKUPVDFNAME="${VDFDIRNAME}/${VDFNAME}_steamtinkerlaunch.${VDFEXT}" + if [ -f "$ORGVDFNAME" ]; then + SHOULDBACKUPVDF=1 + if [ -f "$BACKUPVDFNAME" ]; then + writelog "INFO" "${FUNCNAME[0]} - Found existing VDF backup file '$BACKUPVDFNAME'" + if [ "$(( $(date +"%s") - $(stat -c "%Y" "$BACKUPVDFNAME") ))" -gt "86400" ]; then # file age > 1 day + writelog "INFO" "${FUNCNAME[0]} - Existing VDF backup file is older than 1 day, overwriting" + rm "$BACKUPVDFNAME" + else + writelog "SKIP" "${FUNCNAME[0]} - Existing VDF backup file is not older than 1 day, not overwriting" + SHOULDBACKUPVDF=0 + fi + fi + + if [ "$SHOULDBACKUPVDF" -eq 1 ]; then + writelog "INFO" "${FUNCNAME[0]} - Backing up VDF file '$VDFBASENAME' to '$( basename "$BACKUPVDFNAME" )'" + cp "$ORGVDFNAME" "$BACKUPVDFNAME" + else + writelog "INFO" "${FUNCNAME[0]} - Not backing up VDF file '$VDFBASENAME'" + fi + else + writelog "SKIP" "${FUNCNAME[0]} - VDF file to back up '$ORGVDFNAME' does not exist -- Nothing to back up" + fi +} + ## Generate string of [[:space:]] to represent indentation in VDF file, useful for searching function generateVdfIndentString { SPACETYPE="${2:-\t}" # Type of space, expected values could be '\t' (for writing) or '[[:space:]]' (for searching) @@ -22264,6 +22297,8 @@ function createVdfEntry { writelog "INFO" "${FUNCNAME[0]} - Generated VDF block string '$NEWBLOCKSTR'" writelog "INFO" "${FUNCNAME[0]} - Writing out VDF block string to VDF file at '$VDF'" + backupVdfFile "$VDF" + ## Write out new string to calculated line in VDF file sed -i "${INSERTLINE}a\\${NEWBLOCKSTR}" "$VDF" } @@ -24427,7 +24462,7 @@ function getSteamDeckCompatInfo { if ! "$JQ" -e '.success' "$COMPATFILE" 1>/dev/null; then writelog "INFO" "${FUNCNAME[0]} - File '$COMPATFILE' containing Steam Deck compatibility information already exists, however it looks like it failed last time - Removing it so we can attempt to redownload it" rm "$COMPATFILE" - elif [ "$(( $(date +"%s") - $(stat -c "%Y" "$COMPATFILE") ))" -gt "86400" ]; then # Todo maybe let the user define this in the Global Menu + elif [ "$(( $(date +"%s") - $(stat -c "%Y" "$COMPATFILE") ))" -gt "86400" ]; then # Todo maybe let the user define this in the Global Menu (default right now is > 1 day old) writelog "INFO" "${FUNCNAME[0]} - File '$COMPATFILE' is older than 1 day - Removing it so we can update in case the compatibility rating has changed" rm "$COMPATFILE" fi From 0649afb2426910ee0e6bd3b716358662e8ce68fb Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 21:58:19 +0100 Subject: [PATCH 13/19] Add Non-Steam Game: Use combobox entry for compatibility tool dropdown --- steamtinkerlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 019ddeb8..52566634 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22465,7 +22465,7 @@ function addNonSteamGameGui { --field=" $GUI_SGATENFOOT!$DESC_SGATENFOOT ('NOSTGTENFOOT')":FL "${NOSTGTENFOOT/#-/ -}" \ --field=" $GUI_SGASETACTION!$DESC_SGASETACTION ('NOSTGSETACTION')":CB "$( cleanDropDown "copy" "$SGASETACTIONS" )" \ --field="$(spanFont "$GUI_NOSTGPROPS" "H")":LBL " " \ - --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CB "$( cleanDropDown "$NON" "$NSGPROTYADLIST" )" \ + --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CBE "$( cleanDropDown "$NON" "$NSGPROTYADLIST" )" \ --field=" $GUI_NOSTGLAOP!$DESC_NOSTGLAOP ('NOSTGLAOP')" "${NOSTGLAOP/#-/ -}" \ --field=" $GUI_NOSTTAGS!$DESC_NOSTTAGS ('NOSTTAGS')":CBE "$(cleanDropDown "${NOSTTAGS/#-/ -}" "$VALIDTAGS")" \ --field=" $GUI_NOSTGHIDE!$DESC_NOSTGHIDE ('NOSTGHIDE')":CHK "${NOSTGHIDE/#-/ -}" \ From 49d7af05dc5f8ef053712aca02483077a2510d6f Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 22:06:41 +0100 Subject: [PATCH 14/19] update langfiles --- lang/chinese.txt | 2 ++ lang/dutch.txt | 2 ++ lang/englishUK.txt | 2 ++ lang/french.txt | 2 ++ lang/german.txt | 2 ++ lang/italian.txt | 2 ++ lang/polish.txt | 2 ++ lang/russian.txt | 2 ++ steamtinkerlaunch | 2 +- 9 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lang/chinese.txt b/lang/chinese.txt index ec7da5c0..5ee7222d 100644 --- a/lang/chinese.txt +++ b/lang/chinese.txt @@ -1211,3 +1211,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/lang/dutch.txt b/lang/dutch.txt index c876610c..502c959b 100644 --- a/lang/dutch.txt +++ b/lang/dutch.txt @@ -1210,3 +1210,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/lang/englishUK.txt b/lang/englishUK.txt index cd412566..83eb86d9 100644 --- a/lang/englishUK.txt +++ b/lang/englishUK.txt @@ -1210,3 +1210,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/lang/french.txt b/lang/french.txt index 9b2220b3..7d0238e2 100644 --- a/lang/french.txt +++ b/lang/french.txt @@ -1210,3 +1210,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/lang/german.txt b/lang/german.txt index 590af18c..1f4c3eb8 100644 --- a/lang/german.txt +++ b/lang/german.txt @@ -1212,3 +1212,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/lang/italian.txt b/lang/italian.txt index 53adc322..d0b9e2c5 100644 --- a/lang/italian.txt +++ b/lang/italian.txt @@ -1210,3 +1210,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/lang/polish.txt b/lang/polish.txt index 23a87af2..72af4c39 100644 --- a/lang/polish.txt +++ b/lang/polish.txt @@ -1210,3 +1210,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/lang/russian.txt b/lang/russian.txt index f78b946c..e97d5224 100644 --- a/lang/russian.txt +++ b/lang/russian.txt @@ -1210,3 +1210,5 @@ NOTY_SPECIALKINSTALLING="Installing SpecialK..." GUI_NOSTGPATHS="Game Paths" GUI_NOSTGGAMEART="Game Art" GUI_NOSTGPROPS="Game Properties" +GUI_NOSTGCOMPATTOOL="Compatibility Tool" +DESC_NOSTGCOMPATTOOL="Compatibility Tool to use with the Non-Steam Game - Default is 'none', meaning no tool will be used" diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 52566634..0b2d2095 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230918-3 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230918-5 (nonsteam-setcompattool)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" From 50308e2739b8a64cf3a94fca346cfc841c905ab2 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 23:41:14 +0100 Subject: [PATCH 15/19] update langfiles with note to close the Steam client beforehand --- lang/chinese.txt | 3 +-- lang/dutch.txt | 3 +-- lang/english.txt | 3 +-- lang/englishUK.txt | 3 +-- lang/french.txt | 3 +-- lang/german.txt | 3 +-- lang/italian.txt | 3 +-- lang/polish.txt | 3 +-- lang/russian.txt | 3 +-- steamtinkerlaunch | 2 +- 10 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lang/chinese.txt b/lang/chinese.txt index 5ee7222d..50228b43 100644 --- a/lang/chinese.txt +++ b/lang/chinese.txt @@ -447,8 +447,7 @@ GUI_STEAMCATSEL="选择 Steam 类别" BUT_SEL="选择" BUT_CREATE="创建" BUT_TAGS="标签" -GUI_WARNNSG1="Steam 需要重新启动以使新添加的游戏可用" -GUI_WARNNSG2="当为新游戏选择了标签后,必须在 Steam 客户端运行'XXX'命令并确认后才能激活它们" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Steam 重置集合" GUI_VINFO="已安装的支持 Vortex 的游戏" GUI_VINFO1="要禁用 Vortex Steam 类别中的游戏,需要在 Steam 客户端中直接从该类别中删除。" diff --git a/lang/dutch.txt b/lang/dutch.txt index 502c959b..335f5d9a 100644 --- a/lang/dutch.txt +++ b/lang/dutch.txt @@ -443,8 +443,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Steam needs to be restarted to make a newly added game available" -GUI_WARNNSG2="When Collections are selected for the new game, the command 'XXX'\nmust be run and confirmed afterwards in the Steam client to active them" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam client" diff --git a/lang/english.txt b/lang/english.txt index 338607cc..34c633aa 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -447,8 +447,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Steam needs to be restarted to make a newly added game available" -GUI_WARNNSG2="When Collections are selected for the new game, the command 'XXX'\nmust be run and confirmed afterwards in the Steam client to active them" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam client" diff --git a/lang/englishUK.txt b/lang/englishUK.txt index 83eb86d9..9267860f 100644 --- a/lang/englishUK.txt +++ b/lang/englishUK.txt @@ -443,8 +443,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Steam needs to be restarted to make a newly added game available" -GUI_WARNNSG2="When Collections are selected for the new game, the command 'XXX'\nmust be run and confirmed afterwards in the Steam client to active them" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam client" diff --git a/lang/french.txt b/lang/french.txt index 7d0238e2..e40bfa79 100644 --- a/lang/french.txt +++ b/lang/french.txt @@ -443,8 +443,7 @@ GUI_STEAMCATSEL="Sélectionner les catégories Steam" BUT_SEL="SELECTIONNER" BUT_CREATE="CREER" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Steam doit être redémarré pour qu'un jeu nouvellement ajouté soit disponible." -GUI_WARNNSG2="Lorsque les Collections sont sélectionnées pour le nouveau jeu,la commande\n'XXX' doit être exécutée et confirmée ensuite dans le client Steam pour les activer." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Réinitialisation des collections Steam" GUI_VINFO="Jeux installés prenant en charge Vortex" GUI_VINFO1="Pour désactiver Vortex pour un jeu de la catégorie Steam Vortex,\nil faut le supprimer de la catégorie directement dans le client Steam" diff --git a/lang/german.txt b/lang/german.txt index 1f4c3eb8..b9a5fea3 100644 --- a/lang/german.txt +++ b/lang/german.txt @@ -443,8 +443,7 @@ GUI_STEAMCATSEL="Wähle Steam Kollektionen" BUT_SEL="WÄHLEN" BUT_CREATE="ERSTELLEN" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Steam muß neugestartet werden, damit ein frisch erstelltes Spiel verfügbar ist" -GUI_WARNNSG2="Wenn Tags für das Spiel ausgewählt wurden, muß der Befehl 'XXX'\nim Anschluss ausgeführt werden, um sie zu aktivieren" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installierte Spiele mit Vortex Unterstützung" GUI_VINFO1="Um Vortex für ein Spiel zu deaktivieren, welches in der Vortex Steam Kollektion ist,\nmuß das Spiel direkt im Steam Client aus der Kollektion entfernt werden." diff --git a/lang/italian.txt b/lang/italian.txt index d0b9e2c5..3aab88d5 100644 --- a/lang/italian.txt +++ b/lang/italian.txt @@ -443,8 +443,7 @@ GUI_STEAMCATSEL="Selezionare categorie Steam" BUT_SEL="SELEZIONARE" BUT_CREATE="CREARE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Steam dev'essere riavviato per rendere disponibile il gioco aggiunto" -GUI_WARNNSG2="Quando snon selezionati i Collections per il nuovo gioco il comando 'XXX'\ndeve essere eseguito e successivamente confermato nel Client Steam per attivarli" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Giochi installati con il supporto a Vortex" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam Category.\nit needs to be removed from the category directly within the Steam Client" diff --git a/lang/polish.txt b/lang/polish.txt index 72af4c39..f34e2c1e 100644 --- a/lang/polish.txt +++ b/lang/polish.txt @@ -443,8 +443,7 @@ GUI_STEAMCATSEL="Wybierz kategorie Steam" BUT_SEL="WYBIERZ" BUT_CREATE="UTWÓRZ" BUT_TAGS="TAGI" -GUI_WARNNSG1="Steam musi być uruchomiony ponownnie by nowo dodana gra była dostępna" -GUI_WARNNSG2="Gdy tagi są wybrane dla nowej gry polecenie 'XXX'\nmusi być później uruchomione i potwierdzone w kliencie Steama by je aktywować" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Resetuj kolkcje Steam" GUI_VINFO="Zainstalowane gry ze wsparciem Vortex" GUI_VINFO1="By wyłączyć Vortex dla gry w kategorii Steam Vortex.\nmusi zostać usunięte z kategorii bezpośrednio w kliencie Steama" diff --git a/lang/russian.txt b/lang/russian.txt index e97d5224..c71a1bd2 100644 --- a/lang/russian.txt +++ b/lang/russian.txt @@ -443,8 +443,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Steam needs to be restarted to make a newly added game available" -GUI_WARNNSG2="When Collections are selected for the new game, the command 'XXX'\nmust be run and confirmed afterwards in the Steam client to active them" +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam Client" diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 0b2d2095..3dd243f7 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230918-5 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230918-6 (nonsteam-setcompattool)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" From 9b38c4260406cb8c280a6e40e2a4df16c4bf422b Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 17 Sep 2023 23:42:02 +0100 Subject: [PATCH 16/19] minor ui fix --- steamtinkerlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 3dd243f7..ab1db8d6 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -22451,7 +22451,7 @@ function addNonSteamGameGui { ## Language strings for artwork section were re-used from setGameArt NSGSET="$("$YAD" --f1-action="$F1ACTION" --window-icon="$STLICON" --form --center --on-top "$WINDECO" \ --title="$TITLE" --separator="|" \ - --text="$(spanFont "$GUI_ADDNSG" "H")\n$(strFix "$GUI_WARNNSG1" "$STERECO")." \ + --text="$(spanFont "$GUI_ADDNSG" "H")\n$(strFix "$GUI_WARNNSG1" "$STERECO")" \ --field=" ":LBL " " \ --field="$(spanFont "$GUI_NOSTGPATHS" "H")":LBL " " \ --field=" $GUI_NOSTGAPPNAME!$DESC_NOSTGAPPNAME ('NOSTGAPPNAME')" "${NOSTGAPPNAME/#-/ -}" \ From 254ebad714d6c3b36ed4626f0f999afe2f69c4ae Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 18 Sep 2023 00:59:27 +0100 Subject: [PATCH 17/19] Add Non-Steam Game: Add option to use the default Steam Compatibility Tool --- steamtinkerlaunch | 54 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index ab1db8d6..c4c21ce8 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230918-6 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230918-7 (nonsteam-setcompattool)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" @@ -22302,6 +22302,29 @@ function createVdfEntry { ## Write out new string to calculated line in VDF file sed -i "${INSERTLINE}a\\${NEWBLOCKSTR}" "$VDF" } + +## Get the internal name of the compatibility tool selected for all titles from the Steam Client Compatibility settings +## ex: Proton 8.0-3 would return 'proton_8' +## +## Compatibility Tools, even ones that are Windows EXEs, are not given a compatibility tool by default, so this function can be used +## to select the one used by default for Windows games. +## +## This compatibility tool doesn't even have to be Proton. +function getGlobalSteamCompatToolInternalName { + STEAMCOMPATTOOLSECTION="$( getVdfSection "CompatToolMapping" "" "" "$CFGVDF" )" # Get CompatToolMapping section + if [ -n "$STEAMCOMPATTOOLSECTION" ]; then + printf "%s" "$STEAMCOMPATTOOLSECTION" > "/tmp/tmp.vdf" + GLOBALSTEAMCOMPATTOOLSECTION="$( getVdfSection "0" "" "" "/tmp/tmp.vdf" )" + + if [ -n "$GLOBALSTEAMCOMPATTOOLSECTION" ]; then + echo "$GLOBALSTEAMCOMPATTOOLSECTION" | grep -i "name" | sed "s-\t- -g;s-\"name\"--g;s-\"--g" | xargs + else + writelog "SKIP" "${FUNCNAME[0]} - Could not find Global Compatibility Tool in CompatToolMapping in '$CFGVDF' - Giving up" + fi + else + writelog "SKIP" "${FUNCNAME[0]} - Could not find CompatToolMapping section in '$CFGVDF' - Giving up" + fi +} ### END TEXT-BASED VDF INTERACTION FUNCTIONS function startSettings { @@ -22428,7 +22451,7 @@ function addNonSteamGameGui { # Generate list of Proton versions excluding Proton versions only available to SteamTinkerLaunch # May cause problems with symlinked Proton versions, unsure, unusual case anyway - NSGPROTLIST=("$NON") + NSGPROTLIST=( "$NON" "default" ) for STLKNOWNPROT in "${ProtonCSV[@]}"; do STLKNOWNPROTNAM="$( echo "$STLKNOWNPROT" | cut -d ';' -f1 )" STLKNOWNPROTPATH="$( echo "$STLKNOWNPROT" | cut -d ';' -f2 )" @@ -22443,8 +22466,7 @@ function addNonSteamGameGui { NSGPROTLIST+=("$STLKNOWNPROTNAM") fi done - NSGPROTLIST+=("steamlinuxruntime") - NSGPROTLIST+=("$PROGINTERNALPROTNAME") + NSGPROTLIST+=( "$PROGINTERNALPROTNAME" "steamlinuxruntime" ) NSGPROTYADLIST="$(printf "!%s\n" "${NSGPROTLIST[@]//\"/}" | sort -u | cut -d ';' -f1 | tr -d '\n' | sed "s:^!::" | sed "s:!$::")" @@ -22636,18 +22658,28 @@ function addNonSteamGame { NOSTCOMPATTOOL="" NOSTCOMPATTOOLNAME="${i#*=}" if [ -n "$NOSTCOMPATTOOLNAME" ]; then - NOSTCOMPATTOOLPATH="$( getProtPathFromCSV "$NOSTCOMPATTOOLNAME" )" - - if [ -n "$NOSTCOMPATTOOLPATH" ]; then - NOSTCOMPATTOOL="$( getProtonInternalName "${NOSTCOMPATTOOLNAME};${NOSTCOMPATTOOLPATH}" )" + if [[ "$NOSTCOMPATTOOLNAME" == "default" ]]; then # Default fetches the global Steam compat tool + GLOBALSTEAMCOMPATTOOL="$( getGlobalSteamCompatToolInternalName )" + if [ -n "$GLOBALSTEAMCOMPATTOOL" ]; then + NOSTCOMPATTOOL="$GLOBALSTEAMCOMPATTOOL" + else + writelog "INFO" "${FUNCNAME[0]} - Selected 'default' compatibility tool but could not find one in '$CFGVDF' -- Not writing compatibility tool for Non-Steam Game" + fi else - # i.e. if 'luxtorpeda' was passed, we don't have a path for this, so simply trust the user - writelog "SKIP" "${FUNCNAME[0]} - Could not get Proton path for given Compatibility Tool '$NOSTCOMPATTOOLNAME' from ProtonCSV -- Simply assuming this internal name is valid and not known to SteamTinkerLaunch" - NOSTCOMPATTOOL="$NOSTCOMPATTOOLNAME" + NOSTCOMPATTOOLPATH="$( getProtPathFromCSV "$NOSTCOMPATTOOLNAME" )" + + if [ -n "$NOSTCOMPATTOOLPATH" ]; then + NOSTCOMPATTOOL="$( getProtonInternalName "${NOSTCOMPATTOOLNAME};${NOSTCOMPATTOOLPATH}" )" + else + # i.e. if 'luxtorpeda' was passed, we don't have a path for this, so simply trust the user + writelog "SKIP" "${FUNCNAME[0]} - Could not get Proton path for given Compatibility Tool '$NOSTCOMPATTOOLNAME' from ProtonCSV -- Simply assuming this internal name is valid and not known to SteamTinkerLaunch" + NOSTCOMPATTOOL="$NOSTCOMPATTOOLNAME" + fi fi else writelog "SKIP" "${FUNCNAME[0]} - Compatibility Tool name argument was passed, but was empty '$NOSTCOMPATTOOLNAME' -- Skipping" fi + shift ;; ## Mostly lifted+shifted from setGameArt -hr=*|--hero=*) From 69dca58906bb5ad487eaa165ba7b58618c724878 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 18 Sep 2023 01:00:40 +0100 Subject: [PATCH 18/19] Add Non-Steam Game: update helpscreen --- steamtinkerlaunch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index c4c21ce8..31d01e25 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230918-7 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230918-8 (nonsteam-setcompattool)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" @@ -20701,6 +20701,7 @@ function howto { echo " -t=|--tags= Tags - quoted, comma-separated - optional" echo " -stllo|--stllaunchoption Use '${PROGCMD} %command%' as Launch Option - optional" echo " -ct=|--compatibilitytool= Specify the name of the compatibility tool to use - optional" + echo " Can specify 'default' to use the global Steam Compatibility Tool" echo " -hr=|--hero= Hero Art path - Banner used on the Game Screen (3840x1240 recommended) - optional" echo " -lg=|--logo= Logo Art path - Logo that gets displayed on Game Screen (16:9 recommended) - optional" echo " -ba=|--boxart= Box Art path - Cover art used in the library (600x900 recommended) - optional" From f513d4b7b45b615a75d5f4efbbcd1eb9f2d53769 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 18 Sep 2023 17:26:13 +0100 Subject: [PATCH 19/19] version bump --- steamtinkerlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 31d01e25..b88a3ea3 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20230918-8 (nonsteam-setcompattool)" +PROGVERS="v14.0.20230919-1" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl"