Minimize core options shown by default

- This creates 2 new advance core options to minimize the number of core options shown
-- Advance System Options contains:
--- Overclock
--- RAM power on state
--- no-sprite limit
--- simultaneous opposing direction press
--- zapper crosshairs
-- Advance Sound Options contains:
--- Master volume
--- Sound quality
--- on/off for NES' 5-channel apu
- This also re-arranges the core options when advance options are shown, system options on top,
  gfx/palette/geometry options next, input etc.
This commit is contained in:
negativeExponent
2020-02-15 11:23:07 +08:00
parent 6824376738
commit 1c94704512
2 changed files with 168 additions and 90 deletions

View File

@@ -103,6 +103,8 @@ unsigned dendy = 0;
static unsigned systemRegion = 0;
static unsigned opt_region = 0;
static unsigned opt_showAdvSoundOptions = 0;
static unsigned opt_showAdvSystemOptions = 0;
int FCEUnetplay;
#ifdef PSP
@@ -1010,11 +1012,11 @@ static const keymap turbomap[] = {
static void set_apu_channels(int chan)
{
FSettings.SquareVolume[1] = 256 * ((chan >> 0) & 1);
FSettings.SquareVolume[0] = 256 * ((chan >> 1) & 1);
FSettings.TriangleVolume = 256 * ((chan >> 2) & 1);
FSettings.NoiseVolume = 256 * ((chan >> 3) & 1);
FSettings.PCMVolume = 256 * ((chan >> 4) & 1);
FSettings.SquareVolume[1] = (chan & 1) ? 256 : 0;
FSettings.SquareVolume[0] = (chan & 2) ? 256 : 0;
FSettings.TriangleVolume = (chan & 3) ? 256 : 0;
FSettings.NoiseVolume = (chan & 4) ? 256 : 0;
FSettings.PCMVolume = (chan & 5) ? 256 : 0;
}
static void check_variables(bool startup)
@@ -1301,10 +1303,9 @@ static void check_variables(bool startup)
}
}
#ifdef DEBUG
var.key = key;
enable_apu = 0;
enable_apu = 0xff;
strcpy(key, "fceumm_apu_x");
for (i = 0; i < 5; i++)
@@ -1313,15 +1314,73 @@ static void check_variables(bool startup)
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp(var.value, "disabled"))
{
enable_apu |= (1 << i);
enable_apu &= ~(1 << i);
}
}
set_apu_channels(enable_apu ^ 0xff);
#else
set_apu_channels(0xff);
#endif
set_apu_channels(enable_apu);
update_dipswitch();
var.key = "fceumm_show_adv_system_options";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
unsigned newval = (!strcmp(var.value, "enabled")) ? 1 : 0;
if ((opt_showAdvSystemOptions != newval) || startup)
{
opt_showAdvSystemOptions = newval;
struct retro_core_option_display option_display;
unsigned i;
unsigned size;
char options_list[][25] = {
"fceumm_overclocking",
"fceumm_ramstate",
"fceumm_nospritelimit",
"fceumm_up_down_allowed",
"fceumm_show_crosshair"
};
option_display.visible = opt_showAdvSystemOptions;
size = sizeof(options_list) / sizeof(options_list[0]);
for (i = 0; i < size; i++)
{
option_display.key = options_list[i];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
}
}
var.key = "fceumm_show_adv_sound_options";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
unsigned newval = (!strcmp(var.value, "enabled")) ? 1 : 0;
if ((opt_showAdvSoundOptions != newval) || startup)
{
opt_showAdvSoundOptions = newval;
struct retro_core_option_display option_display;
unsigned i;
unsigned size;
char options_list[][25] = {
"fceumm_sndvolume",
"fceumm_sndquality",
"fceumm_swapduty",
"fceumm_apu_1",
"fceumm_apu_2",
"fceumm_apu_3",
"fceumm_apu_4",
"fceumm_apu_5"
};
option_display.visible = opt_showAdvSoundOptions;
size = sizeof(options_list) / sizeof(options_list[0]);
for (i = 0; i < size; i++)
{
option_display.key = options_list[i];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
}
}
}
static int mzx = 0, mzy = 0;

View File

