From 2f70bda7011efe14e8e689cab687cf00b9fdfe7c Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 10 Dec 2023 23:30:48 +0200 Subject: [PATCH] standalone: allow other that 1 line scanlines doesn't seem useful, but since the code is done I'll keep it notaz/pcsx_rearmed/#287 --- frontend/menu.c | 3 ++- frontend/plugin_lib.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/menu.c b/frontend/menu.c index 53713570..7622c4c1 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -1279,6 +1279,7 @@ static const char h_cscaler[] = "Displays the scaler layer, you can resize it\ static const char h_soft_filter[] = "Works only if game uses low resolution modes"; static const char h_gamma[] = "Gamma/brightness adjustment (default 100)"; #ifdef __ARM_NEON__ +static const char *men_scanlines[] = { "OFF", "1", "2", "3", NULL }; static const char h_scanline_l[] = "Scanline brightness, 0-100%"; #endif @@ -1343,7 +1344,7 @@ static menu_entry e_menu_gfx_options[] = mee_enum ("Hardware Filter", MA_OPT_HWFILTER, plat_target.hwfilter, men_dummy), mee_enum_h ("Software Filter", MA_OPT_SWFILTER, soft_filter, men_soft_filter, h_soft_filter), #ifdef __ARM_NEON__ - mee_onoff ("Scanlines", MA_OPT_SCANLINES, scanlines, 1), + mee_enum ("Scanlines", MA_OPT_SCANLINES, scanlines, men_scanlines), mee_range_h ("Scanline brightness", MA_OPT_SCANLINE_LEVEL, scanline_level, 0, 100, h_scanline_l), #endif mee_range_h ("Gamma adjustment", MA_OPT_GAMMA, g_gamma, 1, 200, h_gamma), diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 50aba227..159da702 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -391,17 +391,21 @@ static void pl_vout_flip(const void *vram, int stride, int bgr24, } else if (scanlines != 0 && scanline_level != 100) { - int l = scanline_level * 2048 / 100; + int h2, l = scanline_level * 2048 / 100; int stride_0 = pl_vout_scale_h >= 2 ? 0 : stride; h1 *= pl_vout_scale_h; - for (; h1 >= 2; h1 -= 2) + while (h1 > 0) { - bgr555_to_rgb565(dest, src, w * 2); - dest += dstride * 2, src += stride_0; + for (h2 = scanlines; h2 > 0 && h1 > 0; h2--, h1--) { + bgr555_to_rgb565(dest, src, w * 2); + dest += dstride * 2, src += stride_0; + } - bgr555_to_rgb565_b(dest, src, w * 2, l); - dest += dstride * 2, src += stride; + for (h2 = scanlines; h2 > 0 && h1 > 0; h2--, h1--) { + bgr555_to_rgb565_b(dest, src, w * 2, l); + dest += dstride * 2, src += stride; + } } } #endif -- 2.39.5