Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steam Deck dependency enhancement #1111

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions lang/english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,8 @@ GUI_SGASETACTION="Artwork Set Method"
DESC_SGASETACTION="Specifies how to set the artwork, either by copying the source files, symlinking them, or moving them - If unsure, leave at default 'copy'"
GUI_STLRAD_PFTST="RADV Perfest options"
DESC_STLRAD_PFTST="A comma-separated list of named flags, which can be used to enable experimental driver features and performance enhancements for RADV Vulkan driver"
GUI_STEAMDECK_AUTOUP="Autoupdate STL libraries [Steam Deck ONLY]"
DESC_STEAMDECK_AUTOUP="Enable the libraries autoupdater for the Steam Deck after an STL update"
GUI_MAHUDLSYM="Use MangoHud --dlsym"
DESC_MAHUDLSYM="Append '--dlsym' to MangoHud - May fix OpenGL games not displaying MangoHud"
GUI_CW_LUTRIS="Wine Lutris URL"
Expand Down
50 changes: 48 additions & 2 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v14.0.20240727-1"
PROGVERS="v14.0.20240819-1 (steamdeck-dependency-handling)"
PROGCMD="${0##*/}"
PROGINTERNALPROTNAME="Proton-stl"
SHOSTL="stl"
Expand Down Expand Up @@ -345,6 +345,7 @@ SGDBTNFTSTYLEOPTS="alternate,blurred,white_logo,material"
GETSTAID="99[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]99"

STLGAMES="$STLCFGDIR/games"
STLSTEAMDECKLASTVERS="$STLCFGDIR/lastvers"
STLGDESKD="$STLGAMES/desktop"
STLIDFD="$STLGAMES/desktopfiles"
STLISLDFD="$STLGAMES/sldesktopfiles"
Expand Down Expand Up @@ -3241,6 +3242,7 @@ function setDefaultCfgValues {
if [ -z "$TERMARGS" ] ; then TERMARGS="-e"; fi
if [ -z "$USEGLOBALWINEDPI" ] ; then USEGLOBALWINEDPI="0"; fi
if [ -z "$GLOBALWINEDPI" ] ; then GLOBALWINEDPI="$DEFWINEDPI"; fi
if [ -z "$STEAMDECK_AUTOUP" ] ; then STEAMDECK_AUTOUP="1"; fi
}

