diff --git a/command_event.c b/command_event.c index c5347d777d..6ed16cbe08 100644 --- a/command_event.c +++ b/command_event.c @@ -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: diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index 9d0665c285..16aab86484 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -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); diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 6e92a14a7d..e8b0e5cdb8 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -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; } diff --git a/frontend/drivers/platform_ps3.c b/frontend/drivers/platform_ps3.c index bb78d06f5c..b4d7502a31 100644 --- a/frontend/drivers/platform_ps3.c +++ b/frontend/drivers/platform_ps3.c @@ -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; } diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c index 74819c572a..22a50ce18d 100644 --- a/frontend/drivers/platform_psp.c +++ b/frontend/drivers/platform_psp.c @@ -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; } diff --git a/frontend/drivers/platform_xdk.cpp b/frontend/drivers/platform_xdk.cpp index e88bd0e498..b8efb070b3 100644 --- a/frontend/drivers/platform_xdk.cpp +++ b/frontend/drivers/platform_xdk.cpp @@ -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; } diff --git a/frontend/frontend_driver.c b/frontend/frontend_driver.c index 546d89fd9c..3720d0ae3f 100644 --- a/frontend/frontend_driver.c +++ b/frontend/frontend_driver.c @@ -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[]) diff --git a/frontend/frontend_driver.h b/frontend/frontend_driver.h index f23949888a..4e1c4ce970 100644 --- a/frontend/frontend_driver.h +++ b/frontend/frontend_driver.h @@ -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[]);