mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
core+gp2x+psp, fix handling mid-frame palette changes
This commit is contained in:
parent
d05e2eb3d6
commit
ace184013b
8 changed files with 82 additions and 51 deletions
|
@ -301,26 +301,26 @@ static int make_local_pal_md(int fast_mode)
|
|||
int pallen = 0x100;
|
||||
|
||||
if (fast_mode) {
|
||||
bgr444_to_rgb32(localPal, PicoMem.cram);
|
||||
bgr444_to_rgb32(localPal, PicoMem.cram, 64);
|
||||
pallen = 0x40;
|
||||
Pico.m.dirtyPal = 0;
|
||||
}
|
||||
else if (Pico.est.rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes
|
||||
switch (Pico.est.SonicPalCount) {
|
||||
case 3: bgr444_to_rgb32(localPal+0xc0, Pico.est.SonicPal+0xc0);
|
||||
case 2: bgr444_to_rgb32(localPal+0x80, Pico.est.SonicPal+0x80);
|
||||
case 1: bgr444_to_rgb32(localPal+0x40, Pico.est.SonicPal+0x40);
|
||||
default:bgr444_to_rgb32(localPal, Pico.est.SonicPal);
|
||||
case 3: bgr444_to_rgb32(localPal+0xc0, Pico.est.SonicPal+0xc0, 64);
|
||||
case 2: bgr444_to_rgb32(localPal+0x80, Pico.est.SonicPal+0x80, 64);
|
||||
case 1: bgr444_to_rgb32(localPal+0x40, Pico.est.SonicPal+0x40, 64);
|
||||
default:bgr444_to_rgb32(localPal, Pico.est.SonicPal, 64);
|
||||
}
|
||||
pallen = (Pico.est.SonicPalCount+1)*0x40;
|
||||
}
|
||||
else if (Pico.video.reg[0xC] & 8) { // shadow/hilight mode
|
||||
bgr444_to_rgb32(localPal, Pico.est.SonicPal);
|
||||
bgr444_to_rgb32(localPal, Pico.est.SonicPal, 64);
|
||||
bgr444_to_rgb32_sh(localPal, Pico.est.SonicPal);
|
||||
memcpy(localPal+0xc0, localPal, 0x40*4); // for spr prio mess
|
||||
}
|
||||
else {
|
||||
bgr444_to_rgb32(localPal, Pico.est.SonicPal);
|
||||
bgr444_to_rgb32(localPal, Pico.est.SonicPal, 64);
|
||||
memcpy(localPal+0x40, localPal, 0x40*4); // for spr prio mess
|
||||
memcpy(localPal+0x80, localPal, 0x80*4); // for spr prio mess
|
||||
}
|
||||
|
@ -336,9 +336,27 @@ static int make_local_pal_md(int fast_mode)
|
|||
|
||||
static int make_local_pal_sms(int fast_mode)
|
||||
{
|
||||
bgr444_to_rgb32(localPal, PicoMem.cram);
|
||||
Pico.m.dirtyPal = 0;
|
||||
return 0x40;
|
||||
static u16 tmspal[32] = {
|
||||
// SMS palette for TMS modes
|
||||
0x0000, 0x0000, 0x00a0, 0x00f0, 0x0500, 0x0f00, 0x0005, 0x0ff0,
|
||||
0x000a, 0x000f, 0x0055, 0x00ff, 0x0050, 0x0f0f, 0x0555, 0x0fff,
|
||||
};
|
||||
int i;
|
||||
|
||||
if (!(Pico.video.reg[0] & 0x4)) {
|
||||
for (i = Pico.est.SonicPalCount; i >= 0; i--) {
|
||||
bgr444_to_rgb32(localPal+i*0x40, tmspal, 32);
|
||||
memcpy(localPal+i*0x40+0x20, localPal+i*0x40, 0x20*4);
|
||||
}
|
||||
} else {
|
||||
for (i = Pico.est.SonicPalCount; i >= 0; i--) {
|
||||
bgr444_to_rgb32(localPal+i*0x40, Pico.est.SonicPal+i*0x40, 32);
|
||||
memcpy(localPal+i*0x40+0x20, localPal+i*0x40, 0x20*4);
|
||||
}
|
||||
}
|
||||
if (Pico.m.dirtyPal == 2)
|
||||
Pico.m.dirtyPal = 0;
|
||||
return (Pico.est.SonicPalCount+1)*0x40;
|
||||
}
|
||||
|
||||
void pemu_finalize_frame(const char *fps, const char *notice)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue