sms, cleanup, add missing tms palette to gp2x

This commit is contained in:
kub 2023-03-07 21:57:33 +00:00
parent 39194ef19e
commit e5a1d4c5f1
3 changed files with 25 additions and 19 deletions

View file

@ -742,30 +742,32 @@ void PicoFrameStartSMS(void)
// Copy LCD enable flag for easier handling // Copy LCD enable flag for easier handling
Pico.m.hardware &= ~PMS_HW_LCD; Pico.m.hardware &= ~PMS_HW_LCD;
if ((PicoIn.opt & POPT_EN_GG_LCD) && (PicoIn.AHW & PAHW_GG)) if ((PicoIn.opt & POPT_EN_GG_LCD) && (PicoIn.AHW & PAHW_GG)) {
Pico.m.hardware |= PMS_HW_LCD; Pico.m.hardware |= PMS_HW_LCD;
if (!(Pico.m.hardware & PMS_HW_LCD) && (mode & 4) && (Pico.video.reg[0] & 0x20)) {
// SMS mode 4 with 1st column blanked
columns = 248;
Pico.est.rendstatus |= PDRAW_SMS_BLANK_1;
}
if (Pico.m.hardware & PMS_HW_LCD) {
// GG LCD always has 160x144 regardless of settings // GG LCD always has 160x144 regardless of settings
screen_offset = 24; // nonetheless the vdp timing has 224 lines screen_offset = 24; // nonetheless the vdp timing has 224 lines
loffs = 48; loffs = 48;
lines = 144; lines = 144;
columns = 160; columns = 160;
} else switch (mode) { } else {
// SMS2 only 224/240 line modes, e.g. Micro Machines if ((mode & 4) && (Pico.video.reg[0] & 0x20)) {
case 0x06|0x08: // SMS mode 4 with 1st column blanked
loffs = screen_offset = 0; columns = 248;
lines = 240; Pico.est.rendstatus |= PDRAW_SMS_BLANK_1;
break; }
case 0x06|0x10:
loffs = screen_offset = 8; switch (mode) {
lines = 224; // SMS2 only 224/240 line modes, e.g. Micro Machines
break; case 0x06|0x08:
loffs = screen_offset = 0;
lines = 240;
break;
case 0x06|0x10:
loffs = screen_offset = 8;
lines = 224;
break;
}
} }
line_offset = 8; // FinalizeLine requires HighCol+8 line_offset = 8; // FinalizeLine requires HighCol+8

View file

@ -574,7 +574,7 @@ static int menu_loop_32x_options(int id, int keys)
static const char *sms_hardwares[] = { "auto", "Game Gear", "Master System", "SG-1000", "SC-3000", NULL }; static const char *sms_hardwares[] = { "auto", "Game Gear", "Master System", "SG-1000", "SC-3000", NULL };
static const char *gg_ghosting_opts[] = { "OFF", "weak", "normal", NULL }; static const char *gg_ghosting_opts[] = { "OFF", "weak", "normal", NULL };
static const char *sms_mappers[] = { "auto", "Sega", "Codemasters", "Korea", "Korea MSX", "Korea X-in-1", "Korea 4-Pak", "Korea Janggun", "Korea Nemesis", "Taiwan 8K RAM", "Korea XOR", NULL }; static const char *sms_mappers[] = { "auto", "Sega", "Codemasters", "Korea", "Korea MSX", "Korea X-in-1", "Korea 4-Pak", "Korea Janggun", "Korea Nemesis", "Taiwan 8K RAM", "Korea XOR", "Sega 32K RAM", NULL };
static const char h_smsfm[] = "FM sound is only supported by few games\nOther games may crash with FM enabled"; static const char h_smsfm[] = "FM sound is only supported by few games\nOther games may crash with FM enabled";
static const char h_ghost[] = "simulates the inertia of the GG LCD display"; static const char h_ghost[] = "simulates the inertia of the GG LCD display";

View file

@ -361,12 +361,16 @@ static int make_local_pal_sms(int fast_mode)
// SMS palette for TMS modes // SMS palette for TMS modes
0x0000, 0x0000, 0x00a0, 0x00f0, 0x0500, 0x0f00, 0x0005, 0x0ff0, 0x0000, 0x0000, 0x00a0, 0x00f0, 0x0500, 0x0f00, 0x0005, 0x0ff0,
0x000a, 0x000f, 0x0055, 0x00ff, 0x0050, 0x0f0f, 0x0555, 0x0fff, 0x000a, 0x000f, 0x0055, 0x00ff, 0x0050, 0x0f0f, 0x0555, 0x0fff,
// TMS palette
0x0000, 0x0000, 0x04c2, 0x07d6, 0x0e55, 0x0f77, 0x055c, 0x0ee4,
0x055f, 0x077f, 0x05bc, 0x08ce, 0x03a2, 0x0b5c, 0x0ccc, 0x0fff,
}; };
int i; int i;
if (!(Pico.video.reg[0] & 0x4)) { if (!(Pico.video.reg[0] & 0x4)) {
for (i = Pico.est.SonicPalCount; i >= 0; i--) { for (i = Pico.est.SonicPalCount; i >= 0; i--) {
bgr444_to_rgb32(localPal+i*0x40, tmspal, 32); int sg = !!(PicoIn.AHW & (PAHW_SG|PAHW_SC));
bgr444_to_rgb32(localPal+i*0x40, tmspal+sg*0x10, 32);
memcpy(localPal+i*0x40+0x20, localPal+i*0x40, 0x20*4); memcpy(localPal+i*0x40+0x20, localPal+i*0x40, 0x20*4);
} }
} else if (fast_mode) { } else if (fast_mode) {