diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index baa971ae47..d630cdce15 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -294,6 +294,11 @@ bool Pcsx2App::OnInit() SysDetect(); AppApplySettings(); +#ifdef __WIN32__ + extern void SetupDwmStuff(WXHWND hMainWindow); + SetupDwmStuff(m_MainFrame->GetHWND()); +#endif + m_CoreAllocs = new SysCoreAllocations(); if( m_CoreAllocs->HadSomeFailures( g_Conf->EmuOptions.Cpu.Recompiler ) ) diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 9455ac3a4f..e318b10972 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -269,7 +269,6 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): m_Listener_SettingsApplied( wxGetApp().Source_SettingsApplied(), EventListener( this, OnSettingsApplied ) ), m_Listener_SettingsLoadSave( wxGetApp().Source_SettingsLoadSave(), EventListener( this, OnSettingsLoadSave ) ) { - for( int i=0; i +#include "Utilities/Console.h" + +// This could potentially reduce lag while running in Aero, +// by telling the DWM the application requires +// multimedia-class scheduling for smooth display. +void SetupDwmStuff(WXHWND hMainWindow) +{ + HRESULT (WINAPI * pDwmEnableMMCSS)(DWORD); + + OSVERSIONINFOEX info = {0}; + info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + info.dwMajorVersion = 6; + + DWORDLONG mask=0; + VER_SET_CONDITION(mask,VER_MAJORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(mask,VER_MINORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(mask,VER_SERVICEPACKMAJOR,VER_GREATER_EQUAL); + VER_SET_CONDITION(mask,VER_SERVICEPACKMINOR,VER_GREATER_EQUAL); + + //info + if(VerifyVersionInfo(&info, + VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR, + mask)) + { + HMODULE hDwmapi = LoadLibrary(wxT("dwmapi.dll")); + if(hDwmapi) + { + pDwmEnableMMCSS = (HRESULT (WINAPI *)(DWORD))GetProcAddress(hDwmapi,"DwmEnableMMCSS"); + if(pDwmEnableMMCSS) + { + if(FAILED(pDwmEnableMMCSS(TRUE))) + { + Console.WriteLn("Warning: DwmEnableMMCSS returned a failure code (not an error)."); + } + else + { + Console.WriteLn("DwmEnableMMCSS successful."); + } + } + + //DwmSetDxFrameDuration(hMainWindow,1); + + FreeLibrary(hDwmapi); + } + } +} \ No newline at end of file diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index d07eec9b82..dcf8626c2e 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -1,7 +1,7 @@ @@ -2477,6 +2476,10 @@ + +