From 4496577e405d4efd9aabc17a0a3f67ff1c781683 Mon Sep 17 00:00:00 2001 From: kub Date: Tue, 8 Feb 2022 22:05:00 +0000 Subject: [PATCH] core gfx, fix sprite problem in savestate load screen --- pico/pico_int.h | 2 +- pico/state.c | 9 +++++++-- pico/videoport.c | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pico/pico_int.h b/pico/pico_int.h index 49180fb5..550cb5b5 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -905,7 +905,7 @@ int PicoVideoFIFOWrite(int count, int byte_p, unsigned sr_mask, unsigned sr_flag void PicoVideoInit(void); void PicoVideoSave(void); void PicoVideoLoad(void); -void PicoVideoCacheSAT(void); +void PicoVideoCacheSAT(int load); // misc.c PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count); diff --git a/pico/state.c b/pico/state.c index 123b1acd..cd6d4de2 100644 --- a/pico/state.c +++ b/pico/state.c @@ -602,7 +602,7 @@ static int state_load_gfx(void *file) char buff[8]; if (PicoIn.AHW & PAHW_32X) - to_find += 2; + to_find += 3; g_read_offs = 0; CHECKED_READ(8, buff); @@ -629,16 +629,19 @@ static int state_load_gfx(void *file) case CHUNK_DRAM: if (Pico32xMem != NULL) CHECKED_READ_BUFF(Pico32xMem->dram); + found++; break; case CHUNK_32XPAL: if (Pico32xMem != NULL) CHECKED_READ_BUFF(Pico32xMem->pal); + found++; Pico32x.dirty_pal = 1; break; case CHUNK_32XSYS: CHECKED_READ_BUFF(Pico32x); + found++; break; #endif default: @@ -712,7 +715,8 @@ int PicoStateLoadGfx(const char *fname) } areaClose(afile); - PicoVideoCacheSAT(); + PicoVideoCacheSAT(1); + Pico.est.rendstatus = -1; return 0; } @@ -771,6 +775,7 @@ void PicoTmpStateRestore(void *data) memcpy(VdpSATCache, t->satcache, sizeof(VdpSATCache)); memcpy(&Pico.video, &t->video, sizeof(Pico.video)); Pico.m.dirtyPal = 1; + PicoVideoCacheSAT(0); #ifndef NO_32X if (PicoIn.AHW & PAHW_32X) { diff --git a/pico/videoport.c b/pico/videoport.c index 7f6ca9a7..4f9cbf10 100644 --- a/pico/videoport.c +++ b/pico/videoport.c @@ -1104,7 +1104,7 @@ unsigned char PicoVideoRead8HV_L(int is_from_z80) return d; } -void PicoVideoCacheSAT(void) +void PicoVideoCacheSAT(int load) { struct PicoVideo *pv = &Pico.video; int l; @@ -1115,7 +1115,7 @@ void PicoVideoCacheSAT(void) SATaddr &= ~0x200, SATmask &= ~0x200; // H40, zero lowest SAT bit // rebuild SAT cache XXX wrong since cache and memory can differ - for (l = 0; l < 80; l++) { + for (l = 0; load && l < 80; l++) { ((u16 *)VdpSATCache)[l*2 ] = PicoMem.vram[(SATaddr>>1) + l*4 ]; ((u16 *)VdpSATCache)[l*2 + 1] = PicoMem.vram[(SATaddr>>1) + l*4 + 1]; } @@ -1170,6 +1170,6 @@ void PicoVideoLoad(void) } if (vf->fifo_ql) pv->status |= SR_DMA; - PicoVideoCacheSAT(); + PicoVideoCacheSAT(1); } // vim:shiftwidth=2:ts=2:expandtab -- 2.39.5