mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Backport this
This commit is contained in:
parent
d53b245528
commit
8b93439738
@ -1179,6 +1179,59 @@ static void menu_action_setting_disp_set_label_core_option_create(
|
||||
strlcpy(s2, path, len2);
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_playlist_associations(file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
const char *label,
|
||||
char *s, size_t len,
|
||||
const char *entry_label,
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
strlcpy(s2, path, len2);
|
||||
char playlist_name_with_ext[PATH_MAX_LENGTH];
|
||||
bool found_matching_core_association = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *str_list = string_split(settings->playlist_names, ";");
|
||||
struct string_list *str_list2 = string_split(settings->playlist_cores, ";");
|
||||
|
||||
*s = '\0';
|
||||
*w = 19;
|
||||
|
||||
strlcpy(playlist_name_with_ext, path, sizeof(playlist_name_with_ext));
|
||||
strlcat(playlist_name_with_ext, ".lpl", sizeof(playlist_name_with_ext));
|
||||
|
||||
for (i = 0; i < str_list->size; i++)
|
||||
{
|
||||
if (string_is_equal(str_list->elems[i].data, playlist_name_with_ext))
|
||||
{
|
||||
if (str_list->size != str_list2->size)
|
||||
break;
|
||||
|
||||
if (str_list2->elems[i].data == NULL)
|
||||
break;
|
||||
|
||||
found_matching_core_association = true;
|
||||
strlcpy(s, str_list2->elems[i].data, len);
|
||||
}
|
||||
}
|
||||
|
||||
string_list_free(str_list);
|
||||
string_list_free(str_list2);
|
||||
|
||||
if (string_is_equal(s, "DETECT") || !found_matching_core_association)
|
||||
strlcpy(s, "N/A", len);
|
||||
else
|
||||
{
|
||||
char buf[PATH_MAX_LENGTH];
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
core_info_get_list(&list);
|
||||
|
||||
if (core_info_list_get_display_name(list, s, buf, sizeof(buf)))
|
||||
strlcpy(s, buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label(file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
const char *label,
|
||||
@ -1208,50 +1261,7 @@ static void menu_action_setting_disp_set_label(file_list_t* list,
|
||||
break;
|
||||
}
|
||||
|
||||
if (type >= MENU_SETTINGS_PLAYLIST_ASSOCIATION_START)
|
||||
{
|
||||
char playlist_name_with_ext[PATH_MAX_LENGTH];
|
||||
unsigned i;
|
||||
bool found_matching_core_association = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *str_list = string_split(settings->playlist_names, ";");
|
||||
struct string_list *str_list2 = string_split(settings->playlist_cores, ";");
|
||||
|
||||
strlcpy(playlist_name_with_ext, path, sizeof(playlist_name_with_ext));
|
||||
strlcat(playlist_name_with_ext, ".lpl", sizeof(playlist_name_with_ext));
|
||||
|
||||
for (i = 0; i < str_list->size; i++)
|
||||
{
|
||||
if (string_is_equal(str_list->elems[i].data, playlist_name_with_ext))
|
||||
{
|
||||
if (str_list->size != str_list2->size)
|
||||
break;
|
||||
|
||||
if (str_list2->elems[i].data == NULL)
|
||||
break;
|
||||
|
||||
found_matching_core_association = true;
|
||||
strlcpy(s, str_list2->elems[i].data, len);
|
||||
}
|
||||
}
|
||||
|
||||
string_list_free(str_list);
|
||||
string_list_free(str_list2);
|
||||
|
||||
if (string_is_equal(s, "DETECT") || !found_matching_core_association)
|
||||
strlcpy(s, "N/A", len);
|
||||
else
|
||||
{
|
||||
char buf[PATH_MAX_LENGTH];
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
core_info_get_list(&list);
|
||||
|
||||
if (core_info_list_get_display_name(list, s, buf, sizeof(buf)))
|
||||
strlcpy(s, buf, len);
|
||||
}
|
||||
}
|
||||
else if (type >= MENU_SETTINGS_CORE_OPTION_START)
|
||||
if (type >= MENU_SETTINGS_CORE_OPTION_START)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
const char *core_opt = NULL;
|
||||
@ -1535,6 +1545,13 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
|
||||
if (!cbs)
|
||||
return -1;
|
||||
|
||||
if (type >= MENU_SETTINGS_PLAYLIST_ASSOCIATION_START)
|
||||
{
|
||||
BIND_ACTION_GET_VALUE(cbs,
|
||||
menu_action_setting_disp_set_label_playlist_associations);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
|
||||
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user