(Menu) Dehardcode MENU_SETTINGS_CORE_INFO

This commit is contained in:
twinaphex 2014-09-03 23:47:24 +02:00
parent a88198a12e
commit d5956f768b
3 changed files with 89 additions and 91 deletions

View File

@ -646,7 +646,7 @@ unsigned menu_common_type_is(const char *label, unsigned type)
type == MENU_SETTINGS ||
type == MENU_SETTINGS_GENERAL_OPTIONS ||
type == MENU_SETTINGS_CORE_OPTIONS ||
type == MENU_SETTINGS_CORE_INFO ||
!strcmp(label, "core_information") ||
type == MENU_SETTINGS_VIDEO_OPTIONS ||
type == MENU_SETTINGS_FONT_OPTIONS ||
type == MENU_SETTINGS_SHADER_OPTIONS ||

View File

@ -106,7 +106,6 @@ typedef enum
// settings options are done here too
MENU_SETTINGS_CORE,
MENU_SETTINGS_CORE_INFO,
MENU_SETTINGS_DEFERRED_CORE,
MENU_SETTINGS_CONFIG,
MENU_SETTINGS_CORE_OPTIONS,

View File

@ -107,7 +107,7 @@ int menu_entries_push_list(menu_handle_t *menu,
add_setting_entry(menu,list,"detect_core_list", 0, setting_data);
add_setting_entry(menu,list,"load_content", 0, setting_data);
add_setting_entry(menu,list,"core_options", MENU_SETTINGS_CORE_OPTIONS, setting_data);
add_setting_entry(menu,list,"core_information", MENU_SETTINGS_CORE_INFO, setting_data);
add_setting_entry(menu,list,"core_information", 0, setting_data);
add_setting_entry(menu,list,"settings", MENU_SETTINGS_OPTIONS, setting_data);
add_setting_entry(menu,list,"performance_counters", MENU_FILE_SWITCH, setting_data);
add_setting_entry(menu,list,"savestate", 0, setting_data);
@ -183,6 +183,93 @@ int menu_entries_push_list(menu_handle_t *menu,
file_list_push(list, "Core Counters", "",
MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO, 0);
}
else if (!strcmp(label, "core_information"))
{
core_info_t *info = (core_info_t*)g_extern.core_info_current;
file_list_clear(list);
if (info->data)
{
snprintf(tmp, sizeof(tmp), "Core name: %s",
info->display_name ? info->display_name : "");
file_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, ", ");
file_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, ", ");
file_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, ", ");
file_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->firmware_count > 0)
{
core_info_list_update_missing_firmware(
g_extern.core_info, info->path,
g_settings.system_directory);
file_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 : "");
file_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");
file_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
if (info->notes)
{
snprintf(tmp, sizeof(tmp), "Core notes: ");
file_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);
file_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
else
file_list_push(list,
"No information available.", "",
MENU_SETTINGS_CORE_OPTION_NONE, 0);
}
else
{
switch (menu_type)
@ -319,94 +406,6 @@ int menu_entries_push_list(menu_handle_t *menu,
file_list_push(list, "No options available.", "",
MENU_SETTINGS_CORE_OPTION_NONE, 0);
break;
case MENU_SETTINGS_CORE_INFO:
{
core_info_t *info = (core_info_t*)g_extern.core_info_current;
file_list_clear(list);
if (info->data)
{
snprintf(tmp, sizeof(tmp), "Core name: %s",
info->display_name ? info->display_name : "");
file_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, ", ");
file_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, ", ");
file_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, ", ");
file_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (info->firmware_count > 0)
{
core_info_list_update_missing_firmware(
g_extern.core_info, info->path,
g_settings.system_directory);
file_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 : "");
file_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");
file_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
if (info->notes)
{
snprintf(tmp, sizeof(tmp), "Core notes: ");
file_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);
file_list_push(list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0);
}
}
}
else
file_list_push(list,
"No information available.", "",
MENU_SETTINGS_CORE_OPTION_NONE, 0);
}
break;
case MENU_SETTINGS_OPTIONS:
file_list_clear(list);
add_setting_entry(menu,list,"Driver Options", MENU_SETTINGS_DRIVERS, setting_data);