Last active
September 3, 2023 01:04
-
-
Save dpanter/4bc3f7dd4983f7f990706acd0214e6af to your computer and use it in GitHub Desktop.
compatcheck.sh - Check which compatibility tools Steam is configured to use on installed games
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# compatcheck.sh | |
# Check which compatibility tools Steam is configured to use on installed games | |
# What's the point? Steam has no easy way to tell you which compat tools are used where. | |
# If you delete a custom proton version that is in use, Steam lists those games as not installed | |
# Created 2020-08-12 - Updated 2020-08-13 | |
# Written for Siduction (Debian sid based distro) | |
# By dpanter https://gist.github.com/dpanter | |
# kudos to MoistGoat | |
# default path to steams main game config file, use legacy path for backwards compatibility | |
CFILE=~/.steam/steam/config/config.vdf | |
# find steam game libraries | |
CDIR=$(grep "BaseInstallFolder" $CFILE | awk -F'"' '/BaseInstallFolder/ { print $4"/steamapps"}') | |
IFS=$'\n' array=($(printf "$CDIR")) | |
# print installed steam games, their appid and currently enabled compatibility tool | |
for c in "${array[@]}"; do | |
printf '\n'"Steam library: $c"'\n' | |
printf "%45s | %-10s | %-10s\n" "-----" "----------" "------------------" | |
printf "%45s | %-10s | %-10s\n" "Title" "AppID" "Compatibility Tool" | |
printf "%45s | %-10s | %-10s\n" "-----" "----------" "------------------" | |
for f in "$c"/*.acf; do | |
COL5=$(grep -w "appid" $f | awk -F'"' '/appid/ { print $4}') | |
COL6=$(grep "installdir" $f | awk -F'"' '/installdir/ { print $4 }') | |
COL7=$(sed -n "/CompatToolMapping/,/SurveyID/p" $CFILE | grep -A 2 -w $COL5 | awk -F'"' '/name/ { print $4 }') | |
printf "%45s | %-10s | %-10s\n" "$COL6" "$COL5" "$COL7" | |
done | |
done | |
# determine if any non-steam games have been installed | |
CNONS=$(sed -n "/CompatToolMapping/,/SurveyID/p" $CFILE | grep -B 2 -w "name" | awk -F'"' '{ print $2 }' | awk 'length>8' ) | |
IFS=$'\n' array=($(printf "$CNONS")) | |
# print all detected non-steam games, their compat directory and currently enabled compatibility tool | |
# this isn't 100% due to how infuriatingly whimsical Valve made this system | |
# use protontricks to grab the game binary, also not 100% | |
if [ -z "$CNONS" ] ; then | |
printf '\n'"Could not find any installed non-Steam games."'\n' | |
else | |
printf '\n'"Non-Steam apps - Note that these compat dirs may no longer exist."'\n' | |
printf "Default location: $HOME/.steam/steam/steamapps/compatdata/"'\n' | |
printf "%45s | %-10s | %-10s\n" "--------------------------" "----------" "------------------" | |
printf "%45s | %-10s | %-10s\n" "Protontricks detected game" "Compat dir" "Compatibility Tool" | |
printf "%45s | %-10s | %-10s\n" "--------------------------" "----------" "------------------" | |
for n in "${array[@]}"; do | |
COL2=$(hash protontricks 2>&-&& protontricks -s non-steam | grep $n | awk -F':' '{ print $2}' | awk -F'(' '{ print $1}') | |
COL3=$(printf $n) | |
COL4=$(sed -n "/CompatToolMapping/,/SurveyID/p" $CFILE | grep -A 2 -w $n | awk -F'"' '/name/ { print $4 }') | |
printf "%45s | %-10s | %-10s\n" "$COL2" "$COL3" "$COL4" | |
done | |
fi | |
# check if protontricks exists in path and nag user to install it if not found | |
hash protontricks 2>&-|| printf '\n'"Protontricks not installed! Highly recommended utility.\nhttps://github.com/Matoking/protontricks"'\n\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment