From 004750f57466d8df289f43566cd5710082200780 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Mon, 22 May 2017 21:11:13 -0700 Subject: Fix regression in horizontal interrupt timing that was breaking the "water" palette swap in the Sonic series and other games --- vdp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vdp.c') diff --git a/vdp.c b/vdp.c index e09b30a..1b7826a 100644 --- a/vdp.c +++ b/vdp.c @@ -3283,6 +3283,13 @@ uint32_t vdp_next_hint(vdp_context * context) if (hint_line > context->inactive_start) { return 0xFFFFFFFF; } + if (hint_line >= context->vcounter) { + //Next interrupt is for a line in the next frame that + //is higher than the line we're on now so just passing + //that line number to vdp_cycles_to_line will yield the wrong + //result + return context->cycles + vdp_cycles_to_line(context, 0) + hint_line * MCLKS_LINE - HINT_FUDGE; + } } } else { uint32_t jump_start, jump_dst; -- cgit v1.2.3