|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# This file is part of RetroPie-Extra, a supplement to RetroPie. |
| 4 | +# For more information, please visit: |
| 5 | +# |
| 6 | +# https://github.com/RetroPie/RetroPie-Setup |
| 7 | +# https://github.com/Exarkuniv/RetroPie-Extra |
| 8 | +# |
| 9 | +# See the LICENSE file distributed with this source and at |
| 10 | +# https://raw.githubusercontent.com/Exarkuniv/RetroPie-Extra/master/LICENSE |
| 11 | +# |
| 12 | + |
| 13 | +rp_module_id="ecwolf-mod" |
| 14 | +rp_module_desc="ECWolf - ECWolf is an advanced source port for Wolfenstein 3D, Spear of Destiny, and Super 3D Noah's Ark based off of the Wolf4SDL code base. It also supports mods from .pk3 files." |
| 15 | +rp_module_licence="GPL2 https://bitbucket.org/ecwolf/ecwolf/raw/5065aaefe055bff5a8bb8396f7f2ca5f2e2cab27/docs/license-gpl.txt" |
| 16 | +rp_module_help="For registered versions, replace the shareware files by adding your full Wolf3d, Spear3D 1.4 version game files to $romdir/ports/wolf3d/." |
| 17 | +rp_module_repo="git https://bitbucket.org/ecwolf/ecwolf master" |
| 18 | +rp_module_section="exp" |
| 19 | +rp_module_flags="" |
| 20 | + |
| 21 | +function depends_ecwolf-mod() { |
| 22 | + getDepends libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev zlib1g-dev libsdl1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev |
| 23 | +} |
| 24 | + |
| 25 | +function sources_ecwolf-mod() { |
| 26 | + gitPullOrClone |
| 27 | + # add Escape to controller bindable keys to access main menu |
| 28 | + applyPatch "$md_data/01_keyboard_patch.diff" |
| 29 | +} |
| 30 | + |
| 31 | +function build_ecwolf-mod() { |
| 32 | + mkdir build |
| 33 | + cd build |
| 34 | + cmake -DCMAKE_BUILD_TYPE=Release -DGPL=ON .. |
| 35 | + make |
| 36 | + md_ret_require="$md_build/build/ecwolf" |
| 37 | +} |
| 38 | + |
| 39 | +function install_ecwolf-mod() { |
| 40 | + md_ret_files=( |
| 41 | + 'build/ecwolf' |
| 42 | + 'build/ecwolf.pk3' |
| 43 | + ) |
| 44 | +} |
| 45 | + |
| 46 | +function game_data_ecwolf-mod() { |
| 47 | + if [[ -z $(ls "$romdir/ports/wolf3d") ]]; then |
| 48 | + cd "$__tmpdir" |
| 49 | + downloadAndExtract "http://maniacsvault.net/ecwolf/files/shareware/wolf3d14.zip" "$romdir/ports/wolf3d/shareware" |
| 50 | + downloadAndExtract "http://maniacsvault.net/ecwolf/files/shareware/soddemo.zip" "$romdir/ports/wolf3d/shareware" |
| 51 | + fi |
| 52 | +} |
| 53 | + |
| 54 | +function _add_games_ecwolf-mod(){ |
| 55 | + local ecw_bin="$1" |
| 56 | + local ext path game |
| 57 | + |
| 58 | + declare -A games=( |
| 59 | + ['wl1']="Wolfenstein 3D (demo)" |
| 60 | + ['wl6']="Wolfenstein 3D" |
| 61 | + ['sod']="Wolfenstein 3D - Spear of Destiny" |
| 62 | + ['sd1']="Wolfenstein 3D - Spear of Destiny" |
| 63 | + ['sdm']="Wolfenstein 3D - Spear of Destiny (demo)" |
| 64 | + ['n3d']="Wolfenstein 3D - Super Noah’s Ark 3D" |
| 65 | + ['sd2']="Wolfenstein 3D - SoD MP2 - Return to Danger" |
| 66 | + ['sd3']="Wolfenstein 3D - SoD MP3 - Ultimate Challenge" |
| 67 | + ) |
| 68 | + |
| 69 | + pushd "$romdir/ports/wolf3d" |
| 70 | + for game in "${!games[@]}"; do |
| 71 | + ecw=$(find . -iname "*.$game" -print -quit) |
| 72 | + [[ -n "$ecw" ]] || continue |
| 73 | + ext="${ecw##*.}" |
| 74 | + path="${ecw%/*}"; path="${path#*/}" |
| 75 | + |
| 76 | + addPort "$md_id" "ecwolf" "${games[$game]}" "pushd $romdir/ports/wolf3d; bash %ROM%; popd" "$romdir/ports/wolf3d/${games[$game]}.ecwolf" |
| 77 | + _add_ecwolf_files_ecwolf-mod "$romdir/ports/wolf3d/${games[$game]}.ecwolf" "$path" "$ext" "$ecw_bin" |
| 78 | + done |
| 79 | + popd |
| 80 | +} |
| 81 | + |
| 82 | +function _add_ecwolf_files_ecwolf-mod() { |
| 83 | +cat >"$1" <<_EOF_ |
| 84 | +cd "$2" |
| 85 | +"$4" --data $3 --fullscreen --res 1920 1080 |
| 86 | +wait \$! |
| 87 | +_EOF_ |
| 88 | +} |
| 89 | + |
| 90 | +function add_games_ecwolf-mod() { |
| 91 | + _add_games_ecwolf-mod "$md_inst/ecwolf" |
| 92 | +} |
| 93 | + |
| 94 | +function configure_ecwolf-mod() { |
| 95 | + mkRomDir "ports/wolf3d" |
| 96 | + |
| 97 | + moveConfigDir "$home/.local/share/ecwolf" "$md_conf_root/ecwolf" |
| 98 | + moveConfigDir "$home/.config/ecwolf" "$md_conf_root/ecwolf" |
| 99 | + |
| 100 | + # Check if some wolfenstein files are present and upload shareware files |
| 101 | + [[ "$md_mode" == "install" ]] && game_data_ecwolf-mod |
| 102 | + [[ "$md_mode" == "install" ]] && add_games_ecwolf-mod |
| 103 | + |
| 104 | + chown -R $user:$user "$romdir/ports/wolf3d" |
| 105 | +} |
0 commit comments