Skip to content

Commit

Permalink
Non-Steam: Disable Steam AppID file (#946)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic2kk authored Oct 21, 2023
1 parent 3bd2e4b commit 93260a8
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lang/chinese.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ DESC_USEWINEDEBUGPROTON="也为 Proton 使用'winedebug 设置'"
GUI_CLEANPROTONTEMP="清除 Proton 临时文件"
DESC_CLEANPROTONTEMP="退出时清理 Proton 临时文件目录'drive_c/users/steamuser/Temp'"
GUI_STEAMAPPIDFILE="SteamAppID 文件"
DESC_STEAMAPPIDFILE="如果启用,在 gamedir 中创建 steam_appid.txt 文件,如果禁用,则删除它"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="应用程序名称"
DESC_NOSTGAPPNAME="游戏的应用名称 - 可选"
GUI_NOSTGEXEPATH="EXE"
Expand Down
2 changes: 1 addition & 1 deletion lang/dutch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ DESC_USEWINEDEBUGPROTON="Use the 'winedebug settings' also for Proton"
GUI_CLEANPROTONTEMP="Clean Proton Temp"
DESC_CLEANPROTONTEMP="Cleanup Proton Temp directory 'drive_c/users/steamuser/Temp' on exit"
GUI_STEAMAPPIDFILE="SteamAppID file"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="App Name"
DESC_NOSTGAPPNAME="The app name of the game - Optional"
GUI_NOSTGEXEPATH="Executable Path"
Expand Down
2 changes: 1 addition & 1 deletion lang/english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ DESC_USEWINEDEBUGPROTON="Use the 'winedebug settings' also for Proton"
GUI_CLEANPROTONTEMP="Clean Proton Temp"
DESC_CLEANPROTONTEMP="Cleanup Proton Temp directory 'drive_c/users/steamuser/Temp' on exit"
GUI_STEAMAPPIDFILE="SteamAppID file"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="App Name"
DESC_NOSTGAPPNAME="The app name of the game - Optional"
GUI_NOSTGEXEPATH="Executable Path"
Expand Down
2 changes: 1 addition & 1 deletion lang/englishUK.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ DESC_USEWINEDEBUGPROTON="Use the 'winedebug settings' also for Proton"
GUI_CLEANPROTONTEMP="Clean Proton Temp"
DESC_CLEANPROTONTEMP="Cleanup Proton Temp directory 'drive_c/users/steamuser/Temp' on exit"
GUI_STEAMAPPIDFILE="SteamAppID file"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="App name"
DESC_NOSTGAPPNAME="The app name of the game - Optional"
GUI_NOSTGEXEPATH="Executable Path"
Expand Down
2 changes: 1 addition & 1 deletion lang/french.txt
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ DESC_USEWINEDEBUGPROTON="Utiliser 'winedebug settings' aussi pour Proton"
GUI_CLEANPROTONTEMP="Nettoyer Proton Temp"
DESC_CLEANPROTONTEMP="Nettoyage du répertoire Proton Temp 'drive_c/users/steamuser/Temp' à la sortie"
GUI_STEAMAPPIDFILE="Fichier SteamAppID"
DESC_STEAMAPPIDFILE="Crée le fichier steam_appid.txt dans le dossier de jeu si activé ou le supprime si désactivé"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="Nom de l'application"
DESC_NOSTGAPPNAME="Le nom de l'application - facultatif"
GUI_NOSTGEXEPATH="Executable"
Expand Down
2 changes: 1 addition & 1 deletion lang/german.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ DESC_USEWINEDEBUGPROTON="Verwende 'Winedebug Einstellungen' auch für Proton"
GUI_CLEANPROTONTEMP="Leere Proton Temp"
DESC_CLEANPROTONTEMP="Leere Proton Temp Verzeichnis 'drive_c/users/steamuser/Temp' beim Beenden"
GUI_STEAMAPPIDFILE="SteamAppID Datei"
DESC_STEAMAPPIDFILE="Erstelle steam_appid.txt Datei im Spieleverzeichnis wenn aktiviert oder entferne sie wenn deaktiviert"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="Spiele Name"
DESC_NOSTGAPPNAME="Der Name des Spiels - Optional"
GUI_NOSTGEXEPATH="Executable"
Expand Down
2 changes: 1 addition & 1 deletion lang/italian.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ DESC_USEWINEDEBUGPROTON="Usa 'Winedebug Settings' anche per Proton"
GUI_CLEANPROTONTEMP="Svuotare la cartella temporanea di Proton"
DESC_CLEANPROTONTEMP="Svuotare la cartella temporanea di Proton 'drive_c/users/steamuser/Temp' all'uscita"
GUI_STEAMAPPIDFILE="SteamAppID File"
DESC_STEAMAPPIDFILE="Se abilitato creare il file steam_appid.txt nella gamedir o cancellarlo se è disabilitato"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="Nome App"
DESC_NOSTGAPPNAME="Il nome dell'APP per il gioco - opzionale"
GUI_NOSTGEXEPATH="Executable"
Expand Down
2 changes: 1 addition & 1 deletion lang/polish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ DESC_USEWINEDEBUGPROTON="Użyj 'Ustawień Winedebug' również dla Protona"
GUI_CLEANPROTONTEMP="Wyczyść pliki tymczasowe Protona"
DESC_CLEANPROTONTEMP="Wyczyść katalog plików tymczasowych Protona w 'drive_c/users/steamuser/Temp' przy wyjściu"
GUI_STEAMAPPIDFILE="Plik SteamAppID"
DESC_STEAMAPPIDFILE="Utwórz plik steam_appid.txt w katalogu gry jeśli włączone lub usuń go jeśli wyłączone"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="Nazwa aplikacji"
DESC_NOSTGAPPNAME="Nazwa aplikacji gry – opcjonalna"
GUI_NOSTGEXEPATH="Plik wykonalny"
Expand Down
2 changes: 1 addition & 1 deletion lang/russian.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ DESC_USEWINEDEBUGPROTON="Use the 'Winedebug Settings' also for Proton"
GUI_CLEANPROTONTEMP="Clean Proton Temp"
DESC_CLEANPROTONTEMP="Cleanup Proton Temp directory 'drive_c/users/steamuser/Temp' on exit"
GUI_STEAMAPPIDFILE="SteamAppID File"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled"
DESC_STEAMAPPIDFILE="Create steam_appid.txt file in gamedir if enabled or delete it if disabled -- This option has no effect for Non-Steam Games"
GUI_NOSTGAPPNAME="App Name"
DESC_NOSTGAPPNAME="The app name of the game - Optional"
GUI_NOSTGEXEPATH="Executable Path"
Expand Down
49 changes: 41 additions & 8 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v14.0.20231022-2"
PROGVERS="v14.0.20231022-3"
PROGCMD="${0##*/}"
PROGINTERNALPROTNAME="Proton-stl"
SHOSTL="stl"
Expand Down Expand Up @@ -2369,7 +2369,6 @@ function setCustomGameVars {
GN="$GE"

# Allows custom programs to use SLR and force it from the toolmanifest -- May not be a good idea but ¯\_(ツ)_/¯
# TODO allow SLR for custom programs?
USESLR=1
HAVESLR=0

Expand Down Expand Up @@ -9164,8 +9163,6 @@ function installReshade {
installRSdll "$CUSTRSDLL" "0" "$RSARCHDLL"
done

## TODO add notifier for ReShade install, like we have for SpecialK

#d3d47 - Required for ReShade
# NOTE 25/08/23: *Is* it still required?
installd3d47dll "$RSD3D47DLL" "$INSTDESTDIR"
Expand Down Expand Up @@ -11628,7 +11625,7 @@ function commandlineOneTimeRun {
if [ "$OTSAVE" == "TRUE" ];then # Save one-time settings to game config file -- Really only useful for OneTimeRunGUI
writelog "INFO" "${FUNCNAME[0]} - Saving One time run settings into '$STLGAMECFG'"
# Only save Proton version if we're using a Windows executable, otherwise we don't set a Proton version!
# TODO check if this still works?

if [ "$ISWINDOWSEXE" -eq 1 ]; then
touch "$FUPDATE"
updateConfigEntry "OTPROTON" "$OTPROTON" "$STLGAMECFG"
Expand Down Expand Up @@ -13929,8 +13926,16 @@ function checkSteamAppIDFile {

if [ "$STEAMAPPIDFILE" -eq 1 ]; then
if [ ! -f "$GSAIT" ]; then
writelog "INFO" "${FUNCNAME[0]} - Creating '$GSAIT' because STEAMAPPIDFILE is enabled"
echo "$AID" > "$GSAIT"
if ! haveNonSteamGame; then
writelog "INFO" "${FUNCNAME[0]} - Creating '$GSAIT' because STEAMAPPIDFILE is enabled"
echo "$AID" > "$GSAIT"
else
# Can't create steam_appid.txt for Non-Steam Games because this causes crashes, see #941
writelog "INFO" "${FUNCNAME[0]} - Looks like we have a Non-Steam Game, not creating '$GSAIT' because this would cause crashes, and forcing 'STEAMAPPIDFILE' to '0'"
touch "$FUPDATE"
STEAMAPPIDFILE=0
updateConfigEntry "STEAMAPPIDFILE" "$STEAMAPPIDFILE" "$STLGAMECFG"
fi
else
writelog "INFO" "${FUNCNAME[0]} - STEAMAPPIDFILE is enabled and '$GSAIT' already exists - nothing to do"
fi
Expand All @@ -13945,8 +13950,9 @@ function checkSteamAppIDFile {
loadCfg "$CSAIT" X
if [ "$OWNSAIT" -eq 1 ]; then
writelog "INFO" "${FUNCNAME[0]} - OWNSAIT is '$OWNSAIT', means the game ships an own '$SAIT'. Leaving untouched and enabling STEAMAPPIDFILE"
updateConfigEntry "STEAMAPPIDFILE" "1" "$STLGAMECFG"
touch "$FUPDATE"
STEAMAPPIDFILE=1
updateConfigEntry "STEAMAPPIDFILE" "$STEAMAPPIDFILE" "$STLGAMECFG"
else
writelog "INFO" "${FUNCNAME[0]} - Removing '$GSAIT' because the game doesn't own it and STEAMAPPIDFILE is disabled"
rm "$GSAIT" 2>/dev/null
Expand Down Expand Up @@ -25499,9 +25505,30 @@ function removeEmptyFiles {
done
}

# Determine if we have a Non-Steam Game based on some observed behaviour:
# - All Steam applications pass a SteamAppId and SteamOverlayGameId environment variable
# - These two values are equal for Steam games/apps (Native+Proton)
# - There is also SteamGameId, which is the same for Steam games/apps (SteamAppId == SteamGameId == SteamOverlayGameId)
# - For Non-Steam Games, SteamAppId and SteamGameId are equal, but SteamOverlayGameId is different and a very long number compared to regular Non-Steam AppIds
# - This option is still passed even if the Steam Overlay is disabled
# - Therefore if SteamAppId and SteamOverlayGameId don't match, we can assume we have a Non-Steam Game
# - There is a chance these values could match if a user somehow manages to accidentally (or purposefully) set the values to be the same, but in 99% of cases this should be sufficient
# - When launching games with SteamTinkerLaunch from the commandline, SteamOverlayGameId probably won't be set
function haveNonSteamGame {
# shellcheck disable=SC2154 # SteamOverlayGameId comes from Steam
if [ -z "$SteamOverlayGameId" ]; then
return 1 # No SteamOverlayGameId, prevents false-positive when running from commandline
elif [ "$SteamAppId" != "$SteamOverlayGameId" ]; then
return 0
else
return 1
fi
}

##################

function main {

initShmStl
restoreGtkCss
rm "$TEMPLOG" "$WINRESLOG" "$PRELOG" "$APPMALOG" "$GGDLOG" 2>/dev/null
Expand Down Expand Up @@ -25545,6 +25572,12 @@ function main {
saveOrgVars
emptyVars "O"

if haveNonSteamGame && [ -n "$SteamAppId" ]; then
writelog "WARN" "${FUNCNAME[0]} - Looks like we have a Non-Steam Game but we have SteamAppId defined -- This has been observed to cause crashes, please remove it from your game folder!"
elif haveNonSteamGame ; then
writelog "INFO" "${FUNCNAME[0]} - Looks like we have a Non-Steam Game here, no extra steps but if this is NOT a Non-Steam Game, please report this incorrect detection as a bug"
fi

# Notify success on Steam Deck
if [ "$ONSTEAMDECK" -eq 1 ] && [ "$STEAMDECKSTEAMRUN" -eq 0 ]; then
printf '\n'
Expand Down

0 comments on commit 93260a8

Please sign in to comment.