It should now properly show supported roms again when no

core info file is found and we have already loaded a
core
This commit is contained in:
twinaphex 2017-04-29 20:27:40 +02:00
parent b303283ac3
commit 8f32801292
3 changed files with 89 additions and 6 deletions

View File

@ -695,13 +695,57 @@ static int general_push(menu_displaylist_info_t *info,
}
break;
case PUSH_DETECT_CORE_LIST:
if (list && !string_is_empty(list->all_ext))
strlcpy(info->exts, list->all_ext, sizeof(info->exts));
else if (system_menu->valid_extensions)
{
if (!string_is_empty(system_menu->valid_extensions))
strlcpy(info->exts, system_menu->valid_extensions,
sizeof(info->exts));
char newstring[PATH_MAX_LENGTH];
union string_list_elem_attr attr;
struct string_list *str_list2 = string_list_new();
newstring[0] = '\0';
attr.i = 0;
if (system_menu->valid_extensions)
{
if (!string_is_empty(system_menu->valid_extensions))
{
unsigned x;
struct string_list *str_list = string_split(system_menu->valid_extensions, "|");
for (x = 0; x < str_list->size; x++)
{
const char *elem = str_list->elems[x].data;
string_list_append(str_list2, elem, attr);
}
string_list_free(str_list);
}
}
if (menu_entries_current_core_is_no_core())
{
if (list && !string_is_empty(list->all_ext))
{
unsigned x;
struct string_list *str_list = string_split(list->all_ext, "|");
for (x = 0; x < str_list->size; x++)
{
if (!string_list_find_elem(str_list2, str_list->elems[x].data))
{
const char *elem = str_list->elems[x].data;
string_list_append(str_list2, elem, attr);
}
}
string_list_free(str_list);
}
}
string_list_join_concat(newstring, sizeof(newstring),
str_list2, "|");
strlcpy(info->exts, newstring, sizeof(info->exts));
string_list_free(str_list2);
}
break;
}

View File

@ -258,6 +258,41 @@ int menu_entries_get_title(char *s, size_t len)
return 0;
}
int menu_entries_get_core_name(char *s, size_t len)
{
struct retro_system_info *system = NULL;
rarch_system_info_t *info = NULL;
const char *core_name = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
core_name = system->library_name;
info = runloop_get_system_info();
if (string_is_empty(core_name) && info)
core_name = info->info.library_name;
if (string_is_empty(core_name))
core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
snprintf(s, len, "%s", core_name);
return 0;
}
bool menu_entries_current_core_is_no_core(void)
{
char corename[255];
const char *no_core_str = NULL;
corename[0] = '\0';
menu_entries_get_core_name(corename, sizeof(corename));
no_core_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
return string_is_equal(corename, no_core_str);
}
/* Sets 's' to the name of the current core
* (shown at the top of the UI). */

View File

@ -136,8 +136,12 @@ void menu_entries_get(size_t i, void *data_entry);
int menu_entries_get_title(char *title, size_t title_len);
bool menu_entries_current_core_is_no_core(void);
int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
int menu_entries_get_core_name(char *s, size_t len);
file_list_t *menu_entries_get_selection_buf_ptr(size_t idx);
file_list_t *menu_entries_get_menu_stack_ptr(size_t idx);