Create MENU_CONTENT_CTL_LOAD_PLAYLIST
This commit is contained in:
parent
b646b548ff
commit
24a04ce201
|
@ -556,6 +556,7 @@ static int action_ok_playlist_entry(const char *path,
|
|||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
size_t selection;
|
||||
menu_content_ctx_playlist_info_t playlist_info;
|
||||
uint32_t core_name_hash, core_path_hash;
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
|
@ -657,7 +658,10 @@ static int action_ok_playlist_entry(const char *path,
|
|||
content_playlist_write_file(tmp_playlist);
|
||||
}
|
||||
|
||||
menu_content_playlist_load(playlist, selection_ptr);
|
||||
playlist_info.data = playlist;
|
||||
playlist_info.idx = selection_ptr;
|
||||
|
||||
menu_content_ctl(MENU_CONTENT_CTL_LOAD_PLAYLIST, &playlist_info);
|
||||
|
||||
if (is_history)
|
||||
{
|
||||
|
|
|
@ -140,20 +140,29 @@ static bool menu_content_load(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* menu_content_playlist_load:
|
||||
* menu_content_load_from_playlist:
|
||||
* @playlist : Playlist handle.
|
||||
* @idx : Index in playlist.
|
||||
*
|
||||
* Initializes core and loads content based on playlist entry.
|
||||
**/
|
||||
void menu_content_playlist_load(void *data, unsigned idx)
|
||||
static bool menu_content_load_from_playlist(void *data)
|
||||
{
|
||||
unsigned idx;
|
||||
const char *core_path = NULL;
|
||||
const char *path = NULL;
|
||||
content_playlist_t *playlist = (content_playlist_t*)data;
|
||||
menu_content_ctx_playlist_info_t *info =
|
||||
(menu_content_ctx_playlist_info_t *)data;
|
||||
content_playlist_t *playlist = NULL;
|
||||
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
playlist = (content_playlist_t*)info->data;
|
||||
idx = info->idx;
|
||||
|
||||
if (!playlist)
|
||||
return;
|
||||
return false;
|
||||
|
||||
content_playlist_get_index(playlist,
|
||||
idx, &path, NULL, &core_path, NULL, NULL, NULL);
|
||||
|
@ -183,7 +192,7 @@ void menu_content_playlist_load(void *data, unsigned idx)
|
|||
RARCH_LOG("File at %s failed to load.\n", path_check);
|
||||
free(path_tolower);
|
||||
free(path_check);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
retro_fclose(fp);
|
||||
free(path_tolower);
|
||||
|
@ -200,6 +209,8 @@ void menu_content_playlist_load(void *data, unsigned idx)
|
|||
event_cmd_exec((void*)path);
|
||||
|
||||
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,6 +289,8 @@ bool menu_content_ctl(enum menu_content_ctl_state state, void *data)
|
|||
{
|
||||
case MENU_CONTENT_CTL_LOAD:
|
||||
return menu_content_load();
|
||||
case MENU_CONTENT_CTL_LOAD_PLAYLIST:
|
||||
return menu_content_load_from_playlist(data);
|
||||
case MENU_CONTENT_CTL_NONE:
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -28,22 +28,24 @@ extern "C" {
|
|||
enum menu_content_ctl_state
|
||||
{
|
||||
MENU_CONTENT_CTL_NONE = 0,
|
||||
|
||||
/* Loads content into currently selected core.
|
||||
* Will also optionally push the content entry
|
||||
* to the history playlist. */
|
||||
MENU_CONTENT_CTL_LOAD
|
||||
MENU_CONTENT_CTL_LOAD,
|
||||
|
||||
/* Initializes core and loads content
|
||||
* (based on playlist entry). */
|
||||
MENU_CONTENT_CTL_LOAD_PLAYLIST
|
||||
};
|
||||
|
||||
bool menu_content_ctl(enum menu_content_ctl_state state, void *data);
|
||||
typedef struct menu_content_ctx_playlist_info
|
||||
{
|
||||
void *data;
|
||||
unsigned idx;
|
||||
} menu_content_ctx_playlist_info_t;
|
||||
|
||||
/**
|
||||
* menu_content_playlist_load:
|
||||
* @playlist : Playlist handle.
|
||||
* @idx : Index in playlist.
|
||||
*
|
||||
* Initializes core and loads content based on playlist entry.
|
||||
**/
|
||||
void menu_content_playlist_load(void *data, unsigned index);
|
||||
bool menu_content_ctl(enum menu_content_ctl_state state, void *data);
|
||||
|
||||
/**
|
||||
* menu_content_defer_core:
|
||||
|
|
Loading…
Reference in New Issue