mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 17:43:02 +00:00
Create task_push_content_load_content_from_playlist_from_menu
This commit is contained in:
parent
ba16bee5d1
commit
96210188b0
@ -1318,10 +1318,9 @@ static int action_ok_playlist_entry_collection(const char *path,
|
|||||||
{
|
{
|
||||||
menu_content_ctx_playlist_info_t playlist_info;
|
menu_content_ctx_playlist_info_t playlist_info;
|
||||||
char new_core_path[PATH_MAX_LENGTH];
|
char new_core_path[PATH_MAX_LENGTH];
|
||||||
|
content_ctx_info_t content_info = {0};
|
||||||
size_t selection = 0;
|
size_t selection = 0;
|
||||||
size_t selection_ptr = 0;
|
size_t selection_ptr = 0;
|
||||||
enum rarch_core_type action_type = CORE_TYPE_PLAIN;
|
|
||||||
enum content_mode_load content_enum_idx = CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU;
|
|
||||||
bool playlist_initialized = false;
|
bool playlist_initialized = false;
|
||||||
playlist_t *playlist = NULL;
|
playlist_t *playlist = NULL;
|
||||||
const char *entry_path = NULL;
|
const char *entry_path = NULL;
|
||||||
@ -1434,8 +1433,14 @@ static int action_ok_playlist_entry_collection(const char *path,
|
|||||||
playlist_get_index(playlist,
|
playlist_get_index(playlist,
|
||||||
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
|
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
return generic_action_ok_file_load(new_core_path, path,
|
|
||||||
action_type, content_enum_idx);
|
if (!task_push_content_load_content_from_playlist_from_menu(
|
||||||
|
new_core_path, path,
|
||||||
|
&content_info,
|
||||||
|
NULL, NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_playlist_entry(const char *path,
|
static int action_ok_playlist_entry(const char *path,
|
||||||
@ -1443,6 +1448,7 @@ static int action_ok_playlist_entry(const char *path,
|
|||||||
{
|
{
|
||||||
size_t selection;
|
size_t selection;
|
||||||
menu_content_ctx_playlist_info_t playlist_info;
|
menu_content_ctx_playlist_info_t playlist_info;
|
||||||
|
content_ctx_info_t content_info = {0};
|
||||||
size_t selection_ptr = 0;
|
size_t selection_ptr = 0;
|
||||||
playlist_t *playlist = g_defaults.content_history;
|
playlist_t *playlist = g_defaults.content_history;
|
||||||
const char *entry_path = NULL;
|
const char *entry_path = NULL;
|
||||||
@ -1517,14 +1523,20 @@ static int action_ok_playlist_entry(const char *path,
|
|||||||
playlist_get_index(playlist,
|
playlist_get_index(playlist,
|
||||||
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
|
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
return generic_action_ok_file_load(core_path, path,
|
if (!task_push_content_load_content_from_playlist_from_menu(
|
||||||
CORE_TYPE_PLAIN, CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU);
|
core_path, path,
|
||||||
|
&content_info,
|
||||||
|
NULL, NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_playlist_entry_start_content(const char *path,
|
static int action_ok_playlist_entry_start_content(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
menu_content_ctx_playlist_info_t playlist_info;
|
menu_content_ctx_playlist_info_t playlist_info;
|
||||||
|
content_ctx_info_t content_info = {0};
|
||||||
size_t selection = 0;
|
size_t selection = 0;
|
||||||
size_t selection_ptr = 0;
|
size_t selection_ptr = 0;
|
||||||
bool playlist_initialized = false;
|
bool playlist_initialized = false;
|
||||||
@ -1619,8 +1631,13 @@ static int action_ok_playlist_entry_start_content(const char *path,
|
|||||||
playlist_get_index(playlist,
|
playlist_get_index(playlist,
|
||||||
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
|
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
return generic_action_ok_file_load(core_path, path,
|
if (!task_push_content_load_content_from_playlist_from_menu(
|
||||||
CORE_TYPE_PLAIN, CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU);
|
core_path, path,
|
||||||
|
&content_info,
|
||||||
|
NULL, NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_cheat_apply_changes(const char *path,
|
static int action_ok_cheat_apply_changes(const char *path,
|
||||||
|
@ -1076,6 +1076,99 @@ error:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool task_push_content_load_content_from_playlist_from_menu(
|
||||||
|
const char *core_path,
|
||||||
|
const char *fullpath,
|
||||||
|
content_ctx_info_t *content_info,
|
||||||
|
retro_task_callback_t cb,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
content_information_ctx_t content_ctx;
|
||||||
|
|
||||||
|
bool loading_from_menu = false;
|
||||||
|
char *error_string = NULL;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
if (!content_info)
|
||||||
|
return false;
|
||||||
|
content_ctx.patch_is_blocked = rarch_ctl(RARCH_CTL_IS_PATCH_BLOCKED, NULL);
|
||||||
|
content_ctx.bios_is_missing = runloop_ctl(RUNLOOP_CTL_IS_MISSING_BIOS, NULL);
|
||||||
|
content_ctx.history_list_enable = false;
|
||||||
|
content_ctx.directory_system = NULL;
|
||||||
|
content_ctx.directory_cache = NULL;
|
||||||
|
content_ctx.valid_extensions = NULL;
|
||||||
|
content_ctx.block_extract = false;
|
||||||
|
content_ctx.need_fullpath = false;
|
||||||
|
content_ctx.set_supports_no_game_enable = false;
|
||||||
|
|
||||||
|
content_ctx.subsystem.data = NULL;
|
||||||
|
content_ctx.subsystem.size = 0;
|
||||||
|
|
||||||
|
if (settings)
|
||||||
|
{
|
||||||
|
content_ctx.history_list_enable = settings->history_list_enable;
|
||||||
|
|
||||||
|
if (!string_is_empty(settings->directory.system))
|
||||||
|
content_ctx.directory_system = strdup(settings->directory.system);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
if (!content_info->environ_get)
|
||||||
|
content_info->environ_get = menu_content_environment_get;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set libretro core path */
|
||||||
|
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
|
||||||
|
|
||||||
|
/* Is content required by this core? */
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
if (fullpath)
|
||||||
|
menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL);
|
||||||
|
else
|
||||||
|
menu_driver_ctl(RARCH_MENU_CTL_SET_LOAD_NO_CONTENT, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* On targets that have no dynamic core loading support, we'd
|
||||||
|
* execute the new core from this point. If this returns false,
|
||||||
|
* we assume we can dynamically load the core. */
|
||||||
|
if (!command_event_cmd_exec(fullpath, &content_ctx, CONTENT_MODE_LOAD_NONE, &error_string))
|
||||||
|
goto error;
|
||||||
|
#ifndef HAVE_DYNAMIC
|
||||||
|
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Load core */
|
||||||
|
#ifdef HAVE_DYNAMIC
|
||||||
|
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (content_ctx.directory_system)
|
||||||
|
free(content_ctx.directory_system);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
error:
|
||||||
|
|
||||||
|
if (error_string)
|
||||||
|
{
|
||||||
|
runloop_msg_queue_push(error_string, 2, 90, true);
|
||||||
|
RARCH_ERR(error_string);
|
||||||
|
free(error_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (content_ctx.directory_system)
|
||||||
|
free(content_ctx.directory_system);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool task_push_content_load_default(
|
bool task_push_content_load_default(
|
||||||
const char *core_path,
|
const char *core_path,
|
||||||
const char *fullpath,
|
const char *fullpath,
|
||||||
@ -1144,7 +1237,6 @@ bool task_push_content_load_default(
|
|||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU:
|
|
||||||
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU:
|
||||||
@ -1193,47 +1285,12 @@ bool task_push_content_load_default(
|
|||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
|
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU:
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
|
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is content required by this core? */
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU:
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
if (fullpath)
|
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL);
|
|
||||||
else
|
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_LOAD_NO_CONTENT, NULL);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On targets that have no dynamic core loading support, we'd
|
|
||||||
* execute the new core from this point. If this returns false,
|
|
||||||
* we assume we can dynamically load the core. */
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU:
|
|
||||||
if (!command_event_cmd_exec(fullpath, &content_ctx, mode, &error_string))
|
|
||||||
goto error;
|
|
||||||
#ifndef HAVE_DYNAMIC
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load core */
|
/* Load core */
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
@ -1241,7 +1298,6 @@ bool task_push_content_load_default(
|
|||||||
#ifdef HAVE_DYNAMIC
|
#ifdef HAVE_DYNAMIC
|
||||||
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
|
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
|
||||||
case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU:
|
|
||||||
#endif
|
#endif
|
||||||
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
||||||
break;
|
break;
|
||||||
@ -1329,7 +1385,6 @@ bool task_push_content_load_default(
|
|||||||
/* Push quick menu onto menu stack */
|
/* Push quick menu onto menu stack */
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU:
|
|
||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1357,7 +1412,6 @@ error:
|
|||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU:
|
|
||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
|
||||||
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
|
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
|
||||||
|
@ -49,8 +49,7 @@ enum content_mode_load
|
|||||||
CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU,
|
CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU,
|
||||||
CONTENT_MODE_LOAD_CONTENT_WITH_IMAGEVIEWER_CORE_FROM_MENU,
|
CONTENT_MODE_LOAD_CONTENT_WITH_IMAGEVIEWER_CORE_FROM_MENU,
|
||||||
CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_COMPANION_UI,
|
CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_COMPANION_UI,
|
||||||
CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI,
|
CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI
|
||||||
CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nbio_status_enum
|
enum nbio_status_enum
|
||||||
@ -147,6 +146,13 @@ bool task_push_decompress(
|
|||||||
|
|
||||||
bool task_push_content_load_nothing_with_dummy_core(content_ctx_info_t *content_info);
|
bool task_push_content_load_nothing_with_dummy_core(content_ctx_info_t *content_info);
|
||||||
|
|
||||||
|
bool task_push_content_load_content_from_playlist_from_menu(
|
||||||
|
const char *core_path,
|
||||||
|
const char *fullpath,
|
||||||
|
content_ctx_info_t *content_info,
|
||||||
|
retro_task_callback_t cb,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
bool task_push_content_load_default(
|
bool task_push_content_load_default(
|
||||||
const char *core_path,
|
const char *core_path,
|
||||||
const char *fullpath,
|
const char *fullpath,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user