Skip to content

Commit

Permalink
Move command_event_cmd_exec to tasks/task_content.c
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed May 16, 2016
1 parent 923d0a8 commit a687c47
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 34 deletions.
30 changes: 0 additions & 30 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,34 +1548,6 @@ static void command_event_main_state(unsigned cmd)
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:
* @cmd : Event command index.
Expand Down Expand Up @@ -2331,8 +2303,6 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_SET_FRAME_LIMIT:
runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL);
break;
case CMD_EVENT_EXEC:
return command_event_cmd_exec(data);
case CMD_EVENT_NONE:
default:
return false;
Expand Down
3 changes: 1 addition & 2 deletions command.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ enum event_command
CMD_EVENT_FULLSCREEN_TOGGLE,
CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG,
CMD_EVENT_VOLUME_UP,
CMD_EVENT_VOLUME_DOWN,
CMD_EVENT_EXEC
CMD_EVENT_VOLUME_DOWN
};

#ifdef HAVE_COMMAND
Expand Down
32 changes: 30 additions & 2 deletions tasks/task_content.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,34 @@

/* 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(
const char *core_path,
const char *fullpath,
Expand Down Expand Up @@ -113,7 +141,7 @@ bool rarch_task_push_content_load_default(
char *fullpath = NULL;

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);
}
#endif
Expand All @@ -126,7 +154,7 @@ bool rarch_task_push_content_load_default(
else
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;

command_event(CMD_EVENT_LOAD_CORE, NULL);
Expand Down

0 comments on commit a687c47

Please sign in to comment.