Skip to content

Commit 0f25b67

Browse files
committed
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
1 parent 75f6dc0 commit 0f25b67

File tree

3 files changed

+91
-13
lines changed

3 files changed

+91
-13
lines changed

scriptmodules/emulators/jzintv.sh

+65-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rp_module_section="opt"
1818
rp_module_flags="sdl2"
1919

2020
function depends_jzintv() {
21-
getDepends libsdl2-dev libreadline-dev
21+
getDepends libsdl2-dev libreadline-dev flip
2222
}
2323

2424
function sources_jzintv() {
@@ -27,6 +27,14 @@ function sources_jzintv() {
2727
# jzintv-YYYYMMDD/ --> jzintv/
2828
mv jzintv-[0-9]* jzintv
2929
cd jzintv/src
30+
# archive files have CRLF linendings, patch has CR only
31+
find . -type f \( -iname "*.c" -o -iname "*.h" \) -exec flip -u {} \+
32+
33+
if isPlatform "rpi"; then
34+
# https://retropie.org.uk/forum/topic/32433/jzintv-has-black-border-or-full-screen-color
35+
applyPatch "$md_data/01_rpi_hide_cursor_sdl2.patch"
36+
applyPatch "$md_data/01_rpi_pillar_boxing_black_background_sdl2.patch"
37+
fi
3038

3139
# Add source release date information to build
3240
mv buildcfg/90-svn.mak buildcfg/90-svn.mak.txt
@@ -44,8 +52,9 @@ function build_jzintv() {
4452
mkdir -p jzintv/bin
4553
cd jzintv/src
4654

55+
isPlatform "rpi" && local extra='EXTRA=-DPLAT_LINUX_RPI'
4756
make clean
48-
DISTCC_HOSTS="" make
57+
DISTCC_HOSTS="" make $extra
4958

5059
md_ret_require="$md_build/jzintv/bin/jzintv"
5160
}
@@ -61,17 +70,60 @@ function install_jzintv() {
6170
}
6271

6372
function configure_jzintv() {
64-
mkRomDir "intellivision"
73+
local -r system="intellivision"
74+
mkRomDir $system
6575

66-
local options=(
67-
--displaysize="%XRES%x%YRES%"
68-
--quiet
69-
--rom-path="$biosdir"
70-
--voice=1
71-
)
76+
local start_script="$md_inst/jzintv_launcher.sh"
77+
cat > "$start_script" << _EOF_
78+
#! /usr/bin/env bash
79+
80+
# \$1: width of display
81+
# \$2: height of display
82+
# \$3: --ecs=1, optional
83+
# \$4,5,6...: more optional parameters
84+
# last parameter: %ROM%
85+
86+
jzintv_bin="$md_inst/bin/jzintv"
87+
88+
disp_w=\$1; shift
89+
disp_h=\$1; shift
90+
91+
min=\$(( \$disp_w < \$disp_h ? \$disp_w : \$disp_h ))
92+
if [[ \$min = \$disp_h ]] ; then
93+
intv_w=\$(echo \$min | awk '{ printf "%0.f\n", \$0 * 1.3333 + .5 }')
94+
intv_h=\$min
95+
else
96+
# 90/270 rotated displays
97+
intv_w=\$min
98+
intv_h=\$(echo \$min | awk '{ printf "%0.f\n", \$0 / 1.3333 }')
99+
fi
100+
101+
# set --gfx-verbose instead of --quiet for verbose output
102+
options=(
103+
-f1 # fullscreen
104+
--quiet
105+
# --gfx-verbose
106+
--displaysize="\${intv_w}x\${intv_h}"
107+
--rom-path="$biosdir"
108+
--voice=1
109+
)
110+
111+
# ingest additional options
112+
while [[ \$# -gt 1 ]] ; do
113+
options+=(\$1); shift
114+
done
115+
116+
rom=\$1
117+
echo "Launching: \$jzintv_bin \${options[*]} \"\$rom\"" >> /dev/shm/runcommand.log
118+
119+
pushd "$romdir/$system" > /dev/null
120+
\$jzintv_bin \${options[*]} "\$rom"
121+
popd
122+
_EOF_
123+
chown $user:$user "$start_script"
124+
chmod u+x "$start_script"
72125

73-
addEmulator 1 "$md_id" "intellivision" "$md_inst/bin/jzintv ${options[*]} %ROM%"
74-
options+=(--ecs=1)
75-
addEmulator 0 "${md_id}-ecs" "intellivision" "$md_inst/bin/jzintv ${options[*]} %ROM%"
76-
addSystem "intellivision"
126+
addEmulator 1 "$md_id" "$system" "bash '$start_script' %XRES% %YRES% %ROM%"
127+
addEmulator 0 "$md_id-ecs" "$system" "bash '$start_script' %XRES% %YRES% --ecs=1 %ROM%"
128+
addSystem "$system"
77129
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/gfx/gfx_sdl2.c
2+
+++ b/gfx/gfx_sdl2.c
3+
@@ -506,7 +511,7 @@ LOCAL int gfx_flip(const gfx_t *const gfx)
4+
/* need to clear the backdrop to our border color before copying the */
5+
/* texture to the display. */
6+
/* -------------------------------------------------------------------- */
7+
- SDL_SetRenderDrawColor(rend, bord_color.r, bord_color.g, bord_color.b, 255);
8+
+ SDL_SetRenderDrawColor(rend, 0, 0, 0, 255);
9+
SDL_RenderClear(rend);
10+
if (pvt->vid_enable || gfx->debug_blank)
11+
SDL_RenderCopy(rend, text, NULL,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--- a/gfx/gfx_sdl2.c
2+
+++ a/gfx/gfx_sdl2.c
3+
@@ -420,7 +420,12 @@ LOCAL int gfx_setup_sdl_display
4+
/* Hide the mouse if full screen. */
5+
/* -------------------------------------------------------------------- */
6+
SDL_ShowCursor(
7+
+#ifndef PLAT_LINUX_RPI
8+
+ /* SDL_GetNumVideoDisplays() may return two on rpi3, thus disable */
9+
+ /* this clause on rpi. This is not only cosmetic, it fixes the */
10+
+ /* UI freeze (not of jzintv itself), if mouse is attached and moved.*/
11+
SDL_GetNumVideoDisplays() == 1 &&
12+
+#endif
13+
(act_wind_flags & SDL_WINDOW_FULLSCREEN) ? SDL_DISABLE : SDL_ENABLE);
14+
15+
SDL_PumpEvents();

0 commit comments

Comments
 (0)