Skip to content

Commit a800bed

Browse files
committed
Added jfsw, Shadow Warrior source port by JonoF
Same author as JFDuke3D
1 parent 0b107d4 commit a800bed

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

scriptmodules/ports/jfsw.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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="jfsw"
13+
rp_module_desc="Shadow Warrior source port by JonoF"
14+
rp_module_help="Place your registered version game files in $romdir/ports/shadowwarrior"
15+
rp_module_licence="GPL2 https://raw.githubusercontent.com/jonof/jfsw/master/GPL.TXT"
16+
rp_module_repo="git https://github.com/jonof/jfsw.git master 12828783"
17+
rp_module_section="exp"
18+
rp_module_flags=""
19+
20+
function depends_jfsw() {
21+
local depends=(
22+
libsdl2-dev libvorbis-dev libfluidsynth-dev
23+
)
24+
25+
isPlatform "x86" && depends+=(nasm)
26+
isPlatform "gl" || isPlatform "mesa" && depends+=(libgl1-mesa-dev libglu1-mesa-dev)
27+
isPlatform "x11" && depends+=(libgtk3.0-dev)
28+
getDepends "${depends[@]}"
29+
}
30+
31+
function sources_jfsw() {
32+
gitPullOrClone
33+
}
34+
35+
function build_jfsw() {
36+
local params=(DATADIR=$romdir/ports/shadowwarrior RELEASE=1)
37+
38+
! isPlatform "x86" && params+=(USE_ASM=0)
39+
! isPlatform "x11" && params+=(WITHOUT_GTK=1)
40+
! isPlatform "gl3" && params+=(USE_POLYMOST=0)
41+
42+
if isPlatform "gl" || isPlatform "mesa"; then
43+
params+=(USE_OPENGL=USE_GL2)
44+
elif isPlatform "gles"; then
45+
params+=(USE_OPENGL=USE_GLES2)
46+
else
47+
params+=(USE_OPENGL=0)
48+
fi
49+
50+
make clean veryclean
51+
make "${params[@]}"
52+
53+
md_ret_require="$md_build/sw"
54+
}
55+
56+
function install_jfsw() {
57+
md_ret_files=(
58+
'sw'
59+
'build'
60+
'README.md'
61+
'GPL.TXT'
62+
)
63+
}
64+
65+
function gamedata_jfsw() {
66+
local dest="$romdir/ports/shadowwarrior"
67+
if [[ ! -n $(find $dest -maxdepth 1 -iname sw.grp) ]]; then
68+
mkUserDir "$dest"
69+
local temp="$(mktemp -d)"
70+
download "ftp://ftp.3drealms.com/share/3dsw12.zip" "$temp"
71+
unzip -L -o "$temp/3dsw12.zip" -d "$temp" swsw12.shr
72+
unzip -L -o "$temp/swsw12.shr" -d "$dest" sw.grp sw.rts
73+
rm -rf "$temp"
74+
fi
75+
chown -R $user:$user "$dest"
76+
}
77+
78+
function configure_jfsw() {
79+
local config="$md_conf_root/sw/jfsw/sw.cfg"
80+
local gamedir="$romdir/ports/shadowwarrior"
81+
82+
mkRomDir "ports/shadowwarrior"
83+
moveConfigDir "$home/.jfsw" "$md_conf_root/sw/jfsw"
84+
85+
addPort "$md_id" "sw" "Shadow Warrior" "$md_inst/sw %ROM%" ""
86+
[[ -n $(find $gamedir -maxdepth 1 -iname dragon.zip) ]] && addPort "$md_id" "sw" "Shadow Warrior Twin Dragon" "$md_inst/sw %ROM%" "-gdragon.zip"
87+
[[ -n $(find $gamedir -maxdepth 1 -iname wt.grp) ]] && addPort "$md_id" "sw" "Shadow Warrior Wanton Destruction" "$md_inst/sw %ROM%" "-gwt.grp"
88+
89+
if [[ "$md_mode" != "install" ]]; then
90+
return
91+
fi
92+
gamedata_jfsw
93+
94+
if [[ -f "$config" ]]; then
95+
return
96+
fi
97+
98+
# no config file exists, creating one
99+
# with alsa as the sound driver
100+
cat >"$config" << _EOF_
101+
[Sound Setup]
102+
MusicParams = "audio.driver=alsa"
103+
_EOF_
104+
chown -R $user:$user "$config"
105+
}

0 commit comments

Comments
 (0)