Implemented a feature which could potentially reduce the slight slowdowns present when running in windowed mode inside Aero.

Since it's late, I will leave it to the world to figure out of it really makes a difference.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2183 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2009-11-11 03:56:14 +00:00
parent 0f43b12d72
commit ce31ac361c
4 changed files with 58 additions and 3 deletions

View File

@ -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 ) )

View File

@ -269,7 +269,6 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
m_Listener_SettingsApplied( wxGetApp().Source_SettingsApplied(), EventListener<int>( this, OnSettingsApplied ) ),
m_Listener_SettingsLoadSave( wxGetApp().Source_SettingsLoadSave(), EventListener<IniInterface>( this, OnSettingsLoadSave ) )
{
for( int i=0; i<PluginId_Count; ++i )
m_PluginMenuPacks[i].Populate( (PluginsEnum_t)i );

View File

@ -0,0 +1,48 @@
#include "PrecompiledHeader.h"
#include <windows.h>
#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);
}
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1253"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="pcsx2"
ProjectGUID="{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
RootNamespace="pcsx2"
@ -69,7 +69,6 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="zlib.lib rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)-dbg.exe"
/>
@ -2477,6 +2476,10 @@
<Filter
Name="Win32"
>
<File
RelativePath="..\DwmSetup.cpp"
>
</File>
<File
RelativePath="..\WinCompressNTFS.cpp"
>