standalone: allow other that 1 line scanlines
authornotaz <notasas@gmail.com>
Sun, 10 Dec 2023 21:30:48 +0000 (23:30 +0200)
committernotaz <notasas@gmail.com>
Sun, 10 Dec 2023 21:30:48 +0000 (23:30 +0200)
doesn't seem useful, but since the code is done I'll keep it
notaz/pcsx_rearmed/#287

frontend/menu.c
frontend/plugin_lib.c

index 5371357..7622c4c 100644 (file)
@@ -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),
index 50aba22..159da70 100644 (file)
@@ -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