From dccc9711d9f547777e59278b0ebc77499fb2eee5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 9 Aug 2017 10:58:43 +0200 Subject: [PATCH] Start hooking up more resolution functions - not working properly yet --- gfx/common/win32_common.cpp | 28 ++++++++++++++++++++-------- gfx/drivers_context/wgl_ctx.cpp | 6 ++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index fb40c7658c..79837dd2ef 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -30,6 +30,9 @@ #include "../../tasks/tasks_internal.h" #include "../../core_info.h" +static unsigned current_window_width = 0; +static unsigned current_window_height = 0; + #if !defined(_XBOX) #define IDI_ICON 1 @@ -752,8 +755,8 @@ static bool win32_monitor_set_fullscreen(unsigned width, unsigned height, memset(&devmode, 0, sizeof(devmode)); devmode.dmSize = sizeof(DEVMODE); - devmode.dmPelsWidth = width; - devmode.dmPelsHeight = height; + devmode.dmPelsWidth = (current_window_width == 0) ? width : current_window_width; + devmode.dmPelsHeight = (current_window_height == 0) ? height : current_window_height; devmode.dmDisplayFrequency = refresh; devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; @@ -1051,7 +1054,7 @@ void win32_destroy_window(void) #ifndef _XBOX UnregisterClass("RetroArch", GetModuleHandle(NULL)); #endif - main_window.hwnd = NULL; + main_window.hwnd = NULL; } void win32_get_video_output_prev( @@ -1087,8 +1090,10 @@ void win32_get_video_output_prev( if (found) { - *width = prev_width; - *height = prev_height; + *width = prev_width; + *height = prev_height; + current_window_width = prev_width; + current_window_height = prev_height; } } @@ -1110,8 +1115,10 @@ void win32_get_video_output_next( { if (found) { - *width = dm.dmPelsWidth; - *height = dm.dmPelsHeight; + *width = dm.dmPelsWidth; + *height = dm.dmPelsHeight; + current_window_width = *width; + current_window_height = *height; break; } @@ -1126,7 +1133,12 @@ void win32_get_video_output_size(unsigned *width, unsigned *height) memset(&dm, 0, sizeof(dm)); dm.dmSize = sizeof(dm); - if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) != 0) + if (current_window_width != 0 && current_window_height != 0) + { + *width = current_window_width; + *height = current_window_height; + } + else if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) != 0) { *width = dm.dmPelsWidth; *height = dm.dmPelsHeight; diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index eb7545b548..28e8edad37 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -710,10 +710,16 @@ static void gfx_ctx_wgl_get_video_output_size(void *data, static void gfx_ctx_wgl_get_video_output_prev(void *data) { + unsigned width = 0; + unsigned height = 0; + win32_get_video_output_prev(&width, &height); } static void gfx_ctx_wgl_get_video_output_next(void *data) { + unsigned width = 0; + unsigned height = 0; + win32_get_video_output_next(&width, &height); } const gfx_ctx_driver_t gfx_ctx_wgl = {