Create task_push_start_builtin_core

This commit is contained in:
twinaphex 2017-02-21 17:22:04 +01:00
parent 9087bc82a0
commit 03948eafd3
3 changed files with 52 additions and 44 deletions

View File

@ -2156,17 +2156,29 @@ static int action_ok_load_core_deferred(const char *path,
static int action_ok_start_net_retropad_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_file_load(NULL, NULL,
CORE_TYPE_FFMPEG,
CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU);
content_ctx_info_t content_info = {0};
if (!task_push_start_builtin_core(
&content_info,
CORE_TYPE_NETRETROPAD,
NULL, NULL))
return -1;
return 0;
}
static int action_ok_start_video_processor_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_file_load(NULL, NULL,
content_ctx_info_t content_info = {0};
if (!task_push_start_builtin_core(
&content_info,
CORE_TYPE_VIDEO_PROCESSOR,
CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU);
NULL, NULL))
return -1;
return 0;
}
#ifdef HAVE_FFMPEG

View File

@ -1448,8 +1448,6 @@ static bool task_loading_from_menu(enum content_mode_load mode)
{
switch (mode)
{
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_CONTENT_WITH_CURRENT_CORE_FROM_MENU:
case CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU:
case CONTENT_MODE_LOAD_CONTENT_WITH_IMAGEVIEWER_CORE_FROM_MENU:
@ -1514,6 +1512,36 @@ bool task_push_load_content_from_cli(
return true;
}
bool task_push_start_builtin_core(
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data)
{
/* Clear content path */
path_clear(RARCH_PATH_CONTENT);
/* Preliminary stuff that has to be done before we
* load the actual content. Can differ per mode. */
retroarch_set_current_core_type(type, true);
/* Load content */
if (!task_load_content_callback(content_info, true, false))
{
#ifdef HAVE_MENU
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
#endif
return false;
}
/* Push quick menu onto menu stack */
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
#endif
return true;
}
bool task_push_content_load_default(
const char *core_path,
const char *fullpath,
@ -1523,17 +1551,6 @@ bool task_push_content_load_default(
retro_task_callback_t cb,
void *user_data)
{
/* Clear content path */
switch (mode)
{
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
path_clear(RARCH_PATH_CONTENT);
break;
default:
break;
}
/* Set content path */
switch (mode)
{
@ -1547,33 +1564,9 @@ bool task_push_content_load_default(
break;
}
/* Preliminary stuff that has to be done before we
* load the actual content. Can differ per mode. */
switch (mode)
{
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD)
retroarch_set_current_core_type(CORE_TYPE_NETRETROPAD, true);
break;
#endif
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
#ifdef HAVE_VIDEO_PROCESSOR
retroarch_set_current_core_type(CORE_TYPE_VIDEO_PROCESSOR, true);
break;
#endif
default:
break;
}
/* Load content */
switch (mode)
{
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD)
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
#endif
#ifdef HAVE_VIDEO_PROCESSOR
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
#endif
case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU:
case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_COMPANION_UI:
case CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU:

View File

@ -38,8 +38,6 @@ typedef int (*transfer_cb_t)(void *data, size_t len);
enum content_mode_load
{
CONTENT_MODE_LOAD_NONE = 0,
CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU,
CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU,
CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU,
CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU,
CONTENT_MODE_LOAD_CONTENT_WITH_IMAGEVIEWER_CORE_FROM_MENU,
@ -153,6 +151,11 @@ bool task_push_load_new_core(
retro_task_callback_t cb,
void *user_data);
bool task_push_start_builtin_core(content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_start_current_core(content_ctx_info_t *content_info);
bool task_push_start_dummy_core(content_ctx_info_t *content_info);