RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Modifying eduke32 scriptmodule to also build VoidSW

    Scheduled Pinned Locked Moved Help and Support
    voidswretropie 4.7scriptmodulesdiscussion
    8 Posts 2 Posters 956 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kaltertod
      last edited by

      As the title says I am wanting to look at the prospect of updating the eduke32 scriptmodule to include building VoidSW (Which is included in the latest eduke32 source) I keep hitting roadblocks with editing the scriptmodule that installs eduke32. To me it seems pretty simple as the command to build VoidSW is simply:

      $ make sw

      However when I try editing the script I get all sorts of errors.

      I would like this to be an open discussion on how to modify the included eduke32 scriptmodule to include the install of VoidSW.

      Most of the problems that I seem to be running into are syntax errors. The scriptmodule already includes building eduke32 for ionfury so I would assume that it would not take to much work to add VoidSW along side eduke32 and the ionfury support.

      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @kaltertod
        last edited by

        @kaltertod Post your modifications to the scriptmodule and the error(s) you get.

        K 1 Reply Last reply Reply Quote 0
        • K
          kaltertod @mitu
          last edited by kaltertod

          I am in no way good at this so please be kind

          Basically I tried copying the ion fury sections of the script and tried to modify them so that it would compile the VoidSW sourceport. However I get syntax errors and line 74 -79 etc... I fix one and then there is another and so on....

          #!/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_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() {
              # was svn rev -r8090
              local revision="dfc16b08"
          
              gitPullOrClone "$md_build" https://voidpoint.io/terminx/eduke32.git "" "$revision"
          
              # 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"
          }
          
          function build_eduke32() {
              local params=(LTO=0 SDL_TARGET=2)
          
              [[ "$md_id1" == "sw" ]] && params+=()
              ! 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)
              
              [[ "$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"
              fi
               
              if [[ "$md_id1" == "sw"  ]]; then
          	md_ret_require="$md_build/sw"
              fi
          
              else
                  md_ret_require="$md_build/eduke32"
              fi
          }
          
          function install_eduke32() {
              md_ret_files=('mapster32')
          
              if [[ "$md_id" == "ionfury" ]]; then
                  md_ret_files+=('fury')
              fi
          
              if [[ "$md_id1" == "sw"  ]]; then
          	md_ret_files+=('sw')
              fi
               
              else
                  md_ret_files+=('eduke32')
              fi
          }
          
          function game_data_eduke32() {
              cd "$_tmpdir"
          
              if [[ "$md_id" == "eduke32" ]]; then
                  if [[ ! -f "$romdir/ports/duke3d/duke3d.grp" ]]; then
                      wget -O 3dduke13.zip "$__archive_url/3dduke13.zip"
                      unzip -L -o 3dduke13.zip dn3dsw13.shr
                      unzip -L -o dn3dsw13.shr -d "$romdir/ports/duke3d" duke3d.grp duke.rts
                      rm 3dduke13.zip dn3dsw13.shr
                      chown -R $user:$user "$romdir/ports/duke3d"
                  fi
              fi
          }
          
          function configure_eduke32() {
              local appname="eduke32"
              local portname="duke3d"
              if [[ "$md_id" == "ionfury" ]]; then
                  appname="fury"
                  portname="ionfury"
              fi
              if [[ "$md_id1" == "sw" ]]; then
          	appname="VoidSW"
          	portname="ShadowWarrior"
              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:$user "$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' '' '')
              fi
              
              if [[ "$md_id" == "sw"  ]]; then
          	num_games=5
          	local game5=('Shadow Warrior' '' '')
              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}" "${binary}.sh %ROM%" "-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
          }
          
          mituM 1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @kaltertod
            last edited by mitu

            That won't work - the modifications are not correct, since the ionfury part is actually called from the ionfury. Not mentioning the syntax errors - I guess you're not familiar with Bash scripting ?

            The SW (Shadow Warrior) part is actually simple to build - just need to build the sw make target

            ...
            function build_eduke32() {
            #[...]
               make veryclean
                CFLAGS+=" -DSDL_USEFOLDER" make "${params[@]}"
            # 
                CFLAGS+=" -DSDL_USEFOLDER" make "${params[@]}" sw
            
            # rest of the scriptmodule
            

            and you should have the sw program in $md_build, ready to be installed (via install_eduke32). However, the source used by the eduke32 scriptmodule has an error when trying to build the sw and the build stops.

            Unless a more recent version of the source is used, building the sw part is not going to work.

            K 1 Reply Last reply Reply Quote 0
            • K
              kaltertod @mitu
              last edited by kaltertod

              @mitu that helps alot, as far as using a newer source VoidSW has been part of the eduke32 source code for quite a few months https://voidpoint.io/terminx/eduke32/-/tree/master/source

              so it should be just a matter of updating the line to local revision="" to reflect the latest source revision correct?

              K 1 Reply Last reply Reply Quote 0
              • K
                kaltertod @kaltertod
                last edited by kaltertod

                @mitu So this is how the build section should be arranged in the script module correct?

                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[@]}"
                
                CFLAGS+=" -DSDL_USEFOLDER" make "${params[@]}" sw
                
                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
                
                }
                
                mituM 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @kaltertod
                  last edited by

                  ..so it should be just a matter of updating the line to local revision="" to reflect the latest source revision correct?

                  Yes, that would be a first step, but can't guarantee that the local patches will apply correctly to newer revisions and the build would be successful.

                  So this is how the build section should be arranged in the script module correct?
                  ...

                  Yes, pretty much. You should also add

                  ...
                  function install_eduke32() {
                  md_ret_files=('mapster32')
                  
                  if [[ "$md_id" == "ionfury" ]]; then
                      md_ret_files+=('fury')
                  else
                      md_ret_files+=('eduke32' 'sw')
                  fi
                  

                  and the installation will add the sw binary to /opt/retropie/ports/eduke32.

                  K 1 Reply Last reply Reply Quote 0
                  • K
                    kaltertod @mitu
                    last edited by

                    @mitu okay I will comment out the sections for the patches and see if it will build with the added lines in your above post. If I run into issues I will post back. Thank you so much for your help

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post

                    Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                    Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.