From 4f9c8e93748144a4b63036820892e34744c4d4eb Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 19 Jul 2019 20:19:09 +0300 Subject: [PATCH] Match the HLE timings to the LLE timings --- Core/display.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/display.c b/Core/display.c index 2bf00ba..fc23044 100644 --- a/Core/display.c +++ b/Core/display.c @@ -769,13 +769,7 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles) fifo_push_bg_row(&gb->bg_fifo, 0, 0, 0, false, false); /* Todo: find out actual access time of SCX */ gb->position_in_line = - (gb->io_registers[GB_IO_SCX] & 7) - 8; - - // Todo: unverified timing - gb->current_lcd_line++; - if (gb->icd_hreset_callback) { - gb->icd_hreset_callback(gb); - } - + if (gb->current_lcd_line == LINES && GB_is_sgb(gb)) { display_vblank(gb); } @@ -915,6 +909,12 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles) } GB_SLEEP(gb, display, 11, LINE_LENGTH - gb->cycles_for_line); gb->mode_for_interrupt = 2; + + // Todo: unverified timing + gb->current_lcd_line++; + if (gb->icd_hreset_callback) { + gb->icd_hreset_callback(gb); + } } /* Lines 144 - 152 */ @@ -987,7 +987,7 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles) gb->window_disabled_while_active = false; gb->current_line = 0; // TODO: not the correct timing - gb->current_lcd_line = -1; + gb->current_lcd_line = 0; if (gb->icd_vreset_callback) { gb->icd_vreset_callback(gb); }