mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 18:50:29 +00:00
(Menu) Refactor hardcoded APPLY_SHADER_CHANGES enum
This commit is contained in:
parent
8600b6dd8c
commit
a03d1475f9
@ -139,7 +139,7 @@ typedef struct menu_ctx_driver_backend
|
||||
void (*shader_manager_set_preset)(struct gfx_shader *, unsigned, const char*);
|
||||
void (*shader_manager_save_preset)(const char *, bool);
|
||||
unsigned (*shader_manager_get_type)(const struct gfx_shader *);
|
||||
int (*shader_manager_setting_toggle)(unsigned, unsigned);
|
||||
int (*shader_manager_setting_toggle)(unsigned, const char *, unsigned);
|
||||
unsigned (*type_is)(unsigned);
|
||||
void (*setting_set_label)(char *, size_t, unsigned *, unsigned,unsigned);
|
||||
const char *ident;
|
||||
|
@ -114,6 +114,7 @@ static int menu_info_screen_iterate(unsigned action)
|
||||
"in the menu might not be correct."
|
||||
);
|
||||
break;
|
||||
#if 0
|
||||
case MENU_SETTINGS_SHADER_APPLY:
|
||||
snprintf(msg, sizeof(msg),
|
||||
" -- Apply Shader Changes. \n"
|
||||
@ -132,6 +133,7 @@ static int menu_info_screen_iterate(unsigned action)
|
||||
"saved to Shader Directory."
|
||||
);
|
||||
break;
|
||||
#endif
|
||||
case MENU_SETTINGS_SHADER_PASSES:
|
||||
snprintf(msg, sizeof(msg),
|
||||
" -- Shader Passes. \n"
|
||||
@ -1188,9 +1190,8 @@ static int menu_setting_ok_toggle(unsigned type,
|
||||
"shader_preset_save", preset_filename_callback);
|
||||
return 0;
|
||||
}
|
||||
else if (type == MENU_SETTINGS_SHADER_APPLY)
|
||||
else if (!strcmp(label, "shader_apply_changes"))
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||
unsigned shader_type = RARCH_SHADER_NONE;
|
||||
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend &&
|
||||
@ -1198,7 +1199,7 @@ static int menu_setting_ok_toggle(unsigned type,
|
||||
shader_type = driver.menu_ctx->backend->shader_manager_get_type(
|
||||
driver.menu->shader);
|
||||
|
||||
if (shader->passes && shader_type != RARCH_SHADER_NONE
|
||||
if (driver.menu->shader->passes && shader_type != RARCH_SHADER_NONE
|
||||
&& driver.menu_ctx && driver.menu_ctx->backend &&
|
||||
driver.menu_ctx->backend->shader_manager_save_preset)
|
||||
driver.menu_ctx->backend->shader_manager_save_preset(NULL, true);
|
||||
@ -1375,7 +1376,7 @@ static int menu_setting_toggle(unsigned type,
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend
|
||||
&& driver.menu_ctx->backend->shader_manager_setting_toggle)
|
||||
return driver.menu_ctx->backend->shader_manager_setting_toggle(
|
||||
type, action);
|
||||
type, label, action);
|
||||
}
|
||||
else if ((type >= MENU_SETTINGS_CORE_OPTION_START))
|
||||
return menu_common_core_setting_toggle(type, action);
|
||||
|
@ -309,7 +309,7 @@ static unsigned menu_common_shader_manager_get_type(
|
||||
}
|
||||
|
||||
static int menu_common_shader_manager_setting_toggle(
|
||||
unsigned id, unsigned action)
|
||||
unsigned id, const char *label, unsigned action)
|
||||
{
|
||||
if (!driver.menu)
|
||||
{
|
||||
@ -367,7 +367,7 @@ static int menu_common_shader_manager_setting_toggle(
|
||||
|
||||
param->current = min(max(param->minimum, param->current), param->maximum);
|
||||
}
|
||||
else if ((id == MENU_SETTINGS_SHADER_APPLY ||
|
||||
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))
|
||||
|
@ -447,6 +447,8 @@ static void rgui_render(void)
|
||||
core_option_get_val(g_extern.system.core_options,
|
||||
type - MENU_SETTINGS_CORE_OPTION_START),
|
||||
sizeof(type_str));
|
||||
else if (type == MENU_FILE_SWITCH)
|
||||
strlcpy(type_str, "...", sizeof(type_str));
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend &&
|
||||
driver.menu_ctx->backend->setting_set_label)
|
||||
driver.menu_ctx->backend->setting_set_label(type_str,
|
||||
|
@ -315,6 +315,8 @@ static void rmenu_render(void)
|
||||
core_option_get_val(g_extern.system.core_options,
|
||||
type - MENU_SETTINGS_CORE_OPTION_START),
|
||||
sizeof(type_str));
|
||||
else if (type == MENU_FILE_SWITCH)
|
||||
strlcpy(type_str, "...", sizeof(type_str));
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend
|
||||
&& driver.menu_ctx->backend->setting_set_label)
|
||||
driver.menu_ctx->backend->setting_set_label(type_str,
|
||||
|
@ -514,6 +514,8 @@ static void rmenu_xui_render(void)
|
||||
core_option_get_val(g_extern.system.core_options,
|
||||
type - MENU_SETTINGS_CORE_OPTION_START),
|
||||
sizeof(type_str));
|
||||
else if (type == MENU_FILE_SWITCH)
|
||||
strlcpy(type_str, "...", sizeof(type_str));
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend
|
||||
&& driver.menu_ctx->backend->setting_set_label)
|
||||
driver.menu_ctx->backend->setting_set_label(type_str,
|
||||
|
@ -61,6 +61,7 @@ typedef enum
|
||||
MENU_FILE_DEVICE,
|
||||
MENU_FILE_PLAYLIST_ENTRY,
|
||||
MENU_FILE_USE_DIRECTORY,
|
||||
MENU_FILE_SWITCH,
|
||||
MENU_SETTINGS,
|
||||
} menu_file_type_t;
|
||||
|
||||
@ -92,7 +93,6 @@ typedef enum
|
||||
MENU_SETTINGS_SHADER_OPTIONS,
|
||||
MENU_SETTINGS_SHADER_FILTER,
|
||||
MENU_SETTINGS_SHADER_PRESET,
|
||||
MENU_SETTINGS_SHADER_APPLY,
|
||||
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,
|
||||
|
@ -221,8 +221,8 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
return -1;
|
||||
|
||||
file_list_clear(list);
|
||||
file_list_push(list, "Apply Shader Changes", "",
|
||||
MENU_SETTINGS_SHADER_APPLY, 0);
|
||||
file_list_push(list, "Apply Shader Changes", "shader_apply_changes",
|
||||
MENU_FILE_SWITCH, 0);
|
||||
file_list_push(list, "Default Filter", "",
|
||||
MENU_SETTINGS_SHADER_FILTER, 0);
|
||||
file_list_push(list, "Load Shader Preset", "",
|
||||
|
Loading…
Reference in New Issue
Block a user