From 0f25b67120d6789679b52a07b666d2fb144cb877 Mon Sep 17 00:00:00 2001 From: Gemba Date: Fri, 1 Apr 2022 22:49:38 +0200 Subject: [PATCH] fixes bg color to black on pillarboxed 4:3 on a 16:9 display and - sets 4:3 display format for jzintv automagically (launcher file) - fixes a UI freeze bug when a mouse is attached and moved on a RPI3 when jzintv is running ref: https://retropie.org.uk/forum/topic/32433/jzintv-has-black-border-or-full-screen-color --- scriptmodules/emulators/jzintv.sh | 78 +++++++++++++++---- .../jzintv/01_rpi_hide_cursor_sdl2.patch | 11 +++ ..._pillar_boxing_black_background_sdl2.patch | 15 ++++ 3 files changed, 91 insertions(+), 13 deletions(-) create mode 100644 scriptmodules/emulators/jzintv/01_rpi_hide_cursor_sdl2.patch create mode 100644 scriptmodules/emulators/jzintv/01_rpi_pillar_boxing_black_background_sdl2.patch diff --git a/scriptmodules/emulators/jzintv.sh b/scriptmodules/emulators/jzintv.sh index 1e5c4a067d..6e31c1db43 100644 --- a/scriptmodules/emulators/jzintv.sh +++ b/scriptmodules/emulators/jzintv.sh @@ -18,7 +18,7 @@ rp_module_section="opt" rp_module_flags="sdl2" function depends_jzintv() { - getDepends libsdl2-dev libreadline-dev + getDepends libsdl2-dev libreadline-dev flip } function sources_jzintv() { @@ -27,6 +27,14 @@ function sources_jzintv() { # jzintv-YYYYMMDD/ --> jzintv/ mv jzintv-[0-9]* jzintv cd jzintv/src + # archive files have CRLF linendings, patch has CR only + find . -type f \( -iname "*.c" -o -iname "*.h" \) -exec flip -u {} \+ + + if isPlatform "rpi"; then + # https://retropie.org.uk/forum/topic/32433/jzintv-has-black-border-or-full-screen-color + applyPatch "$md_data/01_rpi_hide_cursor_sdl2.patch" + applyPatch "$md_data/01_rpi_pillar_boxing_black_background_sdl2.patch" + fi # Add source release date information to build mv buildcfg/90-svn.mak buildcfg/90-svn.mak.txt @@ -44,8 +52,9 @@ function build_jzintv() { mkdir -p jzintv/bin cd jzintv/src + isPlatform "rpi" && local extra='EXTRA=-DPLAT_LINUX_RPI' make clean - DISTCC_HOSTS="" make + DISTCC_HOSTS="" make $extra md_ret_require="$md_build/jzintv/bin/jzintv" } @@ -61,17 +70,60 @@ function install_jzintv() { } function configure_jzintv() { - mkRomDir "intellivision" + local -r system="intellivision" + mkRomDir $system - local options=( - --displaysize="%XRES%x%YRES%" - --quiet - --rom-path="$biosdir" - --voice=1 - ) + local start_script="$md_inst/jzintv_launcher.sh" + cat > "$start_script" << _EOF_ +#! /usr/bin/env bash + +# \$1: width of display +# \$2: height of display +# \$3: --ecs=1, optional +# \$4,5,6...: more optional parameters +# last parameter: %ROM% + +jzintv_bin="$md_inst/bin/jzintv" + +disp_w=\$1; shift +disp_h=\$1; shift + +min=\$(( \$disp_w < \$disp_h ? \$disp_w : \$disp_h )) +if [[ \$min = \$disp_h ]] ; then + intv_w=\$(echo \$min | awk '{ printf "%0.f\n", \$0 * 1.3333 + .5 }') + intv_h=\$min +else + # 90/270 rotated displays + intv_w=\$min + intv_h=\$(echo \$min | awk '{ printf "%0.f\n", \$0 / 1.3333 }') +fi + +# set --gfx-verbose instead of --quiet for verbose output +options=( + -f1 # fullscreen + --quiet +# --gfx-verbose + --displaysize="\${intv_w}x\${intv_h}" + --rom-path="$biosdir" + --voice=1 +) + +# ingest additional options +while [[ \$# -gt 1 ]] ; do + options+=(\$1); shift +done + +rom=\$1 +echo "Launching: \$jzintv_bin \${options[*]} \"\$rom\"" >> /dev/shm/runcommand.log + +pushd "$romdir/$system" > /dev/null +\$jzintv_bin \${options[*]} "\$rom" +popd +_EOF_ + chown $user:$user "$start_script" + chmod u+x "$start_script" - 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%" - addSystem "intellivision" + addEmulator 1 "$md_id" "$system" "bash '$start_script' %XRES% %YRES% %ROM%" + addEmulator 0 "$md_id-ecs" "$system" "bash '$start_script' %XRES% %YRES% --ecs=1 %ROM%" + addSystem "$system" } diff --git a/scriptmodules/emulators/jzintv/01_rpi_hide_cursor_sdl2.patch b/scriptmodules/emulators/jzintv/01_rpi_hide_cursor_sdl2.patch new file mode 100644 index 0000000000..baee3f5958 --- /dev/null +++ b/scriptmodules/emulators/jzintv/01_rpi_hide_cursor_sdl2.patch @@ -0,0 +1,11 @@ +--- a/gfx/gfx_sdl2.c ++++ b/gfx/gfx_sdl2.c +@@ -506,7 +511,7 @@ LOCAL int gfx_flip(const gfx_t *const gfx) + /* need to clear the backdrop to our border color before copying the */ + /* texture to the display. */ + /* -------------------------------------------------------------------- */ +- SDL_SetRenderDrawColor(rend, bord_color.r, bord_color.g, bord_color.b, 255); ++ SDL_SetRenderDrawColor(rend, 0, 0, 0, 255); + SDL_RenderClear(rend); + if (pvt->vid_enable || gfx->debug_blank) + SDL_RenderCopy(rend, text, NULL, diff --git a/scriptmodules/emulators/jzintv/01_rpi_pillar_boxing_black_background_sdl2.patch b/scriptmodules/emulators/jzintv/01_rpi_pillar_boxing_black_background_sdl2.patch new file mode 100644 index 0000000000..5f3d5630c2 --- /dev/null +++ b/scriptmodules/emulators/jzintv/01_rpi_pillar_boxing_black_background_sdl2.patch @@ -0,0 +1,15 @@ +--- a/gfx/gfx_sdl2.c ++++ a/gfx/gfx_sdl2.c +@@ -420,7 +420,12 @@ LOCAL int gfx_setup_sdl_display + /* Hide the mouse if full screen. */ + /* -------------------------------------------------------------------- */ + SDL_ShowCursor( ++#ifndef PLAT_LINUX_RPI ++ /* SDL_GetNumVideoDisplays() may return two on rpi3, thus disable */ ++ /* this clause on rpi. This is not only cosmetic, it fixes the */ ++ /* UI freeze (not of jzintv itself), if mouse is attached and moved.*/ + SDL_GetNumVideoDisplays() == 1 && ++#endif + (act_wind_flags & SDL_WINDOW_FULLSCREEN) ? SDL_DISABLE : SDL_ENABLE); + + SDL_PumpEvents();