sms, add system select option

This commit is contained in:
kub 2021-10-19 22:45:32 +02:00
parent cc1547e8cd
commit 280bfc3ca7
9 changed files with 97 additions and 28 deletions

View file

@ -298,7 +298,7 @@ enum media_type_e PicoLoadMedia(const char *filename,
// simple test for GG. Do this here since m.hardware is nulled in Insert // simple test for GG. Do this here since m.hardware is nulled in Insert
if (PicoIn.AHW & PAHW_SMS) { if (PicoIn.AHW & PAHW_SMS) {
if (!strcmp(rom->ext,"gg")) { if (!strcmp(rom->ext,"gg") && !PicoIn.hwSelect) {
Pico.m.hardware |= 0x1; Pico.m.hardware |= 0x1;
lprintf("detected GG ROM\n"); lprintf("detected GG ROM\n");
} else } else

View file

@ -82,6 +82,10 @@ extern void *p32x_bios_g, *p32x_bios_m, *p32x_bios_s;
#define PAHW_PICO (1<<3) #define PAHW_PICO (1<<3)
#define PAHW_SMS (1<<4) #define PAHW_SMS (1<<4)
#define PHWS_AUTO 0
#define PHWS_GG 1
#define PHWS_SMS 2
#define PQUIRK_FORCE_6BTN (1<<0) #define PQUIRK_FORCE_6BTN (1<<0)
// the emulator is configured and some status is reported // the emulator is configured and some status is reported
@ -97,6 +101,7 @@ typedef struct PicoInterface
unsigned short skipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff unsigned short skipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff
unsigned short regionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe unsigned short regionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe
unsigned short autoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP unsigned short autoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP
unsigned short hwSelect; // hardware preselected via option menu
unsigned short quirks; // game-specific quirks: PQUIRK_* unsigned short quirks; // game-specific quirks: PQUIRK_*
unsigned short overclockM68k; // overclock the emulated 68k, in % unsigned short overclockM68k; // overclock the emulated 68k, in %

View file

@ -335,6 +335,24 @@ void PicoResetMS(void)
ymflag = 0xffff; ymflag = 0xffff;
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
if (PicoIn.hwSelect) {
switch (PicoIn.hwSelect) {
case PHWS_GG: Pico.m.hardware |= 0x1; break;
default: Pico.m.hardware &= ~0x1; break;
}
} else {
unsigned tmr;
// check if the ROM header contains more system information to detect GG
for (tmr = 0x2000; tmr < 0xbfff && tmr <= Pico.romsize; tmr *= 2) {
if (!memcmp(Pico.rom + tmr-16, "TMR SEGA", 8)) {
if (Pico.rom[tmr-1] >= 0x50 && Pico.rom[tmr-1] < 0x80)
Pico.m.hardware |= 0x1;
break;
}
}
}
// reset memory mapping // reset memory mapping
PicoMemSetupMS(); PicoMemSetupMS();
} }
@ -342,7 +360,6 @@ void PicoResetMS(void)
void PicoPowerMS(void) void PicoPowerMS(void)
{ {
int s, tmp; int s, tmp;
unsigned tmr;
memset(&PicoMem,0,sizeof(PicoMem)); memset(&PicoMem,0,sizeof(PicoMem));
memset(&Pico.video,0,sizeof(Pico.video)); memset(&Pico.video,0,sizeof(Pico.video));
@ -359,15 +376,6 @@ void PicoPowerMS(void)
tmp = 1 << s; tmp = 1 << s;
bank_mask = (tmp - 1) >> 14; bank_mask = (tmp - 1) >> 14;
// check if the ROM header contains more system information to detect GG
for (tmr = 0x2000; tmr < 0xbfff && tmr <= Pico.romsize; tmr *= 2) {
if (!memcmp(Pico.rom + tmr-16, "TMR SEGA", 8)) {
if (Pico.rom[tmr-1] >= 0x50 && Pico.rom[tmr-1] < 0x80)
Pico.m.hardware |= 0x1;
break;
}
}
PicoReset(); PicoReset();
} }

View file

@ -597,6 +597,7 @@ void emu_prep_defconfig(void)
defaultConfig.s_PsndRate = 44100; defaultConfig.s_PsndRate = 44100;
defaultConfig.s_PicoRegion = 0; // auto defaultConfig.s_PicoRegion = 0; // auto
defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP
defaultConfig.s_hwSelect = PHWS_AUTO;
defaultConfig.s_PicoCDBuffers = 0; defaultConfig.s_PicoCDBuffers = 0;
defaultConfig.s_PicoSndFilterAlpha = 0x10000 * 60 / 100; defaultConfig.s_PicoSndFilterAlpha = 0x10000 * 60 / 100;
defaultConfig.confirm_save = EOPT_CONFIRM_SAVE; defaultConfig.confirm_save = EOPT_CONFIRM_SAVE;
@ -622,6 +623,7 @@ void emu_set_defconfig(void)
PicoIn.sndRate = currentConfig.s_PsndRate; PicoIn.sndRate = currentConfig.s_PsndRate;
PicoIn.regionOverride = currentConfig.s_PicoRegion; PicoIn.regionOverride = currentConfig.s_PicoRegion;
PicoIn.autoRgnOrder = currentConfig.s_PicoAutoRgnOrder; PicoIn.autoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
PicoIn.hwSelect = currentConfig.s_hwSelect;
PicoIn.sndFilterAlpha = currentConfig.s_PicoSndFilterAlpha; PicoIn.sndFilterAlpha = currentConfig.s_PicoSndFilterAlpha;
} }

