From e5a1d4c5f1f685afef6cedec3262340fde999aff Mon Sep 17 00:00:00 2001 From: kub Date: Tue, 7 Mar 2023 21:57:33 +0000 Subject: [PATCH] sms, cleanup, add missing tms palette to gp2x --- pico/mode4.c | 36 +++++++++++++++++++----------------- platform/common/menu_pico.c | 2 +- platform/gp2x/emu.c | 6 +++++- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/pico/mode4.c b/pico/mode4.c index 9c1cff96..b06ca58d 100644 --- a/pico/mode4.c +++ b/pico/mode4.c @@ -742,30 +742,32 @@ void PicoFrameStartSMS(void) // Copy LCD enable flag for easier handling 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; - 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 screen_offset = 24; // nonetheless the vdp timing has 224 lines loffs = 48; lines = 144; columns = 160; - } else switch (mode) { - // SMS2 only 224/240 line modes, e.g. Micro Machines - case 0x06|0x08: - loffs = screen_offset = 0; - lines = 240; - break; - case 0x06|0x10: - loffs = screen_offset = 8; - lines = 224; - break; + } else { + if ((mode & 4) && (Pico.video.reg[0] & 0x20)) { + // SMS mode 4 with 1st column blanked + columns = 248; + Pico.est.rendstatus |= PDRAW_SMS_BLANK_1; + } + + switch (mode) { + // SMS2 only 224/240 line modes, e.g. Micro Machines + 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 diff --git a/platform/common/menu_pico.c b/platform/common/menu_pico.c index f90fa276..b839697e 100644 --- a/platform/common/menu_pico.c +++ b/platform/common/menu_pico.c @@ -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 *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_ghost[] = "simulates the inertia of the GG LCD display"; diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 1540d81b..42b30437 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -361,12 +361,16 @@ static int make_local_pal_sms(int fast_mode) // SMS palette for TMS modes 0x0000, 0x0000, 0x00a0, 0x00f0, 0x0500, 0x0f00, 0x0005, 0x0ff0, 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; if (!(Pico.video.reg[0] & 0x4)) { 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); } } else if (fast_mode) { -- 2.39.2