|
| 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="jfduke3d" |
| 13 | +rp_module_desc="lightweight Duke3D source port by JonoF" |
| 14 | +rp_module_licence="GPL2 https://raw.githubusercontent.com/jonof/jfduke3d/master/GPL.TXT" |
| 15 | +rp_module_repo="git https://github.com/jonof/jfduke3d.git master 41cd46bc" |
| 16 | +rp_module_section="exp" |
| 17 | +rp_module_flags="" |
| 18 | + |
| 19 | +function depends_jfduke3d() { |
| 20 | + local depends=( |
| 21 | + libsdl2-dev libvorbis-dev libfluidsynth-dev |
| 22 | + ) |
| 23 | + |
| 24 | + isPlatform "x86" && depends+=(nasm) |
| 25 | + isPlatform "gl" || isPlatform "mesa" && depends+=(libgl1-mesa-dev libglu1-mesa-dev) |
| 26 | + isPlatform "x11" && depends+=(libgtk3.0-dev) |
| 27 | + getDepends "${depends[@]}" |
| 28 | +} |
| 29 | + |
| 30 | +function sources_jfduke3d() { |
| 31 | + gitPullOrClone |
| 32 | +} |
| 33 | + |
| 34 | +function build_jfduke3d() { |
| 35 | + local params=(DATADIR=$romdir/ports/duke3d RELEASE=1) |
| 36 | + |
| 37 | + ! isPlatform "x86" && params+=(USE_ASM=0) |
| 38 | + ! isPlatform "x11" && params+=(WITHOUT_GTK=1) |
| 39 | + ! isPlatform "gl3" && params+=(USE_POLYMOST=0) |
| 40 | + |
| 41 | + if isPlatform "gl" || isPlatform "mesa"; then |
| 42 | + params+=(USE_OPENGL=USE_GL2) |
| 43 | + elif isPlatform "gles"; then |
| 44 | + params+=(USE_OPENGL=USE_GLES2) |
| 45 | + else |
| 46 | + params+=(USE_OPENGL=0) |
| 47 | + fi |
| 48 | + |
| 49 | + make clean veryclean |
| 50 | + make "${params[@]}" |
| 51 | + |
| 52 | + md_ret_require="$md_build/duke3d" |
| 53 | +} |
| 54 | + |
| 55 | +function install_jfduke3d() { |
| 56 | + md_ret_files=( |
| 57 | + 'duke3d' |
| 58 | + 'build' |
| 59 | + 'README.md' |
| 60 | + 'GPL.TXT' |
| 61 | + ) |
| 62 | +} |
| 63 | + |
| 64 | +function game_data_jfduke3d() { |
| 65 | + local dest="$romdir/ports/duke3d" |
| 66 | + if [[ ! -n $(find $dest -maxdepth 1 -iname duke3d.grp) ]]; then |
| 67 | + mkUserDir "$dest" |
| 68 | + local temp="$(mktemp -d)" |
| 69 | + download "$__archive_url/3dduke13.zip" "$temp" |
| 70 | + unzip -L -o "$temp/3dduke13.zip" -d "$temp" dn3dsw13.shr |
| 71 | + unzip -L -o "$temp/dn3dsw13.shr" -d "$dest" duke3d.grp duke.rts |
| 72 | + rm -rf "$temp" |
| 73 | + chown -R $user:$user "$dest" |
| 74 | + fi |
| 75 | +} |
| 76 | + |
| 77 | +function configure_jfduke3d() { |
| 78 | + local config="$md_conf_root/jfduke3d/duke3d.cfg" |
| 79 | + |
| 80 | + mkRomDir "ports/duke3d" |
| 81 | + moveConfigDir "$home/.jfduke3d" "$md_conf_root/jfduke3d" |
| 82 | + |
| 83 | + # params are just for parity with eduke32, last one is not supported |
| 84 | + addPort "$md_id" "duke3d" "Duke Nukem 3D" "$md_inst/duke3d" "-j$romdir/ports/duke3d -addon 0" |
| 85 | + |
| 86 | + if [[ "$md_mode" != "install" ]]; then |
| 87 | + return |
| 88 | + fi |
| 89 | + game_data_jfduke3d |
| 90 | + |
| 91 | + if [[ -f "$config" ]]; then |
| 92 | + return |
| 93 | + fi |
| 94 | + |
| 95 | + # no config file exists, creating one |
| 96 | + # with alsa as the sound driver |
| 97 | + cat >"$config" << _EOF_ |
| 98 | +[Sound Setup] |
| 99 | +MusicParams = "audio.driver=alsa" |
| 100 | +_EOF_ |
| 101 | + chown -R $user:$user "$config" |
| 102 | +} |
0 commit comments