View file

@ -72,6 +72,7 @@ typedef struct _currentConfig_t {
int s_PsndRate; int s_PsndRate;
int s_PicoRegion; int s_PicoRegion;
int s_PicoAutoRgnOrder; int s_PicoAutoRgnOrder;
int s_hwSelect;
int s_PicoCDBuffers; int s_PicoCDBuffers;
int s_PicoSndFilterAlpha; int s_PicoSndFilterAlpha;
int Frameskip; int Frameskip;

View file

@ -523,6 +523,29 @@ static int menu_loop_32x_options(int id, int keys)
#endif #endif
// ------------ SMS options menu ------------
#ifndef NO_SMS
static const char *sms_hardwares[] = { "auto", "Game Gear", "Master System", NULL };
static menu_entry e_menu_sms_options[] =
{
mee_enum ("System", MA_SMSOPT_HARDWARE, currentConfig.s_hwSelect, sms_hardwares ),
};
static int menu_loop_sms_options(int id, int keys)
{
static int sel = 0;
me_loop(e_menu_sms_options, &sel);
PicoIn.hwSelect = currentConfig.s_hwSelect;
return 0;
}
#endif
// ------------ adv options menu ------------ // ------------ adv options menu ------------
static const char h_ovrclk[] = "Will break some games, keep at 0"; static const char h_ovrclk[] = "Will break some games, keep at 0";
@ -828,6 +851,9 @@ static menu_entry e_menu_options[] =
mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options), mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options),
#ifndef NO_32X #ifndef NO_32X
mee_handler ("[32X options]", menu_loop_32x_options), mee_handler ("[32X options]", menu_loop_32x_options),
#endif
#ifndef NO_SMS
mee_handler ("[SMS options]", menu_loop_sms_options),
#endif #endif
mee_handler ("[Advanced options]", menu_loop_adv_options), mee_handler ("[Advanced options]", menu_loop_adv_options),
mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg), mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),
@ -1290,6 +1316,9 @@ static menu_entry *e_menu_table[] =
e_menu_cd_options, e_menu_cd_options,
#ifndef NO_32X #ifndef NO_32X
e_menu_32x_options, e_menu_32x_options,
#endif
#ifndef NO_SMS
e_menu_sms_options,
#endif #endif
e_menu_keyconfig, e_menu_keyconfig,
e_menu_hidden, e_menu_hidden,

View file

