From fa00eda625890c410c957a01e880de9f0397fcb3 Mon Sep 17 00:00:00 2001 From: Dwedit Date: Fri, 13 Jul 2018 22:34:03 -0500 Subject: [PATCH] Relocation of Win32 Message Loop Fix is now tied to whether threaded video is enabled or not Menu bar is removed if threaded video is enabled, due to code currently being unsafe when using threaded video. --- gfx/common/win32_common.c | 16 ++++++++++------ retroarch.c | 10 +++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 495e51c316..69f82746f6 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -56,6 +56,7 @@ #include "../../input/input_keymaps.h" #include "../video_thread_wrapper.h" #include "../video_display_server.h" +#include "../../gfx/video_driver.h" #include #ifdef HAVE_MENU @@ -1045,12 +1046,14 @@ void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height) { #if !defined(_XBOX) - const ui_application_t *application = - ui_companion_driver_get_application_ptr(); - if (application) - application->process_events(); + if (video_driver_is_threaded()) + { + const ui_application_t *application = + ui_companion_driver_get_application_ptr(); + if (application) + application->process_events(); + } *quit = g_win32_quit; -#endif if (g_win32_resized) { @@ -1059,6 +1062,7 @@ void win32_check_window(bool *quit, bool *resize, *height = g_win32_resize_height; g_win32_resized = false; } +#endif } bool win32_suppress_screensaver(void *data, bool enable) @@ -1189,7 +1193,7 @@ void win32_set_window(unsigned *width, unsigned *height, settings_t *settings = config_get_ptr(); const ui_window_t *window = ui_companion_driver_get_window_ptr(); - if (!fullscreen && settings->bools.ui_menubar_enable) + if (!fullscreen && settings->bools.ui_menubar_enable && !video_driver_is_threaded()) { RECT rc_temp; rc_temp.left = 0; diff --git a/retroarch.c b/retroarch.c index 84451a1d9e..69836ee943 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2535,6 +2535,14 @@ static enum runloop_state runloop_check_state( } } + if (!video_driver_is_threaded()) + { + const ui_application_t *application = + ui_companion_driver_get_application_ptr(); + if (application) + application->process_events(); + } + video_driver_get_status(&frame_count, &is_alive, &is_focused); #ifdef HAVE_MENU @@ -2687,7 +2695,7 @@ static enum runloop_state runloop_check_state( if (focused || !runloop_idle) { bool libretro_running = menu_display_libretro_running( - rarch_is_inited, + rarch_is_inited, (current_core_type == CORE_TYPE_DUMMY)); menu_driver_render(runloop_idle, rarch_is_inited,