mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
vdp, fix for gfx save/load menu bg
This commit is contained in:
parent
8e4ab3c62c
commit
e721f80136
5 changed files with 29 additions and 15 deletions
|
@ -197,7 +197,7 @@ void PicoDrawSetCallbacks(int (*begin)(unsigned int num), int (*end)(unsigned in
|
|||
void vidConvCpyRGB565(void *to, void *from, int pixels);
|
||||
#endif
|
||||
void PicoDoHighPal555(int sh, int line, struct PicoEState *est);
|
||||
// internals
|
||||
// internals, NB must keep in sync with ASM draw functions
|
||||
#define PDRAW_SPRITES_MOVED (1<<0) // SAT address modified
|
||||
#define PDRAW_WND_DIFF_PRIO (1<<1) // not all window tiles use same priority
|
||||
#define PDRAW_PARSE_SPRITES (1<<2) // SAT needs parsing
|
||||
|
|
|
@ -846,7 +846,7 @@ void ym2612_unpack_state(void);
|
|||
extern unsigned SATaddr, SATmask;
|
||||
static __inline void UpdateSAT(u32 a, u32 d)
|
||||
{
|
||||
unsigned num = (a-SATaddr) >> 3;
|
||||
unsigned num = (a^SATaddr) >> 3;
|
||||
|
||||
Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;
|
||||
if (!(a & 4) && num < 128) {
|
||||
|
@ -876,6 +876,7 @@ void PicoVideoFIFOMode(int active, int h40);
|
|||
int PicoVideoFIFOWrite(int count, int byte_p, unsigned sr_mask, unsigned sr_flags);
|
||||
void PicoVideoSave(void);
|
||||
void PicoVideoLoad(void);
|
||||
void PicoVideoCacheSAT(void);
|
||||
|
||||
// misc.c
|
||||
PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count);
|
||||
|
|
|
@ -710,6 +710,8 @@ int PicoStateLoadGfx(const char *fname)
|
|||
areaRead(&Pico.video, 1, sizeof(Pico.video), afile);
|
||||
}
|
||||
areaClose(afile);
|
||||
|
||||
PicoVideoCacheSAT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -719,6 +721,7 @@ struct PicoTmp
|
|||
unsigned short vram[0x8000];
|
||||
unsigned short cram[0x40];
|
||||
unsigned short vsram[0x40];
|
||||
unsigned int satcache[0x80];
|
||||
|
||||
//struct PicoMisc m;
|
||||
struct PicoVideo video;
|
||||
|
@ -741,6 +744,7 @@ void *PicoTmpStateSave(void)
|
|||
memcpy(t->vram, PicoMem.vram, sizeof(PicoMem.vram));
|
||||
memcpy(t->cram, PicoMem.cram, sizeof(PicoMem.cram));
|
||||
memcpy(t->vsram, PicoMem.vsram, sizeof(PicoMem.vsram));
|
||||
memcpy(t->satcache, VdpSATCache, sizeof(VdpSATCache));
|
||||
memcpy(&t->video, &Pico.video, sizeof(Pico.video));
|
||||
|
||||
#ifndef NO_32X
|
||||
|
@ -763,6 +767,7 @@ void PicoTmpStateRestore(void *data)
|
|||
memcpy(PicoMem.vram, t->vram, sizeof(PicoMem.vram));
|
||||
memcpy(PicoMem.cram, t->cram, sizeof(PicoMem.cram));
|
||||
memcpy(PicoMem.vsram, t->vsram, sizeof(PicoMem.vsram));
|
||||
memcpy(VdpSATCache, t->satcache, sizeof(VdpSATCache));
|
||||
memcpy(&Pico.video, &t->video, sizeof(Pico.video));
|
||||
Pico.m.dirtyPal = 1;
|
||||
|
||||
|
|
|
@ -999,6 +999,25 @@ unsigned char PicoVideoRead8HV_L(void)
|
|||
return d;
|
||||
}
|
||||
|
||||
void PicoVideoCacheSAT(void)
|
||||
{
|
||||
struct PicoVideo *pv = &Pico.video;
|
||||
int l;
|
||||
|
||||
SATaddr = ((pv->reg[5]&0x7f) << 9) | ((pv->reg[6]&0x20) << 11);
|
||||
SATmask = ~0x1ff;
|
||||
if (pv->reg[12]&1)
|
||||
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++) {
|
||||
((u16 *)VdpSATCache)[l*2 ] = PicoMem.vram[(SATaddr>>1) + l*4 ];
|
||||
((u16 *)VdpSATCache)[l*2 + 1] = PicoMem.vram[(SATaddr>>1) + l*4 + 1];
|
||||
}
|
||||
|
||||
Pico.est.rendstatus |= PDRAW_SPRITES_MOVED;
|
||||
}
|
||||
|
||||
void PicoVideoSave(void)
|
||||
{
|
||||
struct VdpFIFO *vf = &VdpFIFO;
|
||||
|
@ -1014,7 +1033,6 @@ void PicoVideoLoad(void)
|
|||
{
|
||||
struct VdpFIFO *vf = &VdpFIFO;
|
||||
struct PicoVideo *pv = &Pico.video;
|
||||
int l;
|
||||
|
||||
// convert former dma_xfers (why was this in PicoMisc anyway?)
|
||||
if (Pico.m.dma_xfers) {
|
||||
|
@ -1023,17 +1041,6 @@ void PicoVideoLoad(void)
|
|||
vf->fifo_total = Pico.m.dma_xfers;
|
||||
Pico.m.dma_xfers = 0;
|
||||
}
|
||||
|
||||
SATaddr = ((pv->reg[5]&0x7f) << 9) | ((pv->reg[6]&0x20) << 11);
|
||||
SATmask = ~0x1ff;
|
||||
if (pv->reg[12]&1)
|
||||
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++) {
|
||||
*((u16 *)VdpSATCache + 2*l ) = PicoMem.vram[(SATaddr>>1) + l*4 ];
|
||||
*((u16 *)VdpSATCache + 2*l+1) = PicoMem.vram[(SATaddr>>1) + l*4 + 1];
|
||||
}
|
||||
PicoVideoCacheSAT();
|
||||
}
|
||||
|
||||
// vim:shiftwidth=2:ts=2:expandtab
|
||||
|
|
|
@ -1219,6 +1219,7 @@ void emu_cmn_forced_frame(int no_scale, int do_emu)
|
|||
|
||||
PicoDrawSetOutFormat(PDF_RGB555, 1);
|
||||
Pico.m.dirtyPal = 1;
|
||||
Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;
|
||||
if (do_emu)
|
||||
PicoFrame();
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue