From 55412d709367789ba85f33d661e3779c89a8a80c Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 15 Oct 2017 21:54:44 -0500 Subject: [PATCH] don't apply color correction for DMG --- libretro/libretro.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libretro/libretro.c b/libretro/libretro.c index 96942d67..ef1dc1fa 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -202,13 +202,6 @@ void retro_set_environment(retro_environment_t cb) { NULL, 0 }, }; cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports); - - static struct retro_variable vars[] = { - { "sameboy_color_correction_mode", "Color Correction; off|correct curves|emulate hardware|preserve brightness" }, - { "sameboy_high_pass_filter_mode", "High Pass Filter; off|accurate|remove dc offset" }, - }; - cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars); - } void retro_set_audio_sample(retro_audio_sample_t cb) @@ -246,7 +239,7 @@ static void check_variables(void) var.key = "sameboy_color_correction_mode"; var.value = NULL; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && GB_is_cgb(&gb)) { if (strcmp(var.value, "off") == 0) GB_set_color_correction_mode(&gb, GB_COLOR_CORRECTION_DISABLED); @@ -422,6 +415,21 @@ bool retro_load_game(const struct retro_game_info *info) else log_cb(RETRO_LOG_INFO, "Rumble environment not supported.\n"); + static struct retro_variable vars_cgb[] = { + { "sameboy_color_correction_mode", "Color Correction; off|correct curves|emulate hardware|preserve brightness" }, + { "sameboy_high_pass_filter_mode", "High Pass Filter; off|accurate|remove dc offset" }, + { NULL } + }; + + static struct retro_variable vars_dmg[] = { + { "sameboy_high_pass_filter_mode", "High Pass Filter; off|accurate|remove dc offset" }, + { NULL } + }; + + if (GB_is_cgb(&gb)) + environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, vars_cgb); + else + environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, vars_dmg); check_variables(); return true;