From 3d413c5d93fec9aee0fbcbff6710c8c9b8f20be5 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Thu, 14 Sep 2023 01:06:37 +0200 Subject: [PATCH] tweak custom resolution settings --- src/config.c | 2 ++ src/dd.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index 2840e53..59d46ca 100644 --- a/src/config.c +++ b/src/config.c @@ -368,6 +368,8 @@ static void cfg_create_ini() "no_dinput_hook=false\n" "refresh_rate=0\n" "non_anti_aliased_fonts=true\n" + "custom_width=0\n" + "custom_height=0\n" "\n" "\n" "\n" diff --git a/src/dd.c b/src/dd.c index 9ad7e68..c1a0ea0 100644 --- a/src/dd.c +++ b/src/dd.c @@ -179,6 +179,12 @@ HRESULT dd_EnumDisplayModes( while (--m.dmPelsWidth % 8); } + if (i == 0 && g_ddraw->custom_width && g_ddraw->custom_height) + { + m.dmPelsWidth = g_ddraw->custom_width; + m.dmPelsHeight = g_ddraw->custom_height; + } + TRACE( " %u: %ux%u@%u %u bpp\n", i, @@ -291,7 +297,8 @@ HRESULT dd_EnumDisplayModes( if (!resolutions[i].cx || !resolutions[i].cy) continue; - if ((max_w && resolutions[i].cx > max_w) || (max_h && resolutions[i].cy > max_h)) + if (!(resolutions[i].cx == g_ddraw->custom_width && resolutions[i].cy == g_ddraw->custom_height) && + ((max_w && resolutions[i].cx > max_w) || (max_h && resolutions[i].cy > max_h))) { DEVMODE m; memset(&m, 0, sizeof(DEVMODE)); @@ -304,7 +311,7 @@ HRESULT dd_EnumDisplayModes( if (ChangeDisplaySettings(&m, CDS_TEST) != DISP_CHANGE_SUCCESSFUL) continue; } - + DebugBreak(); memset(&s, 0, sizeof(s)); s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);