(Menu) Create two new types - MENU_FILE_SHADER and MENU_FILE_SHADER_PRESET

This commit is contained in:
twinaphex 2014-09-10 18:36:35 +02:00
parent 0eea8307a5
commit 3af183dfe3
4 changed files with 46 additions and 24 deletions

View File

@ -1425,30 +1425,6 @@ static int menu_action_ok(const char *menu_path,
menu_common_setting_set_current_string_path(setting, menu_path, path);
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
}
#ifdef HAVE_SHADER_MANAGER
else if (!strcmp(menu_label, "video_shader_preset"))
{
char shader_path[PATH_MAX];
fill_pathname_join(shader_path, menu_path, path, sizeof(shader_path));
if (driver.menu_ctx && driver.menu_ctx->backend &&
driver.menu_ctx->backend->shader_manager_set_preset)
driver.menu_ctx->backend->shader_manager_set_preset(
driver.menu->shader,
gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
shader_path);
menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
}
else if (!strcmp(menu_label, "video_shader_pass"))
{
fill_pathname_join(driver.menu->shader->pass[hack_shader_pass].source.path,
menu_path, path,
sizeof(driver.menu->shader->pass[hack_shader_pass].source.path));
/* This will reset any changed parameters. */
gfx_shader_resolve_parameters(NULL, driver.menu->shader);
menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
}
#endif
else if (!strcmp(menu_label, "configurations"))
{
char config[PATH_MAX];
@ -1475,6 +1451,34 @@ static int menu_action_ok(const char *menu_path,
return 0;
case MENU_FILE_SHADER_PRESET:
#ifdef HAVE_SHADER_MANAGER
{
char shader_path[PATH_MAX];
fill_pathname_join(shader_path, menu_path, path, sizeof(shader_path));
if (driver.menu_ctx && driver.menu_ctx->backend &&
driver.menu_ctx->backend->shader_manager_set_preset)
driver.menu_ctx->backend->shader_manager_set_preset(
driver.menu->shader,
gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
shader_path);
menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
}
#endif
return 0;
case MENU_FILE_SHADER:
#ifdef HAVE_SHADER_MANAGER
fill_pathname_join(driver.menu->shader->pass[hack_shader_pass].source.path,
menu_path, path,
sizeof(driver.menu->shader->pass[hack_shader_pass].source.path));
/* This will reset any changed parameters. */
gfx_shader_resolve_parameters(NULL, driver.menu->shader);
menu_flush_stack_label(driver.menu->menu_stack, "Shader Options");
#endif
return 0;
case MENU_FILE_CORE:
if (!strcmp(menu_label, "deferred_core_list"))

View File

@ -167,6 +167,16 @@ static void disp_set_label(unsigned *w, unsigned type, unsigned i,
strlcpy(type_str, "(CFILE)", type_str_size);
*w = 7;
}
else if (type == MENU_FILE_SHADER_PRESET)
{
strlcpy(type_str, "(PRESET)", type_str_size);
*w = 8;
}
else if (type == MENU_FILE_SHADER)
{
strlcpy(type_str, "(SHADER)", type_str_size);
*w = 8;
}
else if (type >= MENU_SETTINGS_CORE_OPTION_START)
strlcpy(
type_str,

View File

@ -64,6 +64,8 @@ typedef enum
MENU_FILE_LINEFEED_SWITCH,
MENU_FILE_CORE,
MENU_FILE_PLAYLIST_ENTRY,
MENU_FILE_SHADER_PRESET,
MENU_FILE_SHADER,
MENU_FILE_USE_DIRECTORY,
MENU_FILE_SWITCH,
MENU_FILE_CARCHIVE,

View File

@ -672,9 +672,15 @@ int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list)
else if (!strcmp(label, "configurations"))
exts = "cfg";
else if (!strcmp(label, "video_shader_preset"))
{
exts = "cgp|glslp";
default_type_plain = MENU_FILE_SHADER_PRESET;
}
else if (!strcmp(label, "video_shader_pass"))
{
exts = "cg|glsl";
default_type_plain = MENU_FILE_SHADER;
}
else if (!strcmp(label, "video_filter"))
exts = "filt";
else if (!strcmp(label, "audio_dsp_plugin"))