-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathwolf4sdl.sh
More file actions
149 lines (126 loc) · 4.82 KB
/
Copy pathwolf4sdl.sh
File metadata and controls
149 lines (126 loc) · 4.82 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
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
#!/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="wolf4sdl"
rp_module_desc="Wolf4SDL - port of Wolfenstein 3D / Spear of Destiny engine"
rp_module_licence="GPL2 https://raw.githubusercontent.com/AryanWolf3D/Wolf4SDL/master/license-gpl.txt"
rp_module_repo="git https://github.com/AryanWolf3D/Wolf4SDL.git master"
rp_module_section="opt"
rp_module_flags="sdl2"
function depends_wolf4sdl() {
getDepends libsdl2-dev libsdl2-mixer-dev rename
}
function sources_wolf4sdl() {
gitPullOrClone
}
function _get_opts_wolf4sdl() {
echo 'wolf4sdl-sw-v14 -DCARMACIZED -DUPLOAD' # shareware v1.4
echo 'wolf4sdl-3dr-v14 -DCARMACIZED' # 3d realms / apogee v1.4 full
echo 'wolf4sdl-gt-v14 -DCARMACIZED -DGOODTIMES' # gt / id / activision v1.4 full
echo 'wolf4sdl-spear -DCARMACIZED -DGOODTIMES -DSPEAR' # spear of destiny
echo 'wolf4sdl-spear-sw -DCARMACIZED -DSPEARDEMO -DSPEAR' # spear of destiny demo
}
function add_games_wolf4sdl() {
declare -A -g games_wolf4sdl=(
['vswap.wl1']="Wolfenstein 3D demo"
['vswap.wl6']="Wolfenstein 3D"
['vswap.sd1']="Wolfenstein 3D - Spear of Destiny Ep 1"
['vswap.sd2']="Wolfenstein 3D - Spear of Destiny Ep 2"
['vswap.sd3']="Wolfenstein 3D - Spear of Destiny Ep 3"
['vswap.sdm']="Wolfenstein 3D - Spear of Destiny Demo"
)
add_ports_wolf4sdl "$md_inst/bin/wolf4sdl.sh %ROM%" "wolf3d"
}
function add_ports_wolf4sdl() {
local port="$2"
local cmd="$1"
local game
local wad
for game in "${!games_wolf4sdl[@]}"; do
wad="$romdir/ports/wolf3d/$game"
if [[ -f "$wad" ]]; then
addPort "$md_id" "$port" "${games_wolf4sdl[$game]}" "$cmd" "$wad"
fi
done
}
function build_wolf4sdl() {
mkdir -p "bin"
local opt
while read -r opt; do
local bin="${opt%% *}"
local defs="${opt#* }"
make clean
CFLAGS+=" -DVERSIONALREADYCHOSEN -DGPL $defs" make
mv wolf4sdl "bin/$bin"
md_ret_require+=("bin/$bin")
done < <(_get_opts_wolf4sdl)
}
function install_wolf4sdl() {
mkdir -p "$md_inst/share/man"
cp -Rv "$md_build/man6" "$md_inst/share/man/"
md_ret_files=('bin')
}
function game_data_wolf4sdl() {
pushd "$romdir/ports/wolf3d"
rename 'y/A-Z/a-z/' *
popd
if [[ ! -f "$romdir/ports/wolf3d/vswap.wl6" && ! -f "$romdir/ports/wolf3d/vswap.wl1" ]]; then
cd "$__tmpdir"
# Get shareware game data
downloadAndExtract "http://maniacsvault.net/ecwolf/files/shareware/wolf3d14.zip" "$romdir/ports/wolf3d" -j -LL
fi
if [[ ! -f "$romdir/ports/wolf3d/vswap.sdm" && ! -f "$romdir/ports/wolf3d/vswap.sod" ]]; then
cd "$__tmpdir"
# Get shareware game data
downloadAndExtract "http://maniacsvault.net/ecwolf/files/shareware/soddemo.zip" "$romdir/ports/wolf3d" -j -LL
fi
chown -R "$__user":"$__group" "$romdir/ports/wolf3d"
}
function configure_wolf4sdl() {
local game
mkRomDir "ports/wolf3d"
# remove obsolete emulator entries
while read game; do
delEmulator "${game%% *}" "wolf3d"
done < <(_get_opts_wolf4sdl; echo -e "wolf4sdl-spear2\nwolf4sdl-spear3")
if [[ "$md_mode" == "install" ]]; then
game_data_wolf4sdl
cat > "$md_inst/bin/wolf4sdl.sh" << _EOF_
#!/bin/bash
function get_md5sum() {
local file="\$1"
[[ -n "\$file" ]] && md5sum "\$file" 2>/dev/null | cut -d" " -f1
}
function launch_wolf4sdl() {
local wad_file="\$1"
declare -A game_checksums=(
['6efa079414b817c97db779cecfb081c9']="wolf4sdl-sw-v14"
['a6d901dfb455dfac96db5e4705837cdb']="wolf4sdl-3dr-v14"
['b8ff4997461bafa5ef2a94c11f9de001']="wolf4sdl-gt-v14"
['b1dac0a8786c7cdbb09331a4eba00652']="wolf4sdl-spear --mission 1"
['25d92ac0ba012a1e9335c747eb4ab177']="wolf4sdl-spear --mission 2"
['94aeef7980ef640c448087f92be16d83']="wolf4sdl-spear --mission 3"
['e3e87518f51414872c454b7d72a45af6']="wolf4sdl-spear --mission 3"
['35afda760bea840b547d686a930322dc']="wolf4sdl-spear-sw"
)
if [[ "\${game_checksums[\$(get_md5sum \$wad_file)]}" ]] 2>/dev/null; then
pushd "$romdir/ports/wolf3d"
$md_inst/bin/\${game_checksums[\$(get_md5sum \$wad_file)]}
popd
else
echo "Error: \$wad_file (md5: \$(get_md5sum \$wad_file)) is not a supported version"
fi
}
launch_wolf4sdl "\$1"
_EOF_
chmod +x "$md_inst/bin/wolf4sdl.sh"
fi
add_games_wolf4sdl
moveConfigDir "$home/.wolf4sdl" "$md_conf_root/wolf3d"
}