From 4bfa16d18f683c01bbc8b67de5575e6e54123f92 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Thu, 9 Mar 2017 19:23:24 -0800 Subject: Fix graphical corruption and sprite flickering introduced into some games by the last change for horizontal border support --- vdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vdp.c') diff --git a/vdp.c b/vdp.c index c36c2ab..5b96b6e 100644 --- a/vdp.c +++ b/vdp.c @@ -1497,6 +1497,7 @@ static void vdp_advance_line(vdp_context *context) } else if (context->vcounter == 0xDB) { context->vcounter = 0x1D5; } + context->vcounter &= 0x1FF; if (context->vcounter > context->inactive_start) { context->hint_counter = context->regs[REG_HINT]; @@ -1517,7 +1518,7 @@ static void advance_output_line(vdp_context *context) } context->vcounter &= 0x1FF; } else { - if (context->vcounter == context->inactive_start) { + if (context->vcounter == (context->inactive_start & 0x1FF)) { render_framebuffer_updated(context->flags2 & FLAG2_EVEN_FIELD ? FRAMEBUFFER_EVEN: FRAMEBUFFER_ODD, context->h40_lines > (context->inactive_start + context->border_top) / 2 ? LINEBUF_SIZE : (256+HORIZ_BORDER)); if (context->double_res) { context->flags2 ^= FLAG2_EVEN_FIELD; @@ -1526,7 +1527,6 @@ static void advance_output_line(vdp_context *context) context->h40_lines = 0; context->frame++; } - context->vcounter &= 0x1FF; uint32_t output_line; if (context->vcounter < context->inactive_start + context->border_bot) { output_line = context->border_top + context->vcounter; -- cgit v1.2.3