From 6b947c46bc69689292b109515bd9ce53bf2ba3ad Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 9 Oct 2021 22:41:43 +0300 Subject: [PATCH] Correct blank image detection on SGB --- Tester/main.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Tester/main.c b/Tester/main.c index 4a3f8e19..bdcb7ebf 100755 --- a/Tester/main.c +++ b/Tester/main.c @@ -140,10 +140,22 @@ static void vblank(GB_gameboy_t *gb) if (frames >= test_length && !gb->disable_rendering) { bool is_screen_blank = true; - for (unsigned i = GB_get_screen_width(gb) * GB_get_screen_height(gb); i--;) { - if (bitmap[i] != bitmap[0]) { - is_screen_blank = false; - break; + if (!gb->sgb) { + for (unsigned i = 160 * 144; i--;) { + if (bitmap[i] != bitmap[0]) { + is_screen_blank = false; + break; + } + } + } + else { + if (gb->sgb->mask_mode == 0) { + for (unsigned i = 160 * 144; i--;) { + if (gb->sgb->screen_buffer[i] != gb->sgb->screen_buffer[0]) { + is_screen_blank = false; + break; + } + } } }