reworked palette and buffer handling due to some 32X bugs

This commit is contained in:
kub 2019-03-22 23:03:26 +01:00
parent 23eef37f25
commit b1a047c926
13 changed files with 236 additions and 130 deletions

View file

@ -155,7 +155,7 @@ static void blit(const char *fps, const char *notice)
}
// a hack for VR
if (PicoIn.AHW & PAHW_SVP)
memset32((int *)(Pico.est.Draw2FB+328*8+328*223), 0xe0e0e0e0, 328);
memset((int *)(Pico.est.Draw2FB+328*8+328*223), 0xe0e0e0e0, 328*4);
if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
if (currentConfig.EmuOpt&0x4000)
lines_flags|=0x40000; // (Pico.m.frame_count&1)?0x20000:0x40000;
@ -166,22 +166,25 @@ static void blit(const char *fps, const char *notice)
int lines_flags;
// 8bit accurate renderer
if (Pico.m.dirtyPal) {
Pico.m.dirtyPal = 0;
vidConvCpyRGB565(localPal, Pico.cram, 0x40);
if (Pico.m.dirtyPal == 2)
Pico.m.dirtyPal = 0;
/* no support
switch (Pico.est.SonicPalCount) {
case 3: vidConvCpyRGB565(localPal+0xc0, Pico.est.SonicPal+0xc0, 0x40);
case 2: vidConvCpyRGB565(localPal+0x80, Pico.est.SonicPal+0x80, 0x40);
case 1: vidConvCpyRGB565(localPal+0x40, Pico.est.SonicPal+0x40, 0x40);
default://vidConvCpyRGB565(localPal, Pico.est.SonicPal, 0x40);
} */
vidConvCpyRGB565(localPal, Pico.est.SonicPal, 0x40);
if (Pico.video.reg[0xC]&8) { // shadow/hilight mode
//vidConvCpyRGB32sh(localPal+0x40, Pico.cram, 0x40);
//vidConvCpyRGB32hi(localPal+0x80, Pico.cram, 0x40); // TODO?
memcpy32((void *)(localPal+0xc0), (void *)(localPal+0x40), 0x40*2/4);
//vidConvCpyRGB32sh(localPal+0x40, Pico.est.SonicPal, 0x40);
//vidConvCpyRGB32hi(localPal+0x80, Pico.est.SonicPal, 0x40); // TODO?
memcpy((void *)(localPal+0xc0), (void *)(localPal+0x40), 0x40*2);
localPal[0xc0] = 0x0600;
localPal[0xd0] = 0xc000;
localPal[0xe0] = 0x0000; // reserved pixels for OSD
localPal[0xf0] = 0xffff;
}
/* no support
else if (rendstatus & 0x20) { // mid-frame palette changes
vidConvCpyRGB565(localPal+0x40, HighPal, 0x40);
vidConvCpyRGB565(localPal+0x80, HighPal+0x40, 0x40);
} */
}
lines_flags = (Pico.video.reg[1]&8) ? 240 : 224;
if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;

View file

@ -54,7 +54,7 @@ static unsigned int inp_prev = 0;
void menu_draw_begin(int use_bgbuff)
{
if (use_bgbuff)
memcpy32((int *)menu_screen, (int *)bg_buffer, 321*240*2/4);
memcpy((int *)menu_screen, (int *)bg_buffer, 321*240*2);
}
@ -66,7 +66,7 @@ void menu_draw_end(void)
lprintf("%s: Framework2D_LockBuffer() returned NULL\n", __FUNCTION__);
return;
}
memcpy32(giz_screen, (int *)menu_screen, 321*240*2/4);
memcpy(giz_screen, (int *)menu_screen, 321*240*2);
fb_unlock();
giz_screen = NULL;
fb_flip();