From ab3f69d5923eb53606339725a129df0b311bc0ae Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Tue, 23 Nov 2021 17:55:18 +0100 Subject: [PATCH] Modified script to fetch and install an fteqw binary if one is not present in the system. --- README.md | 18 +++++++++++++----- fteqw_wrapper | 48 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 366ed94..5982e3e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Steam Play - FTEQW -If you'd like a convenient way to use your system binary of FTEQW -in order to run games such as: +If you'd like a convenient way to FTEQW in order to run games such as: - Quake (and QuakeWorld, it'll know to differentiate) - Quake Mission Pack 1: Scourge of Armagon @@ -19,12 +18,15 @@ It'll play with the new re-release content by default now; if you want it to ALWAYS start with the original, authentic content set PLAY_RERELEASE to 0 inside fteqw_wrapper. -You will not be able to play the new expansions however. +You will not be able to play the new expansions however if you do that! # Dependencies None, it expects your /bin/sh to handle arrays and things though. -And you want fteqw installed. Put it into $HOME/bin if that's in your $PATH -or something. You'll figure it out. + +If you have fteqw installed on your system (command -v fteqw) it'll use +the system binary. If you don't, it'll grab the latest 64-bit SDL2 binary +from https://www.fteqw.org that's statically linked against any third party +dependencies. It should be as easy as clicking play! # Installation In order to install it, you just clone @@ -32,6 +34,12 @@ the repository into your $HOME/.steam/steam/compatibilitytools.d/ directory. If the directory 'compatibilitytools.d' does not exist, make sure to create it. +# Special Thanks +This script will download and install game-logic from the Yamagi Quake II +project, as it has a redone save-game system that's ASLR friendly. +You are free to provide your own libraries for Quake II and its expansions! +This script will not override them. + # License Copyright (c) 2021 Marco "eukara" Hladik diff --git a/fteqw_wrapper b/fteqw_wrapper index 63c311a..cbae6dd 100755 --- a/fteqw_wrapper +++ b/fteqw_wrapper @@ -19,6 +19,16 @@ COMMANDTYPE=$1 # this is how Steam tries to run the game if [ "$COMMANDTYPE" == "wait-before-run" ]; then + # dependency check... + if ! [ -x "$(command -v wget)" ]; then + xmessage "You don't have wget installed. Please install wget." + exit + fi + if ! [ -x "$(command -v unzip)" ]; then + xmessage "You don't have unzip installed. Please install unzip." + exit + fi + # used to decipher which game we'll play GAMEBINARY=$(basename "$2") # steam game dir @@ -33,33 +43,51 @@ if [ "$COMMANDTYPE" == "wait-before-run" ]; then # its own variable to pass over later GAMEARGS=${PARMARR[@]:2:$ARGLEN-1} + # Do we have a system-wide install of FTEQW? + if [ -x "$(command -v fteqw)" ]; then + ENGINE=fteqw + else + # If we don't... use a SteamPlay-FTEQW one + SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )" + PATH="$SCRPATH":"$PATH" + ENGINE=fteqw-sdl2 + + # If we don't have it, grab the latest version! + if [ ! -f "$SCRPATH/fteqw-sdl2" ]; then + cd "$SCRPATH" + wget https://www.fteqw.org/dl/fteqw-sdl2-linux64.zip + unzip fteqw-sdl2-linux64.zip + rm fteqw-sdl2-linux64.zip readme.txt + fi + fi + if [ "$GAMEBINARY" == "Quake_x64_steam.exe" ]; then if [ $PLAY_RERELEASE == 1 ]; then - fteqw -basedir "$GAMEDIR" $GAMEARGS + $ENGINE -basedir "$GAMEDIR" $GAMEARGS else NEWPATH=$(dirname "$GAMEDIR") - fteqw -basedir "$NEWPATH" -quake $GAMEARGS + $ENGINE -basedir "$NEWPATH" -quake $GAMEARGS fi elif [ "$GAMEBINARY" == "Winquake.exe" ]; then - fteqw -basedir "$GAMEDIR" $GAMEARGS + $ENGINE -basedir "$GAMEDIR" $GAMEARGS elif [ "$GAMEBINARY" == "qwcl.exe" ]; then - fteqw -basedir "$GAMEDIR" -game qw $GAMEARGS + $ENGINE -basedir "$GAMEDIR" -game qw $GAMEARGS elif [ "$GAMEBINARY" == "Glquake.exe" ]; then - fteqw -basedir "$GAMEDIR" -quake $GAMEARGS + $ENGINE -basedir "$GAMEDIR" -quake $GAMEARGS elif [ "$GAMEBINARY" == "glqwcl.exe" ]; then - fteqw -basedir "$GAMEDIR" -quake -game qw $GAMEARGS + $ENGINE -basedir "$GAMEDIR" -quake -game qw $GAMEARGS elif [ "$GAMEBINARY" == "quake3.exe" ]; then - fteqw -basedir "$GAMEDIR" -quake3 $GAMEARGS + $ENGINE -basedir "$GAMEDIR" -quake3 $GAMEARGS elif [ "$GAMEBINARY" == "quake2.exe" ]; then cd "$GAMEDIR" get_library baseq2/game.so q2-baseq2.tgz get_library ctf/game.so q2-ctf.tgz get_library rogue/game.so q2-rogue.tgz get_library xatrix/game.so q2-xatrix.tgz - fteqw -basedir "$GAMEDIR" -quake2 $GAMEARGS + $ENGINE -basedir "$GAMEDIR" -quake2 $GAMEARGS elif [ "$GAMEBINARY" == "glh2.exe" ]; then - fteqw -basedir "$GAMEDIR" -hexen2 $GAMEARGS + $ENGINE -basedir "$GAMEDIR" -hexen2 $GAMEARGS else - fteqw -basedir "$GAMEDIR" $GAMEARGS + $ENGINE -basedir "$GAMEDIR" $GAMEARGS fi fi