#!/bin/sh # use for debug only. # set -x if [ -z "$1" ] || [ -z "$WINEPREFIX" ] || [ -z "$GAMEID" ] || [ -z "$PROTONPATH" ]; then echo "Usage: WINEPREFIX= GAMEID= PROTONPATH= ./gamelauncher.sh " echo "Ex:" echo "WINEPREFIX=$HOME/Games/epic-games-store GAMEID=egs PROTONPATH=\"$HOME/.steam/steam/compatibilitytools.d/GE-Proton8-28\" ./gamelauncher.sh \"$HOME/Games/epic-games-store/drive_c/Program Files (x86)/Epic Games/Launcher/Portal/Binaries/Win32/EpicGamesLauncher.exe\" \"-opengl -SkipBuildPatchPrereq\"" exit 1 fi me="$(readlink -f "$0")" here="${me%/*}" if [ "$WINEPREFIX" ]; then if [ ! -d "$WINEPREFIX" ]; then mkdir -p "$WINEPREFIX" export PROTON_DLL_COPY="*" fi if [ ! -d "$WINEPREFIX"/pfx ]; then ln -s "$WINEPREFIX" "$WINEPREFIX"/pfx > /dev/null 2>&1 fi if [ ! -f "$WINEPREFIX"/tracked_files ]; then touch "$WINEPREFIX"/tracked_files fi if [ ! -f "$WINEPREFIX/dosdevices/" ]; then mkdir -p "$WINEPREFIX"/dosdevices ln -s "../drive_c" "$WINEPREFIX/dosdevices/c:" > /dev/null 2>&1 fi fi if [ -n "$PROTONPATH" ]; then if [ ! -d "$PROTONPATH" ]; then echo "ERROR: $PROTONPATH is invalid, aborting!" exit 1 fi fi export ULWGL_ID="$GAMEID" export STEAM_COMPAT_APP_ID="0" numcheck='^[0-9]+$' if echo "$ULWGL_ID" | cut -d "-" -f 2 | grep -Eq "$numcheck"; then STEAM_COMPAT_APP_ID=$(echo "$ULWGL_ID" | cut -d "-" -f 2) export STEAM_COMPAT_APP_ID fi export SteamAppId="$STEAM_COMPAT_APP_ID" export SteamGameId="$STEAM_COMPAT_APP_ID" # TODO: Ideally this should be the main game install path, which is often, but not always the path of the game's executable. if [ -z "$STEAM_COMPAT_INSTALL_PATH" ]; then exepath="$(readlink -f "$1")" gameinstallpath="${exepath%/*}" export STEAM_COMPAT_INSTALL_PATH="$gameinstallpath" fi compat_lib_path=$(findmnt -T "$STEAM_COMPAT_INSTALL_PATH" | tail -n 1 | awk '{ print $1 }') if [ "$compat_lib_path" != "/" ]; then export STEAM_COMPAT_LIBRARY_PATHS="${STEAM_COMPAT_LIBRARY_PATHS:+"${STEAM_COMPAT_LIBRARY_PATHS}:"}$compat_lib_path" fi if [ -z "$STEAM_RUNTIME_LIBRARY_PATH" ]; 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 case "$line" in /*:*) library_path_prefix=$(echo "$line" | cut -d: -f1) host_library_paths=$host_library_paths$library_path_prefix: esac done <