Create DISPLAYLIST_CORE_INFO

This commit is contained in:
twinaphex 2015-05-13 01:31:58 +02:00
parent 654f1e0868
commit 504b3222ef
3 changed files with 149 additions and 137 deletions

View File

@ -618,6 +618,140 @@ static int deferred_push_video_shader_parameters_common(
}
#endif
static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
{
unsigned i;
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
core_info_t *core_info = (core_info_t*)global->core_info_current;
if (core_info && core_info->data)
{
char tmp[PATH_MAX_LENGTH];
snprintf(tmp, sizeof(tmp), "Core name: %s",
core_info->core_name ? core_info->core_name : "");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(tmp, sizeof(tmp), "Core label: %s",
core_info->display_name ? core_info->display_name : "");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
if (core_info->systemname)
{
snprintf(tmp, sizeof(tmp), "System name: %s",
core_info->systemname);
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (core_info->system_manufacturer)
{
snprintf(tmp, sizeof(tmp), "System manufacturer: %s",
core_info->system_manufacturer);
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (core_info->categories_list)
{
strlcpy(tmp, "Categories: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
core_info->categories_list, ", ");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (core_info->authors_list)
{
strlcpy(tmp, "Authors: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
core_info->authors_list, ", ");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (core_info->permissions_list)
{
strlcpy(tmp, "Permissions: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
core_info->permissions_list, ", ");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (core_info->licenses_list)
{
strlcpy(tmp, "License(s): ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
core_info->licenses_list, ", ");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (core_info->supported_extensions_list)
{
strlcpy(tmp, "Supported extensions: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
core_info->supported_extensions_list, ", ");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (core_info->firmware_count > 0)
{
core_info_list_update_missing_firmware(
global->core_info, core_info->path,
settings->system_directory);
menu_list_push(info->list, "Firmware: ", "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
for (i = 0; i < core_info->firmware_count; i++)
{
if (core_info->firmware[i].desc)
{
snprintf(tmp, sizeof(tmp), " name: %s",
core_info->firmware[i].desc ?
core_info->firmware[i].desc : "");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(tmp, sizeof(tmp), " status: %s, %s",
core_info->firmware[i].missing ?
"missing" : "present",
core_info->firmware[i].optional ?
"optional" : "required");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
if (core_info->notes)
{
snprintf(tmp, sizeof(tmp), "Core notes: ");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
for (i = 0; i < core_info->note_list->size; i++)
{
snprintf(tmp, sizeof(tmp), " %s",
core_info->note_list->elems[i].data);
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
else
menu_list_push(info->list,
"No information available.", "",
MENU_SETTINGS_CORE_OPTION_NONE, 0);
return 0;
}
int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
{
int ret = 0;
@ -680,6 +814,13 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
ret = menu_displaylist_parse_core_options(info);
need_push = true;
break;
case DISPLAYLIST_CORE_INFO:
menu_list_clear(info->list);
ret = menu_displaylist_parse_core_info(info);
need_push = true;
break;
case DISPLAYLIST_CORES_ALL:

View File

@ -40,6 +40,7 @@ enum
DISPLAYLIST_CORES_UPDATER,
DISPLAYLIST_CORES_DETECTED,
DISPLAYLIST_CORE_OPTIONS,
DISPLAYLIST_CORE_INFO,
DISPLAYLIST_PERFCOUNTER_SELECTION,
DISPLAYLIST_PERFCOUNTERS_CORE,
DISPLAYLIST_PERFCOUNTERS_FRONTEND,

View File

@ -130,145 +130,15 @@ static int create_string_list_rdb_entry_int(const char *desc, const char *label,
static int deferred_push_core_information(void *data, void *userdata,
const char *path, const char *label, unsigned type)
{
unsigned i;
core_info_t *info = NULL;
file_list_t *list = (file_list_t*)data;
file_list_t *menu_list = (file_list_t*)userdata;
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
menu_displaylist_info_t info = {0};
if (!list || !menu_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));
info = (core_info_t*)global->core_info_current;
menu_list_clear(list);
if (info && info->data)
{
char tmp[PATH_MAX_LENGTH];
snprintf(tmp, sizeof(tmp), "Core name: %s",
info->core_name ? info->core_name : "");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(tmp, sizeof(tmp), "Core label: %s",
info->display_name ? info->display_name : "");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
if (info->systemname)
{
snprintf(tmp, sizeof(tmp), "System name: %s",
info->systemname);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->system_manufacturer)
{
snprintf(tmp, sizeof(tmp), "System manufacturer: %s",
info->system_manufacturer);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->categories_list)
{
strlcpy(tmp, "Categories: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
info->categories_list, ", ");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->authors_list)
{
strlcpy(tmp, "Authors: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
info->authors_list, ", ");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->permissions_list)
{
strlcpy(tmp, "Permissions: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
info->permissions_list, ", ");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->licenses_list)
{
strlcpy(tmp, "License(s): ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
info->licenses_list, ", ");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->supported_extensions_list)
{
strlcpy(tmp, "Supported extensions: ", sizeof(tmp));
string_list_join_concat(tmp, sizeof(tmp),
info->supported_extensions_list, ", ");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->firmware_count > 0)
{
core_info_list_update_missing_firmware(
global->core_info, info->path,
settings->system_directory);
menu_list_push(list, "Firmware: ", "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
for (i = 0; i < info->firmware_count; i++)
{
if (info->firmware[i].desc)
{
snprintf(tmp, sizeof(tmp), " name: %s",
info->firmware[i].desc ? info->firmware[i].desc : "");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
snprintf(tmp, sizeof(tmp), " status: %s, %s",
info->firmware[i].missing ?
"missing" : "present",
info->firmware[i].optional ?
"optional" : "required");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
if (info->notes)
{
snprintf(tmp, sizeof(tmp), "Core notes: ");
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
for (i = 0; i < info->note_list->size; i++)
{
snprintf(tmp, sizeof(tmp), " %s",
info->note_list->elems[i].data);
menu_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
else
menu_list_push(list,
"No information available.", "",
MENU_SETTINGS_CORE_OPTION_NONE, 0);
menu_driver_populate_entries(path, label, type);
return 0;
return menu_displaylist_push_list(&info, DISPLAYLIST_CORE_INFO);
}
static int deferred_push_system_information(void *data, void *userdata,