Refactor away menu_driver_list_cache

This commit is contained in:
libretroadmin 2023-05-12 01:00:08 +02:00
parent b105fa5a4f
commit fe529ff591
7 changed files with 21 additions and 48 deletions

View File

@ -254,16 +254,13 @@ static int action_left_scroll(unsigned type, const char *label,
static int action_left_goto_tab(void)
{
menu_ctx_list_t list_info;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = menu_list ? MENU_LIST_GET_SELECTION(menu_list, 0) : NULL;
list_info.type = MENU_LIST_HORIZONTAL;
list_info.action = MENU_ACTION_LEFT;
menu_driver_list_cache(&list_info);
if (menu_st->driver_ctx && menu_st->driver_ctx->list_cache)
menu_st->driver_ctx->list_cache(menu_st->userdata,
MENU_LIST_HORIZONTAL, MENU_ACTION_LEFT);
return menu_driver_deferred_push_content_list(selection_buf);
}

View File

@ -6988,7 +6988,7 @@ static int action_ok_start_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
content_ctx_info_t content_info;
menu_ctx_list_t list_info;
struct menu_state *menu_st = menu_state_get_ptr();
content_info.argc = 0;
content_info.argv = NULL;
@ -6998,9 +6998,9 @@ static int action_ok_start_core(const char *path,
/* We are going to push a new menu; ensure
* that the current one is cached for animation
* purposes */
list_info.type = MENU_LIST_PLAIN;
list_info.action = 0;
menu_driver_list_cache(&list_info);
if (menu_st->driver_ctx && menu_st->driver_ctx->list_cache)
menu_st->driver_ctx->list_cache(menu_st->userdata,
MENU_LIST_PLAIN, MENU_ACTION_NOOP);
path_clear(RARCH_PATH_BASENAME);
if (!task_push_start_current_core(&content_info))

View File

@ -283,16 +283,12 @@ static int audio_mixer_stream_volume_right(unsigned type, const char *label,
static int action_right_goto_tab(void)
{
menu_ctx_list_t list_info;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = menu_list ? MENU_LIST_GET_SELECTION(menu_list, 0) : NULL;
list_info.type = MENU_LIST_HORIZONTAL;
list_info.action = MENU_ACTION_RIGHT;
menu_driver_list_cache(&list_info);
if (menu_st->driver_ctx && menu_st->driver_ctx->list_cache)
menu_st->driver_ctx->list_cache(menu_st->userdata,
MENU_LIST_HORIZONTAL, MENU_ACTION_RIGHT);
return menu_driver_deferred_push_content_list(selection_buf);
}

View File

@ -14092,21 +14092,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
info->flags |= MD_FLAG_NEED_NAVIGATION_CLEAR;
/* fall-through */
case DISPLAYLIST_PENDING_CLEAR:
{
menu_ctx_list_t list_info;
if (menu_st->driver_ctx && menu_st->driver_ctx->list_cache)
menu_st->driver_ctx->list_cache(menu_st->userdata,
MENU_LIST_PLAIN, MENU_ACTION_NOOP);
list_info.type = MENU_LIST_PLAIN;
list_info.action = 0;
if (menu_entries_append(info->list, info->path,
info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0,
NULL))
count++;
menu_driver_list_cache(&list_info);
if (menu_entries_append(info->list, info->path,
info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0,
NULL))
count++;
info->flags |= MD_FLAG_NEED_ENTRIES_REFRESH;
}
info->flags |= MD_FLAG_NEED_ENTRIES_REFRESH;
break;
case DISPLAYLIST_USER_BINDS_LIST:
menu_entries_clear(info->list);

View File

@ -4399,17 +4399,6 @@ void menu_driver_frame(bool menu_is_alive, video_frame_info_t *video_info)
menu_st->driver_ctx->frame(menu_st->userdata, video_info);
}
bool menu_driver_list_cache(menu_ctx_list_t *list)
{
struct menu_state *menu_st = &menu_driver_state;
if (!list || !menu_st->driver_ctx || !menu_st->driver_ctx->list_cache)
return false;
menu_st->driver_ctx->list_cache(menu_st->userdata,
list->type, list->action);
return true;
}
/* Teardown function for the menu driver. */
void menu_driver_destroy(
struct menu_state *menu_st)

View File

@ -617,8 +617,6 @@ void menu_driver_frame(bool menu_is_alive, video_frame_info_t *video_info);
int menu_driver_deferred_push_content_list(file_list_t *list);
bool menu_driver_list_cache(menu_ctx_list_t *list);
bool menu_driver_init(bool video_is_threaded);
size_t menu_driver_list_get_selection(void);

View File

@ -5720,14 +5720,12 @@ static enum runloop_state_enum runloop_check_state(
* and exit the function to go to the next frame. */
if (menu_st->flags & MENU_ST_FLAG_PENDING_QUICK_MENU)
{
menu_ctx_list_t list_info;
/* We are going to push a new menu; ensure
* that the current one is cached for animation
* purposes */
list_info.type = MENU_LIST_PLAIN;
list_info.action = 0;
menu_driver_list_cache(&list_info);
if (menu_st->driver_ctx && menu_st->driver_ctx->list_cache)
menu_st->driver_ctx->list_cache(menu_st->userdata,
MENU_LIST_PLAIN, MENU_ACTION_NOOP);
p_disp->flags |= GFX_DISP_FLAG_MSG_FORCE;