@ -87,6 +87,7 @@ typedef enum
MA_32XOPT_PWM, MA_32XOPT_PWM,
MA_32XOPT_MSH2_CYCLES, MA_32XOPT_MSH2_CYCLES,
MA_32XOPT_SSH2_CYCLES, MA_32XOPT_SSH2_CYCLES,
MA_SMSOPT_HARDWARE,
MA_CTRL_PLAYER1, MA_CTRL_PLAYER1,
MA_CTRL_PLAYER2, MA_CTRL_PLAYER2,
MA_CTRL_EMU, MA_CTRL_EMU,

View file

@ -1450,15 +1450,6 @@ static void update_variables(bool first_run)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
PicoSetInputDevice(1, input_name_to_val(var.value)); PicoSetInputDevice(1, input_name_to_val(var.value));
var.value = NULL;
var.key = "picodrive_sprlim";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "enabled") == 0)
PicoIn.opt |= POPT_DIS_SPRITE_LIM;
else
PicoIn.opt &= ~POPT_DIS_SPRITE_LIM;
}
var.value = NULL; var.value = NULL;
var.key = "picodrive_ramcart"; var.key = "picodrive_ramcart";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
@ -1468,6 +1459,17 @@ static void update_variables(bool first_run)
PicoIn.opt &= ~POPT_EN_MCD_RAMCART; PicoIn.opt &= ~POPT_EN_MCD_RAMCART;
} }
var.value = NULL;
var.key = "picodrive_smstype";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "Auto") == 0)
PicoIn.hwSelect = PHWS_AUTO;
else if (strcmp(var.value, "Game Gear") == 0)
PicoIn.hwSelect = PHWS_GG;
else
PicoIn.hwSelect = PHWS_SMS;
}
OldPicoRegionOverride = PicoIn.regionOverride; OldPicoRegionOverride = PicoIn.regionOverride;
var.value = NULL; var.value = NULL;
var.key = "picodrive_region"; var.key = "picodrive_region";
@ -1512,6 +1514,15 @@ static void update_variables(bool first_run)
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &av_info); environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &av_info);
} }
var.value = NULL;
var.key = "picodrive_sprlim";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "enabled") == 0)
PicoIn.opt |= POPT_DIS_SPRITE_LIM;
else
PicoIn.opt &= ~POPT_DIS_SPRITE_LIM;
}
old_show_overscan = show_overscan; old_show_overscan = show_overscan;
var.value = NULL; var.value = NULL;
var.key = "picodrive_overscan"; var.key = "picodrive_overscan";

View file

@ -74,9 +74,9 @@ struct retro_core_option_definition option_defs_us[] = {
"3 button pad" "3 button pad"
}, },
{ {
"picodrive_sprlim", "picodrive_ramcart",
"No sprite limit", "MegaCD RAM cart",
"Enable this to remove the sprite limit.", "Emulate a MegaCD RAM cart, used for save game data. WARNING: When enabled, internal save data (BRAM) will be discarded.",
{ {
{ "disabled", NULL }, { "disabled", NULL },
{ "enabled", NULL }, { "enabled", NULL },
@ -85,12 +85,13 @@ struct retro_core_option_definition option_defs_us[] = {
"disabled" "disabled"
}, },
{ {
"picodrive_ramcart", "picodrive_smstype",
"MegaCD RAM cart", "Master System type",
"Emulate a MegaCD RAM cart, used for save game data. WARNING: When enabled, internal save data (BRAM) will be discarded.", "Choose which type of system the core should emulate for Master system",
{ {
{ "disabled", NULL }, { "Auto", NULL },
{ "enabled", NULL }, { "Game Gear", NULL },
{ "Master System", NULL },
{ NULL, NULL }, { NULL, NULL },
}, },
"disabled" "disabled"
@ -121,6 +122,17 @@ struct retro_core_option_definition option_defs_us[] = {
}, },
"PAR" "PAR"
}, },
{
"picodrive_sprlim",
"No sprite limit",
"Enable this to remove the sprite limit.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{ {
"picodrive_overscan", "picodrive_overscan",
"Show Overscan", "Show Overscan",