function setDefaultCfgValuesdefault_template {
Expand Down Expand Up @@ -3806,6 +3808,8 @@ function saveCfg {
echo "USETERM=\"$USETERM\""
echo "## $DESC_TERMARGS"
echo "TERMARGS=\"$TERMARGS\""
echo "## $DESC_STEAMDECK_AUTOUP"
echo "STEAMDECK_AUTOUP=\"$STEAMDECK_AUTOUP\""

} >> "$1"
#ENDsaveCfgglobal
Expand Down Expand Up @@ -5775,6 +5779,7 @@ function AllSettingsEntriesDummyFunction {
--field=" $GUI_RUNSBS!$DESC_RUNSBS ('RUNSBS')":CHK "${RUNSBS/#-/ -}" `#CAT_Misc` `#SUB_Checkbox` `#MENU_GAME` \
--field=" $GUI_SDLUSEWAYLAND!$DESC_SDLUSEWAYLAND ('SDLUSEWAYLAND')":CHK "${SDLUSEWAYLAND/#-/ -}" `#CAT_Misc` `#SUB_Checkbox` `#MENU_GAME` \
--field=" $GUI_STLRAD_PFTST!$DESC_STLRAD_PFTST ('STLRAD_PFTST')":CBE "$(cleanDropDown "${STLRAD_PFTST/#-/ -}" "none!gpl!sam!rt!emulate_rt!rtwave64!video_decode")" `#CAT_Misc` `#MENU_GAME` \
--field=" $GUI_STEAMDECK_AUTOUP!$DESC_STEAMDECK_AUTOUP ('STEAMDECK_AUTOUP')":CHK "${STEAMDECK_AUTOUP/#-/ -}" `#CAT_Misc` `#SUB_Checkbox` `#MENU_GLOBAL` \
--field="$(spanFont "$GUI_OPTSPROTON" "H")":LBL "SKIP" `#CAT_Proton` `#HEAD_Proton` `#MENU_GAME` `#MENU_GLOBAL` \
--field=" $GUI_USEPROTON!$DESC_USEPROTON ('USEPROTON')":CB "$(cleanDropDown "${USEPROTON/#-/ -}" "$PROTYADLIST")" `#CAT_Proton` `#MENU_GAME` \
--field=" $GUI_USESLR!$DESC_USESLR ('USESLR')":CHK "${USESLR/#-/ -}" `#CAT_Proton` `#SUB_Checkbox` `#MENU_GAME` \
Expand Down Expand Up @@ -26432,7 +26437,14 @@ function checkSteamDeckDependencies {
local CHECKCMD
CHECKCMD="$($DEPCMD &> /dev/null --version && echo "OK" || echo "NOK")"

if [ -f "$(command -v "$DEPCMD")" ] && [ "$CHECKCMD" = "OK" ]; then

# The check now says, don't update dependencies if all of these conditions are true:
# 1. The dependency file exists
# 2. The dependency can actually be ran, confirming it is a valid file
# 3. SteamTinkerLaunch has not updated or autoupdater isn't enabled, so there would be no change in dependency version and thus no need to update
# If any of these are false, we need to check our dependencies (if a file is missing we would need to update, or if it cannot be used we need to update, and also if STL updated we may need a newer version, so update).
if [[ -f "$(command -v "$DEPCMD")" && "$CHECKCMD" = "OK" ]] \
&& ! ( [ "$STEAMDECK_AUTOUP" -eq 1 ] && checkSteamDeckSTLUpdated ); then
writelog "INFO" "${FUNCNAME[0]} - Using '$DEPCMD' binary found in path: '$(command -v "$DEPCMD")'"
echo "Dependency '$DEPCMD' already installed, nothing to do."
else
Expand Down Expand Up @@ -26466,6 +26478,8 @@ function checkSteamDeckDependencies {
installDependencyVersionFromURL "$INNOEXTRACT" "$INNOEXTRACTFILE" "$STLDEPS" "$INNOEXTRACTURL" || steamDeckInstallFail
installDependencyVersionFromURL "$CABEXTRACT" "$CABEXTRACTFILE" "$STLDEPS" "$CABEXTRACTURL" || steamDeckInstallFail

updateSteamDeckLastVers # If everything went well, we update the lastversion file

if [ -f "$(command -v "yad")" ]; then
writelog "INFO" "${FUNCNAME[0]} - Using yad binary found in path: '$(command -v "yad")'"
echo "Dependency 'yad' already installed, nothing to do."
Expand Down Expand Up @@ -26641,6 +26655,7 @@ function steamdedeckt {

if [ "$STEAMDECKSTEAMRUN" -eq 0 ]; then
installFilesSteamDeck
checkSteamDeckLastVers
checkSteamDeckDependencies

# Don't remove dependencies offline
Expand Down Expand Up @@ -26699,6 +26714,22 @@ function restoreGtkCss {
fi
}

function checkSteamDeckLastVers {
# This function just makes sure that the 'lastvers' file exists at the defined path
# If it does not we set it and clear the deps to ensure it starts downloading the libs at the right version
if ! [ -f "$STLSTEAMDECKLASTVERS" ]; then
clearDeckDeps
echo "$PROGVERS" > "$STLSTEAMDECKLASTVERS"
fi
}

function updateSteamDeckLastVers {
# This function updates the 'lastvers' file after a dependency update if there was a version change
if checkSteamDeckSTLUpdated; then
echo "$PROGVERS" > "$STLSTEAMDECKLASTVERS"
fi
}

function prepareSteamDeckCompatInfo {
if [ "$AID" -eq "$PLACEHOLDERAID" ]; then
writelog "SKIP" "${FUNCNAME[0]} - AppID '$AID' is placeholder AppID ('$PLACEHOLDERAID') -- Not fetching Steam Deck compatibility info"
Expand Down Expand Up @@ -26851,6 +26882,21 @@ function getSteamDeckCompatInfo {
echo "$COMPATINFO"
}

# This function will check if the version in `$STLSTEAMDECKLASTVERS` does not match the current version
# For example, if we had v14.0 installed before, 'lastvers' would have v14.0
# Then, if we were updating to v15.0, 'lastvers' would be 'v14.0' but 'PROGVERS' would be 'v15.0'
function checkSteamDeckSTLUpdated {
# This is how updateCfgFile gets the config file version, so re-use it
CHECKLASTVERSSTEAMDECK="$( cat "$STLSTEAMDECKLASTVERS" )"
if [ "$CHECKLASTVERSSTEAMDECK" = "$PROGVERS" ]; then
writelog "INFO" "${FUNCNAME[0]} - Last known SteamTinkerLaunch install version ('$CHECKLASTVERSSTEAMDECK') and the current version ('$PROGVERS') match -- There has been no update since last launch"
return 1
else
writelog "INFO" "${FUNCNAME[0]} - Last known SteamTinkerLaunch install version ('$CHECKLASTVERSSTEAMDECK') and the current version ('$PROGVERS') do NOT match -- It seems there has been an update!"
return 0
fi
}

# Clear dependencies in /home/deck/stl/deps so that they can be redownloaded the next time SteamTinkerLaunch is ran on Steam Deck
# This also serves as a quickfix for #719, as dependencies an be quickly removed and then re-downloaded to ensure better compatibility with SteamOS updates
# In future, STL should auto-bump these somehow
Expand Down