-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_engine.sh
More file actions
executable file
·46 lines (39 loc) · 1.32 KB
/
Copy pathpatch_engine.sh
File metadata and controls
executable file
·46 lines (39 loc) · 1.32 KB
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
#!/usr/bin/env bash
set -e
ANVIL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$ANVIL_DIR/.." && pwd)"
SHIMS="$ANVIL_DIR/patches"
OUT_DIR="$ANVIL_DIR/patches/bin"
GAME_BIN="$REPO_ROOT/game/bin/linuxsteamrt64"
VIDEO_TXT="$REPO_ROOT/game/core/cfg/video.txt"
mkdir -p "$OUT_DIR"
for src in "$SHIMS"/*.c; do
[ -f "$src" ] || continue
name="$(basename "$src" .c)"
echo "Building $name.so..."
gcc -shared -fPIC -O2 -o "$OUT_DIR/$name.so" "$src" -ldl \
-L"$GAME_BIN" -Wl,--no-as-needed -Wl,-rpath,"$GAME_BIN"
done
if [ -f "$VIDEO_TXT" ]; then
echo "Resetting video.txt windowing flags..."
sed -i 's/\("setting\.coop_fullscreen"[ \t]*\)"[^"]*"/\1"0"/' "$VIDEO_TXT"
sed -i 's/\("setting\.nowindowborder"[ \t]*\)"[^"]*"/\1"0"/' "$VIDEO_TXT"
fi
ENGINE_JSON="$REPO_ROOT/game/config/convar/engine.json"
if [ -f "$ENGINE_JSON" ]; then
echo "WARNING: bloom is currently broken by default on Linux. Disabling r_bloom..."
python3 - "$ENGINE_JSON" <<'EOF'
import json, sys, time
path = sys.argv[1]
with open(path) as f:
data = json.load(f)
key = "convar.r_bloom"
if key in data:
data[key]["Value"] = "False"
else:
data[key] = {"Value": "False", "Timeout": int(time.time()) + 86400 * 30, "DeleteAt": 0}
with open(path, "w") as f:
json.dump(data, f, indent=2)
EOF
fi
echo "Done."