# HG changeset patch # User Michael Pavone # Date 1495512673 25200 # Node ID c74a2f31ae5faeb107b3c12d8f6902892a87d7e8 # Parent 6dd2c3edd0b5dc5243c92d084713ef96c6215b33 Fix regression in horizontal interrupt timing that was breaking the "water" palette swap in the Sonic series and other games diff -r 6dd2c3edd0b5 -r c74a2f31ae5f vdp.c --- a/vdp.c Fri May 19 22:07:50 2017 -0700 +++ b/vdp.c Mon May 22 21:11:13 2017 -0700 @@ -3283,6 +3283,13 @@ 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;