Create task_push_content_load_nothing_with_new_core_from_menu

This commit is contained in:
twinaphex 2017-02-21 04:07:40 +01:00
parent e075ade748
commit 0b5118423d
4 changed files with 53 additions and 45 deletions

View File

@ -1076,15 +1076,21 @@ static int generic_action_ok(const char *path,
}
break;
case ACTION_OK_LOAD_CORE:
flush_type = MENU_SETTINGS;
if (generic_action_ok_file_load(action_path,
NULL, CORE_TYPE_PLAIN,
CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU) == 0)
{
content_ctx_info_t content_info = {0};
flush_type = MENU_SETTINGS;
if (!task_push_content_load_nothing_with_new_core_from_menu(
action_path, NULL,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL))
{
#ifndef HAVE_DYNAMIC
ret = -1;
ret = -1;
#endif
}
}
break;
case ACTION_OK_LOAD_CONFIG_FILE:

View File

@ -1256,6 +1256,36 @@ error:
return false;
}
bool task_push_content_load_nothing_with_new_core_from_menu(
const char *core_path,
const char *fullpath,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data)
{
if (!content_info)
return false;
/* Set libretro core path */
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
/* Load core */
command_event(CMD_EVENT_LOAD_CORE, NULL);
#ifndef HAVE_DYNAMIC
/* Fork core? */
if (!frontend_driver_set_fork(FRONTEND_FORK_CORE))
return false;
#endif
/* Preliminary stuff that has to be done before we
* load the actual content. Can differ per mode. */
retroarch_set_current_core_type(type, true);
return true;
}
bool task_push_content_load_default(
const char *core_path,
const char *fullpath,
@ -1297,7 +1327,6 @@ bool task_push_content_load_default(
/* First we determine if we are loading from a menu */
switch (mode)
{
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
#if defined(HAVE_VIDEO_PROCESSOR)
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
#endif
@ -1366,7 +1395,6 @@ bool task_push_content_load_default(
/* Set libretro core path */
switch (mode)
{
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_COMPANION_UI:
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
@ -1378,7 +1406,6 @@ bool task_push_content_load_default(
/* Load core */
switch (mode)
{
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
#ifdef HAVE_DYNAMIC
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
@ -1389,26 +1416,10 @@ bool task_push_content_load_default(
break;
}
#ifndef HAVE_DYNAMIC
/* Fork core? */
switch (mode)
{
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
if (!frontend_driver_set_fork(FRONTEND_FORK_CORE))
goto cleanup;
break;
default:
break;
}
#endif
/* 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_NEW_CORE_FROM_MENU:
retroarch_set_current_core_type(type, true);
break;
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);
@ -1465,17 +1476,10 @@ bool task_push_content_load_default(
}
/* Push quick menu onto menu stack */
switch (mode)
{
case CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU:
break;
default:
#ifdef HAVE_MENU
if (type != CORE_TYPE_DUMMY && mode != CONTENT_MODE_LOAD_FROM_CLI)
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
if (type != CORE_TYPE_DUMMY && mode != CONTENT_MODE_LOAD_FROM_CLI)
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
#endif
break;
}
if (content_ctx.directory_system)
free(content_ctx.directory_system);
@ -1517,14 +1521,6 @@ skip:
RARCH_LOG("Load content blocked. Reason: %s\n", msg_hash_to_str(MSG_FIRMWARE));
return true;
#ifndef HAVE_DYNAMIC
cleanup:
if (content_ctx.directory_system)
free(content_ctx.directory_system);
return false;
#endif
}
void content_get_status(

View File

@ -75,11 +75,10 @@ static void netplay_crc_scan_callback(void *task_data,
content_ctx_info_t content_info = {0};
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname);
task_push_content_load_default(
task_push_content_load_nothing_with_new_core_from_menu(
state->core_path, NULL,
&content_info,
CORE_TYPE_PLAIN,
CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU,
NULL, NULL);
task_push_content_load_nothing_with_current_core_from_menu(&content_info);

View File

@ -40,7 +40,6 @@ enum content_mode_load
{
CONTENT_MODE_LOAD_NONE = 0,
CONTENT_MODE_LOAD_FROM_CLI,
CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU,
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,
@ -143,6 +142,14 @@ bool task_push_decompress(
retro_task_callback_t cb,
void *user_data);
bool task_push_content_load_nothing_with_new_core_from_menu(
const char *core_path,
const char *fullpath,
content_ctx_info_t *content_info,
enum rarch_core_type type,
retro_task_callback_t cb,
void *user_data);
bool task_push_content_load_nothing_with_current_core_from_menu(content_ctx_info_t *content_info);
bool task_push_content_load_nothing_with_dummy_core(content_ctx_info_t *content_info);