mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
Use info files to resolve libretro names.
This commit is contained in:
parent
a53680a57e
commit
091a6379eb
@ -200,7 +200,6 @@ static int rgui_core_setting_toggle(unsigned setting, rgui_action_t action)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DYNAMIC
|
|
||||||
static void rgui_resolve_libretro_names(rgui_list_t *list, const char *dir)
|
static void rgui_resolve_libretro_names(rgui_list_t *list, const char *dir)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < list->size; i++)
|
for (size_t i = 0; i < list->size; i++)
|
||||||
@ -208,28 +207,24 @@ static void rgui_resolve_libretro_names(rgui_list_t *list, const char *dir)
|
|||||||
const char *path;
|
const char *path;
|
||||||
unsigned type = 0;
|
unsigned type = 0;
|
||||||
rgui_list_get_at_offset(list, i, &path, &type);
|
rgui_list_get_at_offset(list, i, &path, &type);
|
||||||
|
|
||||||
char core_path[PATH_MAX];
|
|
||||||
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
|
||||||
|
|
||||||
if (type != RGUI_FILE_PLAIN)
|
if (type != RGUI_FILE_PLAIN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// TODO: If we standardize on .info files later, we could use them here perhaps.
|
char core_path[PATH_MAX];
|
||||||
|
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
||||||
|
char info_path[PATH_MAX];
|
||||||
|
fill_pathname(info_path, core_path, ".info", sizeof(info_path));
|
||||||
|
|
||||||
struct retro_system_info info = {0};
|
config_file_t *conf = config_file_new(info_path);
|
||||||
// Have to employ some heuristics on which cores to load.
|
if (!conf)
|
||||||
// Loading arbitrary libraries is dangerous (some libs can crash in global constructors ...)
|
continue;
|
||||||
if (strstr(path, "retro") && libretro_get_system_info(core_path, &info, NULL))
|
|
||||||
{
|
char display_name[256];
|
||||||
char desc[256];
|
if (config_get_array(conf, "display_name", display_name, sizeof(display_name)))
|
||||||
snprintf(desc, sizeof(desc), "%s %s", info.library_name, info.library_version);
|
rgui_list_set_alt_at_offset(list, i, display_name);
|
||||||
libretro_free_system_info(&info);
|
config_file_free(conf);
|
||||||
rgui_list_set_alt_at_offset(rgui->selection_buf, i, desc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, rgui_action_t action, unsigned menu_type)
|
static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, rgui_action_t action, unsigned menu_type)
|
||||||
{
|
{
|
||||||
@ -1345,10 +1340,8 @@ static int rgui_iterate(void *data, unsigned action)
|
|||||||
else
|
else
|
||||||
rgui_directory_parse(rgui, dir, menu_type, rgui->selection_buf);
|
rgui_directory_parse(rgui, dir, menu_type, rgui->selection_buf);
|
||||||
|
|
||||||
#ifdef HAVE_DYNAMIC
|
|
||||||
if (menu_type == RGUI_SETTINGS_CORE)
|
if (menu_type == RGUI_SETTINGS_CORE)
|
||||||
rgui_resolve_libretro_names(rgui->selection_buf, dir);
|
rgui_resolve_libretro_names(rgui->selection_buf, dir);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Before a refresh, we could have deleted a file on disk, causing
|
// Before a refresh, we could have deleted a file on disk, causing
|
||||||
// selection_ptr to suddendly be out of range. Ensure it doesn't overflow.
|
// selection_ptr to suddendly be out of range. Ensure it doesn't overflow.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user