core+platforms, add SMS option to select TMS palette for gfx modes 0-3

This commit is contained in:
kub 2024-01-13 16:31:43 +01:00
parent dca20effa2
commit 214a6c624c
7 changed files with 36 additions and 2 deletions

View file

@ -741,6 +741,10 @@ void PicoFrameStartSMS(void)
Pico.m.dirtyPal = 1;
}
Pico.m.hardware &= ~PMS_HW_TMS;
if (PicoIn.tmsPalette || (PicoIn.AHW & (PAHW_SG|PAHW_SC)))
Pico.m.hardware |= PMS_HW_TMS;
// Copy LCD enable flag for easier handling
Pico.m.hardware &= ~PMS_HW_LCD;
if ((PicoIn.opt & POPT_EN_GG_LCD) && (PicoIn.AHW & PAHW_GG)) {
@ -886,7 +890,7 @@ void PicoDoHighPal555SMS(void)
* hence GG/SMS/TMS can all be handled the same here */
for (j = cnt; j > 0; j--) {
if (!(Pico.video.reg[0] & 0x4)) // fixed palette in TMS modes
spal = (u32 *)tmspal + (PicoIn.AHW & (PAHW_SG|PAHW_SC) ? 16/2:0);
spal = (u32 *)tmspal + (Pico.m.hardware & PMS_HW_TMS ? 16/2:0);
for (i = 0x20/2; i > 0; i--, spal++, dpal++) {
t = *spal;
#if defined(USE_BGR555)

View file

@ -116,6 +116,7 @@ typedef struct PicoInterface
unsigned short autoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP
unsigned int hwSelect; // hardware preselected via option menu
unsigned int mapper; // mapper selection for SMS, 0 = auto
unsigned int tmsPalette; // palette used by SMS in TMS graphic modes
unsigned short quirks; // game-specific quirks: PQUIRK_*
unsigned short overclockM68k; // overclock the emulated 68k, in %

View file

@ -346,7 +346,8 @@ struct PicoMisc
#define PMS_HW_LCD 0x2 // GG LCD
#define PMS_HW_JAP 0x4 // japanese system
#define PMS_HW_FM 0x8 // FM sound
#define PMS_HW_FMUSED 0x10 // FM sound accessed
#define PMS_HW_TMS 0x10 // assume TMS9918
#define PMS_HW_FMUSED 0x80 // FM sound accessed
#define PMS_MAP_AUTO 0
#define PMS_MAP_SEGA 1

View file

@ -577,10 +577,13 @@ 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", "Sega 32K RAM", NULL };
static const char *sms_tmspalette[] = { "SMS", "SG-1000" };
static const char h_smsfm[] = "FM sound is only supported by few games,\n"
"some games may crash with FM enabled";
static const char h_ghost[] = "Simulate the inertia of the GG LCD display";
static const char h_smspal[] = "Selects the color palette used for SMS games\n"
"using the original TMS9918 graphics modes";
static menu_entry e_menu_sms_options[] =
{
@ -588,6 +591,7 @@ static menu_entry e_menu_sms_options[] =
mee_enum ("Cartridge mapping", MA_SMSOPT_MAPPER, PicoIn.mapper, sms_mappers),
mee_enum_h ("Game Gear LCD ghosting", MA_SMSOPT_GHOSTING, currentConfig.ghosting, gg_ghosting_opts, h_ghost),
mee_onoff_h ("FM Sound Unit", MA_OPT2_ENABLE_YM2413, PicoIn.opt, POPT_EN_YM2413, h_smsfm),
mee_enum_h ("SMS palette in TMS mode", MA_SMSOPT_TMSPALETTE, PicoIn.tmsPalette, sms_tmspalette, h_smspal),
mee_end,
};

View file

@ -99,6 +99,7 @@ typedef enum
MA_SMSOPT_HARDWARE,
MA_SMSOPT_MAPPER,
MA_SMSOPT_GHOSTING,
MA_SMSOPT_TMSPALETTE,
MA_CTRL_PLAYER1,
MA_CTRL_PLAYER2,
MA_CTRL_PLAYER3,

View file

@ -1814,6 +1814,15 @@ static void update_variables(bool first_run)
PicoIn.opt &= ~POPT_EN_YM2413;
}
var.value = NULL;
var.key = "picodrive_smstms";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "SG-1000") == 0)
PicoIn.tmsPalette = 1;
else
PicoIn.tmsPalette = 0;
}
var.value = NULL;
var.key = "picodrive_smsmapper";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {

View file

@ -145,6 +145,20 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"Auto"
},
{
"picodrive_smstms",
"Master System Palette in TMS modes",
NULL,
"Choose which colour palette should be used when an SMS game runs in one of the SG-1000 graphics modes.",
NULL,
"system",
{
{ "SMS", NULL },
{ "SG-1000", NULL },
{ NULL, NULL },
},
"SMS"
},
{
"picodrive_ramcart",
"Sega CD RAM Cart",