mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 19:21:27 +00:00
(core_info.c) CLeanups
This commit is contained in:
parent
c501ee6057
commit
bcccc27205
58
core_info.c
58
core_info.c
@ -709,9 +709,11 @@ bool core_info_unsupported_content_path(const char *path)
|
||||
{
|
||||
const core_info_t *info = &core_info_curr_list->list[i];
|
||||
|
||||
if (string_list_find_elem(info->supported_extensions_list, "zip") ||
|
||||
string_list_find_elem(info->supported_extensions_list, "7z"))
|
||||
return false;
|
||||
if ( !string_list_find_elem(info->supported_extensions_list, "zip")
|
||||
&& !string_list_find_elem(info->supported_extensions_list, "7z"))
|
||||
continue;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -794,12 +796,15 @@ bool core_info_list_get_display_name(core_info_list_t *core_info_list,
|
||||
for (i = 0; i < core_info_list->count; i++)
|
||||
{
|
||||
const core_info_t *info = &core_info_list->list[i];
|
||||
if (string_is_equal(path_basename(info->path), path_basename(path))
|
||||
&& info->display_name)
|
||||
{
|
||||
strlcpy(s, info->display_name, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!string_is_equal(path_basename(info->path), path_basename(path)))
|
||||
continue;
|
||||
|
||||
if (!info->display_name)
|
||||
continue;
|
||||
|
||||
strlcpy(s, info->display_name, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -807,40 +812,25 @@ bool core_info_list_get_display_name(core_info_list_t *core_info_list,
|
||||
|
||||
bool core_info_get_display_name(const char *path, char *s, size_t len)
|
||||
{
|
||||
char *core_name = NULL;
|
||||
bool ret = true;
|
||||
char *display_name = NULL;
|
||||
config_file_t *conf = NULL;
|
||||
|
||||
if (!path_file_exists(path))
|
||||
return false;
|
||||
|
||||
conf = config_file_new(path);
|
||||
config_file_t *conf = config_file_new(path);
|
||||
|
||||
if (!conf)
|
||||
return false;
|
||||
|
||||
config_get_string(conf, "corename",
|
||||
&core_name);
|
||||
config_get_string(conf, "display_name",
|
||||
&display_name);
|
||||
|
||||
if (!core_name || !display_name)
|
||||
{
|
||||
ret = false;
|
||||
goto error;
|
||||
}
|
||||
|
||||
config_file_free(conf);
|
||||
config_get_string(conf, "display_name", &display_name);
|
||||
|
||||
snprintf(s, len,"%s",display_name);
|
||||
|
||||
free(core_name);
|
||||
free(display_name);
|
||||
|
||||
return true;
|
||||
if (display_name)
|
||||
snprintf(s, len, "%s", display_name);
|
||||
|
||||
error:
|
||||
config_file_free(conf);
|
||||
if (core_name)
|
||||
free(core_name);
|
||||
if (display_name)
|
||||
free(display_name);
|
||||
return false;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -181,16 +181,20 @@ static void print_buf_lines(file_list_t *list, char *buf,
|
||||
path_remove_extension(core_path);
|
||||
|
||||
last = (char*)strrchr(core_path, '_');
|
||||
|
||||
if (!string_is_empty(last))
|
||||
{
|
||||
if (!string_is_equal(last, "_libretro"))
|
||||
*last = '\0';
|
||||
}
|
||||
|
||||
strlcat(core_path,
|
||||
file_path_str(FILE_PATH_CORE_INFO_EXTENSION),
|
||||
sizeof(core_path));
|
||||
|
||||
if (core_info_get_display_name(
|
||||
if (
|
||||
path_file_exists(core_path)
|
||||
&& core_info_get_display_name(
|
||||
core_path, display_name, sizeof(display_name)))
|
||||
menu_entries_set_alt_at_offset(list, j, display_name);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user