Skip to content

Commit b2af34a

Browse files
authored
Merge pull request #3862 from cmitu/gzdoom
ports: add GZDoom as a Doom source port
2 parents 4b3b860 + 16be634 commit b2af34a

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

scriptmodules/ports/gzdoom.sh

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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="gzdoom"
13+
rp_module_desc="GZDoom is a feature centric port for all Doom engine games, based on ZDoom"
14+
rp_module_licence="GPL3 https://raw.githubusercontent.com/ZDoom/gzdoom/master/LICENSE"
15+
rp_module_repo="git https://github.com/ZDoom/gzdoom :_get_version_gzdoom"
16+
rp_module_section="opt"
17+
rp_module_flags="sdl2 !armv6"
18+
19+
function _get_version_gzdoom() {
20+
# default GZDoom version
21+
local gzdoom_version="g4.11.3"
22+
23+
# 32 bit is no longer supported since g4.8.1
24+
isPlatform "32bit" && gzdoom_version="g4.8.0"
25+
echo $gzdoom_version
26+
}
27+
28+
function depends_gzdoom() {
29+
local depends=(
30+
cmake libfluidsynth-dev libsdl2-dev libmpg123-dev libsndfile1-dev libbz2-dev
31+
libopenal-dev libjpeg-dev libgl1-mesa-dev libasound2-dev libmpg123-dev libsndfile1-dev
32+
libvpx-dev libwebp-dev pkg-config
33+
zlib1g-dev)
34+
getDepends "${depends[@]}"
35+
}
36+
37+
function sources_gzdoom() {
38+
gitPullOrClone
39+
# add 'ZMusic' repo
40+
cd "$md_build"
41+
gitPullOrClone zmusic https://github.com/ZDoom/ZMusic
42+
# workaround for Ubuntu 20.04 older vpx/wepm dev libraries
43+
sed -i 's/IMPORTED_TARGET libw/IMPORTED_TARGET GLOBAL libw/' CMakeLists.txt
44+
}
45+
46+
function build_gzdoom() {
47+
mkdir -p release
48+
49+
# build 'ZMusic' first
50+
pushd zmusic
51+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$md_build/release/zmusic" .
52+
make
53+
make install
54+
popd
55+
56+
cd release
57+
local params=(-DCMAKE_INSTALL_PREFIX="$md_inst" -DPK3_QUIET_ZIPDIR=ON -DCMAKE_BUILD_TYPE=Release -DDYN_OPENAL=ON -DCMAKE_PREFIX_PATH="$md_build/release/zmusic")
58+
! hasFlag "vulkan" && params+=(-DHAVE_VULKAN=OFF)
59+
60+
cmake "${params[@]}" ..
61+
make
62+
md_ret_require="$md_build/release/$md_id"
63+
}
64+
65+
function install_gzdoom() {
66+
md_ret_files=(
67+
'release/brightmaps.pk3'
68+
'release/gzdoom'
69+
'release/gzdoom.pk3'
70+
'release/lights.pk3'
71+
'release/game_support.pk3'
72+
'release/game_widescreen_gfx.pk3'
73+
'release/soundfonts'
74+
"release/zmusic/lib/libzmusic.so.1"
75+
"release/zmusic/lib/libzmusic.so.1.1.12"
76+
'README.md'
77+
)
78+
}
79+
80+
function add_games_gzdoom() {
81+
local params=("-fullscreen")
82+
local launcher_prefix="DOOMWADDIR=$romdir/ports/doom"
83+
84+
# FluidSynth is too memory/CPU intensive, use OPL emulation for MIDI
85+
if isPlatform "arm"; then
86+
params+=("+set snd_mididevice -3")
87+
fi
88+
# when using the 32bit version on GLES platforms, pre-set the renderer
89+
if isPlatform "32bit" && hasFlag "gles"; then
90+
params+=("+set vid_preferbackend 2")
91+
fi
92+
93+
if isPlatform "kms"; then
94+
params+=("-width %XRES%" "-height %YRES%")
95+
fi
96+
97+
_add_games_lr-prboom "$launcher_prefix $md_inst/$md_id -iwad %ROM% ${params[*]}"
98+
}
99+
100+
function configure_gzdoom() {
101+
mkRomDir "ports/doom"
102+
103+
moveConfigDir "$home/.config/$md_id" "$md_conf_root/doom"
104+
105+
[[ "$md_mode" == "remove" ]] && return
106+
107+
game_data_lr-prboom
108+
add_games_${md_id}
109+
}
110+

0 commit comments

Comments
 (0)