mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
overlay_ptr is now a static global variable inside retroarch.c
This commit is contained in:
parent
e6e4d09c33
commit
fa2e1fb0c1
57
command.c
57
command.c
@ -1744,6 +1744,16 @@ bool command_event(enum event_command cmd, void *data)
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case CMD_EVENT_OVERLAY_DEINIT:
|
||||
#ifdef HAVE_OVERLAY
|
||||
retroarch_overlay_deinit();
|
||||
#endif
|
||||
break;
|
||||
case CMD_EVENT_OVERLAY_INIT:
|
||||
#ifdef HAVE_OVERLAY
|
||||
retroarch_overlay_init();
|
||||
#endif
|
||||
break;
|
||||
case CMD_EVENT_CHEAT_INDEX_PLUS:
|
||||
cheat_manager_index_next();
|
||||
break;
|
||||
@ -2170,45 +2180,10 @@ TODO: Add a setting for these tweaks */
|
||||
settings->bools.video_fps_show = !(settings->bools.video_fps_show);
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_OVERLAY_DEINIT:
|
||||
#ifdef HAVE_OVERLAY
|
||||
input_overlay_free(overlay_ptr);
|
||||
overlay_ptr = NULL;
|
||||
#endif
|
||||
break;
|
||||
case CMD_EVENT_OVERLAY_INIT:
|
||||
{
|
||||
#if defined(GEKKO)
|
||||
/* Avoid a crash at startup or even when toggling overlay in rgui */
|
||||
uint64_t memory_used = frontend_driver_get_used_memory();
|
||||
if(memory_used > (72 * 1024 * 1024))
|
||||
break;
|
||||
#endif
|
||||
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
||||
#ifdef HAVE_OVERLAY
|
||||
{
|
||||
const settings_t *settings = (const settings_t*)config_get_ptr();
|
||||
if (settings->bools.input_overlay_enable)
|
||||
{
|
||||
task_push_overlay_load_default(input_overlay_loaded,
|
||||
settings->paths.path_overlay,
|
||||
settings->bools.input_overlay_hide_in_menu,
|
||||
settings->bools.input_overlay_enable,
|
||||
settings->floats.input_overlay_opacity,
|
||||
settings->floats.input_overlay_scale,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_OVERLAY_NEXT:
|
||||
{
|
||||
#ifdef HAVE_OVERLAY
|
||||
const settings_t *settings = (const settings_t*)config_get_ptr();
|
||||
input_overlay_next(overlay_ptr, settings->floats.input_overlay_opacity);
|
||||
retroarch_overlay_next();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_DSP_FILTER_DEINIT:
|
||||
audio_driver_dsp_filter_free();
|
||||
@ -2398,20 +2373,14 @@ TODO: Add a setting for these tweaks */
|
||||
audio_driver_set_nonblocking_state(boolean);
|
||||
break;
|
||||
case CMD_EVENT_OVERLAY_SET_SCALE_FACTOR:
|
||||
{
|
||||
#ifdef HAVE_OVERLAY
|
||||
const settings_t *settings = (const settings_t*)config_get_ptr();
|
||||
input_overlay_set_scale_factor(overlay_ptr, settings->floats.input_overlay_scale);
|
||||
retroarch_overlay_set_scale_factor();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_OVERLAY_SET_ALPHA_MOD:
|
||||
{
|
||||
#ifdef HAVE_OVERLAY
|
||||
const settings_t *settings = (const settings_t*)config_get_ptr();
|
||||
input_overlay_set_alpha_mod(overlay_ptr, settings->floats.input_overlay_opacity);
|
||||
retroarch_overlay_set_alpha_mod();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_AUDIO_REINIT:
|
||||
driver_uninit(DRIVER_AUDIO_MASK);
|
||||
|
@ -241,9 +241,6 @@ void input_overlay_loaded(retro_task_t *task,
|
||||
|
||||
void input_overlay_set_visibility(int overlay_idx,enum overlay_visibility vis);
|
||||
|
||||
/* FIXME - temporary. Globals are bad */
|
||||
extern input_overlay_t *overlay_ptr;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
62
retroarch.c
62
retroarch.c
@ -1379,7 +1379,7 @@ struct input_overlay
|
||||
input_overlay_state_t overlay_state;
|
||||
};
|
||||
|
||||
input_overlay_t *overlay_ptr = NULL;
|
||||
static input_overlay_t *overlay_ptr = NULL;
|
||||
#endif
|
||||
|
||||
/* INPUT GLOBAL VARIABLES */
|
||||
@ -4530,6 +4530,54 @@ static void input_poll_overlay(input_overlay_t *ol, float opacity,
|
||||
else
|
||||
input_overlay_poll_clear(ol, opacity);
|
||||
}
|
||||
|
||||
void retroarch_overlay_next(void)
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
input_overlay_next(overlay_ptr, settings->floats.input_overlay_opacity);
|
||||
}
|
||||
|
||||
void retroarch_overlay_set_scale_factor(void)
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
input_overlay_set_scale_factor(overlay_ptr, settings->floats.input_overlay_scale);
|
||||
}
|
||||
|
||||
void retroarch_overlay_set_alpha_mod(void)
|
||||
{
|
||||
#ifdef HAVE_OVERLAY
|
||||
settings_t *settings = configuration_settings;
|
||||
input_overlay_set_alpha_mod(overlay_ptr, settings->floats.input_overlay_opacity);
|
||||
#endif
|
||||
}
|
||||
|
||||
void retroarch_overlay_deinit(void)
|
||||
{
|
||||
input_overlay_free(overlay_ptr);
|
||||
overlay_ptr = NULL;
|
||||
}
|
||||
|
||||
void retroarch_overlay_init(void)
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
#if defined(GEKKO)
|
||||
/* Avoid a crash at startup or even when toggling overlay in rgui */
|
||||
uint64_t memory_used = frontend_driver_get_used_memory();
|
||||
if(memory_used > (72 * 1024 * 1024))
|
||||
break;
|
||||
#endif
|
||||
|
||||
retroarch_overlay_deinit();
|
||||
|
||||
if (settings->bools.input_overlay_enable)
|
||||
task_push_overlay_load_default(input_overlay_loaded,
|
||||
settings->paths.path_overlay,
|
||||
settings->bools.input_overlay_hide_in_menu,
|
||||
settings->bools.input_overlay_enable,
|
||||
settings->floats.input_overlay_opacity,
|
||||
settings->floats.input_overlay_scale,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* INPUT REMOTE */
|
||||
@ -11185,8 +11233,10 @@ static bool video_driver_init_internal(bool *video_is_threaded)
|
||||
|
||||
video_driver_init_input(tmp);
|
||||
|
||||
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
||||
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
|
||||
#ifdef HAVE_OVERLAY
|
||||
retroarch_overlay_deinit();
|
||||
retroarch_overlay_init();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VIDEO_LAYOUT
|
||||
if (settings->bools.video_layout_enable)
|
||||
@ -16185,7 +16235,7 @@ void rarch_menu_running_finished(bool quit)
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (!quit)
|
||||
if (settings && settings->bools.input_overlay_hide_in_menu)
|
||||
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
|
||||
retroarch_overlay_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -17686,12 +17736,12 @@ static enum runloop_state runloop_check_state(
|
||||
if (input_driver_keyboard_linefeed_enable)
|
||||
{
|
||||
prev_overlay_restore = false;
|
||||
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
|
||||
retroarch_overlay_init();
|
||||
}
|
||||
else if (prev_overlay_restore)
|
||||
{
|
||||
if (!settings->bools.input_overlay_hide_in_menu)
|
||||
command_event(CMD_EVENT_OVERLAY_INIT, NULL);
|
||||
retroarch_overlay_init();
|
||||
prev_overlay_restore = false;
|
||||
}
|
||||
}
|
||||
|
10
retroarch.h
10
retroarch.h
@ -2259,6 +2259,16 @@ void driver_camera_stop(void);
|
||||
|
||||
bool driver_camera_start(void);
|
||||
|
||||
void retroarch_overlay_next(void);
|
||||
|
||||
void retroarch_overlay_set_scale_factor(void);
|
||||
|
||||
void retroarch_overlay_set_alpha_mod(void);
|
||||
|
||||
void retroarch_overlay_deinit(void);
|
||||
|
||||
void retroarch_overlay_init(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user