From 08e007610903be795a7896b0e083c0358d8e4c9b Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 30 Oct 2023 21:02:42 +0000 Subject: [PATCH 1/9] Add Non-Steam Game: Refactor how VDF values are written --- steamtinkerlaunch | 54 +++++++++-------------------------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 0f91739a..e85e184f 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -23697,59 +23697,25 @@ function addNonSteamGame { printf '\x01%s\x00%s\x00' "AppName" "$NOSTAPPNAME" printf '\x01%s\x00%s\x00' "Exe" "$NOSTEXEPATH" printf '\x01%s\x00%s\x00' "StartDir" "$NOSTSTDIR" + printf '\x01%s\x00%s\x00' "icon" "$NOSTICONPATH" + printf '\x01%s\x00%s\x00' "ShortcutPath" "" + printf '\x01%s\x00%s\x00' "LaunchOptions" "$NOSTLAOP" - if [ -n "$NOSTICONPATH" ]; then - printf '\x01%s\x00%s\x00' "icon" "$NOSTICONPATH" - else - printf '\x01%s\x00\x00' "icon" - fi - - printf '\x01%s\x00\x00' "ShortcutPath" - - if [ -n "$NOSTLAOP" ]; then - printf '\x01%s\x00%s\x00' "LaunchOptions" "$NOSTLAOP" - else - printf '\x01%s\x00\x00' "LaunchOptions" - fi - - if [ "$NOSTHIDE" -eq 1 ]; then - printf '\x02%s\x00\x01\x00\x00\x00' "IsHidden" - else - printf '\x02%s\x00\x00\x00\x00\x00' "IsHidden" - fi - - if [ "$NOSTADC" -eq 1 ]; then - printf '\x02%s\x00\x01\x00\x00\x00' "AllowDesktopConfig" - else - printf '\x02%s\x00\x00\x00\x00\x00' "AllowDesktopConfig" - fi - - if [ "$NOSTAO" -eq 1 ]; then - printf '\x02%s\x00\x01\x00\x00\x00' "AllowOverlay" - else - printf '\x02%s\x00\x00\x00\x00\x00' "AllowOverlay" - fi - - if [ "$NOSTVR" -eq 1 ]; then - printf '\x02%s\x00\x01\x00\x00\x00' "OpenVR" - else - printf '\x02%s\x00\x00\x00\x00\x00' "OpenVR" - fi + # Before we had an ifelse for this, checking if the var -eq 1, but we can just write the value as-is to the VDF + # Use either the defined value, which should be 1 or 0, or default to 0 + printf '\x02%s\x00\x0%s\x00\x00\x00' "IsHidden" "${NOSTHIDE:-0}" + printf '\x02%s\x00\x0%s\x00\x00\x00' "AllowDesktopConfig" "${NOSTADC:-0}" + printf '\x02%s\x00\x0%s\x00\x00\x00' "AllowOverlay" "${NOSTAO:-0}" + printf '\x02%s\x00\x0%s\x00\x00\x00' "OpenVR" "${NOSTVR:-0}" printf '\x02%s\x00\x00\x00\x00\x00' "Devkit" printf '\x01%s\x00\x00' "DevkitGameID" printf '\x02%s\x00\x00\x00\x00\x00' "DevkitOverrideAppID" - printf '\x02%s\x00\x00\x00\x00\x00' "LastPlayTime" printf '\x01%s\x00\x00' "FlatpakAppID" printf '\x00%s\x00' "tags" splitTags "$NOSTTAGS" - printf '\x08' - printf '\x08' - - #file end: - printf '\x08' - printf '\x08' + printf '\x08\x08\x08\x08' } >> "$SCPATH" writelog "INFO" "${FUNCNAME[0]} - Finished writing out new Non-Steam Game Shortcut" From d5e2def3cd02b77c924ff04ecf06d6300e3d8c6f Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 30 Oct 2023 21:03:13 +0000 Subject: [PATCH 2/9] Add Non-Steam Game: Refactor how VDF values are written --- steamtinkerlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index e85e184f..78ea4804 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20231031-1" +PROGVERS="v14.0.20231031-2 (ansg-writeout-refactor)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" From e191f53824e28566488e187c605067f57a14be78 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 30 Oct 2023 22:37:48 +0000 Subject: [PATCH 3/9] Add Non-Steam Game: Default boolean values to blank if not 1 or 0 --- steamtinkerlaunch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 78ea4804..620b0045 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -23320,6 +23320,12 @@ function addNonSteamGame { fi SCPATH="$STUIDPATH/config/$SCVDF" + function checkValidVDFBoolean { + if [ "$1" -eq 1 ] || [ "$1" -eq 0 ]; then + echo "$1" # Only return value if 1 or 0, then other places can do "${var:-0}" + fi + } + function getCRC { echo -n "$1" | gzip -c | tail -c 8 | od -An -N 4 -tx4 } @@ -23449,19 +23455,19 @@ function addNonSteamGame { NOSTLAOP="${i#*=}" shift ;; -hd=*|--hide=*) - NOSTHIDE="${i#*=}" + NOSTHIDE="$( checkValidVDFBoolean "${i#*=}" )" shift ;; -adc=*|--allowdesktopconf=*) - NOSTADC="${i#*=}" + NOSTADC="$( checkValidVDFBoolean "${i#*=}" )" shift ;; -ao=*|--allowoverlay=*) - NOSTAO="${i#*=}" + NOSTAO="$( checkValidVDFBoolean "${i#*=}" )" shift ;; -vr=*|--openvr=*) - NOSTVR="${i#*=}" + NOSTVR="$( checkValidVDFBoolean "${i#*=}" )" shift ;; -t=*|--tags=*) - NOSTTAGS="${i#*=}" + NOSTTAGS="$( checkValidVDFBoolean "${i#*=}" )" shift ;; -stllo=*|--stllaunchoption=*) NOSTSTLLO="${i#*=}" From 3089bc30ee5567341b933d494ccb638cc4b58088 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 30 Oct 2023 22:41:08 +0000 Subject: [PATCH 4/9] Add Non-Steam Game: Simplify checkValidVDFBoolean --- steamtinkerlaunch | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 620b0045..062cce54 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -23321,9 +23321,7 @@ function addNonSteamGame { SCPATH="$STUIDPATH/config/$SCVDF" function checkValidVDFBoolean { - if [ "$1" -eq 1 ] || [ "$1" -eq 0 ]; then - echo "$1" # Only return value if 1 or 0, then other places can do "${var:-0}" - fi + [ "$1" -eq 1 ] || [ "$1" -eq 0 ] && echo "$1" } function getCRC { From 8f4b00415bb7718cb5ace6ce2cbd43f6193a7ed4 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 30 Oct 2023 22:53:12 +0000 Subject: [PATCH 5/9] minor --- steamtinkerlaunch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 062cce54..078395f6 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -23335,9 +23335,8 @@ function addNonSteamGame { ## Notes on how Non-Steam AppIDs work, because it took me almost a year to figure this out ## ---------------------- ## Steam stores shortcuts in a binary file called 'shortcuts.vdf', stored in SROOT/userdata//config - ## This file stores information about Steam shortcuts, with many values being written out in hex, such as the Steam AppID and boolean values ## - ## Non-Steam Game AppIDs are 32bit little-endian (reverse byte order) signed integers, stores as hexidecimal + ## Non-Steam Game AppIDs are 32bit little-endian (reverse byte order) signed integers, stored as hexidecimal ## This AppID is probably generated using some combination of the AppName and Exe with a crc32 generated from them, but it can actually be anything ## Steam likely does things this way in an attempt to ensure "uniqueness" among entries. Projects like Steam-ROM-Manager do the same thing likely for similar reasons ## From a40a4a8a92ff51fbd49337fc61a4614059d3c797 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 30 Oct 2023 22:57:28 +0000 Subject: [PATCH 6/9] minor --- steamtinkerlaunch | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 078395f6..0f810049 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20231031-2 (ansg-writeout-refactor)" +PROGVERS="v14.0.20231031-4 (ansg-writeout-refactor)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" @@ -23347,7 +23347,6 @@ function addNonSteamGame { ## ## We can later re-use these functions to do several things: ## - Check for and remove stray STL configs for no longer stored Non-Steam Game AppIDs (if we had Non-Steam Games we previously used with STL that we no longer use, we can remove these configs in case there is a conflict in future) - ## ---------------------- ### BEGIN MAGIC APPID FUNCTIONS ## ---------- @@ -23642,9 +23641,9 @@ function addNonSteamGame { # Regular artwork notiShow "$NOTY_SGDBDL" - # The entered name to search on will take priority over the actual game EXE name, only one will be used and we will always prefer the entered custom name - # For example if a user naames their Non-Steam Game "The Elder Scrolls IV: Oblivion" but they enter a custom search name because they want artwork for "The Elder Scrolls IV: Oblivion Game of the Year Edition" - # If art is not found for the custom name, users should enter either the Steam AppID or the SteamGridDB Game ID to use as a fallback (Steam AppID will always be preferred because it will always be exact) + # The entered search name is prioritised over actual game EXE name, only one will be used and we will always prefer custom name + # Ex: user names Non-Steam Game "The Elder Scrolls IV: Oblivion" but they enter a custom search name because they want artwork for "The Elder Scrolls IV: Oblivion Game of the Year Edition" + # In case art is not found for the custom name, users should enter either the Steam AppID or the SteamGridDB Game ID to use as a fallback (Steam AppID will always be preferred because it will always be exact) # # Therefore, the order of priority for artwork searching is: # 1. Name search (only ONE of the below will be used) @@ -23693,7 +23692,6 @@ function addNonSteamGame { fi writelog "INFO" "${FUNCNAME[0]} - Adding new set '$NEWSET'" - { printf '\x00%s\x00' "$NEWSET" printf '\x02%s\x00%b' "appid" "$NOSTAIDVDFHEXFMT" @@ -23738,7 +23736,6 @@ function addNonSteamGame { fi writelog "INFO" "${FUNCNAME[0]} - Finished adding new $NSGA" - SGACOPYMETHOD="" # Unset doesn't work for some reason with '--flag' } From f0227d789b6c508bf03f260c450e86cd037037fe Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Wed, 1 Nov 2023 23:57:54 +0000 Subject: [PATCH 7/9] Add Non-Steam Game: Fix using checkValidVDFBoolean for tags --- steamtinkerlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 0f810049..bc2a3e57 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -23463,7 +23463,7 @@ function addNonSteamGame { NOSTVR="$( checkValidVDFBoolean "${i#*=}" )" shift ;; -t=*|--tags=*) - NOSTTAGS="$( checkValidVDFBoolean "${i#*=}" )" + NOSTTAGS="${i#*=}" shift ;; -stllo=*|--stllaunchoption=*) NOSTSTLLO="${i#*=}" From 9c06e61b5b82ce89231f72ea6a9a2558e8c7e59a Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Thu, 2 Nov 2023 01:22:36 +0000 Subject: [PATCH 8/9] Add Non-Steam Game: Write out bytes instead of string using printf --- steamtinkerlaunch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index bc2a3e57..b0dde794 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20231031-4 (ansg-writeout-refactor)" +PROGVERS="v14.0.20231101-1 (ansg-writeout-refactor)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" @@ -23704,10 +23704,10 @@ function addNonSteamGame { # Before we had an ifelse for this, checking if the var -eq 1, but we can just write the value as-is to the VDF # Use either the defined value, which should be 1 or 0, or default to 0 - printf '\x02%s\x00\x0%s\x00\x00\x00' "IsHidden" "${NOSTHIDE:-0}" - printf '\x02%s\x00\x0%s\x00\x00\x00' "AllowDesktopConfig" "${NOSTADC:-0}" - printf '\x02%s\x00\x0%s\x00\x00\x00' "AllowOverlay" "${NOSTAO:-0}" - printf '\x02%s\x00\x0%s\x00\x00\x00' "OpenVR" "${NOSTVR:-0}" + printf '\x02%s\x00%b\x00\x00\x00' "IsHidden" "\x0${NOSTHIDE:-0}" + printf '\x02%s\x00%b\x00\x00\x00' "AllowDesktopConfig" "\x0${NOSTADC:-0}" + printf '\x02%s\x00%b\x00\x00\x00' "AllowOverlay" "\x0${NOSTAO:-0}" + printf '\x02%s\x00%b\x00\x00\x00' "OpenVR" "\x0${NOSTVR:-0}" printf '\x02%s\x00\x00\x00\x00\x00' "Devkit" printf '\x01%s\x00\x00' "DevkitGameID" From 43235560322278bf16fbd0ff47cc40079e1948d1 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Thu, 2 Nov 2023 19:52:40 +0000 Subject: [PATCH 9/9] version bump --- steamtinkerlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index b0dde794..8c0961f5 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20231101-1 (ansg-writeout-refactor)" +PROGVERS="v14.0.20231103-1" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl"