Fix borderless mode

This commit is contained in:
nastys
2019-08-09 15:22:51 +02:00
parent 2e1da17161
commit 93f212fa43
@@ -9,6 +9,8 @@
int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
{
SetProcessDPIAware();
// trick Optimus into switching to the NVIDIA GPU
if (cuInit != NULL) cuInit(0);
@@ -37,19 +39,18 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
*fullScreenFlag = 0;
RECT xy;
SetProcessDPIAware();
SystemParametersInfo(SPI_GETWORKAREA, 0, &xy, 0);
int screenWidth = xy.right - xy.left;
int screenHeight = xy.bottom - xy.top;
if (nWidth > screenWidth)
{
screenWidth = GetSystemMetrics(SM_CXFULLSCREEN);
screenWidth = GetSystemMetrics(SM_CXSCREEN);
xy.left = 0;
}
if (nHeight > screenHeight)
{
screenHeight = GetSystemMetrics(SM_CYFULLSCREEN);
screenHeight = GetSystemMetrics(SM_CYSCREEN);
xy.top = 0;
}
int wndX = xy.left + (screenWidth - nWidth) / 2;
@@ -78,7 +79,6 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
}
}
SetProcessDPIAware();
return true;
}