mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Global - turn bools into flag
This commit is contained in:
parent
070e018c6c
commit
99a763c4e8
23
retroarch.c
23
retroarch.c
@ -5791,7 +5791,7 @@ void main_exit(void *args)
|
|||||||
|
|
||||||
p_rarch->flags &= ~RARCH_FLAGS_HAS_SET_USERNAME;
|
p_rarch->flags &= ~RARCH_FLAGS_HAS_SET_USERNAME;
|
||||||
runloop_st->flags &= ~RUNLOOP_FLAG_IS_INITED;
|
runloop_st->flags &= ~RUNLOOP_FLAG_IS_INITED;
|
||||||
global_get_ptr()->error_on_init = false;
|
global_get_ptr()->flags &= ~GLOB_FLG_ERR_ON_INIT;
|
||||||
#ifdef HAVE_CONFIGFILE
|
#ifdef HAVE_CONFIGFILE
|
||||||
p_rarch->flags &= ~RARCH_FLAGS_BLOCK_CONFIG_READ;
|
p_rarch->flags &= ~RARCH_FLAGS_BLOCK_CONFIG_READ;
|
||||||
#endif
|
#endif
|
||||||
@ -6773,7 +6773,7 @@ static bool retroarch_parse_input_and_config(
|
|||||||
#ifdef HAVE_CONFIGFILE
|
#ifdef HAVE_CONFIGFILE
|
||||||
runloop_st->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE;
|
runloop_st->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE;
|
||||||
#endif
|
#endif
|
||||||
global->cli_load_menu_on_error = false;
|
global->flags &= ~GLOB_FLG_CLI_LOAD_MENU_ON_ERR;
|
||||||
|
|
||||||
/* Make sure we can call retroarch_parse_input several times ... */
|
/* Make sure we can call retroarch_parse_input several times ... */
|
||||||
optind = 0;
|
optind = 0;
|
||||||
@ -7272,7 +7272,7 @@ static bool retroarch_parse_input_and_config(
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case RA_OPT_LOAD_MENU_ON_ERROR:
|
case RA_OPT_LOAD_MENU_ON_ERROR:
|
||||||
global->cli_load_menu_on_error = true;
|
global->flags |= GLOB_FLG_CLI_LOAD_MENU_ON_ERR;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
{
|
{
|
||||||
@ -7391,7 +7391,10 @@ static bool retroarch_parse_input_and_config(
|
|||||||
|
|
||||||
/* Update global 'content launched from command
|
/* Update global 'content launched from command
|
||||||
* line' status flag */
|
* line' status flag */
|
||||||
global->launched_from_cli = cli_active && (cli_core_set || cli_content_set);
|
if (cli_active && (cli_core_set || cli_content_set))
|
||||||
|
global->flags |= (GLOB_FLG_LAUNCHED_FROM_CLI);
|
||||||
|
else
|
||||||
|
global->flags &= ~(GLOB_FLG_LAUNCHED_FROM_CLI);
|
||||||
|
|
||||||
/* Copy SRM/state dirs used, so they can be reused on reentrancy. */
|
/* Copy SRM/state dirs used, so they can be reused on reentrancy. */
|
||||||
if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
|
if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
|
||||||
@ -7482,7 +7485,7 @@ bool retroarch_main_init(int argc, char *argv[])
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
global->error_on_init = true;
|
global->flags |= GLOB_FLG_ERR_ON_INIT;
|
||||||
|
|
||||||
/* Have to initialise non-file logging once at the start... */
|
/* Have to initialise non-file logging once at the start... */
|
||||||
retro_main_log_file_init(NULL, false);
|
retro_main_log_file_init(NULL, false);
|
||||||
@ -7681,8 +7684,8 @@ bool retroarch_main_init(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_DYNAMIC
|
#ifdef HAVE_DYNAMIC
|
||||||
/* Check if menu was active prior to core initialization */
|
/* Check if menu was active prior to core initialization */
|
||||||
if ( !global->launched_from_cli
|
if ( (!(global->flags & GLOB_FLG_LAUNCHED_FROM_CLI))
|
||||||
|| global->cli_load_menu_on_error
|
|| (global->flags & GLOB_FLG_CLI_LOAD_MENU_ON_ERR)
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
|| (menu_st->flags & MENU_ST_FLAG_ALIVE)
|
|| (menu_st->flags & MENU_ST_FLAG_ALIVE)
|
||||||
#endif
|
#endif
|
||||||
@ -7765,8 +7768,8 @@ bool retroarch_main_init(int argc, char *argv[])
|
|||||||
|
|
||||||
command_event(CMD_EVENT_SET_PER_GAME_RESOLUTION, NULL);
|
command_event(CMD_EVENT_SET_PER_GAME_RESOLUTION, NULL);
|
||||||
|
|
||||||
global->error_on_init = false;
|
global->flags &= ~GLOB_FLG_ERR_ON_INIT;
|
||||||
runloop_st->flags |= RUNLOOP_FLAG_IS_INITED;
|
runloop_st->flags |= RUNLOOP_FLAG_IS_INITED;
|
||||||
|
|
||||||
#ifdef HAVE_DISCORD
|
#ifdef HAVE_DISCORD
|
||||||
{
|
{
|
||||||
@ -8224,7 +8227,7 @@ bool should_quit_on_close(void)
|
|||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
if ( ((settings->uints.quit_on_close_content ==
|
if ( ((settings->uints.quit_on_close_content ==
|
||||||
QUIT_ON_CLOSE_CONTENT_CLI)
|
QUIT_ON_CLOSE_CONTENT_CLI)
|
||||||
&& global->launched_from_cli)
|
&& (global->flags & GLOB_FLG_LAUNCHED_FROM_CLI))
|
||||||
|| (settings->uints.quit_on_close_content ==
|
|| (settings->uints.quit_on_close_content ==
|
||||||
QUIT_ON_CLOSE_CONTENT_ENABLED)
|
QUIT_ON_CLOSE_CONTENT_ENABLED)
|
||||||
)
|
)
|
||||||
|
@ -249,11 +249,16 @@ struct rarch_main_wrap
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* All run-time- / command line flag-related globals go here. */
|
/* All run-time- / command line flag-related globals go here. */
|
||||||
|
enum global_flags
|
||||||
|
{
|
||||||
|
GLOB_FLG_ERR_ON_INIT = (1 << 0),
|
||||||
|
GLOB_FLG_LAUNCHED_FROM_CLI = (1 << 1),
|
||||||
|
GLOB_FLG_CLI_LOAD_MENU_ON_ERR = (1 << 2)
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct global
|
typedef struct global
|
||||||
{
|
{
|
||||||
jmp_buf error_sjlj_context; /* 4-byte alignment,
|
jmp_buf error_sjlj_context; /* 4-byte alignment, put it right before long */
|
||||||
put it right before long */
|
|
||||||
|
|
||||||
/* Settings and/or global state that is specific to
|
/* Settings and/or global state that is specific to
|
||||||
* a console-style implementation. */
|
* a console-style implementation. */
|
||||||
@ -290,9 +295,7 @@ typedef struct global
|
|||||||
} console;
|
} console;
|
||||||
|
|
||||||
char error_string[255];
|
char error_string[255];
|
||||||
bool launched_from_cli;
|
uint8_t flags;
|
||||||
bool cli_load_menu_on_error;
|
|
||||||
bool error_on_init;
|
|
||||||
} global_t;
|
} global_t;
|
||||||
|
|
||||||
typedef struct content_file_override
|
typedef struct content_file_override
|
||||||
|
@ -6943,7 +6943,7 @@ int runloop_iterate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch ((enum runloop_state_enum)runloop_check_state(
|
switch ((enum runloop_state_enum)runloop_check_state(
|
||||||
global_get_ptr()->error_on_init,
|
((global_get_ptr()->flags & GLOB_FLG_ERR_ON_INIT) > 0),
|
||||||
settings, current_time))
|
settings, current_time))
|
||||||
{
|
{
|
||||||
case RUNLOOP_STATE_QUIT:
|
case RUNLOOP_STATE_QUIT:
|
||||||
|
@ -2701,7 +2701,7 @@ bool task_push_load_content_with_new_core_from_companion_ui(
|
|||||||
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
global->launched_from_cli = false;
|
global->flags &= ~GLOB_FLG_LAUNCHED_FROM_CLI;
|
||||||
|
|
||||||
if (label)
|
if (label)
|
||||||
strlcpy(runloop_st->name.label, label, sizeof(runloop_st->name.label));
|
strlcpy(runloop_st->name.label, label, sizeof(runloop_st->name.label));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user