From 1f979ca478156936cff447f6e070f15bb5c77673 Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Sat, 16 Nov 2019 02:46:53 +0100 Subject: [PATCH] Merge all four display mode settings --- source-code/data/plugins/config.ini | 8 +++----- source-code/source/plugins/Launcher/framework.h | 5 ++--- source-code/source/plugins/Render/dllmain.cpp | 7 +++++-- source-code/source/plugins/Render/framework.h | 2 -- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/source-code/data/plugins/config.ini b/source-code/data/plugins/config.ini index 5f440e0..fdcb4d9 100644 --- a/source-code/data/plugins/config.ini +++ b/source-code/data/plugins/config.ini @@ -73,13 +73,11 @@ MLAA=1 FRM.Motion.Rate=300 [Resolution] -# 0 = Windowed, 1 = Borderless (Forced to desktop resolution), 2 = Fullscreen +# 0 = Windowed, 1 = Popup (recommended), 2 = Exclusive, 3 = Failsafe # For same as screen res: -1x-1 Display=1 -Width=1280 -Height=720 -# Make borderless mode use a popup window (better performance/lower latency, but can cause screenshot issues) -Borderless.Popup=1 +Width=-1 +Height=-1 # Fullscreen only options BitDepth=32 RefreshRate=60 diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index 56816f5..efc12e2 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -135,8 +135,8 @@ static std::vector getScreenRatesVec(std::vector &screenModes) { std::vector screenModes = getScreenModes(); -DropdownOption* DisplayModeDropdown = new DropdownOption(L"display", RESOLUTION_SECTION, CONFIG_FILE, L"Display:", L"Sets the window/screen mode.", 0, std::vector({ L"Windowed", L"Borderless", L"Fullscreen" })); -ResolutionOption* DisplayResolutionOption = new ResolutionOption(L"width", L"height", RESOLUTION_SECTION, CONFIG_FILE, L"Resolution:", L"Sets the display resolution.", resolution(1280, 720), getScreenResolutionsVec(screenModes), true, RESOPT_INCLUDE_MATCH_SCREEN); +DropdownOption* DisplayModeDropdown = new DropdownOption(L"display", RESOLUTION_SECTION, CONFIG_FILE, L"Display:", L"Sets the window/screen mode.", 1, std::vector({ L"Windowed", L"Popup (recommended)", L"Exclusive", L"Failsafe" })); +ResolutionOption* DisplayResolutionOption = new ResolutionOption(L"width", L"height", RESOLUTION_SECTION, CONFIG_FILE, L"Resolution:", L"Sets the display resolution.", resolution(-1, -1), getScreenResolutionsVec(screenModes), true, RESOPT_INCLUDE_MATCH_SCREEN); ConfigOptionBase* screenResolutionArray[] = { DisplayModeDropdown, @@ -186,7 +186,6 @@ ConfigOptionBase* optionsArray[] = { new BooleanOption(L"TAA", GRAPHICS_SECTION, CONFIG_FILE, L"TAA", L"Temporal Anti-Aliasing", true, false), new BooleanOption(L"MLAA", GRAPHICS_SECTION, CONFIG_FILE, L"MLAA", L"Morphological Anti-Aliasing", true, false), - new BooleanOption(L"borderless.popup", RESOLUTION_SECTION, CONFIG_FILE, L"Popup Borderless Mode", L"Makes borderless mode use a popup window.\nPerformance may increase and latency should decrease, but screenshots may not work as expected.", true, false), new BooleanOption(L"FPS.Limit.LightMode", GRAPHICS_SECTION, CONFIG_FILE, L"Use Lightweight Limiter", L"Makes the FPS limiter use less CPU.\nMay have less consistent performance.", true, false), new NumericOption(L"FPS.Limit", GRAPHICS_SECTION, CONFIG_FILE, L"FPS Limit:", L"Allows you to set a frame rate cap. Set to -1 to unlock the frame rate.", 60, -1, INT_MAX), new NumericOption(L"frm.motion.rate", GRAPHICS_SECTION, CONFIG_FILE, L"FRM Motion Rate:", L"Sets the motion rate (fps) for the Frame Rate Manager component.\nLarger values should be smoother, but more CPU intensive and possibly buggier.", 300, 1, INT_MAX), diff --git a/source-code/source/plugins/Render/dllmain.cpp b/source-code/source/plugins/Render/dllmain.cpp index 4754bf3..dab3f9f 100644 --- a/source-code/source/plugins/Render/dllmain.cpp +++ b/source-code/source/plugins/Render/dllmain.cpp @@ -70,7 +70,7 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int)) glutInitWindowPosition(wndX, wndY); glutCreateWindow(title); - if (nDisplay == 1) // borderless mode + if (nDisplay == 1 || nDisplay == 3) // borderless mode { // support borderless mode even with original copy of glut HDC hDev = wglGetCurrentDC(); // get handle to current opengl device context @@ -78,8 +78,11 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int)) LONG_PTR wndStyle = WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // set no border (visible to ensure something is shown immediately) - if (nPopupBorderless) + if (nDisplay == 1) + { wndStyle |= WS_POPUP; + printf("[Render Manager] Popup enabled.\n"); + } SetWindowLongPtr(hWnd, GWL_STYLE, wndStyle); SetWindowPos(hWnd, HWND_TOP, wndX, wndY, nWidth, nHeight, SWP_FRAMECHANGED); // adjust position to apply new style diff --git a/source-code/source/plugins/Render/framework.h b/source-code/source/plugins/Render/framework.h index 696d17d..9bc848f 100644 --- a/source-code/source/plugins/Render/framework.h +++ b/source-code/source/plugins/Render/framework.h @@ -35,8 +35,6 @@ int nIntResHeight = GetPrivateProfileIntW(L"resolution", L"r.height", 720, CONFI int nBitDepth = GetPrivateProfileIntW(L"resolution", L"bitdepth", 32, CONFIG_FILE); int nRefreshRate = GetPrivateProfileIntW(L"resolution", L"refreshrate", 60, CONFIG_FILE); -int nPopupBorderless = GetPrivateProfileIntW(L"resolution", L"borderless.popup", TRUE, CONFIG_FILE); - int nFpsLimit = GetPrivateProfileIntW(L"graphics", L"fps.limit", 60, CONFIG_FILE); int nUseLightLimiter = GetPrivateProfileIntW(L"graphics", L"fps.limit.lightmode", TRUE, CONFIG_FILE); int nVerboseLimiter = GetPrivateProfileIntW(L"graphics", L"fps.limit.verbose", FALSE, CONFIG_FILE);