mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
(Menu) Move more actions over to menu_entries_cbs.c
This commit is contained in:
parent
78e58e4a0f
commit
82d1168622
@ -47,9 +47,6 @@ extern unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2];
|
|||||||
extern unsigned menu_current_gx_resolution;
|
extern unsigned menu_current_gx_resolution;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: Ugly hack, nees to be refactored badly
|
|
||||||
size_t hack_shader_pass = 0;
|
|
||||||
|
|
||||||
static int menu_message_toggle(unsigned action)
|
static int menu_message_toggle(unsigned action)
|
||||||
{
|
{
|
||||||
if (driver.video_data && driver.menu_ctx
|
if (driver.video_data && driver.menu_ctx
|
||||||
@ -743,8 +740,6 @@ static int menu_action_ok(const char *menu_path,
|
|||||||
rarch_setting_t *setting = (rarch_setting_t*)
|
rarch_setting_t *setting = (rarch_setting_t*)
|
||||||
setting_data_find_setting(setting_data, menu_label);
|
setting_data_find_setting(setting_data, menu_label);
|
||||||
|
|
||||||
(void)hack_shader_pass;
|
|
||||||
|
|
||||||
if (file_list_get_size(driver.menu->selection_buf) == 0)
|
if (file_list_get_size(driver.menu->selection_buf) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -858,32 +853,6 @@ static int menu_action_ok(const char *menu_path,
|
|||||||
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
|
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
|
||||||
|
|
||||||
return 0;
|
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));
|
|
||||||
menu_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:
|
case MENU_FILE_CORE:
|
||||||
|
|
||||||
if (!strcmp(menu_label, "deferred_core_list"))
|
if (!strcmp(menu_label, "deferred_core_list"))
|
||||||
|
@ -75,6 +75,57 @@ static int action_ok_shader_apply_changes(const char *path,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Ugly hack, nees to be refactored badly
|
||||||
|
size_t hack_shader_pass = 0;
|
||||||
|
|
||||||
|
static int action_ok_shader_pass_load(const char *path,
|
||||||
|
const char *label, unsigned type, size_t index)
|
||||||
|
{
|
||||||
|
const char *menu_path = NULL;
|
||||||
|
if (!driver.menu)
|
||||||
|
return -1;
|
||||||
|
(void)menu_path;
|
||||||
|
|
||||||
|
#ifdef HAVE_SHADER_MANAGER
|
||||||
|
file_list_get_last(driver.menu->menu_stack, &menu_path, NULL,
|
||||||
|
NULL);
|
||||||
|
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");
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static int action_ok_shader_preset_load(const char *path,
|
||||||
|
const char *label, unsigned type, size_t index)
|
||||||
|
{
|
||||||
|
const char *menu_path = NULL;
|
||||||
|
char shader_path[PATH_MAX];
|
||||||
|
if (!driver.menu)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
(void)shader_path;
|
||||||
|
(void)menu_path;
|
||||||
|
#ifdef HAVE_SHADER_MANAGER
|
||||||
|
file_list_get_last(driver.menu->menu_stack, &menu_path, NULL,
|
||||||
|
NULL);
|
||||||
|
fill_pathname_join(shader_path, menu_path, path, sizeof(shader_path));
|
||||||
|
menu_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");
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int action_ok_shader_preset_save_as(const char *path,
|
static int action_ok_shader_preset_save_as(const char *path,
|
||||||
const char *label, unsigned type, size_t index)
|
const char *label, unsigned type, size_t index)
|
||||||
{
|
{
|
||||||
@ -93,6 +144,10 @@ static int menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
|
|||||||
{
|
{
|
||||||
if (type == MENU_FILE_PLAYLIST_ENTRY)
|
if (type == MENU_FILE_PLAYLIST_ENTRY)
|
||||||
cbs->action_ok = action_ok_playlist_entry;
|
cbs->action_ok = action_ok_playlist_entry;
|
||||||
|
else if (type == MENU_FILE_SHADER_PRESET)
|
||||||
|
cbs->action_ok = action_ok_shader_preset_load;
|
||||||
|
else if (type == MENU_FILE_SHADER)
|
||||||
|
cbs->action_ok = action_ok_shader_pass_load;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user