Create menu_playlist_find_associated_core

This commit is contained in:
twinaphex 2015-10-31 16:27:48 +01:00
parent 0480ba4bd2
commit a509fc50b1
2 changed files with 35 additions and 19 deletions

View File

@ -514,6 +514,7 @@ static int action_ok_playlist_entry(const char *path,
#if 0
RARCH_LOG("path: %s, label: %s, core path: %s, core name: %s, idx: %d\n", entry_path, entry_label,
core_path, core_name, selection_ptr);
RARCH_LOG("playlist file: %s\n", menu->db_playlist_file);
#endif
core_path_hash = core_path ? menu_hash_calculate(core_path) : 0;
@ -523,7 +524,9 @@ static int action_ok_playlist_entry(const char *path,
(core_path_hash == MENU_VALUE_DETECT) &&
(core_name_hash == MENU_VALUE_DETECT)
)
{
return action_ok_file_load_with_detect_core(entry_path, label, type, selection_ptr, entry_idx);
}
rarch_playlist_load_content(playlist, selection_ptr);

View File

@ -2248,6 +2248,34 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool ho
return 0;
}
bool menu_playlist_find_associated_core(const char *path, char *s, size_t len)
{
bool ret = false;
unsigned j;
settings_t *settings = config_get_ptr();
struct string_list *existing_core_names = string_split(settings->playlist_names, ";");
struct string_list *existing_core_paths = string_split(settings->playlist_cores, ";");
for (j = 0; j < existing_core_names->size; j++)
{
if (!strcmp(path, existing_core_names->elems[j].data))
{
if (existing_core_paths)
{
const char *existing_core = existing_core_paths->elems[j].data;
if (existing_core)
strlcpy(s, existing_core, len);
}
break;
}
}
string_list_free(existing_core_names);
string_list_free(existing_core_paths);
return ret;
}
int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
{
size_t i;
@ -2483,23 +2511,9 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
char path_base[PATH_MAX_LENGTH] = {0};
char core_path[PATH_MAX_LENGTH] = {0};
const char *path = path_basename(str_list->elems[i].data);
struct string_list *existing_core_names = string_split(settings->playlist_names, ";");
struct string_list *existing_core_paths = string_split(settings->playlist_cores, ";");
for (j = 0; j < existing_core_names->size; j++)
{
if (!strcmp(path, existing_core_names->elems[j].data))
{
if (existing_core_paths)
{
const char *existing_core = existing_core_paths->elems[j].data;
if (existing_core)
strlcpy(core_path, existing_core, sizeof(core_path));
}
break;
}
}
if (!menu_playlist_find_associated_core(path, core_path, sizeof(core_path)))
strlcpy(core_path, "DETECT", sizeof(core_path));
strlcpy(path_base, path, sizeof(path_base));
@ -2514,8 +2528,6 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
path_base,
str_list->elems[i].data, MENU_SETTINGS_PLAYLIST_ASSOCIATION_START + i, 0, 0);
string_list_free(existing_core_names);
string_list_free(existing_core_paths);
}
strlcpy(settings->playlist_names, new_playlist_names, sizeof(settings->playlist_names));
@ -3100,6 +3112,7 @@ void menu_displaylist_push_list_process(menu_displaylist_info_t *info)
}
}
int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
{
menu_file_list_cbs_t *cbs = NULL;