Implement RARCH_MENU_CTL_LIST_CACHE

This commit is contained in:
twinaphex 2016-02-10 06:43:56 +01:00
parent 23e48f1821
commit 99d21fd701
3 changed files with 34 additions and 18 deletions

View File

@ -158,11 +158,18 @@ static int action_left_mainmenu(unsigned type, const char *label,
switch (push_list)
{
case 1:
menu_driver_list_cache(MENU_LIST_HORIZONTAL, action);
{
menu_ctx_list_t list_info;
if (cbs && cbs->action_content_list_switch)
return cbs->action_content_list_switch(
selection_buf, menu_stack, "", "", 0);
list_info.type = MENU_LIST_HORIZONTAL;
list_info.action = action;
menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info);
if (cbs && cbs->action_content_list_switch)
return cbs->action_content_list_switch(
selection_buf, menu_stack, "", "", 0);
}
break;
case 2:
action_left_scroll(0, "", false);

View File

@ -177,11 +177,18 @@ static int action_right_mainmenu(unsigned type, const char *label,
switch (push_list)
{
case 1:
menu_driver_list_cache(MENU_LIST_HORIZONTAL, action);
{
menu_ctx_list_t list_info;
if (cbs && cbs->action_content_list_switch)
return cbs->action_content_list_switch(selection_buf, menu_stack,
"", "", 0);
list_info.type = MENU_LIST_HORIZONTAL;
list_info.action = action;
menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info);
if (cbs && cbs->action_content_list_switch)
return cbs->action_content_list_switch(selection_buf, menu_stack,
"", "", 0);
}
break;
case 2:
action_right_scroll(0, "", false);

View File

@ -249,9 +249,9 @@ void menu_driver_list_free(file_list_t *list, size_t idx, size_t list_size)
size_t menu_driver_list_get_selection(void)
{
if (menu_driver_ctx && menu_driver_ctx->list_get_selection)
return menu_driver_ctx->list_get_selection(menu_userdata);
return 0;
if (!menu_driver_ctx || !menu_driver_ctx->list_get_selection)
return 0;
return menu_driver_ctx->list_get_selection(menu_userdata);
}
bool menu_driver_list_push(menu_displaylist_info_t *info, unsigned type)
@ -263,12 +263,6 @@ bool menu_driver_list_push(menu_displaylist_info_t *info, unsigned type)
return false;
}
void menu_driver_list_cache(menu_list_type_t type, unsigned action)
{
if (menu_driver_ctx->list_cache)
menu_driver_ctx->list_cache(menu_userdata, type, action);
}
size_t menu_driver_list_get_size(menu_list_type_t type)
{
if (!menu_driver_ctx || !menu_driver_ctx->list_get_size)
@ -706,7 +700,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_driver_ctx->context_reset(menu_userdata);
break;
case RARCH_MENU_CTL_CONTEXT_DESTROY:
if (menu_driver_ctx && menu_driver_ctx->context_destroy)
if (menu_driver_ctx->context_destroy)
menu_driver_ctx->context_destroy(menu_userdata);
break;
case RARCH_MENU_CTL_SHADER_MANAGER_INIT:
@ -725,6 +719,14 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_driver_ctx->list_set_selection(menu_userdata, list);
}
break;
case RARCH_MENU_CTL_LIST_CACHE:
{
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
if (!list || !menu_driver_ctx || !menu_driver_ctx->list_cache)
return false;
menu_driver_ctx->list_cache(menu_userdata, list->type, list->action);
}
break;
case RARCH_MENU_CTL_LIST_INSERT:
{
menu_ctx_list_t *list = (menu_ctx_list_t*)data;