diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 2f40e45bfc..ed9f1fc7da 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -1806,10 +1806,8 @@ void menu_populate_entries(void *data, unsigned menu_type) file_list_push(rgui->selection_buf, "Default Filter", RGUI_SETTINGS_SHADER_FILTER, 0); file_list_push(rgui->selection_buf, "Load Shader Preset", RGUI_SETTINGS_SHADER_PRESET, 0); -#ifdef HAVE_OSK - file_list_push(rgui->selection_buf, "Save Shader Preset", + file_list_push(rgui->selection_buf, "Save As Shader Preset", RGUI_SETTINGS_SHADER_PRESET_SAVE, 0); -#endif file_list_push(rgui->selection_buf, "Shader Passes", RGUI_SETTINGS_SHADER_PASSES, 0); diff --git a/frontend/menu/menu_settings.c b/frontend/menu/menu_settings.c index 388fcf7326..f37ba5346b 100644 --- a/frontend/menu/menu_settings.c +++ b/frontend/menu/menu_settings.c @@ -405,6 +405,30 @@ static bool osk_callback_enter_filename_init(void *data) #endif +static void preset_filename_callback(void *userdata, const char *str) +{ + rgui_handle_t *rgui = (rgui_handle_t*)userdata; + + if (str && *str) + { + char filepath[PATH_MAX]; + + fill_pathname_join(filepath, g_settings.video.shader_dir, str, sizeof(filepath)); + strlcat(filepath, ".cgp", sizeof(filepath)); + config_file_t *conf = config_file_new(NULL); + if (conf) + { + gfx_shader_write_conf_cgp(conf, &rgui->shader); + config_file_write(conf, filepath); + config_file_free(conf); + } + } + rgui->keyboard.display = false; + rgui->keyboard.label = NULL; + rgui->old_input_state = -1ULL; // Avoid triggering states on pressing return. + g_extern.system.key_event = menu_key_event; +} + #ifdef HAVE_NETPLAY static void netplay_port_callback(void *userdata, const char *str) { @@ -1739,6 +1763,10 @@ int menu_set_settings(void *data, unsigned setting, unsigned action) else #endif { + g_extern.system.key_event = NULL; + rgui->keyboard.display = true; + rgui->keyboard.label = "Preset Filename: "; + rgui->keyboard.buffer = input_keyboard_start_line(rgui, preset_filename_callback); } } break;