Skip to content

Commit

Permalink
fixes bg color to black on pillarboxed 4:3 on a 16:9 display and
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Gemba committed Apr 3, 2022
1 parent 75f6dc0 commit 0f25b67
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 13 deletions.
78 changes: 65 additions & 13 deletions scriptmodules/emulators/jzintv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand All @@ -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"
}
Expand All @@ -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"
}
11 changes: 11 additions & 0 deletions scriptmodules/emulators/jzintv/01_rpi_hide_cursor_sdl2.patch
Original file line number Diff line number Diff line change
@@ -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,
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit 0f25b67

Please sign in to comment.