From 09b7e2fff4aaf453adb5ccf6de3a6b697299b676 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Mon, 11 Sep 2017 23:56:35 +0300 Subject: [PATCH] =?UTF-8?q?Fixed=20a=20bug=20in=20scx=5Fdelay=E2=80=99s=20?= =?UTF-8?q?calculation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/display.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/display.c b/Core/display.c index fd502ec..927e30c 100755 --- a/Core/display.c +++ b/Core/display.c @@ -292,12 +292,12 @@ static void update_display_state(GB_gameboy_t *gb, uint8_t cycles) Todo: Investigate what causes the difference between our findings */ uint8_t stat_delay = gb->cgb_double_speed? 2 : 4; // (gb->cgb_mode? 0 : 4); /* Todo: Is this correct for DMG mode CGB? */ - uint8_t scx_delay = gb->effective_scx; + uint8_t scx_delay = gb->effective_scx & 7; if (gb->cgb_double_speed) { - scx_delay = (scx_delay + 1) & ~1 & 7; + scx_delay = (scx_delay + 1) & ~1; } else { - scx_delay = (scx_delay + (gb->first_scanline ? 2 : 0)) & ~3 & 7; + scx_delay = (scx_delay + (gb->first_scanline ? 2 : 0)) & ~3; } /* Todo: These are correct for DMG, DMG-mode CGB, and single speed CGB. Is is correct for double speed CGB? */