Reimplement frontend_driver_set_fork

This commit is contained in:
twinaphex 2016-02-04 17:46:50 +01:00
parent 332f48f2df
commit 7a5db5a73a
8 changed files with 102 additions and 39 deletions

View File

@ -922,7 +922,7 @@ bool event_cmd_exec(void *data)
#if defined(HAVE_DYNAMIC)
rarch_ctl(RARCH_CTL_LOAD_CONTENT, NULL);
#else
frontend_driver_set_fork(true, true, false);
frontend_driver_set_fork(FRONTEND_FORK_CORE_WITH_ARGS);
#endif
return true;
@ -1375,7 +1375,7 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
break;
case EVENT_CMD_RESTART_RETROARCH:
if (!frontend_driver_set_fork(true, false, true))
if (!frontend_driver_set_fork(FRONTEND_FORK_SALAMANDER_RESTART))
return false;
break;
case EVENT_CMD_MENU_SAVE_CURRENT_CONFIG:

View File

@ -370,27 +370,38 @@ static void frontend_gx_process_args(int *argc, char *argv[])
}
#ifdef HW_RVL
static bool frontend_gx_set_fork(bool exitspawn, bool start_game, bool restart)
static bool frontend_gx_set_fork(enum frontend_fork fork_mode)
{
#ifndef IS_SALAMANDER
if (restart)
switch (fork_mode)
{
char new_path[PATH_MAX_LENGTH];
char salamander_name[PATH_MAX_LENGTH];
case FRONTEND_FORK_CORE:
exit_spawn = true;
break;
case FRONTEND_FORK_CORE_WITH_ARGS:
exit_spawn = true;
exitspawn_start_game = true;
break;
case FRONTEND_FORK_SALAMANDER_RESTART:
#ifndef IS_SALAMANDER
{
char new_path[PATH_MAX_LENGTH];
char salamander_name[PATH_MAX_LENGTH];
if (frontend_driver_get_salamander_basename(salamander_name,
sizeof(salamander_name)))
{
fill_pathname_join(new_path, g_defaults.dir.core,
salamander_name, sizeof(new_path));
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, new_path);
}
}
if (frontend_driver_get_salamander_basename(salamander_name,
sizeof(salamander_name)))
{
fill_pathname_join(new_path, g_defaults.dir.core,
salamander_name, sizeof(new_path));
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, new_path);
}
}
exit_spawn = true;
#endif
exit_spawn = exitspawn;
exitspawn_start_game = start_game;
break;
default:
case FRONTEND_FORK_NONE:
return false;
}
#ifndef IS_SALAMANDER
rarch_ctl(RARCH_CTL_FORCE_QUIT, NULL);

View File

@ -2121,14 +2121,22 @@ static int frontend_android_parse_drive_list(void *data)
#endif
#ifndef HAVE_DYNAMIC
static bool frontend_linux_set_fork(bool exitspawn,
bool start_game, bool restart)
static bool frontend_linux_set_fork(enum frontend_fork fork_mode)
{
exit_spawn = exitspawn;
exitspawn_start_game = start_game;
if (restart) /* not implemented */
return false;
switch (fork_mode)
{
case FRONTEND_FORK_CORE:
exit_spawn = true;
break;
case FRONTEND_FORK_CORE_WITH_ARGS:
exit_spawn = true;
exitspawn_start_game = true;
break;
case FRONTEND_FORK_SALAMANDER_RESTART:
case FRONTEND_FORK_NONE:
default:
return false;
}
return true;
}

View File

@ -328,10 +328,22 @@ static void frontend_ps3_deinit(void *data)
}
#ifndef IS_SALAMANDER
static bool frontend_ps3_set_fork(bool exit, bool start_game, bool restart)
static bool frontend_ps3_set_fork(enum frontend_fork fork_mode)
{
exit_spawn = exitspawn;
exitspawn_start_game = start_game;
switch (fork_mode)
{
case FRONTEND_FORK_CORE:
exit_spawn = true;
break;
case FRONTEND_FORK_CORE_WITH_ARGS:
exit_spawn = true;
exitspawn_start_game = true;
break;
case FRONTEND_FORK_SALAMANDER_RESTART:
case FRONTEND_FORK_NONE:
default:
return false;
}
return true;
}

View File

@ -269,10 +269,22 @@ static void frontend_psp_exec(const char *path, bool should_load_game)
#endif
}
static bool frontend_psp_set_fork(bool exit, bool start_game, bool restart)
static bool frontend_psp_set_fork(enum frontend_fork fork_mode)
{
exit_spawn = true;
exitspawn_start_game = start_game;
switch (fork_mode)
{
case FRONTEND_FORK_CORE:
exit_spawn = true;
break;
case FRONTEND_FORK_CORE_WITH_ARGS:
exit_spawn = true;
exitspawn_start_game = true;
break;
case FRONTEND_FORK_SALAMANDER_RESTART:
case FRONTEND_FORK_NONE:
default:
return false;
}
return true;
}

View File

@ -1292,10 +1292,22 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
#endif
}
static bool frontend_xdk_set_fork(bool exit, bool start_game, bool restart)
static bool frontend_xdk_set_fork(enum frontend_fork fork_mode)
{
exit_spawn = exit;
exitspawn_start_game = start_game;
switch (fork_mode)
{
case FRONTEND_FORK_CORE:
exit_spawn = true;
break;
case FRONTEND_FORK_CORE_WITH_ARGS:
exit_spawn = true;
exitspawn_start_game = true;
break;
case FRONTEND_FORK_NONE:
case FRONTEND_FORK_SALAMANDER_RESTART:
default:
return false;
}
return true;
}

View File

@ -214,13 +214,13 @@ bool frontend_driver_has_fork(void)
return true;
}
bool frontend_driver_set_fork(bool a, bool b, bool restart)
bool frontend_driver_set_fork(enum frontend_fork fork_mode)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend_driver_has_fork())
return false;
return frontend->set_fork(a, b, restart);
return frontend->set_fork(fork_mode);
}
void frontend_driver_process_args(int *argc, char *argv[])

View File

@ -40,6 +40,14 @@ enum frontend_powerstate
FRONTEND_POWERSTATE_ON_POWER_SOURCE
};
enum frontend_fork
{
FRONTEND_FORK_NONE = 0,
FRONTEND_FORK_CORE,
FRONTEND_FORK_CORE_WITH_ARGS,
FRONTEND_FORK_SALAMANDER_RESTART
};
enum frontend_architecture
{
FRONTEND_ARCH_NONE = 0,
@ -64,7 +72,7 @@ typedef struct frontend_ctx_driver
process_args_t process_args;
void (*exec)(const char *, bool);
bool (*set_fork)(bool exitspawn, bool start_game, bool restart);
bool (*set_fork)(enum frontend_fork fork_mode);
void (*shutdown)(bool);
void (*get_name)(char *, size_t);
void (*get_os)(char *, size_t, int *major, int *minor);
@ -116,7 +124,7 @@ int frontend_driver_parse_drive_list(void *data);
void frontend_driver_content_loaded(void);
bool frontend_driver_set_fork(bool a, bool b, bool restart);
bool frontend_driver_set_fork(enum frontend_fork fork_mode);
void frontend_driver_process_args(int *argc, char *argv[]);