Add LCD Color Filter core options

This commit is contained in:
negativeExponent 2020-08-12 07:43:21 +08:00
parent 364a182968
commit 54399dffea
4 changed files with 46 additions and 12 deletions

View File

@ -59,3 +59,7 @@ SOURCES_CXX += \
$(CORE_DIR)/gb/gbMemory.cpp \
$(CORE_DIR)/gb/gbSGB.cpp \
$(CORE_DIR)/gb/gbSound.cpp
# Filters
SOURCES_CXX += \
$(CORE_DIR)/gba/gbafilter.cpp

View File

@ -232,17 +232,25 @@ void utilUpdateSystemColorMaps(bool lcd)
{
int i = 0;
(void)lcd;
switch (systemColorDepth) {
case 16:
for (i = 0; i < 0x10000; i++)
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x7c00) >> 10) << systemBlueShift);
for (i = 0; i < 0x10000; i++) {
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd)
gbafilter_pal(systemColorMap16, 0x10000);
break;
case 24:
case 32:
for (i = 0; i < 0x10000; i++)
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x7c00) >> 10) << systemBlueShift);
for (i = 0; i < 0x10000; i++) {
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd)
gbafilter_pal32(systemColorMap32, 0x10000);
break;
}
}

View File

@ -56,6 +56,7 @@ static bool option_forceRTCenable = false;
static bool option_showAdvancedOptions = false;
static double option_sndFiltering = 0.5;
static unsigned option_gbPalette = 0;
static bool option_lcdfilter = false;
static unsigned retropad_device[4] = {0};
static unsigned systemWidth = gbaWidth;
@ -1211,6 +1212,16 @@ static void update_variables(bool startup)
gbColorOption = (!strcmp(var.value, "enabled")) ? 1 : 0;
}
var.key = "vbam_lcdfilter";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
bool prev_lcdfilter = option_lcdfilter;
option_lcdfilter = (!strcmp(var.value, "enabled")) ? true : false;
if (prev_lcdfilter != option_lcdfilter)
utilUpdateSystemColorMaps(option_lcdfilter);
}
var.key = "vbam_show_advanced_options";
var.value = NULL;
@ -1539,8 +1550,8 @@ bool retro_load_game(const struct retro_game_info *game)
return false;
}
utilUpdateSystemColorMaps(option_lcdfilter);
update_variables(true);
utilUpdateSystemColorMaps(false);
soundInit();
if (type == IMAGE_GBA) {

View File

@ -189,6 +189,17 @@ struct retro_core_option_definition option_defs_us[] = {
},
"disabled"
},
{
"vbam_lcdfilter",
"LCD Color Filter",
"TODO:",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_turboenable",
"Enable Turbo Buttons",