From cd60c29a9270a2b3c5dae1caefa984deeccd07dd Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Tue, 24 Dec 2024 03:43:31 +0100 Subject: [PATCH] return fake value for HORZRES and VERTRES --- src/winapi_hooks.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c index 50551a3..bbb680b 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -909,17 +909,21 @@ SHORT WINAPI fake_GetAsyncKeyState(int vKey) int WINAPI fake_GetDeviceCaps(HDC hdc, int index) { DWORD bpp = 0; + DWORD width = 0; + DWORD height = 0; if (g_ddraw.ref && g_ddraw.bpp) { bpp = g_ddraw.bpp; + width = g_ddraw.width; + height = g_ddraw.height; } else if (g_config.fake_mode[0]) { char* e = &g_config.fake_mode[0]; - strtoul(e, &e, 0); - strtoul(e + 1, &e, 0); + width = strtoul(e, &e, 0); + height = strtoul(e + 1, &e, 0); bpp = strtoul(e + 1, &e, 0); } @@ -953,6 +957,19 @@ int WINAPI fake_GetDeviceCaps(HDC hdc, int index) } } + if (width && WindowFromDC(hdc) == GetDesktopWindow()) + { + if (index == HORZRES) + { + return width; + } + + if (index == VERTRES) + { + return height; + } + } + return real_GetDeviceCaps(hdc, index); }