Move launched_from_cli to global state

This commit is contained in:
twinaphex 2020-06-13 08:19:49 +02:00
parent b46a316df9
commit b74b8b6a6c
4 changed files with 14 additions and 21 deletions

View File

@ -85,9 +85,6 @@ bool content_reset_savestate_backups(void);
bool content_undo_load_buf_is_empty(void); bool content_undo_load_buf_is_empty(void);
bool content_undo_save_buf_is_empty(void); bool content_undo_save_buf_is_empty(void);
/* Checks if launched from the commandline */
bool content_launched_from_cli(void);
/* Clears the pending subsystem rom buffer */ /* Clears the pending subsystem rom buffer */
bool content_is_subsystem_pending_load(void); bool content_is_subsystem_pending_load(void);

View File

@ -34690,7 +34690,7 @@ bool retroarch_main_init(int argc, char *argv[])
if (init_failed) if (init_failed)
{ {
/* Check if menu was active prior to core initialization */ /* Check if menu was active prior to core initialization */
if (!content_launched_from_cli() if (!global->launched_from_cli
#ifdef HAVE_MENU #ifdef HAVE_MENU
|| p_rarch->menu_driver_alive || p_rarch->menu_driver_alive
#endif #endif

View File

@ -224,6 +224,7 @@ typedef struct rarch_resolution
typedef struct global typedef struct global
{ {
bool launched_from_cli;
struct struct
{ {
char savefile[8192]; char savefile[8192];

View File

@ -204,8 +204,6 @@ typedef struct content_state
struct string_list *temporary_content; struct string_list *temporary_content;
} content_state_t; } content_state_t;
/* TODO/FIXME - global state - perhaps move outside this file */
static bool _launched_from_cli = true;
static content_state_t content_st; static content_state_t content_st;
#ifdef HAVE_CDROM #ifdef HAVE_CDROM
@ -1951,8 +1949,11 @@ end:
} }
#endif #endif
static bool task_load_content_callback(content_ctx_info_t *content_info, static bool task_load_content_internal(
bool loading_from_menu, bool loading_from_cli, bool loading_from_companion_ui) content_ctx_info_t *content_info,
bool loading_from_menu,
bool loading_from_cli,
bool loading_from_companion_ui)
{ {
content_information_ctx_t content_ctx; content_information_ctx_t content_ctx;
@ -2102,7 +2103,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
_launched_from_cli = false; global->launched_from_cli = false;
if (global) if (global)
{ {
@ -2113,7 +2114,7 @@ bool task_push_load_content_with_new_core_from_companion_ui(
} }
/* Load content */ /* Load content */
if (!task_load_content_callback(content_info, true, false, true)) if (!task_load_content_internal(content_info, true, false, true))
return false; return false;
#ifdef HAVE_MENU #ifdef HAVE_MENU
@ -2133,7 +2134,7 @@ bool task_push_load_content_from_cli(
void *user_data) void *user_data)
{ {
/* Load content */ /* Load content */
if (!task_load_content_callback(content_info, true, true, false)) if (!task_load_content_internal(content_info, true, true, false))
return false; return false;
return true; return true;
@ -2153,7 +2154,7 @@ bool task_push_start_builtin_core(
retroarch_set_current_core_type(type, true); retroarch_set_current_core_type(type, true);
/* Load content */ /* Load content */
if (!task_load_content_callback(content_info, true, false, false)) if (!task_load_content_internal(content_info, true, false, false))
{ {
retroarch_menu_running(); retroarch_menu_running();
return false; return false;
@ -2187,7 +2188,7 @@ bool task_push_load_content_with_current_core_from_companion_ui(
* > TODO/FIXME: Set loading_from_companion_ui 'false' for * > TODO/FIXME: Set loading_from_companion_ui 'false' for
* now, until someone can implement the required higher * now, until someone can implement the required higher
* level functionality in 'win32_common.c' and 'ui_cocoa.m' */ * level functionality in 'win32_common.c' and 'ui_cocoa.m' */
if (!task_load_content_callback(content_info, true, false, false)) if (!task_load_content_internal(content_info, true, false, false))
return false; return false;
/* Push quick menu onto menu stack */ /* Push quick menu onto menu stack */
@ -2209,7 +2210,7 @@ bool task_push_load_content_with_core_from_menu(
path_set(RARCH_PATH_CONTENT, fullpath); path_set(RARCH_PATH_CONTENT, fullpath);
/* Load content */ /* Load content */
if (!task_load_content_callback(content_info, true, false, false)) if (!task_load_content_internal(content_info, true, false, false))
{ {
retroarch_menu_running(); retroarch_menu_running();
return false; return false;
@ -2236,7 +2237,7 @@ bool task_push_load_subsystem_with_core_from_menu(
p_content->pending_subsystem_init = true; p_content->pending_subsystem_init = true;
/* Load content */ /* Load content */
if (!task_load_content_callback(content_info, true, false, false)) if (!task_load_content_internal(content_info, true, false, false))
{ {
retroarch_menu_running(); retroarch_menu_running();
return false; return false;
@ -2280,12 +2281,6 @@ void content_clear_subsystem(void)
} }
} }
/* Checks if launched from the commandline */
bool content_launched_from_cli(void)
{
return _launched_from_cli;
}
/* Get the current subsystem */ /* Get the current subsystem */
int content_get_subsystem(void) int content_get_subsystem(void)
{ {