mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Move more state out of global
This commit is contained in:
parent
5d70131ce1
commit
c76272ad8d
34
retroarch.c
34
retroarch.c
@ -62,9 +62,6 @@
|
|||||||
|
|
||||||
#include "config.features.h"
|
#include "config.features.h"
|
||||||
|
|
||||||
static char current_savestate_dir[PATH_MAX_LENGTH];
|
|
||||||
static char current_savefile_dir[PATH_MAX_LENGTH];
|
|
||||||
|
|
||||||
/* Descriptive names for options without short variant. Please keep the name in
|
/* Descriptive names for options without short variant. Please keep the name in
|
||||||
sync with the option name. Order does not matter. */
|
sync with the option name. Order does not matter. */
|
||||||
enum
|
enum
|
||||||
@ -88,6 +85,13 @@ enum
|
|||||||
RA_OPT_MAX_FRAMES
|
RA_OPT_MAX_FRAMES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char current_savestate_dir[PATH_MAX_LENGTH];
|
||||||
|
static char current_savefile_dir[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
|
static bool error_on_init;
|
||||||
|
static char error_string[PATH_MAX_LENGTH];
|
||||||
|
static jmp_buf error_sjlj_context;
|
||||||
|
|
||||||
#define _PSUPP(var, name, desc) printf(" %s:\n\t\t%s: %s\n", name, desc, _##var##_supp ? "yes" : "no")
|
#define _PSUPP(var, name, desc) printf(" %s:\n\t\t%s: %s\n", name, desc, _##var##_supp ? "yes" : "no")
|
||||||
|
|
||||||
static void print_features(void)
|
static void print_features(void)
|
||||||
@ -1138,17 +1142,18 @@ void rarch_init_system_av_info(void)
|
|||||||
int rarch_main_init(int argc, char *argv[])
|
int rarch_main_init(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int sjlj_ret;
|
int sjlj_ret;
|
||||||
bool *verbosity = NULL;
|
bool *verbosity = NULL;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
init_state();
|
init_state();
|
||||||
|
|
||||||
if ((sjlj_ret = setjmp(global->error_sjlj_context)) > 0)
|
if ((sjlj_ret = setjmp(error_sjlj_context)) > 0)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Fatal error received in: \"%s\"\n", global->error_string);
|
RARCH_ERR("Fatal error received in: \"%s\"\n", error_string);
|
||||||
return sjlj_ret;
|
return sjlj_ret;
|
||||||
}
|
}
|
||||||
global->inited.error = true;
|
|
||||||
|
error_on_init = true;
|
||||||
retro_main_log_file_init(NULL);
|
retro_main_log_file_init(NULL);
|
||||||
parse_input(argc, argv);
|
parse_input(argc, argv);
|
||||||
|
|
||||||
@ -1229,7 +1234,7 @@ int rarch_main_init(int argc, char *argv[])
|
|||||||
event_command(EVENT_CMD_SAVEFILES_INIT);
|
event_command(EVENT_CMD_SAVEFILES_INIT);
|
||||||
event_command(EVENT_CMD_SET_PER_GAME_RESOLUTION);
|
event_command(EVENT_CMD_SET_PER_GAME_RESOLUTION);
|
||||||
|
|
||||||
global->inited.error = false;
|
error_on_init = false;
|
||||||
global->inited.main = true;
|
global->inited.main = true;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1707,16 +1712,11 @@ int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t le
|
|||||||
**/
|
**/
|
||||||
void retro_fail(int error_code, const char *error)
|
void retro_fail(int error_code, const char *error)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* We cannot longjmp unless we're in rarch_main_init().
|
/* We cannot longjmp unless we're in rarch_main_init().
|
||||||
* If not, something went very wrong, and we should
|
* If not, something went very wrong, and we should
|
||||||
* just exit right away. */
|
* just exit right away. */
|
||||||
retro_assert(global->inited.error);
|
retro_assert(error_on_init);
|
||||||
|
|
||||||
strlcpy(global->error_string, error, sizeof(global->error_string));
|
strlcpy(error_string, error, sizeof(error_string));
|
||||||
longjmp(global->error_sjlj_context, error_code);
|
longjmp(error_sjlj_context, error_code);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,6 @@ typedef struct global
|
|||||||
{
|
{
|
||||||
bool main;
|
bool main;
|
||||||
bool content;
|
bool content;
|
||||||
bool error;
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool no_content;
|
bool no_content;
|
||||||
@ -311,8 +310,6 @@ typedef struct global
|
|||||||
} core;
|
} core;
|
||||||
} inited;
|
} inited;
|
||||||
|
|
||||||
jmp_buf error_sjlj_context;
|
|
||||||
char error_string[PATH_MAX_LENGTH];
|
|
||||||
retro_keyboard_event_t frontend_key_event;
|
retro_keyboard_event_t frontend_key_event;
|
||||||
} global_t;
|
} global_t;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user