From 852ea898e795b05ff1d1784946ad52bda83ed94b Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Jun 2017 18:36:21 +0100 Subject: [PATCH] Fix #5534: Unable to select any full screen resolutions --- src/openrct2-ui/UiContext.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 2facbf5a72..70571a0ccc 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -606,16 +606,18 @@ private: SDL_GetDesktopDisplayMode(displayIndex, &mode); // Get resolutions - auto resolutions = std::vector(numDisplayModes); + auto resolutions = std::vector(); float desktopAspectRatio = (float)mode.w / mode.h; for (sint32 i = 0; i < numDisplayModes; i++) { SDL_GetDisplayMode(displayIndex, i, &mode); - - float aspectRatio = (float)mode.w / mode.h; - if (_resolutionsAllowAnyAspectRatio || std::fabs(desktopAspectRatio - aspectRatio) < 0.0001f) + if (mode.w > 0 && mode.h > 0) { - resolutions.push_back({ mode.w, mode.h }); + float aspectRatio = (float)mode.w / mode.h; + if (_resolutionsAllowAnyAspectRatio || std::fabs(desktopAspectRatio - aspectRatio) < 0.0001f) + { + resolutions.push_back({ mode.w, mode.h }); + } } } @@ -642,6 +644,8 @@ private: gConfigGeneral.fullscreen_width = resolutions.back().Width; gConfigGeneral.fullscreen_height = resolutions.back().Height; } + + _fsResolutions = resolutions; } Resolution GetClosestResolution(sint32 inWidth, sint32 inHeight)