changeset 1366:c74a2f31ae5f

Fix regression in horizontal interrupt timing that was breaking the "water" palette swap in the Sonic series and other games
author Michael Pavone <pavone@retrodev.com>
date Mon, 22 May 2017 21:11:13 -0700
parents 6dd2c3edd0b5
children 52c99430ba5f
files vdp.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;