Cleanup task_push_content_load_default

This commit is contained in:
twinaphex 2017-02-21 04:40:57 +01:00
parent 1582a47bb9
commit 409a7769c6

View File

@ -1394,8 +1394,6 @@ bool task_push_content_load_default(
content_information_ctx_t content_ctx;
bool loading_from_menu = false;
char *error_string = NULL;
settings_t *settings = config_get_ptr();
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);
@ -1410,14 +1408,6 @@ bool task_push_content_load_default(
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);
}
/* First we determine if we are loading from a menu */
switch (mode)
{
@ -1468,18 +1458,9 @@ bool task_push_content_load_default(
{
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
break;
default:
break;
}
/* Load core */
switch (mode)
{
#ifdef HAVE_DYNAMIC
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
#endif
command_event(CMD_EVENT_LOAD_CORE, NULL);
#endif
break;
default:
break;
@ -1518,20 +1499,69 @@ bool task_push_content_load_default(
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_COMPANION_UI:
case CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU:
case CONTENT_MODE_LOAD_CONTENT_WITH_IMAGEVIEWER_CORE_FROM_MENU:
{
bool ret = false;
char *error_string = NULL;
settings_t *settings = config_get_ptr();
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;
if (!content_info->environ_get)
content_info->environ_get = menu_content_environment_get;
#endif
task_push_content_update_firmware_status(&content_ctx);
task_push_content_update_firmware_status(&content_ctx);
if(
content_ctx.bios_is_missing &&
settings->check_firmware_before_loading)
goto skip;
if(
content_ctx.bios_is_missing &&
settings->check_firmware_before_loading)
{
runloop_msg_queue_push(msg_hash_to_str(MSG_FIRMWARE), 100, 500, true);
RARCH_LOG("Load content blocked. Reason: %s\n",
msg_hash_to_str(MSG_FIRMWARE));
if (!task_load_content(content_info, &content_ctx,
loading_from_menu, mode, &error_string))
goto error;
return true;
}
ret = task_load_content(content_info, &content_ctx,
loading_from_menu, mode, &error_string);
if (content_ctx.directory_system)
free(content_ctx.directory_system);
if (!ret)
{
if (error_string)
{
runloop_msg_queue_push(error_string, 2, 90, true);
RARCH_ERR(error_string);
free(error_string);
}
#ifdef HAVE_MENU
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:
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
break;
default:
break;
}
#endif
return false;
}
}
break;
case CONTENT_MODE_LOAD_NONE:
default:
@ -1544,44 +1574,6 @@ bool task_push_content_load_default(
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, 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
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:
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
break;
default:
break;
}
#endif
if (content_ctx.directory_system)
free(content_ctx.directory_system);
return false;
skip:
runloop_msg_queue_push(msg_hash_to_str(MSG_FIRMWARE), 100, 500, true);
RARCH_LOG("Load content blocked. Reason: %s\n", msg_hash_to_str(MSG_FIRMWARE));
return true;
}