From: kub Date: Wed, 14 Feb 2024 22:36:43 +0000 (+0100) Subject: core, fix some bugs reported by ASAN X-Git-Tag: v2.00~124 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b38c0ea6f9d61f529eb6ca0b34c2587232300660;p=picodrive.git core, fix some bugs reported by ASAN --- diff --git a/pico/draw.c b/pico/draw.c index d47240cf..1b4ceb3c 100644 --- a/pico/draw.c +++ b/pico/draw.c @@ -2095,17 +2095,16 @@ static void PicoLine(int line, int offs, int sh, int bgc, int off, int on) void PicoDrawSync(int to, int off, int on) { struct PicoEState *est = &Pico.est; - int line, offs = 0; + int line, offs; int sh = (est->Pico->video.reg[0xC] & 8) >> 3; // shadow/hilight? int bgc = est->Pico->video.reg[7] & 0x3f; pprof_start(draw); - if (rendlines != 240) { - offs = 8; - if (to > 223) - to = 223; - } + offs = (240-rendlines) >> 1; + if (to >= rendlines) + to = rendlines-1; + if (est->DrawScanline <= to && (est->rendstatus & (PDRAW_DIRTY_SPRITES|PDRAW_PARSE_SPRITES))) ParseSprites(to + 1, on); diff --git a/pico/videoport.c b/pico/videoport.c index 503e0eb3..73c90edb 100644 --- a/pico/videoport.c +++ b/pico/videoport.c @@ -397,7 +397,7 @@ int PicoVideoFIFOHint(void) // reset slot to start of scanline vf->fifo_slot = 0; // only need to refresh sprite position if we are synced - if (Pico.est.DrawScanline == Pico.m.scanline) + if (Pico.est.DrawScanline == Pico.m.scanline && !(pv->status & SR_VB)) PicoDrawRefreshSprites(); // if CPU is waiting for the bus, advance CPU and FIFO until bus is free