fix parsing of steamappid inside ulwgl ids, pass '0' as steamappid for games with no steam version (https://github.com/ValveSoftware/steam-runtime/issues/287#issuecomment-831877852)

This commit is contained in:
GloriousEggroll 2024-01-26 11:40:12 -07:00
parent 608eeb0344
commit c3c016bcdc
2 changed files with 4 additions and 15 deletions

13
ULWGL
View File

@ -177,18 +177,7 @@ if [ -n "$log_to_file" ]; then
if [ -z "${STEAM_COMPAT_APP_ID-}" ] && [ -z "${SteamAppId-}" ]; then
app="non-steam-game"
else
# for non-steam games ULWGL passes the ULWGL_ID as STEAM_COMPAT_APP_ID and SteamAppId
# which means it won't be null and will fail the above check, making this script think
# it's a steam game. We need to perform a numerical check here
# to validate a non-numeric ID is set as a non-steam game.
numcheck='^[0-9]+$'
# if is numeric, assign as steam app id.
if [[ $(cat ${STEAM_COMPAT_APP_ID-}) =~ $numcheck ]] || [[ $(cat ${SteamAppId-}) =~ $numcheck ]]; then
app="app${STEAM_COMPAT_APP_ID-${SteamAppId}}"
else
# if not numeric, assign as non-steam game.
app="non-steam-game"
fi
app="app${STEAM_COMPAT_APP_ID-${SteamAppId}}"
fi
log_filename="slr-${app}-t$(date +'%Y%m%dT%H%M%S').log"

View File

@ -17,10 +17,10 @@ if [[ $WINEPREFIX ]]; then
fi
export PROTONPATH="$PROTONPATH"
export ULWGL_ID="$GAMEID"
export STEAM_COMPAT_APP_ID="$GAMEID"
export STEAM_COMPAT_APP_ID="0"
numcheck='^[0-9]+$'
if [[ $(cat $ULWGL_ID | cut -d "-" -f 2) =~ $numcheck ]]; then
export STEAM_COMPAT_APP_ID=$(cat $ULWGL_ID | cut -d "-" -f 2)
if [[ $(echo $ULWGL_ID | cut -d "-" -f 2) =~ $numcheck ]]; then
export STEAM_COMPAT_APP_ID=$(echo $ULWGL_ID | cut -d "-" -f 2)
fi
export SteamAppId="$STEAM_COMPAT_APP_ID"
export SteamGameId="$STEAM_COMPAT_APP_ID"