mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Refactor MODE_EXITSPAWN and MODE_EXITSPAWN_START_GAME
This commit is contained in:
parent
245dc71658
commit
e6a79f798b
@ -1062,8 +1062,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
*g_extern.fullpath = '\0';
|
||||
|
||||
#if defined(RARCH_CONSOLE)
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_EXITSPAWN);
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_EXITSPAWN_START_GAME);
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->set_fork)
|
||||
driver.frontend_ctx->set_fork(true, true);
|
||||
#elif defined(HAVE_DYNAMIC)
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
|
||||
#endif
|
||||
|
@ -113,9 +113,7 @@ void main_exit(args_type() args)
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->deinit)
|
||||
driver.frontend_ctx->deinit(args);
|
||||
|
||||
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN)
|
||||
&& driver.frontend_ctx
|
||||
&& driver.frontend_ctx->exitspawn)
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->exitspawn)
|
||||
driver.frontend_ctx->exitspawn(g_settings.libretro,
|
||||
sizeof(g_settings.libretro));
|
||||
|
||||
|
@ -61,6 +61,7 @@ typedef struct frontend_ctx_driver
|
||||
process_args_t process_args;
|
||||
int (*process_events)(void *data);
|
||||
void (*exec)(const char *, bool);
|
||||
void (*set_fork)(bool exitspawn, bool start_game);
|
||||
void (*shutdown)(bool);
|
||||
void (*get_name)(char *, size_t);
|
||||
int (*get_rating)(void);
|
||||
|
@ -889,6 +889,7 @@ const frontend_ctx_driver_t frontend_ctx_android = {
|
||||
NULL, /* process_args */
|
||||
frontend_android_process_events, /* process_events */
|
||||
NULL, /* exec */
|
||||
NULL, /* set_fork */
|
||||
frontend_android_shutdown, /* shutdown */
|
||||
frontend_android_get_name, /* get_name */
|
||||
frontend_android_get_rating, /* get_rating */
|
||||
|
@ -73,6 +73,7 @@ const frontend_ctx_driver_t frontend_ctx_apple = {
|
||||
NULL, /* process_args */
|
||||
NULL, /* process_events */
|
||||
NULL, /* exec */
|
||||
NULL, /* set_fork */
|
||||
frontend_apple_shutdown, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_apple_get_rating, /* get_rating */
|
||||
|
@ -59,6 +59,9 @@ enum
|
||||
GX_DEVICE_END
|
||||
};
|
||||
|
||||
static bool exit_spawn = false;
|
||||
static bool exitspawn_start_game = false;
|
||||
|
||||
#if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER)
|
||||
static devoptab_t dotab_stdout = {
|
||||
"stdout", // device name
|
||||
@ -306,8 +309,10 @@ static void frontend_gx_exitspawn(char *core_path, size_t sizeof_core_path)
|
||||
if (gx_rom_path[0] != '\0')
|
||||
should_load_game = true;
|
||||
#elif defined(HW_RVL)
|
||||
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_START_GAME))
|
||||
should_load_game = true;
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
return;
|
||||
|
||||
frontend_gx_exec(core_path, should_load_game);
|
||||
|
||||
@ -342,6 +347,12 @@ static void frontend_gx_exec(const char *path, bool should_load_game)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_gx_set_fork(bool exitspawn, bool start_game)
|
||||
{
|
||||
exit_spawn = exitspawn;
|
||||
exitspawn_start_game = start_game;
|
||||
}
|
||||
|
||||
static int frontend_gx_get_rating(void)
|
||||
{
|
||||
#ifdef HW_RVL
|
||||
@ -359,6 +370,7 @@ const frontend_ctx_driver_t frontend_ctx_gx = {
|
||||
frontend_gx_process_args, /* process_args */
|
||||
NULL, /* process_events */
|
||||
frontend_gx_exec, /* exec */
|
||||
frontend_gx_set_fork, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_gx_get_rating, /* get_rating */
|
||||
|
@ -29,6 +29,7 @@ const frontend_ctx_driver_t frontend_ctx_null = {
|
||||
NULL, /* process_args */
|
||||
NULL, /* process_events */
|
||||
NULL, /* exec */
|
||||
NULL, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
NULL, /* get_rating */
|
||||
|
@ -41,6 +41,8 @@ SYS_PROCESS_PARAM(1001, 0x200000)
|
||||
static bool multiman_detected = false;
|
||||
#endif
|
||||
|
||||
static bool exit_spawn = false;
|
||||
static bool exitspawn_start_game = false;
|
||||
|
||||
#ifdef IS_SALAMANDER
|
||||
#include <netex/net.h>
|
||||
@ -306,6 +308,12 @@ static void frontend_ps3_deinit(void *data)
|
||||
|
||||
static void frontend_ps3_exec(const char *path, bool should_load_game);
|
||||
|
||||
static void frontend_ps3_set_fork(bool exit, bool start_game)
|
||||
{
|
||||
exit_spawn = exitspawn;
|
||||
exitspawn_start_game = start_game;
|
||||
}
|
||||
|
||||
static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
||||
{
|
||||
#ifdef HAVE_RARCH_EXEC
|
||||
@ -315,8 +323,10 @@ static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
|
||||
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_START_GAME))
|
||||
should_load_game = true;
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
return;
|
||||
#endif
|
||||
|
||||
frontend_ps3_exec(core_path, should_load_game);
|
||||
@ -439,6 +449,7 @@ const frontend_ctx_driver_t frontend_ctx_ps3 = {
|
||||
NULL, /* process_args */
|
||||
NULL, /* process_events */
|
||||
frontend_ps3_exec, /* exec */
|
||||
frontend_ps3_set_fork, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_ps3_get_rating, /* get_rating */
|
||||
|
@ -42,6 +42,9 @@ PSP_HEAP_SIZE_MAX();
|
||||
|
||||
char eboot_path[512];
|
||||
|
||||
static bool exit_spawn = false;
|
||||
static bool exitspawn_start_game = false;
|
||||
|
||||
#ifdef IS_SALAMANDER
|
||||
#include "../../file_ext.h"
|
||||
#endif
|
||||
@ -206,14 +209,20 @@ static void frontend_psp_exec(const char *path, bool should_load_game)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_psp_set_fork(bool exit, bool start_game)
|
||||
{
|
||||
exit_spawn = true;
|
||||
exitspawn_start_game = start_game;
|
||||
}
|
||||
|
||||
static void frontend_psp_exitspawn(char *core_path, size_t sizeof_core_path)
|
||||
{
|
||||
bool should_load_game = false;
|
||||
#ifndef IS_SALAMANDER
|
||||
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_START_GAME))
|
||||
should_load_game = true;
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
return;
|
||||
#endif
|
||||
frontend_psp_exec(core_path, should_load_game);
|
||||
}
|
||||
@ -231,6 +240,7 @@ const frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
NULL, /* process_args */
|
||||
NULL, /* process_events */
|
||||
frontend_psp_exec, /* exec */
|
||||
frontend_psp_set_fork, /* set_fork */
|
||||
frontend_psp_shutdown, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_psp_get_rating, /* get_rating */
|
||||
|
@ -67,6 +67,7 @@ const frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
NULL, /* process_args */
|
||||
NULL, /* process_events */
|
||||
NULL, /* exec */
|
||||
NULL, /* set_fork */
|
||||
frontend_qnx_shutdown, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_qnx_get_rating, /* get_rating */
|
||||
|
@ -31,6 +31,9 @@
|
||||
#include "../../general.h"
|
||||
#endif
|
||||
|
||||
static bool exit_spawn;
|
||||
static bool exitspawn_start_game;
|
||||
|
||||
#ifdef _XBOX1
|
||||
static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
|
||||
{
|
||||
@ -258,13 +261,21 @@ static void frontend_xdk_init(void *data)
|
||||
|
||||
static void frontend_xdk_exec(const char *path, bool should_load_game);
|
||||
|
||||
static void frontend_xdk_set_fork(bool exit, bool start_game)
|
||||
{
|
||||
exit_spawn = exit;
|
||||
exitspawn_start_game = start_game;
|
||||
}
|
||||
|
||||
static void frontend_xdk_exitspawn(char *core_path,
|
||||
size_t sizeof_core_path)
|
||||
{
|
||||
bool should_load_game = false;
|
||||
#ifndef IS_SALAMANDER
|
||||
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_START_GAME))
|
||||
should_load_game = true;
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
return;
|
||||
#endif
|
||||
frontend_xdk_exec(core_path, should_load_game);
|
||||
}
|
||||
@ -330,6 +341,7 @@ const frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
NULL, /* process_args */
|
||||
NULL, /* process_events */
|
||||
frontend_xdk_exec, /* exec */
|
||||
frontend_xdk_set_fork, /* set_fork */
|
||||
NULL, /* shutdown */
|
||||
NULL, /* get_name */
|
||||
frontend_xdk_get_rating, /* get_rating */
|
||||
|
@ -137,7 +137,6 @@ enum action_state
|
||||
RARCH_ACTION_STATE_LOAD_CONTENT,
|
||||
RARCH_ACTION_STATE_MENU_RUNNING,
|
||||
RARCH_ACTION_STATE_MENU_RUNNING_FINISHED,
|
||||
RARCH_ACTION_STATE_EXITSPAWN,
|
||||
RARCH_ACTION_STATE_QUIT,
|
||||
RARCH_ACTION_STATE_FORCE_QUIT,
|
||||
};
|
||||
@ -147,8 +146,6 @@ enum menu_enums
|
||||
MODE_NONE = 0,
|
||||
MODE_MENU_WIDESCREEN,
|
||||
MODE_MENU_HD,
|
||||
MODE_EXITSPAWN,
|
||||
MODE_EXITSPAWN_START_GAME,
|
||||
};
|
||||
|
||||
enum sound_mode_enums
|
||||
|
@ -2927,9 +2927,6 @@ void rarch_main_set_state(unsigned cmd)
|
||||
/* Restore libretro keyboard callback. */
|
||||
g_extern.system.key_event = g_extern.frontend_key_event;
|
||||
break;
|
||||
case RARCH_ACTION_STATE_EXITSPAWN:
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_EXITSPAWN);
|
||||
break;
|
||||
case RARCH_ACTION_STATE_QUIT:
|
||||
g_extern.system.shutdown = true;
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
|
||||
@ -3272,7 +3269,8 @@ void rarch_main_command(unsigned cmd)
|
||||
SALAMANDER_FILE,
|
||||
sizeof(g_extern.fullpath));
|
||||
#endif
|
||||
rarch_main_set_state(RARCH_ACTION_STATE_EXITSPAWN);
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->set_fork)
|
||||
driver.frontend_ctx->set_fork(true, false);
|
||||
break;
|
||||
case RARCH_CMD_MENU_SAVE_CONFIG:
|
||||
save_core_config();
|
||||
|
Loading…
x
Reference in New Issue
Block a user