@@ -31,7 +31,7 @@ extern "C" {
struct retro_core_option_definition option_defs_common[] = {
{
"fceumm_region",
"Region Override",
"Region",
"Force core to use NTSC, PAL or Dendy region timings.",
{
{ "Auto", NULL },
@@ -43,15 +43,39 @@ struct retro_core_option_definition option_defs_common[] = {
"Auto",
},
{
"fceumm_aspect",
"Preferred aspect ratio",
"Choose preferred aspect ratio.",
"fceumm_overclocking",
"Overclock",
"Enables or disables overclocking which can reduce slowdowns in some games. Postrender method is more compatible with every game with Vblank more effective for games like Contra Force.",
{
{ "8:7 PAR", NULL },
{ "4:3", NULL },
{ "disabled", NULL },
{ "2x-Postrender", NULL },
{ "2x-VBlank", NULL },
{ NULL, NULL},
},
"8:7 PAR",
"disabled",
},
{
"fceumm_ramstate",
"RAM Power-On Fill (Needs Restart)",
"Choose RAM startup during power up. Some games rely on initial ram values for random generator as an example.",
{
{ "fill $ff", "$FF" },
{ "fill $00", "$00" },
{ "random", "random" },
{ NULL, NULL},
},
"fill $ff",
},
{
"fceumm_nospritelimit",
"No Sprite Limit",
"Removes the 8-per-scanline hardware limit. This reduces sprite flickering but can cause some games to glitch since some use this for effects.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled",
},
{
"fceumm_palette",
@@ -82,17 +106,16 @@ struct retro_core_option_definition option_defs_common[] = {
"default",
},
{
"fceumm_up_down_allowed",
"Allow Opposing Directions",
"Allows simultaneous UP+DOWN or LEFT+RIGHT button combinations which can create different effects in some games.",
"fceumm_aspect",
"Aspect Ratio",
"Choose preferred aspect ratio.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ "8:7 PAR", NULL },
{ "4:3", NULL },
{ NULL, NULL},
},
"disabled",
"8:7 PAR",
},
#ifdef PSP
{
"fceumm_overscan",
@@ -108,7 +131,7 @@ struct retro_core_option_definition option_defs_common[] = {
#else
{
"fceumm_overscan_h",
"Crop Overscan (Horizontal)",
"Crop Horizontal Overscan",
"Removes 8 pixel from left and right side of the screen to simulate overscan seen on standard CRT television.",
{
{ "disabled", NULL },
@@ -119,7 +142,7 @@ struct retro_core_option_definition option_defs_common[] = {
},
{
"fceumm_overscan_v",
"Crop Overscan (Vertical)",
"Crop Vertical Overscan",
"Removes 8 pixel from the top and bottom of the screen to simulate overscan seen on standard CRT television.",
{
{ "disabled", NULL },
@@ -128,54 +151,11 @@ struct retro_core_option_definition option_defs_common[] = {
},
"enabled",
},
#endif
#endif /* overscan options */
{
"fceumm_nospritelimit",
"No Sprite Limit",
"Removes the 8-per-scanline hardware limit. This reduces sprite flickering but can cause some games to glitch since some use this for effects.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled",
},
{
"fceumm_sndvolume",
"Sound Volume",
"Change master volume level",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL},
},
"7",
},
{
"fceumm_sndquality",
"Sound Quality",
"Enable higher quality sounds in exchange for more processing power required",
{
{ "Low", NULL },
{ "High", NULL },
{ "Very High", NULL },
{ NULL, NULL},
},
"Low",
},
{
"fceumm_swapduty",
"Swap Duty Cycles",
"Simulates the sound from famiclones has the pulse wave channels duty cycle bits reversed.",
"fceumm_up_down_allowed",
"Allow Opposing Directions",
"Allows simultaneous UP+DOWN or LEFT+RIGHT button combinations which can create different effects in some games.",
{
{ "disabled", NULL },
{ "enabled", NULL },
@@ -237,30 +217,48 @@ struct retro_core_option_definition option_defs_common[] = {
"enabled",
},
{
"fceumm_overclocking",
"Overclocking",
"Enables or disables overclocking which can reduce slowdowns in some games. Postrender method is more compatible with every game with Vblank more effective for games like Contra Force.",
"fceumm_sndquality",
"Sound Quality",
"Enable higher quality sounds in exchange for more processing power required",
{
{ "disabled", NULL },
{ "2x-Postrender", NULL },
{ "2x-VBlank", NULL },
{ "Low", NULL },
{ "High", NULL },
{ "Very High", NULL },
{ NULL, NULL},
},
"Low",
},
{
"fceumm_swapduty",
"Swap Duty Cycles",
"Simulates the sound from famiclones has the pulse wave channels duty cycle bits reversed.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled",
},
{
"fceumm_ramstate",
"RAM power up state (Restart)",
"Choose RAM startup during power up. Some games rely on initial ram values for random generator as an example.",
"fceumm_sndvolume",
"Master Volume",
"Change master volume level",
{
{ "fill $ff", NULL },
{ "fill $00", NULL },
{ "random", NULL },
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL},
},
"fill $ff",
"7",
},
#ifdef DEBUG
{
"fceumm_apu_1",
"Channel 1 (Square 1)",
@@ -316,7 +314,28 @@ struct retro_core_option_definition option_defs_common[] = {
},
"enabled",
},
#endif
{
"fceumm_show_adv_system_options",
"Show Advanced System Options",
"Show advanced system options and tweaks.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"fceumm_show_adv_sound_options",
"Show Advanced Sound Options",
"Show advanced sound options and tweaks.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{ NULL, NULL, NULL, { {0} }, NULL },
};