diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 910c5d36db..3a6558609f 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -88,35 +88,6 @@ static int menu_info_screen_iterate(unsigned action) { switch (info_type) { - case MENU_SETTINGS_SHADER_PRESET: - snprintf(msg, sizeof(msg), - " -- Load Shader Preset. \n" - " \n" - " Load a " -#ifdef HAVE_CG - "Cg" -#endif -#ifdef HAVE_GLSL -#ifdef HAVE_CG - "/" -#endif - "GLSL" -#endif -#ifdef HAVE_HLSL -#if defined(HAVE_CG) || defined(HAVE_HLSL) - "/" -#endif - "HLSL" -#endif - " preset directly. \n" - "The menu shader menu is updated accordingly. \n" - " \n" - "If the CGP uses scaling methods which are not \n" - "simple, (i.e. source scaling, same scaling \n" - "factor for X/Y), the scaling factor displayed \n" - "in the menu might not be correct." - ); - break; case MENU_SETTINGS_SHADER_PASSES: snprintf(msg, sizeof(msg), " -- Shader Passes. \n" @@ -1352,8 +1323,9 @@ static int menu_setting_toggle(unsigned type, { struct retro_perf_counter **counters = NULL; - if ((type >= MENU_SETTINGS_SHADER_FILTER) && - (type <= MENU_SETTINGS_SHADER_LAST)) + if ((!strcmp(label, "video_shader_preset")) || + ((type >= MENU_SETTINGS_SHADER_FILTER) && + (type <= MENU_SETTINGS_SHADER_LAST))) { if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_setting_toggle) @@ -2332,7 +2304,6 @@ static void menu_common_setting_set_label(char *type_str, break; #endif case MENU_SETTINGS_CUSTOM_VIEWPORT: - case MENU_SETTINGS_SHADER_PRESET: case MENU_SETTINGS_CUSTOM_BIND_ALL: case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL: strlcpy(type_str, "...", type_str_size); diff --git a/frontend/menu/backend/menu_common_shader_backend.c b/frontend/menu/backend/menu_common_shader_backend.c index d329c96636..34d6226f1b 100644 --- a/frontend/menu/backend/menu_common_shader_backend.c +++ b/frontend/menu/backend/menu_common_shader_backend.c @@ -324,6 +324,8 @@ static int menu_common_shader_manager_setting_toggle( unsigned dist_filter = id - MENU_SETTINGS_SHADER_0_FILTER; unsigned dist_scale = id - MENU_SETTINGS_SHADER_0_SCALE; + RARCH_LOG("shader label: %s\n", label); + if (id == MENU_SETTINGS_SHADER_FILTER) { if ((current_setting = setting_data_find_setting( @@ -370,13 +372,13 @@ static int menu_common_shader_manager_setting_toggle( else if (!strcmp(label, "shader_apply_changes") || id == MENU_SETTINGS_SHADER_PASSES) menu_setting_set(id, action); - else if (((dist_shader % 3) == 0 || id == MENU_SETTINGS_SHADER_PRESET)) + else if (!strcmp(label, "video_shader_preset")) { struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader; struct gfx_shader_pass *pass = NULL; dist_shader /= 3; - if (shader && id == MENU_SETTINGS_SHADER_PRESET) + if (shader) pass = &shader->pass[dist_shader]; switch (action) @@ -384,8 +386,7 @@ static int menu_common_shader_manager_setting_toggle( case MENU_ACTION_OK: menu_entries_push(driver.menu->menu_stack, g_settings.video.shader_dir, - (id == MENU_SETTINGS_SHADER_PRESET) ? - "video_shader_preset" : "video_shader_pass", + "video_shader_preset", id, driver.menu->selection_ptr); break; @@ -398,6 +399,28 @@ static int menu_common_shader_manager_setting_toggle( break; } } + else if ((dist_shader % 3) == 0) + { + struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader; + + dist_shader /= 3; + + switch (action) + { + case MENU_ACTION_OK: + menu_entries_push(driver.menu->menu_stack, + g_settings.video.shader_dir, + "video_shader_pass", + id, driver.menu->selection_ptr); + break; + + case MENU_ACTION_START: + break; + + default: + break; + } + } else if ((dist_filter % 3) == 0) { dist_filter /= 3; diff --git a/frontend/menu/disp/rgui.c b/frontend/menu/disp/rgui.c index 47e48d5e4d..4012bab5da 100644 --- a/frontend/menu/disp/rgui.c +++ b/frontend/menu/disp/rgui.c @@ -363,7 +363,6 @@ static void rgui_render(void) type <= MENU_SETTINGS_SHADER_LAST) { if ( - type == MENU_SETTINGS_SHADER_PRESET || type == MENU_SETTINGS_SHADER_PARAMETERS || type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS) strlcpy(type_str, "...", sizeof(type_str)); diff --git a/frontend/menu/disp/rmenu.c b/frontend/menu/disp/rmenu.c index 8c3942cbaf..fc85e2b4ef 100644 --- a/frontend/menu/disp/rmenu.c +++ b/frontend/menu/disp/rmenu.c @@ -232,7 +232,6 @@ static void rmenu_render(void) type <= MENU_SETTINGS_SHADER_LAST) { if ( - type == MENU_SETTINGS_SHADER_PRESET || type == MENU_SETTINGS_SHADER_PARAMETERS || type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS) strlcpy(type_str, "...", sizeof(type_str)); diff --git a/frontend/menu/disp/rmenu_xui.cpp b/frontend/menu/disp/rmenu_xui.cpp index 473fec25c6..fca46ce463 100644 --- a/frontend/menu/disp/rmenu_xui.cpp +++ b/frontend/menu/disp/rmenu_xui.cpp @@ -442,9 +442,7 @@ static void rmenu_xui_render(void) if (type >= MENU_SETTINGS_SHADER_FILTER && type <= MENU_SETTINGS_SHADER_LAST) { - if (type == MENU_SETTINGS_SHADER_PRESET) - strlcpy(type_str, "...", sizeof(type_str)); - else if (type == MENU_SETTINGS_SHADER_FILTER) + if (type == MENU_SETTINGS_SHADER_FILTER) snprintf(type_str, sizeof(type_str), "%s", g_settings.video.smooth ? "Linear" : "Nearest"); else if (driver.menu_ctx && driver.menu_ctx->backend diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 8e36fb3c8a..6507152a4a 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -664,7 +664,7 @@ unsigned menu_common_type_is(const char *label, unsigned type) type >= MENU_SETTINGS_SHADER_0 && type <= MENU_SETTINGS_SHADER_LAST && (((type - MENU_SETTINGS_SHADER_0) % 3) == 0)) || - type == MENU_SETTINGS_SHADER_PRESET) + !strcmp(label, "video_shader_preset")) return MENU_SETTINGS_SHADER_OPTIONS; if ( diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index c0a794a4f5..9712396450 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -91,7 +91,6 @@ typedef enum MENU_SETTINGS_CUSTOM_VIEWPORT, MENU_SETTINGS_SHADER_OPTIONS, MENU_SETTINGS_SHADER_FILTER, - MENU_SETTINGS_SHADER_PRESET, MENU_SETTINGS_SHADER_PARAMETERS, // Modifies current shader directly. Will not get saved to CGP. MENU_SETTINGS_SHADER_PRESET_PARAMETERS, // Modifies shader preset currently in menu. MENU_SETTINGS_SHADER_PASSES, diff --git a/frontend/menu/menu_entries.c b/frontend/menu/menu_entries.c index e4ad0384b6..d3d94d005b 100644 --- a/frontend/menu/menu_entries.c +++ b/frontend/menu/menu_entries.c @@ -491,8 +491,8 @@ int menu_entries_push_list(menu_handle_t *menu, MENU_FILE_SWITCH, 0); file_list_push(list, "Default Filter", "", MENU_SETTINGS_SHADER_FILTER, 0); - file_list_push(list, "Load Shader Preset", "", - MENU_SETTINGS_SHADER_PRESET, 0); + file_list_push(list, "Load Shader Preset", "video_shader_preset", + MENU_FILE_SWITCH, 0); file_list_push(list, "Shader Preset Save As", "video_shader_preset_save_as", MENU_FILE_SWITCH, 0); file_list_push(list, "Parameters (Current)", "", @@ -565,7 +565,7 @@ int menu_entries_push_list(menu_handle_t *menu, int menu_parse_check(const char *label, unsigned menu_type) { -#if 0 +#if 1 RARCH_LOG("label is menu_parse_check: %s\n", label); #endif if (!((menu_type == MENU_FILE_DIRECTORY || @@ -883,6 +883,36 @@ int menu_entries_get_description(const char *label, return 0; } - + else if (!strcmp(label, "video_shader_preset")) + { + snprintf(msg, sizeof_msg, + " -- Load Shader Preset. \n" + " \n" + " Load a " +#ifdef HAVE_CG + "Cg" +#endif +#ifdef HAVE_GLSL +#ifdef HAVE_CG + "/" +#endif + "GLSL" +#endif +#ifdef HAVE_HLSL +#if defined(HAVE_CG) || defined(HAVE_HLSL) + "/" +#endif + "HLSL" +#endif + " preset directly. \n" + "The menu shader menu is updated accordingly. \n" + " \n" + "If the CGP uses scaling methods which are not \n" + "simple, (i.e. source scaling, same scaling \n" + "factor for X/Y), the scaling factor displayed \n" + "in the menu might not be correct." + ); + return 0; + } return -1; }