Reapply the fix

This commit is contained in:
void_17 2026-03-03 02:13:52 +07:00
parent e0779be14f
commit 59abab18f5

View file

@ -707,7 +707,19 @@ void CleanupDevice()
if( g_pd3dDevice ) g_pd3dDevice->Release(); if( g_pd3dDevice ) g_pd3dDevice->Release();
} }
typedef HRESULT(__stdcall* SetProcessDpiAwareness_f)(PROCESS_DPI_AWARENESS);
static HRESULT dyn_SetProcessDpiAwareness(PROCESS_DPI_AWARENESS value)
{
static const auto ptr = reinterpret_cast<SetProcessDpiAwareness_f>(
reinterpret_cast<void*>(::GetProcAddress(static_cast<HMODULE>(LoadLibraryExW(L"Shcore.dll", nullptr, 0)), "SetProcessDpiAwareness")));
if (ptr == nullptr)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return E_NOTIMPL;
}
return ptr(value);
}
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance, _In_opt_ HINSTANCE hPrevInstance,
@ -717,7 +729,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(lpCmdLine);
SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); dyn_SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN); g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN); g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN);