RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Intellivision jzintv for SDL2 - Proposed scriptmodule

    Scheduled Pinned Locked Moved Ideas and Development
    intellivisionjzintvsdl2
    5 Posts 2 Posters 716 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.
    • LolonoisL
      Lolonois
      last edited by

      I noticed the SDL2 release of jzintv by coincidence as I am on the "Kernel 5.x mission" ;-) and I don't want to miss any of my current emulators with my display-rotated Acrade once Kernel 4.19 is discontinued - full context here.

      However, I am pretty exited about a) the impressive changes and improvements on jzintv since the last two releases since 2018 (FWIW see ReleaseNotes in source ZIP archive of jzintv) and b) the fact it will work also rotated on a Kernel 5.x RetroPie due to its SDL2 usage. Works like charm. :)

      The current RetroPie-Setup comes with a jzintv from late 2018 and is SDL1 based.

      So I propose these changes for the jzintv.sh scriptmodule (tested on Rpi4, 4.19 kernel, RetroPie-Setup 4.7.12 / 21edf451).

      diff --git a/scriptmodules/emulators/jzintv.sh b/scriptmodules/emulators/jzintv.sh
      index a8916632..be95dcdc 100644
      --- a/scriptmodules/emulators/jzintv.sh
      +++ b/scriptmodules/emulators/jzintv.sh
      @@ -13,16 +13,18 @@ rp_module_id="jzintv"
       rp_module_desc="Intellivision emulator"
       rp_module_help="ROM Extensions: .int .bin\n\nCopy your Intellivision roms to $romdir/intellivision\n\nCopy the required BIOS files exec.bin and grom.bin to $biosdir"
       rp_module_licence="GPL2 http://spatula-city.org/%7Eim14u2c/intv/"
      -rp_module_repo="file $__archive_url/jzintv-20181225.zip"
      +rp_module_repo="file http://spatula-city.org/%7Eim14u2c/intv/dl/jzintv-20200712-src.zip"
       rp_module_section="opt"
       rp_module_flags="sdl1 !mali"
       
       function depends_jzintv() {
      -    getDepends libsdl1.2-dev
      +    getDepends libsdl2-dev
       }
       
       function sources_jzintv() {
           downloadAndExtract "$md_repo_url" "$md_build"
      +    # jzintv-YYYYMMDD/ --> jzintv/
      +    mv jzintv* jzintv
           cd jzintv/src
           # aarch64 doesn't include sys/io.h - we can just remove it in this case
           isPlatform "aarch64" && grep -rl "include.*sys/io.h" | xargs sed -i "/include.*sys\/io.h/d"
      @@ -31,24 +33,33 @@ function sources_jzintv() {
       function build_jzintv() {
           mkdir -p jzintv/bin
           cd jzintv/src
      -    make clean
      -    make CC="gcc" CXX="g++" WARN="" WARNXX="" OPT_FLAGS="$CFLAGS"
      +    make -f Makefile.rpi_sdl2 clean
      +    make -f Makefile.rpi_sdl2 CC="gcc" CXX="g++" WARN="" WARNXX="" OPT_FLAGS="$CFLAGS"
           md_ret_require="$md_build/jzintv/bin/jzintv"
       }
       
       function install_jzintv() {
      +    rm -f jzintv/bin/*.dll
           md_ret_files=(
               'jzintv/bin'
      +        'jzintv/doc'
               'jzintv/src/COPYING.txt'
               'jzintv/src/COPYRIGHT.txt'
      +        $(find jzintv/Release*)
           )
       }
       
       function configure_jzintv() {
           mkRomDir "intellivision"
       
      -    ! isPlatform "x11" && setBackend "$md_id" "dispmanx"
      -
      -    addEmulator 1 "$md_id" "intellivision" "$md_inst/bin/jzintv -p $biosdir -q %ROM%"
      +    disp_size=$(vcgencmd dispmanx_list | grep -o '[0-9][0-9]*x[0-9][0-9]*')
      +    local options=(
      +        --ecs=1
      +        --voice=1
      +        --displaysize="${disp_size}"
      +        --rom-path=$biosdir
      +        #--quiet
      +    )
      +    addEmulator 1 "$md_id" "intellivision" "$md_inst/bin/jzintv ${options[*]} %ROM%"
           addSystem "intellivision"
       }
      
      

      Before creating a PR could @mitu et al pls have a first cursory look on this proposal and comment?

      For the early adapters, feel free to make a copy of your current RetroPie-Setup/scriptmodules/emulators/jzintv.sh and replace it with the proposed version https://github.com/Gemba/RetroPie-Setup/blob/fb_jzintv_20200712/scriptmodules/emulators/jzintv.sh

      Cheers

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

        @lolonois said in Intellivision jzintv for SDL2 - Proposed scriptmodule:

        Before creating a PR could @mitu et al pls have a first cursory look on this proposal and comment?

        I think I tested the newer version a few months back, not sure if it ran ok - but if you tested it and looks fine, we could upgrade it.

        My comments so far would be :

        • rp_module_flags should include the sdl2 flag. This helps with the backend selection (which superseeded the dispmanx flag recently). If backend selection doesn't work, then the flag should be removed.
        • if SDL2 is to be used, then the !maliflag could possibly be removed, allowing the installation on Odroid/Tinkerboard/Tegra systems.
        • as an addendum to the previous point, is the Makefile.rpi_sdl2 really necessary ? The module should not be RPI specific (right now should install on PC/x86/x86_64), any optimizing $CFLAGS would be added automatically by the setup script.
        • don't use vcgencmd - it's RPI (and Raspberry OS) specific. As mentioned in the previous point, the module should work on other platforms. If you need to add the video resolution size, then use the %HEIGHT%, %WIDTH% placeholders - they'll be automatically expanded by runcommand at runtime (and they'll also be set depending on the chosen resolution in the runcommand launch menu).
        LolonoisL 1 Reply Last reply Reply Quote 0
        • LolonoisL
          Lolonois @mitu
          last edited by

          @mitu thanks for the useful hints and advise. I did rework the patch and now it looks as below.

          NB: Setting jzintv=1 in backends.cfg had no effect.

          Two things to consider / to be decided by the maintainers:

          1. May be it is fair to host the sources on a RetroPie server. I don't expect that the server of Joseph Zbiciak (jzIntv author) will be slashdotted but I also don't know his hosting contract.
          2. Currently the build is done as Debug release (thus the dependency to libreadline-dev). For release builds this is not needed and additionally Joseph provides some (optimization) hints in src/buildcfg/. Question is: Leave it as Debug build or let the scriptmodule build a Release build?
          diff --git a/scriptmodules/emulators/jzintv.sh b/scriptmodules/emulators/jzintv.sh
          index a8916632..bf696cde 100644
          --- a/scriptmodules/emulators/jzintv.sh
          +++ b/scriptmodules/emulators/jzintv.sh
          @@ -11,18 +11,22 @@
           
           rp_module_id="jzintv"
           rp_module_desc="Intellivision emulator"
          -rp_module_help="ROM Extensions: .int .bin\n\nCopy your Intellivision roms to $romdir/intellivision\n\nCopy the required BIOS files exec.bin and grom.bin to $biosdir"
          +rp_module_help="ROM Extensions: .int .bin .rom\n\nCopy your Intellivision roms to $romdir/intellivision\n\nCopy the required BIOS files exec.bin and grom.bin to $biosdir"
           rp_module_licence="GPL2 http://spatula-city.org/%7Eim14u2c/intv/"
          -rp_module_repo="file $__archive_url/jzintv-20181225.zip"
          +rp_module_repo="file http://spatula-city.org/%7Eim14u2c/intv/dl/jzintv-20200712-src.zip"
           rp_module_section="opt"
          -rp_module_flags="sdl1 !mali"
          +rp_module_flags="sdl2"
           
           function depends_jzintv() {
          -    getDepends libsdl1.2-dev
          +    # libreadline-dev only needed for debug builds
          +    # see: src/buildcfg/10-opt-for-linux-rpi-release.mak.txt
          +    getDepends libsdl2-dev libreadline-dev
           }
           
           function sources_jzintv() {
               downloadAndExtract "$md_repo_url" "$md_build"
          +    # jzintv-YYYYMMDD/ --> jzintv/
          +    mv jzintv* jzintv
               cd jzintv/src
               # aarch64 doesn't include sys/io.h - we can just remove it in this case
               isPlatform "aarch64" && grep -rl "include.*sys/io.h" | xargs sed -i "/include.*sys\/io.h/d"
          @@ -31,24 +35,43 @@ function sources_jzintv() {
           function build_jzintv() {
               mkdir -p jzintv/bin
               cd jzintv/src
          +
          +    # Add source release date information to build
          +    mv buildcfg/90-svn.mak buildcfg/90-svn.mak.txt
          +    echo "SVN_REV := $(echo $md_repo_url | grep -o -P '[\d]{8}')" > buildcfg/90-src_releasedate.mak
          +    sed -i.zip-dist "s/SVN Revision/Releasedate/" svn_revision.c
          +
               make clean
               make CC="gcc" CXX="g++" WARN="" WARNXX="" OPT_FLAGS="$CFLAGS"
          +
               md_ret_require="$md_build/jzintv/bin/jzintv"
           }
           
           function install_jzintv() {
          +    rm -f jzintv/bin/*.dll
               md_ret_files=(
                   'jzintv/bin'
          +        'jzintv/doc'
                   'jzintv/src/COPYING.txt'
                   'jzintv/src/COPYRIGHT.txt'
          +        $(find jzintv/Release*)
               )
           }
           
           function configure_jzintv() {
               mkRomDir "intellivision"
           
          -    ! isPlatform "x11" && setBackend "$md_id" "dispmanx"
          +    local options=(
          +        --displaysize="%XRES%x%YRES%"
          +        --fullscreen=1
          +        #--quiet
          +        --rom-path=$biosdir
          +        --voice=1
          +    )
          +
          +    addEmulator 1 "$md_id" "intellivision" "$md_inst/bin/jzintv ${options[*]} %ROM%"
          +    options+=(--ecs=1)
          +    addEmulator 0 "${md_id}_ecs" "intellivision" "$md_inst/bin/jzintv ${options[*]} %ROM%"
           
          -    addEmulator 1 "$md_id" "intellivision" "$md_inst/bin/jzintv -p $biosdir -q %ROM%"
               addSystem "intellivision"
           }
          
          

          Also I noted there was no developer documentation for %XRES% and %YRES%. I added a section to runcommand.sh so it gets visibility in the apidocs (retropie_packages.sh apidocs). Would be a separate PR.

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

            @lolonois said in Intellivision jzintv for SDL2 - Proposed scriptmodule:

            NB: Setting jzintv=1 in backends.cfg had no effect.

            That's not how the backends helper works - it should be configured from Configuration/Tools.

            May be it is fair to host the sources on a RetroPie server. I don't expect that the server of Joseph Zbiciak (jzIntv author) will be slashdotted but I also don't know his hosting contract.

            In this case leave the download url like before - using $__archive_url.

            Currently the build is done as Debug release (thus the dependency to libreadline-dev). For release builds this is not needed and additionally Joseph provides some (optimization) hints in src/buildcfg/.

            That would be strange - my take on this is that readline is used for jzintv's debugger, not for Debug builds.

                *   Debugger improvements:
                    *   GNU Readline support!
                        *   Available on Windows, Linux, Mac by default.
                        *   Readline-enabled builds pump event-loop in background,
                            improving window behavior / interaction w/ the OS.
            
            LolonoisL 1 Reply Last reply Reply Quote 0
            • LolonoisL
              Lolonois @mitu
              last edited by

              To clarify on backends.cfg: If it shows jzintv="dispmanx" the emulator call gets these environment variables passed in: SDL1_VIDEODRIVER=dispmanx SDL_DISPMANX_WIDTH=1600 SDL_DISPMANX_HEIGHT=1200 /opt/retropie/emulators/jzintv/bin/jzintv ... (but has no effect on the emulator), if it is absent or configured to SDL2 KMS in _Configurations/Tools _ (results in jzintv="default" in backends.cfg) no env variables are prefixed to the emulator call. So long story short: No need to explicitly set something in backends.cfg.

              On readline: You are right, if it is disabled in the build, a simplified implementation will be used. So I will leave libreadline-dev in the dependencies.

              Will file the two PRs shortly, will use $__archive_url.

              Thanks again.

              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.