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;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
static void rgui_resolve_libretro_names(rgui_list_t *list, const char *dir)
|
||||
{
|
||||
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;
|
||||
unsigned type = 0;
|
||||
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)
|
||||
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};
|
||||
// Have to employ some heuristics on which cores to load.
|
||||
// Loading arbitrary libraries is dangerous (some libs can crash in global constructors ...)
|
||||
if (strstr(path, "retro") && libretro_get_system_info(core_path, &info, NULL))
|
||||
{
|
||||
char desc[256];
|
||||
snprintf(desc, sizeof(desc), "%s %s", info.library_name, info.library_version);
|
||||
libretro_free_system_info(&info);
|
||||
rgui_list_set_alt_at_offset(rgui->selection_buf, i, desc);
|
||||
}
|
||||
config_file_t *conf = config_file_new(info_path);
|
||||
if (!conf)
|
||||
continue;
|
||||
|
||||
char display_name[256];
|
||||
if (config_get_array(conf, "display_name", display_name, sizeof(display_name)))
|
||||
rgui_list_set_alt_at_offset(list, i, display_name);
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
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
|
||||
rgui_directory_parse(rgui, dir, menu_type, rgui->selection_buf);
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
if (menu_type == RGUI_SETTINGS_CORE)
|
||||
rgui_resolve_libretro_names(rgui->selection_buf, dir);
|
||||
#endif
|
||||
|
||||
// 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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user