From 38ee0206532a7cc48ad707082b1265bfc0547cd6 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 31 Jan 2020 01:29:59 +0200 Subject: [PATCH] Fixed a regression bug that made the first CGB frame blank instead of repeated. --- Core/display.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Core/display.c b/Core/display.c index f0e2ff2..7f3d23e 100644 --- a/Core/display.c +++ b/Core/display.c @@ -974,10 +974,16 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles) GB_STAT_update(gb); if (gb->frame_skip_state == GB_FRAMESKIP_LCD_TURNED_ON) { - if (!GB_is_sgb(gb) || gb->current_lcd_line < LINES) { - display_vblank(gb); + if (GB_is_cgb(gb)) { + GB_timing_sync(gb); + gb->frame_skip_state = GB_FRAMESKIP_FIRST_FRAME_SKIPPED; + } + else { + if (!GB_is_sgb(gb) || gb->current_lcd_line < LINES) { + display_vblank(gb); + } + gb->frame_skip_state = GB_FRAMESKIP_SECOND_FRAME_RENDERED; } - gb->frame_skip_state = GB_FRAMESKIP_SECOND_FRAME_RENDERED; } else { gb->frame_skip_state = GB_FRAMESKIP_SECOND_FRAME_RENDERED;