core, fix some bugs reported by ASAN

This commit is contained in:
kub 2024-02-14 23:36:43 +01:00
parent b5d8374c6a
commit b38c0ea6f9
2 changed files with 6 additions and 7 deletions

View file

@ -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) void PicoDrawSync(int to, int off, int on)
{ {
struct PicoEState *est = &Pico.est; struct PicoEState *est = &Pico.est;
int line, offs = 0; int line, offs;
int sh = (est->Pico->video.reg[0xC] & 8) >> 3; // shadow/hilight? int sh = (est->Pico->video.reg[0xC] & 8) >> 3; // shadow/hilight?
int bgc = est->Pico->video.reg[7] & 0x3f; int bgc = est->Pico->video.reg[7] & 0x3f;
pprof_start(draw); pprof_start(draw);
if (rendlines != 240) { offs = (240-rendlines) >> 1;
offs = 8; if (to >= rendlines)
if (to > 223) to = rendlines-1;
to = 223;
}
if (est->DrawScanline <= to && if (est->DrawScanline <= to &&
(est->rendstatus & (PDRAW_DIRTY_SPRITES|PDRAW_PARSE_SPRITES))) (est->rendstatus & (PDRAW_DIRTY_SPRITES|PDRAW_PARSE_SPRITES)))
ParseSprites(to + 1, on); ParseSprites(to + 1, on);

View file

@ -397,7 +397,7 @@ int PicoVideoFIFOHint(void)
// reset slot to start of scanline // reset slot to start of scanline
vf->fifo_slot = 0; vf->fifo_slot = 0;
// only need to refresh sprite position if we are synced // 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(); PicoDrawRefreshSprites();
// if CPU is waiting for the bus, advance CPU and FIFO until bus is free // if CPU is waiting for the bus, advance CPU and FIFO until bus is free