mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Create RARCH_CTL_IS_INITED, RARCH_CTL_SET_INITED, RARCH_CTL_UNSET_INITED
This commit is contained in:
parent
5643b7d3d8
commit
01d58f8681
@ -200,7 +200,6 @@ bool main_load_content(int argc, char **argv, void *args,
|
||||
char *argv_copy [MAX_ARGS] = {NULL};
|
||||
char **rarch_argv_ptr = (char**)argv;
|
||||
int *rarch_argc_ptr = (int*)&argc;
|
||||
global_t *global = global_get_ptr();
|
||||
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)
|
||||
calloc(1, sizeof(*wrap_args));
|
||||
|
||||
@ -224,7 +223,7 @@ bool main_load_content(int argc, char **argv, void *args,
|
||||
rarch_argc_ptr = (int*)&rarch_argc;
|
||||
}
|
||||
|
||||
if (global->inited.main)
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL))
|
||||
rarch_main_deinit();
|
||||
|
||||
if ((ret = rarch_main_init(*rarch_argc_ptr, rarch_argv_ptr)))
|
||||
|
@ -1325,7 +1325,7 @@ static int mui_list_push(void *data, void *userdata,
|
||||
case DISPLAYLIST_MAIN_MENU:
|
||||
menu_entries_clear(info->list);
|
||||
|
||||
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false);
|
||||
|
||||
|
@ -2568,7 +2568,7 @@ static int xmb_list_push(void *data, void *userdata, menu_displaylist_info_t *in
|
||||
case DISPLAYLIST_MAIN_MENU:
|
||||
menu_entries_clear(info->list);
|
||||
|
||||
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
|
||||
#include "../../config.def.h"
|
||||
#include "../../content.h"
|
||||
#include "../../gfx/font_driver.h"
|
||||
#include "../../gfx/video_context_driver.h"
|
||||
#include "../../gfx/d3d/d3d.h"
|
||||
@ -199,7 +200,7 @@ static void menu_display_d3d_draw_bg(
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
|
||||
|
||||
if ((settings->menu.pause_libretro
|
||||
|| !global->inited.main || (global->inited.core.type == CORE_TYPE_DUMMY))
|
||||
|| !rarch_ctl(RARCH_CTL_IS_INITED, NULL) || (global->inited.core.type == CORE_TYPE_DUMMY))
|
||||
&& !force_transparency
|
||||
&& texture)
|
||||
coords.color = (const float*)coord_color2;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../config.def.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../gfx/font_driver.h"
|
||||
#include "../../gfx/video_context_driver.h"
|
||||
#include "../../gfx/video_shader_driver.h"
|
||||
@ -165,7 +166,7 @@ static void menu_display_gl_draw_bg(
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
|
||||
|
||||
if ((settings->menu.pause_libretro
|
||||
|| !global->inited.main || (global->inited.core.type == CORE_TYPE_DUMMY))
|
||||
|| !rarch_ctl(RARCH_CTL_IS_INITED, NULL) || (global->inited.core.type == CORE_TYPE_DUMMY))
|
||||
&& !force_transparency
|
||||
&& texture)
|
||||
coords.color = (const float*)coord_color2;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <formats/image.h>
|
||||
|
||||
#include "../config.def.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../configuration.h"
|
||||
#include "../runloop.h"
|
||||
#include "../gfx/video_thread_wrapper.h"
|
||||
@ -308,7 +309,7 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!settings->menu.pause_libretro)
|
||||
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
@ -1721,7 +1721,7 @@ static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t
|
||||
if (!menu)
|
||||
return -1;
|
||||
|
||||
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
{
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
@ -1819,7 +1819,7 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
|
||||
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY)
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY)
|
||||
&& !strcmp(menu->deferred_path, fullpath))
|
||||
menu_displaylist_parse_load_content_settings(info);
|
||||
else
|
||||
@ -2599,7 +2599,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_MAIN_MENU:
|
||||
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false);
|
||||
|
||||
|
19
retroarch.c
19
retroarch.c
@ -1198,13 +1198,12 @@ int rarch_main_init(int argc, char *argv[])
|
||||
event_command(EVENT_CMD_SET_PER_GAME_RESOLUTION);
|
||||
|
||||
rarch_ctl(RARCH_CTL_UNSET_ERROR_ON_INIT, NULL);
|
||||
global->inited.main = true;
|
||||
rarch_ctl(RARCH_CTL_SET_INITED, NULL);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
event_command(EVENT_CMD_CORE_DEINIT);
|
||||
|
||||
global->inited.main = false;
|
||||
rarch_ctl(RARCH_CTL_UNSET_INITED, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1285,6 +1284,7 @@ void rarch_main_init_wrap(const struct rarch_main_wrap *args,
|
||||
|
||||
bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
{
|
||||
static bool rarch_is_inited = false;
|
||||
static bool rarch_error_on_init = false;
|
||||
static bool rarch_block_config_read = false;
|
||||
static bool rarch_force_fullscreen = false;
|
||||
@ -1293,7 +1293,16 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case RARCH_CTL_IS_INITED:
|
||||
return rarch_is_inited;
|
||||
case RARCH_CTL_UNSET_INITED:
|
||||
rarch_is_inited = false;
|
||||
break;
|
||||
case RARCH_CTL_SET_INITED:
|
||||
rarch_is_inited = true;
|
||||
break;
|
||||
case RARCH_CTL_DESTROY:
|
||||
rarch_is_inited = false;
|
||||
rarch_error_on_init = false;
|
||||
rarch_block_config_read = false;
|
||||
rarch_force_fullscreen = false;
|
||||
@ -1312,7 +1321,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
bool inited = false;
|
||||
if (!global)
|
||||
return false;
|
||||
inited = global->inited.main;
|
||||
inited = rarch_ctl(RARCH_CTL_IS_INITED, NULL);
|
||||
if (!inited)
|
||||
return false;
|
||||
|
||||
@ -1522,7 +1531,7 @@ void rarch_main_deinit(void)
|
||||
event_command(EVENT_CMD_SUBSYSTEM_FULLPATHS_DEINIT);
|
||||
event_command(EVENT_CMD_SAVEFILES_DEINIT);
|
||||
|
||||
global->inited.main = false;
|
||||
rarch_ctl(RARCH_CTL_UNSET_INITED, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,6 +61,12 @@ enum rarch_ctl_state
|
||||
/* Initialize all drivers. */
|
||||
RARCH_CTL_INIT,
|
||||
|
||||
RARCH_CTL_UNSET_INITED,
|
||||
|
||||
RARCH_CTL_SET_INITED,
|
||||
|
||||
RARCH_CTL_IS_INITED,
|
||||
|
||||
RARCH_CTL_PREINIT,
|
||||
|
||||
RARCH_CTL_DESTROY,
|
||||
|
@ -1331,7 +1331,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
{
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
||||
{
|
||||
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY))
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||
}
|
||||
else
|
||||
|
@ -284,7 +284,6 @@ typedef struct global
|
||||
|
||||
struct
|
||||
{
|
||||
bool main;
|
||||
struct
|
||||
{
|
||||
enum rarch_core_type type;
|
||||
|
@ -246,9 +246,8 @@ static void poll_iteration(void)
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||
{
|
||||
NSApplicationTerminateReply reply = NSTerminateNow;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (global && global->inited.main)
|
||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL))
|
||||
reply = NSTerminateCancel;
|
||||
|
||||
ui_companion_event_command(EVENT_CMD_QUIT);
|
||||
|
Loading…
Reference in New Issue
Block a user