From a0fc0f3e0965db3cba0d8f288d4c25103e0fdd5a Mon Sep 17 00:00:00 2001 From: GloriousEggroll Date: Sun, 28 Jan 2024 16:46:32 -0700 Subject: [PATCH] add support for STEAM_COMPAT_LIBRARY_PATHS, allows gamedrive to work --- gamelauncher.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gamelauncher.sh b/gamelauncher.sh index b602bb5..aebaf03 100755 --- a/gamelauncher.sh +++ b/gamelauncher.sh @@ -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