summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-05-22 21:11:13 -0700
committerMichael Pavone <pavone@retrodev.com>2017-05-22 21:11:13 -0700
commit004750f57466d8df289f43566cd5710082200780 (patch)
tree0480311f73d488df1022194f45196a54ac000e28 /vdp.c
parent50e7961c813f3663f7688a47c47491e9ed9dea00 (diff)
Fix regression in horizontal interrupt timing that was breaking the "water" palette swap in the Sonic series and other games
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c7
1 files changed, 7 insertions, 0 deletions
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;