win32: Add a config file only DWM tweaks option.

This commit is contained in:
Brandon Wright 2019-02-17 17:27:50 -06:00
parent f2b5f26a35
commit abea8212d5
3 changed files with 15 additions and 0 deletions

View File

@ -759,6 +759,7 @@ void WinRegisterConfigItems()
AddBoolC("HideMenu", GUI.HideMenu, false, "true to auto-hide the menu bar on startup.");
AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync");
AddBoolC("ReduceInputLag", GUI.ReduceInputLag, false, "true to reduce input lag by hard synchronization");
AddBoolC("DWMTweaks", GUI.DWMTweaks, false, "true to try and avoid DWM stutter");
AddBoolC("FilterMessageFont", GUI.filterMessagFont, true, "true to filter message font with EPX on 2x/3x scales if MessagesInImage is false)");
#undef CATEGORY
#define CATEGORY "Settings"

View File

@ -118,6 +118,19 @@ bool WinDisplayReset(void)
S9xGraphicsDeinit();
S9xSetWinPixelFormat ();
S9xGraphicsInit();
if (GUI.DWMTweaks)
{
HMODULE dwmlib = LoadLibrary(TEXT("dwmapi"));
if (dwmlib)
{
HRESULT(WINAPI *dwmEnableMMCSS)(BOOL) = (HRESULT(WINAPI *)(BOOL))GetProcAddress(dwmlib, "DwmEnableMMCSS");
dwmEnableMMCSS(true);
return true;
}
MessageBox(GUI.hWnd, TEXT("Couldn't enable MMCSS for DWM"), TEXT("Warning"), MB_OK | MB_ICONWARNING);
}
return true;
} else {
MessageBox (GUI.hWnd, Languages[ GUI.Language].errInitDD, TEXT("Snes9X - Display Failure"), MB_OK | MB_ICONSTOP);

View File

@ -156,6 +156,7 @@ struct sGUI {
bool Vsync;
bool ReduceInputLag;
bool shaderEnabled;
bool DWMTweaks;
TCHAR D3DshaderFileName[MAX_PATH];
TCHAR OGLshaderFileName[MAX_PATH];