-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy patheduke32.sh
167 lines (139 loc) · 5.48 KB
/
eduke32.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/usr/bin/env bash
# This file is part of The RetroPie Project
#
# The RetroPie Project is the legal property of its developers, whose names are
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
#
# See the LICENSE.md file at the top-level directory of this distribution and
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
#
rp_module_id="eduke32"
rp_module_desc="Duke3D source port"
rp_module_licence="GPL2 https://voidpoint.io/terminx/eduke32/-/raw/master/package/common/gpl-2.0.txt?inline=false"
rp_module_repo="git https://voidpoint.io/terminx/eduke32.git master dfc16b08"
rp_module_section="opt"
function depends_eduke32() {
local depends=(
flac libflac-dev libvorbis-dev libpng-dev libvpx-dev freepats
libsdl2-dev libsdl2-mixer-dev
)
isPlatform "x86" && depends+=(nasm)
isPlatform "gl" || isPlatform "mesa" && depends+=(libgl1-mesa-dev libglu1-mesa-dev)
isPlatform "x11" && depends+=(libgtk2.0-dev)
getDepends "${depends[@]}"
}
function sources_eduke32() {
gitPullOrClone
# r6918 causes a 20+ second delay on startup on ARM devices
isPlatform "arm" && applyPatch "$md_data/0001-revert-r6918.patch"
# r7424 gives a black skybox when r_useindexedcolortextures is 0
applyPatch "$md_data/0002-fix-skybox.patch"
# r6776 breaks VC4 & GLES 2.0 devices that lack GL_RED internal
# format support for glTexImage2D/glTexSubImage2D
isPlatform "gles" && applyPatch "$md_data/0003-replace-gl_red.patch"
# gcc 6.3.x compiler fix
applyPatch "$md_data/0004-recast-function.patch"
# cherry-picked commit fixing a game bug in E1M4 (shrinker ray stuck)
applyPatch "$md_data/0005-e1m4-shrinker-bug.patch"
# two more commits r8241 + r8247 fixing a bug in E4M4 (instant death in water)
applyPatch "$md_data/0006-e4m4-water-bug.patch"
}
function build_eduke32() {
local params=(LTO=0 SDL_TARGET=2)
[[ "$md_id" == "ionfury" ]] && params+=(FURY=1)
! isPlatform "x86" && params+=(NOASM=1)
! isPlatform "x11" && params+=(HAVE_GTK2=0)
! isPlatform "gl3" && params+=(POLYMER=0)
! ( isPlatform "gl" || isPlatform "mesa" ) && params+=(USE_OPENGL=0)
# r7242 requires >1GB memory allocation due to netcode changes.
isPlatform "arm" && params+=(NETCODE=0)
make veryclean
CFLAGS+=" -DSDL_USEFOLDER" make "${params[@]}"
if [[ "$md_id" == "ionfury" ]]; then
md_ret_require="$md_build/fury"
else
md_ret_require="$md_build/eduke32"
fi
}
function install_eduke32() {
md_ret_files=('mapster32')
if [[ "$md_id" == "ionfury" ]]; then
md_ret_files+=('fury')
else
md_ret_files+=('eduke32')
fi
}
function game_data_eduke32() {
local dest="$romdir/ports/duke3d"
if [[ "$md_id" == "eduke32" ]]; then
if [[ ! -f "$dest/duke3d.grp" ]]; then
mkUserDir "$dest"
local temp="$(mktemp -d)"
download "$__archive_url/3dduke13.zip" "$temp"
unzip -L -o "$temp/3dduke13.zip" -d "$temp" dn3dsw13.shr
unzip -L -o "$temp/dn3dsw13.shr" -d "$dest" duke3d.grp duke.rts
rm -rf "$temp"
chown -R "$__user":"$__group" "$dest"
fi
fi
}
function configure_eduke32() {
local appname="eduke32"
local portname="duke3d"
if [[ "$md_id" == "ionfury" ]]; then
appname="fury"
portname="ionfury"
fi
local config="$md_conf_root/$portname/settings.cfg"
mkRomDir "ports/$portname"
moveConfigDir "$home/.config/$appname" "$md_conf_root/$portname"
add_games_eduke32 "$portname" "$md_inst/$appname"
# remove old launch script
rm -f "$romdir/ports/Duke3D Shareware.sh"
if [[ "$md_mode" == "install" ]]; then
game_data_eduke32
touch "$config"
iniConfig " " '"' "$config"
# enforce vsync for kms targets
isPlatform "kms" && iniSet "r_swapinterval" "1"
# the VC4 & V3D drivers render menu splash colours incorrectly without this
isPlatform "mesa" && iniSet "r_useindexedcolortextures" "0"
chown -R "$__user":"$__group" "$config"
fi
}
function add_games_eduke32() {
local portname="$1"
local binary="$2"
local game
local game_args
local game_path
local game_launcher
local num_games=4
if [[ "$md_id" == "ionfury" ]]; then
num_games=0
local game0=('Ion Fury' '' '')
else
local game0=('Duke Nukem 3D' '' '-addon 0')
local game1=('Duke Nukem 3D - Duke It Out In DC' 'addons/dc' '-addon 1')
local game2=('Duke Nukem 3D - Nuclear Winter' 'addons/nw' '-addon 2')
local game3=('Duke Nukem 3D - Caribbean - Lifes A Beach' 'addons/vacation' '-addon 3')
local game4=('NAM' 'addons/nam' '-nam')
fi
for ((game=0;game<=num_games;game++)); do
game_launcher="game$game[0]"
game_path="game$game[1]"
game_args="game$game[2]"
if [[ -d "$romdir/ports/$portname/${!game_path}" ]]; then
addPort "$md_id" "$portname" "${!game_launcher}" "pushd $md_conf_root/$portname; ${binary}.sh %ROM%; popd" "-j$romdir/ports/$portname/${game0[1]} -j$romdir/ports/$portname/${!game_path} ${!game_args}"
fi
done
if [[ "$md_mode" == "install" ]]; then
# we need to use a dumb launcher script to strip quotes from runcommand's generated arguments
cat > "${binary}.sh" << _EOF_
#!/bin/bash
# HACK: force vsync for RPI Mesa driver for now
VC4_DEBUG=always_sync $binary \$*
_EOF_
chmod +x "${binary}.sh"
fi
}