1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-25 01:57:47 +01:00

return fake value for HORZRES and VERTRES

This commit is contained in:
FunkyFr3sh 2024-12-24 03:43:31 +01:00
parent daa2833509
commit cd60c29a92

View File

@ -909,17 +909,21 @@ SHORT WINAPI fake_GetAsyncKeyState(int vKey)
int WINAPI fake_GetDeviceCaps(HDC hdc, int index) int WINAPI fake_GetDeviceCaps(HDC hdc, int index)
{ {
DWORD bpp = 0; DWORD bpp = 0;
DWORD width = 0;
DWORD height = 0;
if (g_ddraw.ref && g_ddraw.bpp) if (g_ddraw.ref && g_ddraw.bpp)
{ {
bpp = g_ddraw.bpp; bpp = g_ddraw.bpp;
width = g_ddraw.width;
height = g_ddraw.height;
} }
else if (g_config.fake_mode[0]) else if (g_config.fake_mode[0])
{ {
char* e = &g_config.fake_mode[0]; char* e = &g_config.fake_mode[0];
strtoul(e, &e, 0); width = strtoul(e, &e, 0);
strtoul(e + 1, &e, 0); height = strtoul(e + 1, &e, 0);
bpp = 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); return real_GetDeviceCaps(hdc, index);
} }