diff --git a/gfx/gfx_widgets.c b/gfx/gfx_widgets.c index 7f79f069e7..9b9661082c 100644 --- a/gfx/gfx_widgets.c +++ b/gfx/gfx_widgets.c @@ -1500,6 +1500,7 @@ void gfx_widgets_frame(void *data) gfx_display_t *p_disp = (gfx_display_t*)video_info->disp_userdata; gfx_display_ctx_driver_t *dispctx= p_disp->dispctx; dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)video_info->widgets_userdata; + bool fps_show = video_info->fps_show; bool framecount_show = video_info->framecount_show; bool memory_show = video_info->memory_show; bool core_status_msg_show = video_info->core_status_msg_show; @@ -1507,12 +1508,12 @@ void gfx_widgets_frame(void *data) 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; bool menu_screensaver_active = video_info->menu_screensaver_active; - bool notifications_hidden = video_info->notifications_hidden; + bool notifications_hidden = video_info->notifications_hidden || + video_info->msg_queue_delay; int top_right_x_advance = video_width; p_dispwidget->gfx_widgets_frame_count++; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index eefe533f7b..fdf6f743a9 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2832,18 +2832,19 @@ VIDEO_FLAG_WIDGETS_FAST_FORWARD; video_info->overlay_behind_menu = false; #endif + video_info->msg_queue_delay = runloop_st->msg_queue_delay; video_info->runloop_is_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED; video_info->runloop_is_slowmotion = runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION; video_info->fastforward_frameskip = settings->bools.fastforward_frameskip; video_info->input_driver_nonblock_state = input_st ? - (input_st->flags & INP_FLAG_NONBLOCKING) : false; + (input_st->flags & INP_FLAG_NONBLOCKING) : false; video_info->input_driver_grab_mouse_state = (input_st->flags & INP_FLAG_GRAB_MOUSE_STATE); video_info->disp_userdata = disp_get_ptr(); video_info->userdata = -VIDEO_DRIVER_GET_PTR_INTERNAL(video_st); + VIDEO_DRIVER_GET_PTR_INTERNAL(video_st); #ifdef HAVE_THREADS VIDEO_DRIVER_THREADED_UNLOCK(video_st, is_threaded); @@ -3958,7 +3959,9 @@ void video_driver_frame(const void *data, unsigned width, } #endif - if (runloop_st->msg_queue_size > 0) + if (runloop_st->msg_queue_delay > 0) + runloop_st->msg_queue_delay--; + else if (runloop_st->msg_queue_size > 0) { /* If widgets are currently enabled, then * messages were pushed to the queue before @@ -3970,12 +3973,12 @@ void video_driver_frame(const void *data, unsigned width, if (widgets_active) { msg_queue_entry_t msg_entry; - bool msg_found = false; + bool msg_found = false; RUNLOOP_MSG_QUEUE_LOCK(runloop_st); msg_found = msg_queue_extract( &runloop_st->msg_queue, &msg_entry); - runloop_st->msg_queue_size = msg_queue_size( + runloop_st->msg_queue_size = msg_queue_size( &runloop_st->msg_queue); RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st); @@ -4002,7 +4005,8 @@ void video_driver_frame(const void *data, unsigned width, const char *msg = NULL; RUNLOOP_MSG_QUEUE_LOCK(runloop_st); msg = msg_queue_pull(&runloop_st->msg_queue); - runloop_st->msg_queue_size = msg_queue_size(&runloop_st->msg_queue); + runloop_st->msg_queue_size = msg_queue_size(&runloop_st->msg_queue); + if (msg) strlcpy(video_driver_msg, msg, sizeof(video_driver_msg)); RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 4304c677c0..63fad385df 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -471,6 +471,7 @@ typedef struct video_frame_info unsigned black_frame_insertion; unsigned fps_update_interval; unsigned memory_update_interval; + unsigned msg_queue_delay; float menu_wallpaper_opacity; float menu_framebuffer_opacity; diff --git a/runloop.h b/runloop.h index 92a237329a..780cdd6024 100644 --- a/runloop.h +++ b/runloop.h @@ -246,6 +246,7 @@ struct runloop runloop_core_status_msg_t core_status_msg; + unsigned msg_queue_delay; unsigned pending_windowed_scale; unsigned max_frames; unsigned audio_latency; diff --git a/tasks/task_save.c b/tasks/task_save.c index 6a5d5fd07f..801d514204 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -1324,7 +1324,13 @@ static void task_push_save_state(const char *path, void *data, size_t size, bool state->flags |= (SAVE_TASK_FLAG_AUTOSAVE | SAVE_TASK_FLAG_MUTE); if (settings->bools.savestate_thumbnail_enable) - state->flags |= SAVE_TASK_FLAG_THUMBNAIL_ENABLE; + { + /* Delay OSD messages and widgets for a few frames + * to prevent GPU screenshots from having notifications */ + runloop_state_t *runloop_st = runloop_state_get_ptr(); + runloop_st->msg_queue_delay = 10; + state->flags |= SAVE_TASK_FLAG_THUMBNAIL_ENABLE; + } state->state_slot = settings->ints.state_slot; if (video_driver_cached_frame_has_valid_framebuffer()) state->flags |= SAVE_TASK_FLAG_HAS_VALID_FB;