Merge pull request #89 from negativeExponent/add_color_and_interframe_options
Add color and interframe options
This commit is contained in:
commit
2f1439c5bd
|
@ -59,3 +59,8 @@ SOURCES_CXX += \
|
|||
$(CORE_DIR)/gb/gbMemory.cpp \
|
||||
$(CORE_DIR)/gb/gbSGB.cpp \
|
||||
$(CORE_DIR)/gb/gbSound.cpp
|
||||
|
||||
# Filters
|
||||
SOURCES_CXX += \
|
||||
$(CORE_DIR)/filters/interframe.cpp \
|
||||
$(CORE_DIR)/gba/gbafilter.cpp
|
||||
|
|
|
@ -232,18 +232,26 @@ 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);
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
for (i = 0; i < 0x10000; i++)
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
break;
|
||||
case 16:
|
||||
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);
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal32(systemColorMap32, 0x10000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "../gb/gbSGB.h"
|
||||
#include "../gb/gbSound.h"
|
||||
|
||||
#include "../filters/interframe.hpp"
|
||||
|
||||
#define FRAMERATE (16777216.0 / 280896.0) // 59.73
|
||||
#define SAMPLERATE 32768.0
|
||||
|
||||
|
@ -56,6 +58,9 @@ 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;
|
||||
// filters
|
||||
static IFBFilterFunc ifb_filter_func = NULL;
|
||||
|
||||
static unsigned retropad_device[4] = {0};
|
||||
static unsigned systemWidth = gbaWidth;
|
||||
|
@ -66,7 +71,7 @@ static IMAGE_TYPE type = IMAGE_UNKNOWN;
|
|||
// global vars
|
||||
uint16_t systemColorMap16[0x10000];
|
||||
uint32_t systemColorMap32[0x10000];
|
||||
int RGB_LOW_BITS_MASK = 0;
|
||||
int RGB_LOW_BITS_MASK = 0x821; // used for 16bit inter-frame filters
|
||||
int systemRedShift = 0;
|
||||
int systemBlueShift = 0;
|
||||
int systemGreenShift = 0;
|
||||
|
@ -1211,6 +1216,40 @@ 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_interframeblending";
|
||||
var.value = NULL;
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
|
||||
if (!strcmp(var.value, "smart"))
|
||||
{
|
||||
if (systemColorDepth == 16)
|
||||
ifb_filter_func = SmartIB;
|
||||
else
|
||||
ifb_filter_func = SmartIB32;
|
||||
}
|
||||
else if (!strcmp(var.value, "motion blur"))
|
||||
{
|
||||
if (systemColorDepth == 16)
|
||||
ifb_filter_func = MotionBlurIB;
|
||||
else
|
||||
ifb_filter_func = MotionBlurIB32;
|
||||
}
|
||||
else
|
||||
ifb_filter_func = NULL;
|
||||
}
|
||||
else
|
||||
ifb_filter_func = NULL;
|
||||
|
||||
var.key = "vbam_show_advanced_options";
|
||||
var.value = NULL;
|
||||
|
||||
|
@ -1539,8 +1578,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) {
|
||||
|
@ -1701,6 +1740,8 @@ bool systemCanChangeSoundQuality(void)
|
|||
void systemDrawScreen(void)
|
||||
{
|
||||
unsigned pitch = systemWidth * (systemColorDepth >> 3);
|
||||
if (ifb_filter_func)
|
||||
ifb_filter_func(pix, pitch, systemWidth, systemHeight);
|
||||
video_cb(pix, systemWidth, systemHeight, pitch);
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,29 @@ struct retro_core_option_definition option_defs_us[] = {
|
|||
},
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"vbam_lcdfilter",
|
||||
"LCD Color Filter",
|
||||
"TODO:",
|
||||
{
|
||||
{ "disabled", NULL },
|
||||
{ "enabled", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"vbam_interframeblending",
|
||||
"Interframe Blending",
|
||||
"TODO:",
|
||||
{
|
||||
{ "disabled", NULL },
|
||||
{ "smart", NULL },
|
||||
{ "motion blur", NULL },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"vbam_turboenable",
|
||||
"Enable Turbo Buttons",
|
||||
|
|
Loading…
Reference in New Issue