-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathHalf-Life.sh
87 lines (63 loc) · 2.63 KB
/
Half-Life.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
if [ -d "/opt/system/Tools/PortMaster/" ]; then
controlfolder="/opt/system/Tools/PortMaster"
elif [ -d "/opt/tools/PortMaster/" ]; then
controlfolder="/opt/tools/PortMaster"
else
controlfolder="/roms/ports/PortMaster"
fi
source $controlfolder/control.txt
source $controlfolder/tasksetter
get_controls
PORTDIR="$(cd $(dirname "$0"); pwd)"
GAMEDIR="${PORTDIR}/Half-Life"
cd $GAMEDIR
# Grab text output...
$ESUDO chmod 666 /dev/tty0
printf "\033c" > /dev/tty0
## Load directly into a mod
RUNMOD=
# Install half life binaries / config files
if [[ -f "${GAMEDIR}/binaries/valve_first_run" ]]; then
if [[ ! -f "${GAMEDIR}/valve/halflife.wad" ]]; then
echo "No game files found." > ./log.txt
$ESUDO systemctl restart oga_events &
exit 1
fi
echo "Copying valve binaries/config files." > /dev/tty0 2>&1
$ESUDO cp -rfv "${GAMEDIR}/binaries/valve" "${GAMEDIR}/" > /dev/tty0 2>&1
# Mark step as done
$ESUDO rm -fv "${GAMEDIR}/binaries/valve_first_run" > /dev/tty0 2>&1
fi
# Do bshift install if the files exist
if [[ -f "${GAMEDIR}/bshift/halflife.wad" ]] && [[ -f "${GAMEDIR}/binaries/bshift_first_run" ]]; then
echo "Copying bshift binaries/config files." > /dev/tty0 2>&1
$ESUDO cp -rfv "${GAMEDIR}/binaries/bshift" "${GAMEDIR}/" > /dev/tty0 2>&1
# Make mod run script
$ESUDO cp -v "${PORTDIR}/Half-Life.sh" "${PORTDIR}/Half-Life Blue Shift.sh" > /dev/tty0 2>&1
$ESUDO sed -i 's/RUNMOD=/RUNMOD="-game bshift"/' "${PORTDIR}/Half-Life Blue Shift.sh"
# Mark step as done
$ESUDO rm -fv "${GAMEDIR}/binaries/bshift_first_run" > /dev/tty0 2>&1
fi
# Do opforce install if the files exist
if [[ -f "${GAMEDIR}/gearbox/OPFOR.WAD" ]] && [[ -f "${GAMEDIR}/binaries/gearbox_first_run" ]]; then
echo "Copying gearbox binaries/config files." > /dev/tty0 2>&1
$ESUDO cp -rfv "${GAMEDIR}/binaries/gearbox" "${GAMEDIR}/" > /dev/tty0 2>&1
# Make mod run script
$ESUDO cp -v "${PORTDIR}/Half-Life.sh" "${PORTDIR}/Half-Life Opposing Forces.sh" > /dev/tty0 2>&1
$ESUDO sed -i 's/RUNMOD=/RUNMOD="-game gearbox"/' "${PORTDIR}/Half-Life Opposing Forces.sh"
# Mark step as done
$ESUDO rm -fv "${GAMEDIR}/binaries/gearbox_first_run" > /dev/tty0 2>&1
fi
$ESUDO chmod 666 /dev/tty1
$ESUDO chmod 666 /dev/uinput
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib32:$GAMEDIR/valve/dlls:$GAMEDIR/valve/cl_dlls"
$GPTOKEYB "xash3d" &
$TASKSET ./xash3d -ref gles2 -fullscreen -console $RUNMOD 2>&1 | tee -a ./log.txt
$ESUDO kill -9 $(pidof gptokeyb)
unset LD_LIBRARY_PATH
unset SDL_GAMECONTROLLERCONFIG
$ESUDO systemctl restart oga_events &
# Disable console
printf "\033c" >> /dev/tty1