Skip to content

Commit

Permalink
standalone: allow other that 1 line scanlines
Browse files Browse the repository at this point in the history
doesn't seem useful, but since the code is done I'll keep it
notaz/pcsx_rearmed/#287
  • Loading branch information
notaz committed Dec 10, 2023
1 parent 60693a9 commit 2f70bda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion frontend/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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),
Expand Down
16 changes: 10 additions & 6 deletions frontend/plugin_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f70bda

Please sign in to comment.