Move command_event_cmd_exec to tasks/task_content.c

This commit is contained in:
twinaphex 2016-05-16 14:58:08 +02:00
parent 923d0a879b
commit a687c47f7e
3 changed files with 31 additions and 34 deletions

View File

@ -1548,34 +1548,6 @@ static void command_event_main_state(unsigned cmd)
RARCH_LOG("%s\n", msg); RARCH_LOG("%s\n", msg);
} }
static bool command_event_cmd_exec(void *data)
{
char *fullpath = NULL;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
if (fullpath != data)
{
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
if (data)
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, data);
}
#if defined(HAVE_DYNAMIC)
#ifdef HAVE_MENU
if (!menu_content_ctl(MENU_CONTENT_CTL_LOAD, NULL))
{
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
return false;
}
#endif
#else
frontend_driver_set_fork(FRONTEND_FORK_CORE_WITH_ARGS);
#endif
return true;
}
/** /**
* command_event: * command_event:
* @cmd : Event command index. * @cmd : Event command index.
@ -2331,8 +2303,6 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_SET_FRAME_LIMIT: case CMD_EVENT_SET_FRAME_LIMIT:
runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL); runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL);
break; break;
case CMD_EVENT_EXEC:
return command_event_cmd_exec(data);
case CMD_EVENT_NONE: case CMD_EVENT_NONE:
default: default:
return false; return false;

View File

@ -208,8 +208,7 @@ enum event_command
CMD_EVENT_FULLSCREEN_TOGGLE, CMD_EVENT_FULLSCREEN_TOGGLE,
CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG, CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG,
CMD_EVENT_VOLUME_UP, CMD_EVENT_VOLUME_UP,
CMD_EVENT_VOLUME_DOWN, CMD_EVENT_VOLUME_DOWN
CMD_EVENT_EXEC
}; };
#ifdef HAVE_COMMAND #ifdef HAVE_COMMAND

View File

@ -28,6 +28,34 @@
/* TODO/FIXME - turn this into actual task */ /* TODO/FIXME - turn this into actual task */
static bool command_event_cmd_exec(void *data)
{
char *fullpath = NULL;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
if (fullpath != data)
{
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
if (data)
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, data);
}
#if defined(HAVE_DYNAMIC)
#ifdef HAVE_MENU
if (!menu_content_ctl(MENU_CONTENT_CTL_LOAD, NULL))
{
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
return false;
}
#endif
#else
frontend_driver_set_fork(FRONTEND_FORK_CORE_WITH_ARGS);
#endif
return true;
}
bool rarch_task_push_content_load_default( bool rarch_task_push_content_load_default(
const char *core_path, const char *core_path,
const char *fullpath, const char *fullpath,
@ -113,7 +141,7 @@ bool rarch_task_push_content_load_default(
char *fullpath = NULL; char *fullpath = NULL;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
command_event(CMD_EVENT_EXEC, (void*)fullpath); command_event_cmd_exec((void*)fullpath);
command_event(CMD_EVENT_QUIT, NULL); command_event(CMD_EVENT_QUIT, NULL);
} }
#endif #endif
@ -126,7 +154,7 @@ bool rarch_task_push_content_load_default(
else else
menu_driver_ctl(RARCH_MENU_CTL_SET_LOAD_NO_CONTENT, NULL); menu_driver_ctl(RARCH_MENU_CTL_SET_LOAD_NO_CONTENT, NULL);
if (!command_event(CMD_EVENT_EXEC, (void*)fullpath)) if (!command_event_cmd_exec((void*)fullpath))
return false; return false;
command_event(CMD_EVENT_LOAD_CORE, NULL); command_event(CMD_EVENT_LOAD_CORE, NULL);