Skip to content

Commit

Permalink
return fake value for HORZRES and VERTRES
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Dec 24, 2024
1 parent daa2833 commit cd60c29
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/winapi_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit cd60c29

Please sign in to comment.