mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 10:40:39 +00:00
Combine menu_flush_stack functions
This commit is contained in:
parent
d5de270b8a
commit
16c16eb579
@ -34,7 +34,7 @@ void menu_entries_common_load_content(bool persist)
|
||||
|
||||
event_command(persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT);
|
||||
|
||||
menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
|
||||
menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);
|
||||
menu->msg_force = true;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ static int action_ok_playlist_entry(const char *path,
|
||||
|
||||
rarch_playlist_load_content(g_defaults.history,
|
||||
menu->navigation.selection_ptr);
|
||||
menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
|
||||
menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ static int action_ok_shader_pass_load(const char *path,
|
||||
|
||||
/* This will reset any changed parameters. */
|
||||
video_shader_resolve_parameters(NULL, menu->shader);
|
||||
menu_list_flush_stack_by_needle(menu->menu_list, "shader_options");
|
||||
menu_list_flush_stack(menu->menu_list, "shader_options", 0);
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
@ -424,7 +424,7 @@ static int action_ok_record_configfile_load(const char *path,
|
||||
|
||||
fill_pathname_join(global->record.config, menu_path, path, sizeof(global->record.config));
|
||||
|
||||
menu_list_flush_stack_by_needle(menu->menu_list, "Recording Settings");
|
||||
menu_list_flush_stack(menu->menu_list, "Recording Settings", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ static int action_ok_remap_file_load(const char *path,
|
||||
fill_pathname_join(remap_path, menu_path, path, sizeof(remap_path));
|
||||
input_remapping_load_file(remap_path);
|
||||
|
||||
menu_list_flush_stack_by_needle(menu->menu_list, "core_input_remapping_options");
|
||||
menu_list_flush_stack(menu->menu_list, "core_input_remapping_options", 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -475,7 +475,7 @@ static int action_ok_video_filter_file_load(const char *path,
|
||||
|
||||
event_command(EVENT_CMD_REINIT);
|
||||
|
||||
menu_list_flush_stack_by_needle(menu->menu_list, "video_options");
|
||||
menu_list_flush_stack(menu->menu_list, "video_options", 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -505,7 +505,7 @@ static int action_ok_cheat_file_load(const char *path,
|
||||
if (!global->cheat)
|
||||
return -1;
|
||||
|
||||
menu_list_flush_stack_by_needle(menu->menu_list, "core_cheat_options");
|
||||
menu_list_flush_stack(menu->menu_list, "core_cheat_options", 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -564,7 +564,7 @@ static int action_ok_shader_preset_load(const char *path,
|
||||
menu_shader_manager_set_preset(menu->shader,
|
||||
video_shader_parse_type(shader_path, RARCH_SHADER_NONE),
|
||||
shader_path);
|
||||
menu_list_flush_stack_by_needle(menu->menu_list, "shader_options");
|
||||
menu_list_flush_stack(menu->menu_list, "shader_options", 0);
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
@ -758,7 +758,7 @@ static int action_ok_core_load(const char *path,
|
||||
fill_pathname_join(settings->libretro, menu_path, path,
|
||||
sizeof(settings->libretro));
|
||||
event_command(EVENT_CMD_LOAD_CORE);
|
||||
menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
|
||||
menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
/* No content needed for this core, load core immediately. */
|
||||
|
||||
@ -890,7 +890,7 @@ static int action_ok_config_load(const char *path,
|
||||
&menu_path, NULL, NULL);
|
||||
|
||||
fill_pathname_join(config, menu_path, path, sizeof(config));
|
||||
menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
|
||||
menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);
|
||||
menu->msg_force = true;
|
||||
if (rarch_replace_config(config))
|
||||
{
|
||||
@ -919,7 +919,7 @@ static int action_ok_disk_image_append(const char *path,
|
||||
|
||||
event_command(EVENT_CMD_RESUME);
|
||||
|
||||
menu_list_flush_stack(menu->menu_list, MENU_SETTINGS);
|
||||
menu_list_flush_stack(menu->menu_list, NULL, MENU_SETTINGS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -243,28 +243,17 @@ void *menu_list_get_last_stack_actiondata(const menu_list_t *list)
|
||||
return file_list_get_last_actiondata(list->menu_stack);
|
||||
}
|
||||
|
||||
void menu_list_flush_stack(menu_list_t *list,
|
||||
unsigned final_type)
|
||||
static int menu_list_flush_stack_type(
|
||||
const char *needle, const char *label,
|
||||
unsigned type, unsigned final_type)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned type = 0;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu || !list)
|
||||
return;
|
||||
|
||||
menu_set_refresh();
|
||||
file_list_get_last(list->menu_stack, &path, &label, &type);
|
||||
|
||||
while (type != final_type)
|
||||
{
|
||||
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
|
||||
file_list_get_last(list->menu_stack, &path, &label, &type);
|
||||
}
|
||||
if (needle)
|
||||
return strcmp(needle, label);
|
||||
return type != final_type;
|
||||
}
|
||||
|
||||
void menu_list_flush_stack_by_needle(menu_list_t *list,
|
||||
const char *needle)
|
||||
void menu_list_flush_stack(menu_list_t *list,
|
||||
const char *needle, unsigned final_type)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
@ -276,7 +265,7 @@ void menu_list_flush_stack_by_needle(menu_list_t *list,
|
||||
menu_set_refresh();
|
||||
file_list_get_last(list->menu_stack, &path, &label, &type);
|
||||
|
||||
while (strcmp(needle, label) != 0)
|
||||
while (menu_list_flush_stack_type(needle, label, type, final_type) != 0)
|
||||
{
|
||||
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
|
||||
file_list_get_last(list->menu_stack, &path, &label, &type);
|
||||
|
@ -64,10 +64,7 @@ void menu_list_free(menu_list_t *menu_list);
|
||||
menu_list_t *menu_list_new(void);
|
||||
|
||||
void menu_list_flush_stack(menu_list_t *list,
|
||||
unsigned final_type);
|
||||
|
||||
void menu_list_flush_stack_by_needle(menu_list_t *list,
|
||||
const char *needle);
|
||||
const char *needle, unsigned final_type);
|
||||
|
||||
void menu_list_pop(file_list_t *list, size_t *directory_ptr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user