mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
First working implementation of playlist associations
This commit is contained in:
parent
6edc7aa73e
commit
da1931ad9f
@ -538,7 +538,7 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
|
||||
*num_infos = supported;
|
||||
}
|
||||
|
||||
static core_info_t *find_core_info(core_info_list_t *list,
|
||||
core_info_t *core_info_find(core_info_list_t *list,
|
||||
const char *core)
|
||||
{
|
||||
size_t i;
|
||||
@ -579,7 +579,7 @@ void core_info_list_update_missing_firmware(core_info_list_t *core_info_list,
|
||||
if (!core_info_list || !core)
|
||||
return;
|
||||
|
||||
if (!(info = find_core_info(core_info_list, core)))
|
||||
if (!(info = core_info_find(core_info_list, core)))
|
||||
return;
|
||||
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
@ -607,7 +607,7 @@ void core_info_list_get_missing_firmware(core_info_list_t *core_info_list,
|
||||
*firmware = NULL;
|
||||
*num_firmware = 0;
|
||||
|
||||
if (!(info = find_core_info(core_info_list, core)))
|
||||
if (!(info = core_info_find(core_info_list, core)))
|
||||
return;
|
||||
|
||||
*firmware = info->firmware;
|
||||
|
@ -101,6 +101,9 @@ bool core_info_list_get_info(core_info_list_t *list,
|
||||
|
||||
const char *core_info_list_get_all_extensions(void);
|
||||
|
||||
core_info_t *core_info_find(core_info_list_t *list,
|
||||
const char *core);
|
||||
|
||||
bool core_info_list_get_display_name(core_info_list_t *list,
|
||||
const char *path, char *buf, size_t size);
|
||||
|
||||
|
@ -466,7 +466,6 @@ static int action_ok_playlist_entry(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
size_t selection;
|
||||
char new_core_path[PATH_MAX_LENGTH];
|
||||
uint32_t core_name_hash, core_path_hash;
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
@ -526,11 +525,33 @@ static int action_ok_playlist_entry(const char *path,
|
||||
(core_name_hash == MENU_VALUE_DETECT)
|
||||
)
|
||||
{
|
||||
if (!menu_playlist_find_associated_core(menu->db_playlist_file, new_core_path, sizeof(new_core_path)))
|
||||
char new_core_path[PATH_MAX_LENGTH];
|
||||
core_info_t *core_info = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
const char *path_base = path_basename(menu->db_playlist_file);
|
||||
bool found_associated_core = menu_playlist_find_associated_core(
|
||||
path_base, new_core_path, sizeof(new_core_path));
|
||||
|
||||
if (!(core_info = core_info_find(global->core_info.list, new_core_path)))
|
||||
found_associated_core = false;
|
||||
|
||||
if (found_associated_core)
|
||||
{
|
||||
char new_display_name[PATH_MAX_LENGTH];
|
||||
|
||||
strlcpy(new_display_name, core_info->display_name, sizeof(new_display_name));
|
||||
content_playlist_update(menu->playlist, selection_ptr,
|
||||
menu->playlist->entries[selection_ptr].path, menu->playlist->entries[selection_ptr].label,
|
||||
new_core_path , new_display_name,
|
||||
menu->playlist->entries[selection_ptr].crc32,
|
||||
menu->playlist->entries[selection_ptr].db_name);
|
||||
content_playlist_write_file(menu->playlist);
|
||||
}
|
||||
else
|
||||
return action_ok_file_load_with_detect_core(entry_path, label, type, selection_ptr, entry_idx);
|
||||
}
|
||||
|
||||
rarch_playlist_load_content(playlist, new_core_path, selection_ptr);
|
||||
rarch_playlist_load_content(playlist, selection_ptr);
|
||||
|
||||
if (is_history)
|
||||
{
|
||||
|
@ -1491,10 +1491,10 @@ void rarch_main_deinit(void)
|
||||
*
|
||||
* Initializes core and loads content based on playlist entry.
|
||||
**/
|
||||
void rarch_playlist_load_content(void *data, const char *core_path, unsigned idx)
|
||||
void rarch_playlist_load_content(void *data, unsigned idx)
|
||||
{
|
||||
unsigned i;
|
||||
char new_core_path[PATH_MAX_LENGTH];
|
||||
const char *core_path = NULL;
|
||||
const char *path = NULL;
|
||||
char *path_check = NULL;
|
||||
char *path_tolower = NULL;
|
||||
@ -1508,9 +1508,6 @@ void rarch_playlist_load_content(void *data, const char *core_path, unsigned idx
|
||||
if (!playlist)
|
||||
return;
|
||||
|
||||
if (!core_path)
|
||||
core_path = new_core_path;
|
||||
|
||||
content_playlist_get_index(playlist,
|
||||
idx, &path, NULL, &core_path, NULL, NULL, NULL);
|
||||
|
||||
|
@ -165,12 +165,11 @@ void rarch_main_deinit(void);
|
||||
/**
|
||||
* rarch_playlist_load_content:
|
||||
* @playlist : Playlist handle.
|
||||
* @path : Path to associated core (optional).
|
||||
* @idx : Index in playlist.
|
||||
*
|
||||
* Initializes core and loads content based on playlist entry.
|
||||
**/
|
||||
void rarch_playlist_load_content(void *data, const char *core_path, unsigned index);
|
||||
void rarch_playlist_load_content(void *data, unsigned index);
|
||||
|
||||
/**
|
||||
* rarch_defer_core:
|
||||
|
Loading…
x
Reference in New Issue
Block a user