From 07b628ff8c85764d524a4bc2e951ebe5e8b2e8d0 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 1 Jun 2023 20:31:29 +0300 Subject: [PATCH] Waiting for blitter hang fix --- blitter.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/blitter.cpp b/blitter.cpp index 6764ee6e..d13efecf 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -1929,9 +1929,21 @@ static bool waitingblits (void) } bool waited = false; + int waiting = 0; + int vpos_prev = vpos; while ((blt_info.blit_main || blt_info.blit_finald) && dmaen (DMA_BLITTER)) { waited = true; x_do_cycles (8 * CYCLE_UNIT); + if (vpos_prev != vpos) { + vpos_prev = vpos; + waiting++; + if (waiting > maxvpos * 5) { + break; + } + } + if (blitter_cycle_exact && blit_cyclecounter > 0 && !shifter[0] && !shifter[1] && !shifter[2] && !shifter[3]) { + break; + } } if (warned && waited) { warned--; -- 2.47.3