Enable widget persistence across drivers_init()/driver_uninit() events

This commit is contained in:
jdgleaver 2020-03-11 11:35:01 +00:00
parent 2a0833378d
commit 086c68bca7
16 changed files with 202 additions and 133 deletions

View File

@ -295,7 +295,7 @@
{
bool statistics_show = video_info->statistics_show;
#ifdef HAVE_GFX_WIDGETS
bool widgets_inited = video_info->widgets_inited;
bool widgets_active = gfx_widgets_active();
#endif
[self _beginFrame];
@ -338,7 +338,7 @@
}
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
if (widgets_active)
{
[rce pushDebugGroup:@"menu widgets"];
gfx_widgets_frame(video_info);

View File

@ -1206,7 +1206,6 @@ static bool d3d10_gfx_frame(
D3D10Device context = d3d10->device;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
bool widgets_inited = video_info->widgets_inited;
bool statistics_show = video_info->statistics_show;
struct font_params
*osd_params = (struct font_params*)
@ -1510,8 +1509,7 @@ static bool d3d10_gfx_frame(
#endif
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
if (msg && *msg)

View File

@ -1285,7 +1285,6 @@ static bool d3d11_gfx_frame(
d3d11_texture_t* texture = NULL;
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
D3D11DeviceContext context = d3d11->context;
bool widgets_inited = video_info->widgets_inited;
const char *stat_text = video_info->stat_text;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
@ -1583,8 +1582,7 @@ static bool d3d11_gfx_frame(
#endif
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
if (msg && *msg)

View File

@ -1170,7 +1170,6 @@ static bool d3d12_gfx_frame(
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
const char *stat_text = video_info->stat_text;
bool statistics_show = video_info->statistics_show;
bool widgets_inited = video_info->widgets_inited;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
struct font_params *osd_params = (struct font_params*)
@ -1566,8 +1565,7 @@ static bool d3d12_gfx_frame(
#endif
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
if (msg && *msg)

View File

@ -1528,7 +1528,6 @@ static bool d3d9_frame(void *data, const void *frame,
unsigned width = video_info->width;
unsigned height = video_info->height;
bool statistics_show = video_info->statistics_show;
bool widgets_inited = video_info->widgets_inited;
bool black_frame_insertion = video_info->black_frame_insertion;
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
@ -1628,8 +1627,7 @@ static bool d3d9_frame(void *data, const void *frame,
#endif
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
if (msg && *msg)

View File

@ -2813,7 +2813,6 @@ static bool gl2_frame(void *data, const void *frame,
unsigned height = gl->video_height;
bool use_rgba = video_info->use_rgba;
bool statistics_show = video_info->statistics_show;
bool widgets_inited = video_info->widgets_inited;
bool msg_bgcolor_enable = video_info->msg_bgcolor_enable;
bool black_frame_insertion = video_info->black_frame_insertion;
bool input_driver_nonblock_state = video_info->input_driver_nonblock_state;
@ -3051,8 +3050,7 @@ static bool gl2_frame(void *data, const void *frame,
#endif
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
if (!string_is_empty(msg))

View File

@ -858,8 +858,7 @@ static bool gl1_gfx_frame(void *data, const void *frame,
#endif
#ifdef HAVE_GFX_WIDGETS
if (video_info->widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
#ifdef HAVE_OVERLAY

View File

@ -1843,7 +1843,6 @@ static bool gl_core_frame(void *data, const void *frame,
&video_info->osd_stat_params;
const char *stat_text = video_info->stat_text;
bool statistics_show = video_info->statistics_show;
bool widgets_inited = video_info->widgets_inited;
bool msg_bgcolor_enable = video_info->msg_bgcolor_enable;
bool black_frame_insertion = video_info->black_frame_insertion;
void *context_data = video_info->context_data;
@ -1938,8 +1937,7 @@ static bool gl_core_frame(void *data, const void *frame,
#endif
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
if (!string_is_empty(msg))

View File

@ -1348,8 +1348,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
}
#ifdef HAVE_GFX_WIDGETS
if (video_info->widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
if (msg)

View File

@ -1677,7 +1677,6 @@ static bool vulkan_frame(void *data, const void *frame,
void *context_data = video_info->context_data;
bool statistics_show = video_info->statistics_show;
const char *stat_text = video_info->stat_text;
bool widgets_inited = video_info->widgets_inited;
bool black_frame_insertion = video_info->black_frame_insertion;
bool input_driver_nonblock_state = video_info->input_driver_nonblock_state;
bool runloop_is_slowmotion = video_info->runloop_is_slowmotion;
@ -1988,8 +1987,7 @@ static bool vulkan_frame(void *data, const void *frame,
font_driver_render_msg(vk, msg, NULL, NULL);
#ifdef HAVE_GFX_WIDGETS
if (widgets_inited)
gfx_widgets_frame(video_info);
gfx_widgets_frame(video_info);
#endif
/* End the render pass. We're done rendering to backbuffer now. */

View File

@ -46,7 +46,20 @@
#include "../cheevos-new/badges.h"
#endif
/* TODO: Fix context reset freezing everything in place (probably kills animations when it shouldn't anymore) */
static bool widgets_inited = false;
static bool widgets_active = false;
bool gfx_widgets_active(void)
{
return widgets_active;
}
static bool widgets_persisting = false;
void gfx_widgets_set_persistence(bool persist)
{
widgets_persisting = persist;
}
static float msg_queue_background[16] = COLOR_HEX_TO_FLOAT(0x3A3A3A, 1.0f);
static float msg_queue_info[16] = COLOR_HEX_TO_FLOAT(0x12ACF8, 1.0f);
@ -228,7 +241,7 @@ static uintptr_t msg_queue_icon_outline = 0;
static uintptr_t msg_queue_icon_rect = 0;
static bool msg_queue_has_icons = false;
extern gfx_animation_ctx_tag gfx_widgets_generic_tag;
static gfx_animation_ctx_tag gfx_widgets_generic_tag = (uintptr_t)&widgets_active;
gfx_animation_ctx_tag gfx_widgets_get_generic_tag(void)
{
@ -410,6 +423,9 @@ void gfx_widgets_msg_queue_push(
{
menu_widget_msg_t* msg_widget = NULL;
if (!widgets_active)
return;
if (fifo_write_avail(msg_queue) > 0)
{
/* Get current msg if it exists */
@ -922,7 +938,12 @@ static void gfx_widgets_hourglass_tick(void *userdata)
gfx_animation_push(&entry);
}
/* Forward declaration */
/* Forward declarations */
static void gfx_widgets_context_reset(bool is_threaded,
unsigned width, unsigned height, bool fullscreen,
const char *dir_assets, char *font_path);
static void gfx_widgets_context_destroy(void);
static void gfx_widgets_free(void);
static void gfx_widgets_layout(
bool is_threaded, const char *dir_assets, char *font_path);
#ifdef HAVE_MENU
@ -936,10 +957,14 @@ void gfx_widgets_iterate(
bool is_threaded)
{
size_t i;
float scale_factor;
if (!widgets_active)
return;
/* Check whether screen dimensions or menu scale
* factor have changed */
float scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB) ?
scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB) ?
gfx_display_get_widget_pixel_scale(width, height, fullscreen) :
gfx_display_get_widget_dpi_scale(width, height, fullscreen);
@ -1473,20 +1498,42 @@ static void gfx_widgets_draw_load_content_animation(
void gfx_widgets_frame(void *data)
{
/* (Pointless) optimisation: allocating these
* costs nothing, so do it *before* the
* 'widgets_active' check... */
size_t i;
video_frame_info_t *video_info = (video_frame_info_t*)data;
bool framecount_show = video_info->framecount_show;
bool memory_show = video_info->memory_show;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
bool widgets_is_paused = video_info->widgets_is_paused;
bool fps_show = video_info->fps_show;
bool widgets_is_fastforwarding = video_info->widgets_is_fast_forwarding;
bool widgets_is_rewinding = video_info->widgets_is_rewinding;
bool runloop_is_slowmotion = video_info->runloop_is_slowmotion;
int top_right_x_advance = video_width;
int scissor_me_timbers = 0;
video_frame_info_t *video_info;
bool framecount_show;
bool memory_show;
void *userdata;
unsigned video_width;
unsigned video_height;
bool widgets_is_paused;
bool fps_show;
bool widgets_is_fastforwarding;
bool widgets_is_rewinding;
bool runloop_is_slowmotion;
int top_right_x_advance;
int scissor_me_timbers;
if (!widgets_active)
return;
/* ...but assigning them costs a tiny amount,
* so do it *after* the 'widgets_active' check */
video_info = (video_frame_info_t*)data;
framecount_show = video_info->framecount_show;
memory_show = video_info->memory_show;
userdata = video_info->userdata;
video_width = video_info->width;
video_height = video_info->height;
widgets_is_paused = video_info->widgets_is_paused;
fps_show = video_info->fps_show;
widgets_is_fastforwarding = video_info->widgets_is_fast_forwarding;
widgets_is_rewinding = video_info->widgets_is_rewinding;
runloop_is_slowmotion = video_info->runloop_is_slowmotion;
top_right_x_advance = video_width;
scissor_me_timbers = 0;
gfx_widgets_frame_count++;
@ -1974,52 +2021,69 @@ void gfx_widgets_frame(void *data)
gfx_display_unset_viewport(video_width, video_height);
}
bool gfx_widgets_init(bool video_is_threaded, bool fullscreen)
bool gfx_widgets_init(
bool video_is_threaded,
unsigned width, unsigned height, bool fullscreen,
const char *dir_assets, char *font_path)
{
size_t i;
if (!gfx_display_init_first_driver(video_is_threaded))
goto error;
gfx_widgets_frame_count = 0;
for (i = 0; i < widgets_len; i++)
if (!widgets_inited)
{
const gfx_widget_t* widget = widgets[i];
size_t i;
if (widget->init)
widget->init(video_is_threaded, fullscreen);
gfx_widgets_frame_count = 0;
for (i = 0; i < widgets_len; i++)
{
const gfx_widget_t* widget = widgets[i];
if (widget->init)
widget->init(video_is_threaded, fullscreen);
}
msg_queue = fifo_new(MSG_QUEUE_PENDING_MAX * sizeof(menu_widget_msg_t*));
if (!msg_queue)
goto error;
current_msgs = (file_list_t*)calloc(1, sizeof(file_list_t));
if (!current_msgs)
goto error;
if (!file_list_reserve(current_msgs, MSG_QUEUE_ONSCREEN_MAX))
goto error;
widgets_inited = true;
}
msg_queue = fifo_new(MSG_QUEUE_PENDING_MAX * sizeof(menu_widget_msg_t*));
gfx_widgets_context_reset(video_is_threaded,
width, height, fullscreen,
dir_assets, font_path);
if (!msg_queue)
goto error;
current_msgs = (file_list_t*)calloc(1, sizeof(file_list_t));
if (!current_msgs)
goto error;
if (!file_list_reserve(current_msgs, MSG_QUEUE_ONSCREEN_MAX))
goto error;
/* Initialise scaling parameters
* NOTE - special cases:
* > Ozone has a capped scale factor
* > XMB uses pixel based scaling - all other drivers
* use DPI based scaling */
video_driver_get_size(&last_video_width, &last_video_height);
last_scale_factor = (gfx_display_get_driver_id() == MENU_DRIVER_ID_XMB) ?
gfx_display_get_widget_pixel_scale(last_video_width, last_video_height, fullscreen) :
gfx_display_get_widget_dpi_scale(last_video_width, last_video_height, fullscreen);
widgets_active = true;
return true;
error:
gfx_widgets_free();
return false;
}
void gfx_widgets_deinit(void)
{
if (!widgets_inited)
return;
gfx_widgets_context_destroy();
widgets_active = false;
if (!widgets_persisting)
gfx_widgets_free();
}
static void gfx_widgets_layout(
bool is_threaded, const char *dir_assets, char *font_path)
{
@ -2156,7 +2220,7 @@ static void gfx_widgets_layout(
}
}
void gfx_widgets_context_reset(bool is_threaded,
static void gfx_widgets_context_reset(bool is_threaded,
unsigned width, unsigned height, bool fullscreen,
const char *dir_assets, char *font_path)
{
@ -2302,13 +2366,11 @@ static void gfx_widgets_achievement_next(void* userdata)
}
#endif
void gfx_widgets_free(void)
static void gfx_widgets_free(void)
{
size_t i;
gfx_animation_ctx_tag libretro_tag;
gfx_widgets_context_destroy();
for (i = 0; i < widgets_len; i++)
{
const gfx_widget_t* widget = widgets[i];
@ -2388,6 +2450,9 @@ void gfx_widgets_free(void)
/* Volume */
volume_alpha = 0.0f;
widgets_inited = false;
widgets_active = false;
}
static void gfx_widgets_volume_timer_end(void *userdata)
@ -2413,6 +2478,9 @@ void gfx_widgets_volume_update_and_show(float new_volume, bool mute)
{
gfx_timer_ctx_entry_t entry;
if (!widgets_active)
return;
gfx_animation_kill_by_tag(&volume_tag);
volume_db = new_volume;
@ -2430,6 +2498,9 @@ void gfx_widgets_volume_update_and_show(float new_volume, bool mute)
bool gfx_widgets_set_fps_text(const char *new_fps_text)
{
if (!widgets_active)
return false;
strlcpy(gfx_widgets_fps_text,
new_fps_text, sizeof(gfx_widgets_fps_text));
@ -2502,6 +2573,9 @@ void gfx_widgets_start_load_content_animation(const char *content_name, bool rem
float icon_color[16] = COLOR_HEX_TO_FLOAT(0x0473C9, 1.0f); /* TODO: random color */
unsigned timing = 0;
if (!widgets_active)
return;
/* Prepare data */
load_content_animation_icon = 0;
@ -2680,6 +2754,9 @@ void gfx_widgets_push_achievement(const char *title, const char *badge)
{
int start_notification = 1;
if (!widgets_active)
return;
if (cheevo_popup_queue_read_index < 0)
{
/* queue uninitialized */
@ -2744,6 +2821,9 @@ void gfx_widgets_set_message(char *msg)
gfx_timer_ctx_entry_t timer;
gfx_animation_ctx_tag tag = (uintptr_t) &generic_message_timer;
if (!widgets_active)
return;
strlcpy(generic_message, msg, sizeof(generic_message));
generic_message_alpha = DEFAULT_BACKDROP;
@ -2781,6 +2861,9 @@ void gfx_widgets_set_libretro_message(const char *msg, unsigned duration)
gfx_timer_ctx_entry_t timer;
gfx_animation_ctx_tag tag = (uintptr_t) &libretro_message_timer;
if (!widgets_active)
return;
strlcpy(libretro_message, msg, sizeof(libretro_message));
libretro_message_alpha = DEFAULT_BACKDROP;

View File

@ -115,9 +115,14 @@ typedef struct gfx_widget gfx_widget_t;
extern const gfx_widget_t gfx_widget_screenshot;
bool gfx_widgets_init(bool video_is_threaded, bool fullscreen);
bool gfx_widgets_active(void);
void gfx_widgets_set_persistence(bool persist);
void gfx_widgets_free(void);
bool gfx_widgets_init(
bool video_is_threaded,
unsigned width, unsigned height, bool fullscreen,
const char *dir_assets, char *font_path);
void gfx_widgets_deinit(void);
void gfx_widgets_msg_queue_push(
retro_task_t *task, const char *msg,
@ -155,10 +160,6 @@ void gfx_widgets_start_load_content_animation(
void gfx_widgets_cleanup_load_content_animation(void);
void gfx_widgets_context_reset(bool is_threaded,
unsigned width, unsigned height, bool fullscreen,
const char *dir_assets, char *font_path);
void gfx_widgets_push_achievement(const char *title, const char *badge);
/* Warning: not thread safe! */

View File

@ -1216,7 +1216,7 @@ static void thread_apply_state_changes(void *data)
static struct video_shader *thread_get_current_shader(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr || !thr->poke)
if (!thr || !thr->poke || !thr->poke->get_current_shader)
return NULL;
return thr->poke->get_current_shader(thr->driver_data);
}

View File

@ -106,7 +106,12 @@ static void gfx_widgets_play_screenshot_flash(void)
void gfx_widgets_screenshot_taken(const char *shotname, const char *filename)
{
gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
gfx_widget_screenshot_state_t* state = NULL;
if (!gfx_widgets_active())
return;
state = gfx_widget_screenshot_get_ptr();
gfx_widgets_play_screenshot_flash();
strlcpy(state->filename, filename, sizeof(state->filename));
strlcpy(state->shotname, shotname, sizeof(state->shotname));

View File

@ -2636,9 +2636,6 @@ bool is_accessibility_enabled(void)
#endif
#ifdef HAVE_GFX_WIDGETS
static bool gfx_widgets_inited = false;
gfx_animation_ctx_tag gfx_widgets_generic_tag = (uintptr_t) &gfx_widgets_inited;
/* Status icons */
static bool gfx_widgets_paused = false;
static bool gfx_widgets_fast_forward = false;
@ -2648,7 +2645,7 @@ static bool gfx_widgets_rewinding = false;
bool gfx_widgets_ready(void)
{
#ifdef HAVE_GFX_WIDGETS
return gfx_widgets_inited;
return gfx_widgets_active();
#else
return false;
#endif
@ -5557,7 +5554,7 @@ bool retroarch_apply_shader(enum rarch_shader_type type, const char *preset_path
preset_file ? "Shader: \"%s\"" : "Shader: %s",
preset_file ? preset_file : "None");
#ifdef HAVE_GFX_WIDGETS
if (gfx_widgets_inited)
if (gfx_widgets_active())
gfx_widgets_set_message(msg);
else
#endif
@ -6996,7 +6993,7 @@ static void command_event_set_volume(float gain)
new_volume);
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (gfx_widgets_active())
gfx_widgets_volume_update_and_show(new_volume, audio_driver_mute_enable);
else
#endif
@ -7992,7 +7989,7 @@ static void retroarch_pause_checks(void)
RARCH_LOG("%s\n", msg_hash_to_str(MSG_PAUSED));
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (gfx_widgets_active())
gfx_widgets_paused = is_paused;
else
#endif
@ -8012,7 +8009,7 @@ static void retroarch_pause_checks(void)
else
{
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (gfx_widgets_active())
gfx_widgets_paused = is_paused;
#endif
RARCH_LOG("%s\n", msg_hash_to_str(MSG_UNPAUSED));
@ -8529,7 +8526,7 @@ bool command_event(enum event_command cmd, void *data)
audio_driver_mute_enable = !audio_driver_mute_enable;
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (gfx_widgets_active())
gfx_widgets_volume_update_and_show(
configuration_settings->floats.audio_volume,
audio_driver_mute_enable);
@ -9713,6 +9710,10 @@ void main_exit(void *args)
if (config_save_on_exit)
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
#if defined(HAVE_GFX_WIDGETS)
/* Do not want menu widgets to live any more. */
gfx_widgets_set_persistence(false);
#endif
#ifdef HAVE_MENU
/* Do not want menu context to live any more. */
menu_driver_ctl(RARCH_MENU_CTL_UNSET_OWN_DRIVER, NULL);
@ -11200,7 +11201,7 @@ static bool rarch_environment_cb(unsigned cmd, void *data)
const struct retro_message *msg = (const struct retro_message*)data;
RARCH_LOG("[Environ]: SET_MESSAGE: %s\n", msg->msg);
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (gfx_widgets_active())
gfx_widgets_set_libretro_message(msg->msg,
roundf((float)msg->frames / 60.0f * 1000.0f));
else
@ -23615,8 +23616,10 @@ static void video_driver_frame(const void *data, unsigned width,
static retro_time_t curr_time;
static retro_time_t fps_time;
static float last_fps, frame_time;
retro_time_t new_time =
cpu_features_get_time_usec();
retro_time_t new_time = cpu_features_get_time_usec();
#if defined(HAVE_GFX_WIDGETS)
bool widgets_active = gfx_widgets_active();
#endif
if (!video_driver_active)
return;
@ -23780,7 +23783,7 @@ static void video_driver_frame(const void *data, unsigned width,
* extracted and pushed to the widget message
* queue instead */
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (widgets_active)
{
bool msg_found = false;
msg_queue_entry_t msg_entry;
@ -23897,7 +23900,7 @@ static void video_driver_frame(const void *data, unsigned width,
)
{
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (widgets_active)
gfx_widgets_set_fps_text(video_info.fps_text);
else
#endif
@ -24073,12 +24076,10 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->fps_text[0] = '\0';
#if defined(HAVE_GFX_WIDGETS)
video_info->widgets_inited = gfx_widgets_inited;
video_info->widgets_is_paused = gfx_widgets_paused;
video_info->widgets_is_fast_forwarding = gfx_widgets_fast_forward;
video_info->widgets_is_rewinding = gfx_widgets_rewinding;
#else
video_info->widgets_inited = false;
video_info->widgets_is_paused = false;
video_info->widgets_is_fast_forwarding = false;
video_info->widgets_is_rewinding = false;
@ -24175,7 +24176,10 @@ bool video_driver_translate_coord_viewport(
int norm_full_vp_width = (int)vp->full_width;
int norm_full_vp_height = (int)vp->full_height;
if (norm_full_vp_width <= 0 || norm_full_vp_height <= 0)
if (norm_vp_width <= 0 ||
norm_vp_height <= 0 ||
norm_full_vp_width <= 0 ||
norm_full_vp_height <= 0)
return false;
if (mouse_x >= 0 && mouse_x <= norm_full_vp_width)
@ -25292,6 +25296,11 @@ static void drivers_init(int flags)
settings_t *settings = configuration_settings;
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
#if defined(HAVE_GFX_WIDGETS)
/* By default, we want menu widgets to persist through driver reinits. */
gfx_widgets_set_persistence(true);
#endif
#ifdef HAVE_MENU
/* By default, we want the menu to persist through driver reinits. */
menu_driver_ctl(RARCH_MENU_CTL_SET_OWN_DRIVER, NULL);
@ -25379,17 +25388,10 @@ static void drivers_init(int flags)
bool video_is_fullscreen = settings->bools.video_fullscreen ||
rarch_force_fullscreen;
if (!gfx_widgets_inited)
gfx_widgets_inited = gfx_widgets_init(
video_is_threaded, video_is_fullscreen);
if (gfx_widgets_inited)
gfx_widgets_context_reset(video_is_threaded,
video_driver_width, video_driver_height, video_is_fullscreen,
settings->paths.directory_assets,
settings->paths.path_font);
else
gfx_widgets_free();
gfx_widgets_init(video_is_threaded,
video_driver_width, video_driver_height, video_is_fullscreen,
settings->paths.directory_assets,
settings->paths.path_font);
}
else
#endif
@ -25461,11 +25463,7 @@ static void driver_uninit(int flags)
/* This absolutely has to be done before video_driver_free_internal()
* is called/completes, otherwise certain menu drivers
* (e.g. Vulkan) will segfault */
{
if (gfx_widgets_inited)
gfx_widgets_free();
gfx_widgets_inited = false;
}
gfx_widgets_deinit();
#endif
#ifdef HAVE_MENU
@ -25533,11 +25531,7 @@ static void retroarch_deinit_drivers(void)
* in case the handle is lost in the threaded
* video driver in the meantime
* (breaking video_driver_has_widgets) */
if (gfx_widgets_inited)
{
gfx_widgets_free();
gfx_widgets_inited = false;
}
gfx_widgets_deinit();
#endif
/* Video */
@ -27870,7 +27864,7 @@ static void runloop_task_msg_queue_push(
bool flush)
{
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited && task->title && !task->mute)
if (gfx_widgets_active() && task->title && !task->mute)
{
runloop_msg_queue_lock();
ui_companion_driver_msg_queue_push(msg,
@ -28756,7 +28750,7 @@ void runloop_msg_queue_push(const char *msg,
accessibility_speak_priority((char*) msg, 0);
#endif
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (gfx_widgets_active())
{
gfx_widgets_msg_queue_push(NULL, msg,
roundf((float)duration / 60.0f * 1000.0f),
@ -29002,14 +28996,14 @@ static void update_fastforwarding_state(void)
if (runloop_fastmotion)
{
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (gfx_widgets_active())
gfx_widgets_fast_forward = true;
#endif
}
#if defined(HAVE_GFX_WIDGETS)
else
{
if (gfx_widgets_inited)
if (gfx_widgets_active())
{
gfx_widgets_fast_forward = false;
{
@ -29044,6 +29038,9 @@ static enum runloop_state runloop_check_state(retro_time_t current_time)
bool menu_is_alive = menu_driver_alive;
bool display_kb = menu_input_dialog_get_display_kb();
#endif
#if defined(HAVE_GFX_WIDGETS)
bool widgets_active = gfx_widgets_active();
#endif
#if defined(HAVE_TRANSLATE) && defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_ai_service_overlay_get_state() == 3)
@ -29330,7 +29327,7 @@ static enum runloop_state runloop_check_state(retro_time_t current_time)
video_driver_width, video_driver_height);
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (widgets_active)
{
bool video_is_fullscreen = settings->bools.video_fullscreen ||
rarch_force_fullscreen;
@ -29662,7 +29659,7 @@ static enum runloop_state runloop_check_state(retro_time_t current_time)
/* Show the fast-forward OSD for 1 frame every frame if menu widgets are disabled */
#if defined(HAVE_GFX_WIDGETS)
if (!gfx_widgets_inited && runloop_fastmotion)
if (!widgets_active && runloop_fastmotion)
#else
if (runloop_fastmotion)
#endif
@ -29737,7 +29734,7 @@ static enum runloop_state runloop_check_state(retro_time_t current_time)
runloop_paused, s, sizeof(s), &t);
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_inited)
if (widgets_active)
gfx_widgets_rewinding = rewinding;
else
#endif
@ -29772,7 +29769,7 @@ static enum runloop_state runloop_check_state(retro_time_t current_time)
video_driver_cached_frame();
#if defined(HAVE_GFX_WIDGETS)
if (!gfx_widgets_inited)
if (!widgets_active)
#endif
{
if (state_manager_frame_is_reversed())

View File

@ -1096,7 +1096,6 @@ typedef struct video_info
typedef struct video_frame_info
{
bool menu_mouse_enable;
bool widgets_inited;
bool widgets_is_paused;
bool widgets_is_fast_forwarding;
bool widgets_is_rewinding;