From 1b23c51a9fd39d0a83a1b9680500babc36ffa575 Mon Sep 17 00:00:00 2001 From: The Dax Date: Mon, 17 Feb 2014 03:30:38 -0500 Subject: [PATCH] Win32: Make PPSSPP DPI aware to avoid flickering in fullscreen on some PC hardware setups. --- Windows/main.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Windows/main.cpp b/Windows/main.cpp index 4b1fe9592b..edcb935b11 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -202,8 +202,32 @@ bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &default } } +bool SystemIsWindowsVistaOrHigher() +{ + u64 conditionMask = 0; + OSVERSIONINFOEX osvi; + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + + osvi.dwOSVersionInfoSize = sizeof(osvi); + osvi.dwMajorVersion = 6; + u32 op = VER_EQUAL; + + VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, op); + + const u32 typeMask = VER_MAJORVERSION; + + return VerifyVersionInfo(&osvi, typeMask, conditionMask) != FALSE; +} + int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) { + // Windows Vista and above: alert Windows that PPSSPP is DPI aware, + // so that we don't flicker in fullscreen on some PCs. + if (SystemIsWindowsVistaOrHigher()) { + if (!IsProcessDPIAware()) + SetProcessDPIAware(); + } + // FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1). Just disable it. #ifdef _M_X64 _set_FMA3_enable(0);