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

Commandline: Add support for Non-Steam Games to getCompatData #970

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 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.20231108-3"
PROGVERS="v14.0.20231108-4"
PROGCMD="${0##*/}"
PROGINTERNALPROTNAME="Proton-stl"
SHOSTL="stl"
Expand Down Expand Up @@ -7849,6 +7849,8 @@ function getGameExe {
}

function getCompatData {
SEARCHSTEAMSHORTCUTS="${2:-0}" # Default to not searching Steam shortcuts

if [ -z "$1" ]; then
echo "A Game ID or Game Title is required as argument"
else
Expand Down Expand Up @@ -7899,6 +7901,25 @@ function getCompatData {
fi
fi

# Check Steam Shortcuts for games never launched with STL
if [ ! -d "$SEARCHGAMEDIR" ] && [ "$SEARCHSTEAMSHORTCUTS" -eq 1 ] && haveAnySteamShortcuts ; then
while read -r SCVDFE; do
SCVDFEAID="$( parseSteamShortcutEntryAppID "$SCVDFE" )"
SCVDFENAME="$( parseSteamShortcutEntryAppName "$SCVDFE" )"

## If we have a match, build a hardcoded compatdata pointing at the Steam Root compatdata dir and if it exists, return that
## Seems like this is always where Steam generates compatdata for Non-Steam Games
## may instead be primary drive which defaults to Steam Root, but for now looks like Steam Root is the main place, so should work most of the time
if [ "$SCVDFEAID" -eq "$1" ] 2>/dev/null || [[ ${SCVDFENAME,,} == *"${1,,}"* ]]; then
SCVDFECODA="$SROOT/$SA/$CODA/${SCVDFEAID}"
if [ -d "$SCVDFECODA" ]; then
COMPATGAMESTR="$SCVDFENAME ($SCVDFEAID) -> $SCVDFECODA"
fi
break
fi
done <<< "$( getSteamShortcutHex )"
fi

echo "${COMPATGAMESTR:-$NOTFOUNDSTR}"
fi
else
Expand Down Expand Up @@ -22020,7 +22041,7 @@ function commandline {
elif [ "$1" == "gettitle" ] || [ "$1" == "gt" ]; then
getTitleFromID "$2" "1"
elif [ "$1" == "getcompatdata" ] || [ "$1" == "gc" ]; then
getCompatData "$2"
getCompatData "$2" "1"
elif [ "$1" == "getgamedir" ] || [ "$1" == "gg" ]; then
if [ "$3" == "only" ]; then
getGameDir "$2" "X"
Expand Down