mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Refactor menu_list_pop_stack functions
This commit is contained in:
parent
3931134924
commit
46f9b325f8
@ -42,7 +42,7 @@ static int menu_message_toggle(unsigned action)
|
|||||||
driver.menu_ctx->render_messagebox(driver.menu->message_contents);
|
driver.menu_ctx->render_messagebox(driver.menu->message_contents);
|
||||||
|
|
||||||
if (action == MENU_ACTION_OK)
|
if (action == MENU_ACTION_OK)
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ static int menu_info_screen_iterate(unsigned action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action == MENU_ACTION_OK)
|
if (action == MENU_ACTION_OK)
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ static int menu_start_screen_iterate(unsigned action)
|
|||||||
driver.menu_ctx->render_messagebox(msg);
|
driver.menu_ctx->render_messagebox(msg);
|
||||||
|
|
||||||
if (action == MENU_ACTION_OK)
|
if (action == MENU_ACTION_OK)
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ static int menu_settings_iterate(unsigned action,
|
|||||||
|
|
||||||
case MENU_ACTION_CANCEL:
|
case MENU_ACTION_CANCEL:
|
||||||
apply_deferred_settings();
|
apply_deferred_settings();
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
break;
|
break;
|
||||||
case MENU_ACTION_SELECT:
|
case MENU_ACTION_SELECT:
|
||||||
menu_list_push_stack(driver.menu->menu_list, "", "info_screen",
|
menu_list_push_stack(driver.menu->menu_list, "", "info_screen",
|
||||||
@ -349,7 +349,8 @@ static int menu_viewport_iterate(unsigned action)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ACTION_CANCEL:
|
case MENU_ACTION_CANCEL:
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
|
|
||||||
if (!strcmp(label, "custom_viewport_2"))
|
if (!strcmp(label, "custom_viewport_2"))
|
||||||
{
|
{
|
||||||
menu_list_push_stack(driver.menu->menu_list, "", "",
|
menu_list_push_stack(driver.menu->menu_list, "", "",
|
||||||
@ -359,7 +360,8 @@ static int menu_viewport_iterate(unsigned action)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ACTION_OK:
|
case MENU_ACTION_OK:
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
|
|
||||||
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT
|
if (type == MENU_SETTINGS_CUSTOM_VIEWPORT
|
||||||
&& !g_settings.video.scale_integer)
|
&& !g_settings.video.scale_integer)
|
||||||
{
|
{
|
||||||
@ -483,7 +485,7 @@ static int menu_load_or_open_zip_iterate(unsigned action)
|
|||||||
{
|
{
|
||||||
case MENU_ACTION_OK:
|
case MENU_ACTION_OK:
|
||||||
case MENU_ACTION_CANCEL:
|
case MENU_ACTION_CANCEL:
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
|
|
||||||
menu_list_get_last_stack(driver.menu->menu_list->menu_stack,
|
menu_list_get_last_stack(driver.menu->menu_list->menu_stack,
|
||||||
&menu_path, &menu_label, NULL);
|
&menu_path, &menu_label, NULL);
|
||||||
@ -570,13 +572,13 @@ static int menu_common_iterate(unsigned action)
|
|||||||
else if (type == MENU_SETTINGS_CUSTOM_BIND)
|
else if (type == MENU_SETTINGS_CUSTOM_BIND)
|
||||||
{
|
{
|
||||||
if (menu_input_bind_iterate(driver.menu))
|
if (menu_input_bind_iterate(driver.menu))
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
|
else if (type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
|
||||||
{
|
{
|
||||||
if (menu_input_bind_iterate_keyboard(driver.menu))
|
if (menu_input_bind_iterate_keyboard(driver.menu))
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +631,7 @@ static int menu_common_iterate(unsigned action)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ACTION_CANCEL:
|
case MENU_ACTION_CANCEL:
|
||||||
menu_list_pop_stack(driver.menu->menu_list->menu_stack);
|
menu_list_pop_stack(driver.menu->menu_list);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ACTION_OK:
|
case MENU_ACTION_OK:
|
||||||
|
@ -271,7 +271,7 @@ static int action_ok_path_use_directory(const char *path,
|
|||||||
if (setting->type == ST_DIR)
|
if (setting->type == ST_DIR)
|
||||||
{
|
{
|
||||||
menu_action_setting_set_current_string(setting, menu_path);
|
menu_action_setting_set_current_string(setting, menu_path);
|
||||||
menu_list_pop_stack_by_needle(driver.menu->menu_list->menu_stack, setting->name);
|
menu_list_pop_stack_by_needle(driver.menu->menu_list, setting->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -479,7 +479,7 @@ static int action_ok_file_load(const char *path,
|
|||||||
if (setting && setting->type == ST_PATH)
|
if (setting && setting->type == ST_PATH)
|
||||||
{
|
{
|
||||||
menu_action_setting_set_current_string_path(setting, menu_path, path);
|
menu_action_setting_set_current_string_path(setting, menu_path, path);
|
||||||
menu_list_pop_stack_by_needle(driver.menu->menu_list->menu_stack, setting->name);
|
menu_list_pop_stack_by_needle(driver.menu->menu_list, setting->name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -521,7 +521,7 @@ static int action_ok_set_path(const char *path,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
menu_action_setting_set_current_string_path(setting, menu_path, path);
|
menu_action_setting_set_current_string_path(setting, menu_path, path);
|
||||||
menu_list_pop_stack_by_needle(driver.menu->menu_list->menu_stack, setting->name);
|
menu_list_pop_stack_by_needle(driver.menu->menu_list, setting->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -155,19 +155,19 @@ void menu_list_flush_stack_by_needle(menu_list_t *list,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_list_pop_stack(file_list_t *list)
|
void menu_list_pop_stack(menu_list_t *list)
|
||||||
{
|
{
|
||||||
if (!list)
|
if (!list)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (file_list_get_size(list) > 1)
|
if (file_list_get_size(list->menu_stack) > 1)
|
||||||
{
|
{
|
||||||
menu_list_pop(list, &driver.menu->selection_ptr);
|
menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
|
||||||
driver.menu->need_refresh = true;
|
driver.menu->need_refresh = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_list_pop_stack_by_needle(file_list_t *list,
|
void menu_list_pop_stack_by_needle(menu_list_t *list,
|
||||||
const char *needle)
|
const char *needle)
|
||||||
{
|
{
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
@ -178,11 +178,11 @@ void menu_list_pop_stack_by_needle(file_list_t *list,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
driver.menu->need_refresh = true;
|
driver.menu->need_refresh = true;
|
||||||
file_list_get_last(list, &path, &label, &type);
|
file_list_get_last(list->menu_stack, &path, &label, &type);
|
||||||
while (strcmp(needle, label) == 0)
|
while (strcmp(needle, label) == 0)
|
||||||
{
|
{
|
||||||
menu_list_pop(list, &driver.menu->selection_ptr);
|
menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
|
||||||
file_list_get_last(list, &path, &label, &type);
|
file_list_get_last(list->menu_stack, &path, &label, &type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ void menu_list_flush_stack_by_needle(menu_list_t *list,
|
|||||||
|
|
||||||
void menu_list_pop(file_list_t *list, size_t *directory_ptr);
|
void menu_list_pop(file_list_t *list, size_t *directory_ptr);
|
||||||
|
|
||||||
void menu_list_pop_stack(file_list_t *list);
|
void menu_list_pop_stack(menu_list_t *list);
|
||||||
|
|
||||||
void menu_list_pop_stack_by_needle(file_list_t *list,
|
void menu_list_pop_stack_by_needle(menu_list_t *list,
|
||||||
const char *needle);
|
const char *needle);
|
||||||
|
|
||||||
void menu_list_get_at_offset(const file_list_t *list, size_t index,
|
void menu_list_get_at_offset(const file_list_t *list, size_t index,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user