(XMB/Horizontal list)

1) Create list_get_entry
2) Will show one entry at the top that is the 'full database' for
that collection
This commit is contained in:
twinaphex 2015-06-08 17:02:14 +02:00
parent 68b02ff25d
commit 2eba39e41d
9 changed files with 67 additions and 42 deletions

View File

@ -697,6 +697,7 @@ menu_ctx_driver_t menu_ctx_glui = {
NULL,
NULL,
NULL,
NULL,
glui_load_image,
"glui",
NULL,

View File

@ -46,6 +46,7 @@ menu_ctx_driver_t menu_ctx_null = {
NULL, // list_clear
NULL, // list_cache
NULL, // list_get_size
NULL, // list_get_entry
NULL, // list_set_selection
NULL, // bind_init
NULL, // load_image

View File

@ -657,6 +657,7 @@ menu_ctx_driver_t menu_ctx_rgui = {
NULL,
NULL,
NULL,
NULL,
"rgui",
NULL,
};

View File

@ -327,6 +327,7 @@ menu_ctx_driver_t menu_ctx_rmenu = {
NULL,
NULL,
NULL,
NULL,
"rmenu",
NULL,
};

View File

@ -682,6 +682,7 @@ menu_ctx_driver_t menu_ctx_rmenu_xui = {
NULL,
NULL,
NULL,
NULL,
rmenu_xui_list_set_selection,
NULL,
"rmenu_xui",

View File

@ -252,6 +252,32 @@ static size_t xmb_list_get_size(void *data, menu_list_type_t type)
return list_size;
}
static void *xmb_list_get_entry(void *data, menu_list_type_t type, unsigned i)
{
size_t list_size = 0;
menu_handle_t *menu = (menu_handle_t*)data;
xmb_handle_t *xmb = menu ? (xmb_handle_t*)menu->userdata : NULL;
void *ptr = NULL;
switch (type)
{
case MENU_LIST_PLAIN:
if (menu && menu->menu_list)
list_size = file_list_get_size(menu->menu_list->menu_stack);
if (i < list_size)
ptr = (void*)&menu->menu_list->menu_stack->list[i];
break;
case MENU_LIST_HORIZONTAL:
if (xmb && xmb->horizontal_list)
list_size = file_list_get_size(xmb->horizontal_list);
if (i < list_size)
ptr = (void*)&xmb->horizontal_list->list[i];
break;
}
return ptr;
}
static float xmb_item_y(xmb_handle_t *xmb, int i, size_t current)
{
float iy = xmb->icon.spacing.vertical;
@ -2129,6 +2155,7 @@ menu_ctx_driver_t menu_ctx_xmb = {
NULL,
xmb_list_cache,
xmb_list_get_size,
xmb_list_get_entry,
NULL,
xmb_list_bind_init,
xmb_load_image,

View File

@ -1292,6 +1292,7 @@ static int menu_displaylist_parse_settings_in_subgroup(menu_displaylist_info_t *
return 0;
}
#if 0
static void menu_displaylist_push_horizontal_menu_list_content(
file_list_t *list, core_info_t *info, const char* path)
{
@ -1322,58 +1323,36 @@ static void menu_displaylist_push_horizontal_menu_list_content(
string_list_free(str_list);
}
#endif
static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *_info)
static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info)
{
char db_path[PATH_MAX_LENGTH];
char rpl_basename[PATH_MAX_LENGTH];
size_t i;
const char *path = NULL;
core_info_t *info = NULL;
global_t *global = global_get_ptr();
core_info_list_t *info_list = (core_info_list_t*)global->core_info;
file_list_t *list = info_list ? _info->list : NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
struct item_file *item = (struct item_file*)menu_driver_list_get_entry(MENU_LIST_HORIZONTAL,
menu->categories.selection_ptr - 1);
if (!info_list)
if (!item)
return -1;
info = (core_info_t*)&info_list->list[menu->categories.selection_ptr - 1];
#if 0
menu_list_push(list, info->display_name, "content_actions",
MENU_FILE_CONTENTLIST_ENTRY, 0);
#endif
if (!info)
return -1;
strlcpy(rpl_basename, item->path, sizeof(rpl_basename));
path_remove_extension(rpl_basename);
strlcpy(settings->libretro, info->path, sizeof(settings->libretro));
fill_pathname_join(db_path, settings->content_database,
rpl_basename, sizeof(db_path));
strlcat(db_path, ".rdb", sizeof(db_path));
path = settings->core_assets_directory;
list = _info->list;
if (!info->supports_no_game)
menu_displaylist_push_horizontal_menu_list_content(list, info, path);
else
menu_list_push(list, info->display_name, "content_actions",
MENU_FILE_CONTENTLIST_ENTRY, 0);
if (!info->databases_list)
return 0;
for (i = 0; i < info->databases_list->size; i++)
{
char db_path[PATH_MAX_LENGTH];
struct string_list *str_list = (struct string_list*)info->databases_list;
if (!str_list)
continue;
fill_pathname_join(db_path, settings->content_database,
str_list->elems[i].data, sizeof(db_path));
strlcat(db_path, ".rdb", sizeof(db_path));
if (!path_file_exists(db_path))
continue;
menu_list_push(list, path_basename(db_path), "core_database",
if (path_file_exists(db_path))
menu_list_push(info->list, path_basename(db_path), "core_database",
MENU_FILE_RDB, 0);
}
return 0;
}

View File

@ -269,6 +269,16 @@ size_t menu_driver_list_get_size(menu_list_type_t type)
return 0;
}
void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i)
{
menu_handle_t *menu = menu_driver_get_ptr();
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
if (driver && driver->list_get_entry)
return driver->list_get_entry(menu, type, i);
return NULL;
}
void menu_driver_navigation_increment(void)
{
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();

View File

@ -257,7 +257,8 @@ typedef struct menu_ctx_driver
void (*list_delete)(file_list_t *list, size_t, size_t);
void (*list_clear)(file_list_t *list);
void (*list_cache)(menu_list_type_t, unsigned);
size_t(*list_get_size)(void *data, menu_list_type_t);
size_t(*list_get_size)(void *data, menu_list_type_t type);
void *(*list_get_entry)(void *data, menu_list_type_t type, unsigned i);
void (*list_set_selection)(file_list_t *list);
int (*bind_init)(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
@ -356,6 +357,8 @@ size_t menu_driver_list_get_size(menu_list_type_t type);
void menu_driver_list_set_selection(file_list_t *list);
void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i);
const menu_ctx_driver_t *menu_ctx_driver_get_ptr(void);
void menu_driver_context_destroy(void);
@ -366,6 +369,7 @@ void menu_driver_set_alive(void);
void menu_driver_unset_alive(void);
int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1,