mirror of
https://github.com/libretro/RetroArch
synced 2025-02-18 18:40:06 +00:00
Improve behavior a bit.
This commit is contained in:
parent
1fb53627ac
commit
a2ec78320b
@ -63,6 +63,17 @@ bool gfx_window_title(char *buf, size_t size)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "dynamic.h"
|
#include "dynamic.h"
|
||||||
|
// We only load this library once, so we let it be unloaded at application shutdown,
|
||||||
|
// since unloading it early seems to cause issues on some systems.
|
||||||
|
|
||||||
|
static dylib_t dwmlib = NULL;
|
||||||
|
|
||||||
|
static void gfx_dwm_shutdown(void)
|
||||||
|
{
|
||||||
|
if (dwmlib)
|
||||||
|
dylib_close(dwmlib);
|
||||||
|
}
|
||||||
|
|
||||||
void gfx_set_dwm(void)
|
void gfx_set_dwm(void)
|
||||||
{
|
{
|
||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
@ -70,14 +81,15 @@ void gfx_set_dwm(void)
|
|||||||
return;
|
return;
|
||||||
inited = true;
|
inited = true;
|
||||||
|
|
||||||
dylib_t lib = dylib_load("dwmapi.dll");
|
dwmlib = dylib_load("dwmapi.dll");
|
||||||
if (!lib)
|
if (!dwmlib)
|
||||||
{
|
{
|
||||||
SSNES_LOG("Did not find dwmapi.dll");
|
SSNES_LOG("Did not find dwmapi.dll");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
atexit(gfx_dwm_shutdown);
|
||||||
|
|
||||||
HRESULT (WINAPI *mmcss)(BOOL) = (HRESULT (WINAPI*)(BOOL))dylib_proc(lib, "DwmEnableMMCSS");
|
HRESULT (WINAPI *mmcss)(BOOL) = (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS");
|
||||||
if (mmcss)
|
if (mmcss)
|
||||||
{
|
{
|
||||||
SSNES_LOG("Setting multimedia scheduling for DWM.\n");
|
SSNES_LOG("Setting multimedia scheduling for DWM.\n");
|
||||||
@ -85,22 +97,18 @@ void gfx_set_dwm(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!g_settings.video.disable_composition)
|
if (!g_settings.video.disable_composition)
|
||||||
goto end;
|
return;
|
||||||
|
|
||||||
HRESULT (WINAPI *composition_enable)(UINT) = (HRESULT (WINAPI*)(UINT))dylib_proc(lib, "DwmEnableComposition");
|
HRESULT (WINAPI *composition_enable)(UINT) = (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition");
|
||||||
if (!composition_enable)
|
if (!composition_enable)
|
||||||
{
|
{
|
||||||
SSNES_ERR("Did not find DwmEnableComposition ...\n");
|
SSNES_ERR("Did not find DwmEnableComposition ...\n");
|
||||||
dylib_close(lib);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT ret = composition_enable(0);
|
HRESULT ret = composition_enable(0);
|
||||||
if (FAILED(ret))
|
if (FAILED(ret))
|
||||||
SSNES_ERR("Failed to set composition state ...\n");
|
SSNES_ERR("Failed to set composition state ...\n");
|
||||||
|
|
||||||
end:
|
|
||||||
dylib_close(lib);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user