Skip to content

Commit 1d83718

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 1d83718

File tree

3 files changed

+86
-11
lines changed

3 files changed

+86
-11
lines changed

scriptmodules/emulators/jzintv.sh

Lines changed: 60 additions & 11 deletions
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 dos2unix
2222
}
2323

2424
function sources_jzintv() {
@@ -28,6 +28,12 @@ function sources_jzintv() {
2828
mv jzintv-[0-9]* jzintv
2929
cd jzintv/src
3030

31+
if isPlatform "rpi" ; then
32+
dos2unix $(find "$md_data" -iname "*.patch" -exec grep -h "^+++" {} \+ | cut -f2- -d '/' | uniq | xargs)
33+
applyPatch "$md_data/01_rpi_hide_cursor_sdl2.patch"
34+
applyPatch "$md_data/01_rpi_pillar_boxing_black_background_sdl2.patch"
35+
fi
36+
3137
# Add source release date information to build
3238
mv buildcfg/90-svn.mak buildcfg/90-svn.mak.txt
3339
echo "SVN_REV := $(echo $md_repo_url | grep -o -P '[\d]{8}')" > buildcfg/90-src_releasedate.mak
@@ -44,8 +50,13 @@ function build_jzintv() {
4450
mkdir -p jzintv/bin
4551
cd jzintv/src
4652

53+
if isPlatform "rpi" ; then
54+
local -r extra='EXTRA=-DPLAT_LINUX_RPI'
55+
else
56+
local -r extra=''
57+
fi
4758
make clean
48-
DISTCC_HOSTS="" make
59+
DISTCC_HOSTS="" make $extra
4960

5061
md_ret_require="$md_build/jzintv/bin/jzintv"
5162
}
@@ -63,15 +74,53 @@ function install_jzintv() {
6374
function configure_jzintv() {
6475
mkRomDir "intellivision"
6576

66-
local options=(
67-
--displaysize="%XRES%x%YRES%"
68-
--quiet
69-
--rom-path="$biosdir"
70-
--voice=1
71-
)
77+
local -r start_script="$md_inst/jzintv_launcher.sh"
78+
cat > "$start_script" << _EOF_
79+
#! /usr/bin/env bash
80+
81+
# \$1: width of display
82+
# \$2: height of display
83+
# \$3: --ecs=1, optional
84+
# \$4,5,6...: more optional parameters
85+
# last parameter: %ROM%
86+
87+
jzintv_bin="$md_inst/bin/jzintv"
88+
89+
# regular case: w>=h (rotation 90/270 not supported by jzintv)
90+
disp_w=\$1; shift
91+
disp_h=\$1; shift
92+
93+
ratio="4/3"
94+
do_pillarboxing='\$(python3 -c "print(\$disp_w / \$disp_h >= \$ratio)")'
95+
if [[ "\$do_pillarboxing" == "True" ]] ; then
96+
# le/ri padding
97+
intv_w=\$(python3 -c "print(round(\$disp_h * \$ratio))")
98+
intv_h=\$disp_h
99+
else
100+
# top/btm padding (letterboxing; e.g., on 5:4 displays)
101+
intv_w=\$disp_w
102+
intv_h=\$(python3 -c "print(round(\$disp_w / (\$ratio)))")
103+
fi
104+
105+
# set --gfx-verbose instead of --quiet for verbose output
106+
options=(
107+
-f1 # fullscreen
108+
--quiet
109+
# --gfx-verbose
110+
--displaysize="\${intv_w}x\${intv_h}"
111+
--rom-path="$biosdir"
112+
--voice=1
113+
)
114+
115+
echo "Launching: \$jzintv_bin \${options[@]} \"\$@\"" >> /dev/shm/runcommand.log
116+
pushd "$romdir/intellivision" > /dev/null
117+
\$jzintv_bin \${options[@]} "\$@"
118+
popd
119+
_EOF_
120+
chown $user:$user "$start_script"
121+
chmod u+x "$start_script"
72122

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%"
123+
addEmulator 1 "$md_id" "intellivision" "'$start_script' %XRES% %YRES% %ROM%"
124+
addEmulator 0 "$md_id-ecs" "intellivision" "'$start_script' %XRES% %YRES% --ecs=1 %ROM%"
76125
addSystem "intellivision"
77126
}
Lines changed: 15 additions & 0 deletions
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();
Lines changed: 11 additions & 0 deletions
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,

0 commit comments

Comments
 (0)