Skip to content

Commit 6f0091f

Browse files
committed
Add Unreal Tournament install script
1 parent 0cfd1fb commit 6f0091f

File tree

2 files changed

+822
-0
lines changed

2 files changed

+822
-0
lines changed

scriptmodules/ports/ut.sh

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is part of RetroPie-Extra, a supplement to RetroPie.
4+
# For more information, please visit:
5+
#
6+
# https://github.com/RetroPie/RetroPie-Setup
7+
# https://github.com/Exarkuniv/RetroPie-Extra
8+
#
9+
# See the LICENSE file distributed with this source and at
10+
# https://raw.githubusercontent.com/Exarkuniv/RetroPie-Extra/master/LICENSE
11+
#
12+
# This game works on i386, arm64, and amd64 package architectures
13+
#
14+
rp_module_id="ut"
15+
rp_module_desc="Unreal Tournament"
16+
rp_module_licence="PROP https://github.com/OldUnreal/UnrealTournamentPatches/blob/master/LICENSE.md"
17+
rp_module_help="Install game data by coping the contents of Maps/ Music/ Sounds/ Textures/ into their respective directories in $romdir/ports/ut/
18+
19+
Make sure you do not overwrite the Texture files that came with the patch, otherwise the in-game text will render incorrectly.
20+
21+
Post installation:
22+
Open '$home/.utpg/UnrealTournament.ini' and go to the section:
23+
24+
[SDLDrv.SDLClient]
25+
WindowedViewportX=1024
26+
WindowedViewportY=768
27+
WindowedColorBits=32
28+
FullscreenViewportX=1920
29+
FullscreenViewportY=1080
30+
FullscreenColorBits=32
31+
32+
Ensure the Fullscreen* Variables match your resolution.
33+
34+
Note: Some display problems may be solved by removing '$md_inst/System64/libSDL2-2.0.so.0' and creating a symlink pointing to the system libSDL2-2.0.so.0, eg '/usr/lib/$(uname -m)-linux-gnu/libSDL2-2.0.so.0' This is not a guarantee, but if you have trouble, start with this.
35+
"
36+
rp_module_section="exp"
37+
rp_module_repo="https://github.com/OldUnreal/UnrealTournamentPatches/"
38+
rp_module_flags="!all x86 64bit"
39+
40+
function _get_branch_ut() {
41+
local version=$(curl https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest 2>&1 | grep -m 1 tag_name | cut -d\" -f4 | cut -dv -f2)
42+
echo -ne $version
43+
}
44+
45+
function depends_ut() {
46+
local depends=(libsdl2-2.0-0 libopenal1)
47+
48+
isPlatform "rpi" && depends+=(xorg)
49+
getDepends "${depends[@]}"
50+
}
51+
52+
function install_bin_ut() {
53+
local version="$(_get_branch_ut)"
54+
local arch="$(dpkg --print-architecture)"
55+
56+
# For some reason, it failed when using "$rp_module_repo", this works perfectly.
57+
local base_url="https://github.com/OldUnreal/UnrealTournamentPatches"
58+
local dl_file="OldUnreal-UTPatch${version}-Linux-${arch}.tar.bz2"
59+
local dl_url="${base_url}/releases/download/v${version}/${dl_file}"
60+
61+
# The download files use "x86" for the i386 architecture
62+
[[ "${arch}" == "i386" ]] && arch="x86"
63+
64+
downloadAndExtract "$dl_url" "$md_inst" "--no-same-owner"
65+
}
66+
67+
function __config_game_data() {
68+
local ut_game_dir=$1
69+
70+
if [[ ! -d "$romdir/ports/ut/$ut_game_dir" ]]; then
71+
mkdir -p "$romdir/ports/ut/$ut_game_dir"
72+
chown -R "$__user":"$__group" "$romdir/ports/ut/$ut_game_dir"
73+
else
74+
chown "$__user":"$__group" "$romdir/ports/ut/$ut_game_dir"
75+
fi
76+
77+
if [[ -d "$md_inst/$ut_game_dir" ]]; then
78+
cd "$md_inst/$ut_game_dir"
79+
for file in $(ls -d *); do
80+
81+
echo "Moving $md_inst/$ut_game_dir/$file -> $romdir/ports/$ut_game_dir/$file"
82+
83+
if [[ -d "$md_inst/$ut_game_dir/$file" ]]; then
84+
if [[ ! -d "$romdir/ports/ut/$ut_game_dir/$file" ]]; then
85+
mv "$md_inst/$ut_game_dir/$file" "$romdir/ports/ut/$ut_game_dir/$file"
86+
else
87+
rm -rf "$romdir/ports/ut/$ut_game_dir/$file"
88+
mv "$md_inst/$ut_game_dir/$file" "$romdir/ports/ut/$ut_game_dir/$file"
89+
fi
90+
else
91+
mv "$md_inst/$ut_game_dir/$file" "$romdir/ports/ut/$ut_game_dir/$file"
92+
fi
93+
done
94+
95+
rm -rf "$md_inst/$ut_game_dir"
96+
fi
97+
98+
ln -snf "$romdir/ports/ut/$ut_game_dir" "$md_inst/$ut_game_dir"
99+
}
100+
101+
function game_data_ut() {
102+
103+
for dir in Help Maps Music Sounds Textures Web; do
104+
105+
# Ensure we aren't moving files that are already in place.
106+
# Eliminates 'mv: '$src/$file' and '$dst/$file' are the same file' errors.
107+
if [[ ! -h "$md_inst/$dir" ]]; then
108+
__config_game_data "$dir"
109+
fi
110+
done
111+
112+
local bonus_pack_4_url="https://unreal-archive-files-s3.s3.us-west-002.backblazeb2.com/patches-updates/Unreal%20Tournament/Bonus%20Packs/utbonuspack4-zip.zip"
113+
downloadAndExtract "$bonus_pack_4_url" "$romdir/ports/ut/"
114+
115+
chown -R "$__user":"$__group" "$romdir/ports/ut"
116+
find "$romdir/ports/ut" -type f -exec chmod 644 {} \;
117+
find "$romdir/ports/ut" -type d -exec chmod 755 {} \;
118+
119+
}
120+
121+
function configure_ut() {
122+
if isPlatform "x86"; then
123+
addPort "$md_id" "ut" "Unreal Tournament" "$md_inst/System64/ut-bin"
124+
else
125+
local launch_prefix="XINIT-WM:"
126+
addPort "$md_id" "ut" "Unreal Tournament" "$launch_prefix$md_inst/SystemARM64/ut-bin"
127+
fi
128+
129+
mkRomDir "ports/ut"
130+
131+
if [[ "$md_mode" == "install" ]]; then
132+
game_data_ut
133+
fi
134+
135+
moveConfigDir "$home/.utpg" "$md_conf_root/ut"
136+
137+
# We only want to install this if it is not already installed.
138+
if [[ ! -f "$home/.utpg/UnrealTournament.ini" ]]; then
139+
cp "$md_data/UnrealTournament.ini" "$home/.utpg/UnrealTournament.ini"
140+
chown "$__user":"$__group" "$home/.utpg/UnrealTournament.ini"
141+
chmod 644 "$home/.utpg/UnrealTournament.ini"
142+
fi
143+
}

0 commit comments

Comments
 (0)