add support for STEAM_COMPAT_LIBRARY_PATHS, allows gamedrive to work

This commit is contained in:
GloriousEggroll 2024-01-28 16:46:32 -07:00
parent f6f062bcd6
commit a0fc0f3e09

View File

@ -24,7 +24,6 @@ if [[ $(echo $ULWGL_ID | cut -d "-" -f 2) =~ $numcheck ]]; then
fi
export SteamAppId="$STEAM_COMPAT_APP_ID"
export SteamGameId="$STEAM_COMPAT_APP_ID"
export STEAM_COMPAT_LIBRARY_PATHS=''
if [[ -z $STEAM_COMPAT_INSTALL_PATH ]]; then
exepath="$(readlink -f "$1")"
@ -32,6 +31,30 @@ if [[ -z $STEAM_COMPAT_INSTALL_PATH ]]; then
export STEAM_COMPAT_INSTALL_PATH="$gameinstallpath"
fi
if [[ -z $STEAM_COMPAT_LIBRARY_PATHS ]]; then
# The following info taken from steam ~/.local/share/ubuntu12_32/steam-runtime/run.sh
host_library_paths=
exit_status=0
ldconfig_output=$(/sbin/ldconfig -XNv 2> /dev/null; exit $?) || exit_status=$?
if [[ $exit_status != 0 ]]; then
echo "Warning: An unexpected error occurred while executing \"/sbin/ldconfig -XNv\", the exit status was $exit_status"
fi
while read -r line; do
# If line starts with a leading / and contains :, it's a new path prefix
if [[ "$line" =~ ^/.*: ]]
then
library_path_prefix=$(echo "$line" | cut -d: -f1)
host_library_paths=$host_library_paths$library_path_prefix:
fi
done <<< "$ldconfig_output"
host_library_paths="${LD_LIBRARY_PATH:+"${LD_LIBRARY_PATH}:"}$host_library_paths"
steam_runtime_library_paths="${STEAM_COMPAT_INSTALL_PATH}:${host_library_paths}"
export STEAM_COMPAT_LIBRARY_PATHS="$steam_runtime_library_paths"
fi
if [[ -z $PROTON_VERB ]]; then
export PROTON_VERB="waitforexitandrun"
fi