Move core parsing code to menu_displaylist.c
This commit is contained in:
parent
b55ae6aa08
commit
f76c43fc66
|
@ -491,6 +491,30 @@ static int menu_displaylist_parse_historylist(menu_displaylist_info_t *info)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int menu_displaylist_parse_cores(menu_displaylist_info_t *info)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
size_t list_size = 0;
|
||||||
|
const core_info_t *core_info = NULL;
|
||||||
|
global_t *global = global_get_ptr();
|
||||||
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
if (!menu)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
core_info_list_get_supported_cores(global->core_info,
|
||||||
|
menu->deferred_path, &core_info, &list_size);
|
||||||
|
|
||||||
|
for (i = 0; i < list_size; i++)
|
||||||
|
{
|
||||||
|
menu_list_push(info->list, core_info[i].path, "",
|
||||||
|
MENU_FILE_CORE, 0);
|
||||||
|
menu_list_set_alt_at_offset(info->list, i,
|
||||||
|
core_info[i].display_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -537,6 +561,14 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
menu_driver_populate_entries(info->path, info->label, info->type);
|
menu_driver_populate_entries(info->path, info->label, info->type);
|
||||||
break;
|
break;
|
||||||
|
case DISPLAYLIST_CORES_ALL:
|
||||||
|
menu_list_clear(info->list);
|
||||||
|
|
||||||
|
ret = menu_displaylist_parse_cores(info);
|
||||||
|
|
||||||
|
menu_list_sort_on_alt(info->list);
|
||||||
|
menu_list_populate_generic(info->list, info->path, info->label, info->type);
|
||||||
|
break;
|
||||||
case DISPLAYLIST_HISTORY:
|
case DISPLAYLIST_HISTORY:
|
||||||
menu_list_clear(info->list);
|
menu_list_clear(info->list);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ enum
|
||||||
DISPLAYLIST_HISTORY,
|
DISPLAYLIST_HISTORY,
|
||||||
DISPLAYLIST_DEFAULT,
|
DISPLAYLIST_DEFAULT,
|
||||||
DISPLAYLIST_CORES,
|
DISPLAYLIST_CORES,
|
||||||
|
DISPLAYLIST_CORES_ALL,
|
||||||
DISPLAYLIST_CORES_DETECTED,
|
DISPLAYLIST_CORES_DETECTED,
|
||||||
DISPLAYLIST_PERFCOUNTER_SELECTION,
|
DISPLAYLIST_PERFCOUNTER_SELECTION,
|
||||||
DISPLAYLIST_PERFCOUNTERS_CORE,
|
DISPLAYLIST_PERFCOUNTERS_CORE,
|
||||||
|
|
|
@ -967,39 +967,15 @@ done:
|
||||||
static int deferred_push_core_list_deferred(void *data, void *userdata,
|
static int deferred_push_core_list_deferred(void *data, void *userdata,
|
||||||
const char *path, const char *label, unsigned type)
|
const char *path, const char *label, unsigned type)
|
||||||
{
|
{
|
||||||
unsigned i;
|
menu_displaylist_info_t info = {0};
|
||||||
size_t list_size = 0;
|
|
||||||
const core_info_t *info = NULL;
|
|
||||||
file_list_t *list = NULL;
|
|
||||||
file_list_t *menu_list = NULL;
|
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
|
||||||
if (!menu)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
list = (file_list_t*)data;
|
info.list = (file_list_t*)data;
|
||||||
menu_list = (file_list_t*)userdata;
|
info.menu_list = (file_list_t*)userdata;
|
||||||
|
info.type = type;
|
||||||
|
strlcpy(info.path, path, sizeof(info.path));
|
||||||
|
strlcpy(info.label, label, sizeof(info.label));
|
||||||
|
|
||||||
if (!list || !menu_list)
|
return menu_displaylist_push_list(&info, DISPLAYLIST_CORES_ALL);
|
||||||
return -1;
|
|
||||||
|
|
||||||
menu_list_clear(list);
|
|
||||||
core_info_list_get_supported_cores(global->core_info,
|
|
||||||
menu->deferred_path, &info, &list_size);
|
|
||||||
|
|
||||||
for (i = 0; i < list_size; i++)
|
|
||||||
{
|
|
||||||
menu_list_push(list, info[i].path, "",
|
|
||||||
MENU_FILE_CORE, 0);
|
|
||||||
menu_list_set_alt_at_offset(list, i,
|
|
||||||
info[i].display_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu_list_sort_on_alt(list);
|
|
||||||
|
|
||||||
menu_list_populate_generic(list, path, label, type);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int deferred_push_database_manager_list_deferred(void *data, void *userdata,
|
static int deferred_push_database_manager_list_deferred(void *data, void *userdata,
|
||||||
|
|
Loading…
Reference in New Issue