Skip to content

Commit 9d81223

Browse files
committed
Add installer script for Doom3 BFG edition.
1 parent 4e9bd19 commit 9d81223

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

scriptmodules/ports/rbdoom3_bfg.sh

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is part of The RetroPie Project
4+
#
5+
# The RetroPie Project is the legal property of its developers, whose names are
6+
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
7+
#
8+
# See the LICENSE.md file at the top-level directory of this distribution and
9+
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
10+
#
11+
12+
rp_module_id="rbdoom3_bfg"
13+
rp_module_desc="rbdoom3_bfg - Doom 3: BFG Edition"
14+
rp_module_licence="GPL3 https://raw.githubusercontent.com/RobertBeckebans/RBDOOM-3-BFG/master/LICENSE.md"
15+
rp_module_help="For the game data, from your windows install (Gog or Steam) locate the 'base' directory. Copy ALL contents to $romdir/ports/doom3_bfg"
16+
rp_module_section="exp"
17+
rp_module_repo="git https://github.com/RobertBeckebans/RBDOOM-3-BFG.git :_get_branch_rbdoom3_bfg"
18+
rp_module_flags=""
19+
20+
function _get_branch_rbdoom3_bfg() {
21+
# NOTE v1.4.0 may be the last version available to build on a rpi. Newer versions have added a
22+
# Microsoft DirectX dependency https://github.com/microsoft/DirectXShaderCompiler which only
23+
# supports nvidia, amd, and intel GPUs (Not available for rpi)
24+
local version="v1.4.0"
25+
26+
if compareVersions "$__os_debian_ver" eq 10; then
27+
version="1.3.0"
28+
# elif compareVersions "$__os_debian_ver" gt 10; then
29+
# if isPlatform "x86_64"; then
30+
# local release_url
31+
# release_url="https://api.github.com/repos/RobertBeckebans/RBDOOM-3-BFG/releases/latest"
32+
# version=$(curl $release_url 2>&1 | grep -m 1 tag_name | cut -d\" -f4 | cut -dv -f2)
33+
# fi
34+
fi
35+
36+
echo -ne "$version"
37+
}
38+
39+
function _arch_rbdoom3_bfg() {
40+
return "$(uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')"
41+
}
42+
43+
function depends_rbdoom3_bfg() {
44+
local depends=(cmake libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev libopenal-dev)
45+
depends+=(libswscale-dev libglew-dev zlib1g-dev libpng-dev rapidjson-dev libjpeg-dev)
46+
47+
if compareVersions "$__os_debian_ver" gt 10; then
48+
depends+=(libimgui-dev)
49+
fi
50+
51+
if isPlatform "rpi"; then
52+
depnds+=(xorg)
53+
fi
54+
55+
getDepends "${depends[@]}"
56+
}
57+
58+
function sources_rbdoom3_bfg() {
59+
gitPullOrClone
60+
}
61+
62+
function build_rbdoom3_bfg() {
63+
local params=()
64+
local rbdoom3_version
65+
66+
rbdoom3_version=$(_get_branch_rbdoom3_bfg)
67+
68+
if isPlatform "rpi"; then
69+
# DCPU_TYPE is the only value to change: armhf for 32bit and aarch64 for 64bit Is there a
70+
# variable that responds with those two values and only those values? Might be a way to
71+
# simplify this.
72+
# NOTE: I am guessing on DCPU_TYPE for 64bit
73+
params+=(-G 'Unix Makefiles' -DUSE_PRECOMPILED_HEADERS=OFF)
74+
params+=(-DCPU_OPTIMIZATION='' -DUSE_INTRINSICS_SSE=OFF)
75+
76+
if isPlatform "64bit"; then
77+
params+=(-DCPU_TYPE=aarch64)
78+
else
79+
params+=(-DCPU_TYPE=armhf)
80+
fi
81+
else
82+
params+=(-G 'Eclipse CDT4 - Unix Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo)
83+
fi
84+
85+
if [[ "$rbdoom3_version" != "v1.2.0" ]]; then
86+
if compareVersions "$__os_debian_ver" gt 10; then
87+
params+=(-DUSE_SYSTEM_IMGUI=ON)
88+
fi
89+
fi
90+
91+
params+=(-DSDL2=ON -DUSE_SYSTEM_ZLIB=ON -DUSE_SYSTEM_LIBPNG=ON -DUSE_SYSTEM_RAPIDJSON=ON)
92+
params+=(-DUSE_SYSTEM_LIBGLEW=ON -DUSE_SYSTEM_LIBJPEG=ON)
93+
94+
if [[ -d $md_build/build ]]; then
95+
cd $md_build
96+
rm -rf build
97+
fi
98+
99+
mkdir $md_build/build
100+
cd $md_build/build
101+
102+
cmake "${params[@]}" ../neo
103+
104+
# Make clean is probably not necessary. It can't hurt, might help.
105+
make clean
106+
make
107+
108+
md_ret_require="$md_build/build/RBDoom3BFG"
109+
}
110+
111+
function install_rbdoom3_bfg() {
112+
md_ret_files=(
113+
"build/RBDoom3BFG"
114+
"base/default.cfg"
115+
"base/extract_resources.cfg"
116+
"base/renderprogs"
117+
)
118+
}
119+
120+
function configure_rbdoom3_bfg() {
121+
local launch_prefix=""
122+
if ! isPlatform "x86"; then
123+
launch_prefix="XINIT-WM:"
124+
fi
125+
126+
addPort "$md_id" "doom3_bfg" "Doom 3 (BFG Edition)" "$launch_prefix$md_inst/RBDoom3BFG"
127+
128+
mkRomDir "ports/doom3_bfg"
129+
130+
moveConfigDir "$md_inst/base" "$romdir/ports/doom3_bfg"
131+
moveConfigDir "$home/.local/share/rbdoom3bfg" "$md_conf_root/rbdoom3bfg"
132+
133+
if [[ "$md_mode" == "install" ]]; then
134+
mkdir /opt/retropie/ports/rbdoom3_bfg/base/
135+
mkdir -p "$home/.doom3/base"
136+
fi
137+
138+
}

0 commit comments

Comments
 (0)