From ccbf60698a8ed50257e62779cb2a057d8bbf5306 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sun, 1 Sep 2024 12:34:36 +0200 Subject: [PATCH] allow to override SM_CXSCREEN and SM_CYSCREEN via fake_mode --- src/winapi_hooks.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c index da7a99c..12e6056 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -307,13 +307,29 @@ BOOL WINAPI fake_GetCursorInfo(PCURSORINFO pci) int WINAPI fake_GetSystemMetrics(int nIndex) { + DWORD width = 0; + DWORD height = 0; + if (g_ddraw.ref && g_ddraw.width) + { + width = g_ddraw.width; + height = g_ddraw.height; + } + else if (g_config.fake_mode[0]) + { + char* e = &g_config.fake_mode[0]; + + width = strtoul(e, &e, 0); + height = strtoul(e + 1, &e, 0); + } + + if (width) { if (nIndex == SM_CXSCREEN) - return g_ddraw.width; + return width; if (nIndex == SM_CYSCREEN) - return g_ddraw.height; + return height; } return real_GetSystemMetrics(nIndex);