diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 87e0aec0f8..dc23592203 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -163,13 +163,13 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type) #ifdef HW_RVL file_list_push(menu->selection_buf, "VI Trap filtering", "", MENU_SETTINGS_VIDEO_SOFT_FILTER, 0); #endif -#if defined(HW_RVL) || defined(_XBOX360) - file_list_push(menu->selection_buf, "Gamma", "", MENU_SETTINGS_VIDEO_GAMMA, 0); -#endif + if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "video_gamma"))) + file_list_push(menu->selection_buf, "", "video_gamma", MENU_SETTINGS_VIDEO_GAMMA, 0); #ifdef _XBOX1 file_list_push(menu->selection_buf, "Soft filtering", "", MENU_SETTINGS_SOFT_DISPLAY_FILTER, 0); - file_list_push(menu->selection_buf, "Flicker filtering", "", MENU_SETTINGS_FLICKER_FILTER, 0); #endif + if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "video_filter_flicker"))) + file_list_push(menu->selection_buf, "", "video_filter_flicker", MENU_SETTINGS_FLICKER_FILTER, 0); file_list_push(menu->selection_buf, "", "video_scale_integer", MENU_SETTINGS_VIDEO_INTEGER_SCALE, 0); file_list_push(menu->selection_buf, "", "aspect_ratio_index", MENU_SETTINGS_VIDEO_ASPECT_RATIO, 0); file_list_push(menu->selection_buf, "Custom Ratio", "", MENU_SETTINGS_CUSTOM_VIEWPORT, 0); @@ -2774,8 +2774,8 @@ static int menu_common_shader_manager_setting_toggle(unsigned id, menu_common_setting_push_current_menu(driver.menu->menu_stack, "", id, driver.menu->selection_ptr, action); else if (id >= MENU_SETTINGS_SHADER_PARAMETER_0 && id <= MENU_SETTINGS_SHADER_PARAMETER_LAST) { - struct gfx_shader *shader; - struct gfx_shader_parameter *param; + struct gfx_shader *shader = NULL; + struct gfx_shader_parameter *param = NULL; if (!(shader = (struct gfx_shader*)driver.menu->parameter_shader)) return 0; @@ -2950,8 +2950,6 @@ static int menu_common_core_setting_toggle(unsigned setting, unsigned action) } #ifdef GEKKO -#define MAX_GAMMA_SETTING 2 - static unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = { { 512, 192 }, { 598, 200 }, @@ -2994,8 +2992,6 @@ static unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = { }; static unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480; -#else -#define MAX_GAMMA_SETTING 1 #endif @@ -3560,35 +3556,6 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t find_next_menu_driver(); break; #endif - case MENU_SETTINGS_VIDEO_GAMMA: - if (action == MENU_ACTION_START) - { - g_extern.console.screen.gamma_correction = 0; - if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) - driver.video_poke->apply_state_changes(driver.video_data); - } - else if (action == MENU_ACTION_LEFT) - { - if (g_extern.console.screen.gamma_correction > 0) - { - g_extern.console.screen.gamma_correction--; - if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) - driver.video_poke->apply_state_changes(driver.video_data); - } - } - else if (action == MENU_ACTION_RIGHT) - { - if (g_extern.console.screen.gamma_correction < MAX_GAMMA_SETTING) - { - g_extern.console.screen.gamma_correction++; - if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) - driver.video_poke->apply_state_changes(driver.video_data); - } - } - break; - - - #if defined(GEKKO) case MENU_SETTINGS_VIDEO_RESOLUTION: if (action == MENU_ACTION_LEFT) @@ -3799,22 +3766,6 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t break; #endif #ifdef _XBOX1 - case MENU_SETTINGS_FLICKER_FILTER: - switch (action) - { - case MENU_ACTION_LEFT: - if (g_extern.console.screen.flicker_filter_index > 0) - g_extern.console.screen.flicker_filter_index--; - break; - case MENU_ACTION_RIGHT: - if (g_extern.console.screen.flicker_filter_index < 5) - g_extern.console.screen.flicker_filter_index++; - break; - case MENU_ACTION_START: - g_extern.console.screen.flicker_filter_index = 0; - break; - } - break; case MENU_SETTINGS_SOFT_DISPLAY_FILTER: switch (action) { diff --git a/settings_data.c b/settings_data.c index 15d5261dfe..6f178af064 100644 --- a/settings_data.c +++ b/settings_data.c @@ -869,6 +869,8 @@ static void general_read_handler(const void *data) *setting->value.boolean = g_settings.video.fullscreen; else if (!strcmp(setting->name, "video_rotation")) *setting->value.unsigned_integer = g_settings.video.rotation; + else if (!strcmp(setting->name, "video_gamma")) + *setting->value.unsigned_integer = g_extern.console.screen.gamma_correction; else if (!strcmp(setting->name, "video_threaded")) *setting->value.boolean = g_settings.video.threaded; else if (!strcmp(setting->name, "video_swap_interval")) @@ -1045,6 +1047,8 @@ static void general_read_handler(const void *data) strlcpy(setting->value.string, g_settings.content_history_path, setting->size); else if (!strcmp(setting->name, "video_filter_dir")) strlcpy(setting->value.string, g_settings.video.filter_dir, setting->size); + else if (!strcmp(setting->name, "video_filter_flicker")) + *setting->value.unsigned_integer = g_extern.console.screen.flicker_filter_index; else if (!strcmp(setting->name, "audio_filter_dir")) strlcpy(setting->value.string, g_settings.audio.filter_dir, setting->size); else if (!strcmp(setting->name, "video_shader_dir")) @@ -1148,6 +1152,12 @@ static void general_write_handler(const void *data) if (driver.video && driver.video->set_rotation) driver.video->set_rotation(driver.video_data, (g_settings.video.rotation + g_extern.system.rotation) % 4); } + else if (!strcmp(setting->name, "video_gamma")) + { + g_extern.console.screen.gamma_correction = *setting->value.unsigned_integer; + if (driver.video_data && driver.video_poke && driver.video_poke->apply_state_changes) + driver.video_poke->apply_state_changes(driver.video_data); + } else if (!strcmp(setting->name, "video_threaded")) { g_settings.video.threaded = *setting->value.boolean; @@ -1391,6 +1401,8 @@ static void general_write_handler(const void *data) strlcpy(g_settings.video.filter_path, setting->value.string, sizeof(g_settings.video.filter_path)); rarch_cmd = RARCH_CMD_REINIT; } + else if (!strcmp(setting->name, "video_filter_flicker")) + g_extern.console.screen.flicker_filter_index = *setting->value.unsigned_integer; else if (!strcmp(setting->name, "camera_allow")) g_settings.camera.allow = *setting->value.boolean; else if (!strcmp(setting->name, "location_allow")) @@ -1464,6 +1476,12 @@ WITH_FLAGS(SD_FLAG_HAS_RANGE) #define WITH_VALUES(VALUES) (list[index -1]).values = VALUES; +#ifdef GEKKO +#define MAX_GAMMA_SETTING 2 +#else +#define MAX_GAMMA_SETTING 1 +#endif + rarch_setting_t* setting_data_get_list(void) { int i, player, index; @@ -1590,6 +1608,9 @@ rarch_setting_t* setting_data_get_list(void) #endif CONFIG_BOOL(g_settings.video.smooth, "video_smooth", "Use Bilinear Filtering", video_smooth, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_UINT(g_settings.video.rotation, "video_rotation", "Rotation", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 3, 1, true, true) +#if defined(HW_RVL) || defined(_XBOX360) + CONFIG_UINT(g_extern.console.screen.gamma_correction, "video_gamma", "Gamma", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, MAX_GAMMA_SETTING, 1, true, true) +#endif END_SUB_GROUP() @@ -1614,6 +1635,9 @@ rarch_setting_t* setting_data_get_list(void) CONFIG_BOOL(g_settings.video.crop_overscan, "video_crop_overscan", "Crop Overscan (reload)", crop_overscan, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) #ifndef HAVE_FILTERS_BUILTIN CONFIG_PATH(g_settings.video.filter_path, "video_filter", "Software filter", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) +#endif +#ifdef _XBOX1 + CONFIG_UINT(g_settings.video.swap_interval, "video_filter_flicker", "Flicker filter", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 5, 1, true, true) #endif END_SUB_GROUP()