mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Move history list parsing to menu_displaylist.c
This commit is contained in:
parent
ec1e6ee06b
commit
b55ae6aa08
@ -454,6 +454,43 @@ static int menu_entries_push_horizontal_menu_list(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_historylist(menu_displaylist_info_t *info)
|
||||
{
|
||||
unsigned i;
|
||||
size_t list_size = content_playlist_size(g_defaults.history);
|
||||
|
||||
for (i = 0; i < list_size; i++)
|
||||
{
|
||||
char fill_buf[PATH_MAX_LENGTH];
|
||||
char path_copy[PATH_MAX_LENGTH];
|
||||
const char *core_name = NULL;
|
||||
const char *path = NULL;
|
||||
|
||||
strlcpy(path_copy, info->path, sizeof(path_copy));
|
||||
|
||||
path = path_copy;
|
||||
|
||||
content_playlist_get_index(g_defaults.history, i,
|
||||
&path, NULL, &core_name);
|
||||
strlcpy(fill_buf, core_name, sizeof(fill_buf));
|
||||
|
||||
if (path)
|
||||
{
|
||||
char path_short[PATH_MAX_LENGTH];
|
||||
|
||||
fill_short_pathname_representation(path_short, path,
|
||||
sizeof(path_short));
|
||||
snprintf(fill_buf,sizeof(fill_buf),"%s (%s)",
|
||||
path_short, core_name);
|
||||
}
|
||||
|
||||
menu_list_push(info->list, fill_buf, "",
|
||||
MENU_FILE_PLAYLIST_ENTRY, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -500,6 +537,14 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
if (ret == 0)
|
||||
menu_driver_populate_entries(info->path, info->label, info->type);
|
||||
break;
|
||||
case DISPLAYLIST_HISTORY:
|
||||
menu_list_clear(info->list);
|
||||
|
||||
ret = menu_displaylist_parse_historylist(info);
|
||||
|
||||
if (ret == 0)
|
||||
menu_list_populate_generic(info->list, info->path, info->label, info->type);
|
||||
break;
|
||||
case DISPLAYLIST_DATABASE_QUERY:
|
||||
menu_list_clear(info->list);
|
||||
menu_database_populate_query(info->list, info->path, (info->path_c[0] == '\0') ? NULL : info->path_c);
|
||||
|
@ -32,6 +32,7 @@ enum
|
||||
DISPLAYLIST_MAIN_MENU,
|
||||
DISPLAYLIST_SETTINGS,
|
||||
DISPLAYLIST_HORIZONTAL,
|
||||
DISPLAYLIST_HISTORY,
|
||||
DISPLAYLIST_DEFAULT,
|
||||
DISPLAYLIST_CORES,
|
||||
DISPLAYLIST_CORES_DETECTED,
|
||||
|
@ -1822,47 +1822,18 @@ static int deferred_push_core_updater_list(void *data, void *userdata,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static int deferred_push_history_list(void *data, void *userdata,
|
||||
const char *path, const char *label, unsigned type)
|
||||
{
|
||||
unsigned i;
|
||||
size_t list_size = 0;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
menu_displaylist_info_t info = {0};
|
||||
|
||||
if (!list)
|
||||
return -1;
|
||||
info.list = (file_list_t*)data;
|
||||
info.menu_list = (file_list_t*)userdata;
|
||||
info.type = type;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label, label, sizeof(info.label));
|
||||
|
||||
(void)userdata;
|
||||
|
||||
menu_list_clear(list);
|
||||
list_size = content_playlist_size(g_defaults.history);
|
||||
|
||||
for (i = 0; i < list_size; i++)
|
||||
{
|
||||
char fill_buf[PATH_MAX_LENGTH];
|
||||
const char *core_name = NULL;
|
||||
|
||||
content_playlist_get_index(g_defaults.history, i,
|
||||
&path, NULL, &core_name);
|
||||
strlcpy(fill_buf, core_name, sizeof(fill_buf));
|
||||
|
||||
if (path)
|
||||
{
|
||||
char path_short[PATH_MAX_LENGTH];
|
||||
fill_short_pathname_representation(path_short,path,sizeof(path_short));
|
||||
snprintf(fill_buf,sizeof(fill_buf),"%s (%s)",
|
||||
path_short,core_name);
|
||||
}
|
||||
|
||||
menu_list_push(list, fill_buf, "",
|
||||
MENU_FILE_PLAYLIST_ENTRY, 0);
|
||||
}
|
||||
|
||||
menu_list_populate_generic(list, path, label, type);
|
||||
|
||||
return 0;
|
||||
return menu_displaylist_push_list(&info, DISPLAYLIST_HISTORY);
|
||||
}
|
||||
|
||||
static int deferred_push_content_actions(void *data, void *userdata,
|
||||
|
Loading…
x
Reference in New Issue
Block a user