mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-29 19:20:48 +00:00
GetDisplayConfigBufferSizes and QueryDisplayConfig now go
through function pointers for backwards compatibility
This commit is contained in:
parent
402b1432ee
commit
33c1d55801
@ -92,6 +92,9 @@ extern void *dinput_wgl;
|
|||||||
extern void *dinput;
|
extern void *dinput;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef LONG(CALLBACK* QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO*, UINT32*, DISPLAYCONFIG_MODE_INFO*, DISPLAYCONFIG_TOPOLOGY_ID*);
|
||||||
|
typedef LONG(CALLBACK* GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*);
|
||||||
|
|
||||||
static bool g_resized = false;
|
static bool g_resized = false;
|
||||||
bool g_restore_desktop = false;
|
bool g_restore_desktop = false;
|
||||||
static bool doubleclick_on_titlebar = false;
|
static bool doubleclick_on_titlebar = false;
|
||||||
@ -1276,6 +1279,18 @@ float win32_get_refresh_rate(void *data)
|
|||||||
DISPLAYCONFIG_PATH_INFO *PathInfoArray = NULL;
|
DISPLAYCONFIG_PATH_INFO *PathInfoArray = NULL;
|
||||||
DISPLAYCONFIG_MODE_INFO *ModeInfoArray = NULL;
|
DISPLAYCONFIG_MODE_INFO *ModeInfoArray = NULL;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
#ifdef HAVE_DYNAMIC
|
||||||
|
static QUERYDISPLAYCONFIG pQueryDisplayConfig;
|
||||||
|
static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes;
|
||||||
|
if (!pQueryDisplayConfig)
|
||||||
|
pQueryDisplayConfig = (QUERYDISPLAYCONFIG)GetProcAddress(GetModuleHandle("user32.dll"), "QueryDisplayConfig");
|
||||||
|
|
||||||
|
if (!pGetDisplayConfigBufferSizes)
|
||||||
|
pGetDisplayConfigBufferSizes = (GETDISPLAYCONFIGBUFFERSIZES)GetProcAddress(GetModuleHandle("user32.dll"), "GetDisplayConfigBufferSizes");
|
||||||
|
#else
|
||||||
|
static QUERYDISPLAYCONFIG pQueryDisplayConfig = QueryDisplayConfig;
|
||||||
|
static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes = GetDisplayConfigBufferSizes;
|
||||||
|
#endif
|
||||||
|
|
||||||
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
if (!GetVersionEx(&version_info))
|
if (!GetVersionEx(&version_info))
|
||||||
@ -1285,7 +1300,7 @@ float win32_get_refresh_rate(void *data)
|
|||||||
(version_info.dwMajorVersion == 6 && version_info.dwMinorVersion < 1))
|
(version_info.dwMajorVersion == 6 && version_info.dwMinorVersion < 1))
|
||||||
return refresh_rate;
|
return refresh_rate;
|
||||||
|
|
||||||
result = GetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT,
|
result = pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT,
|
||||||
&NumPathArrayElements,
|
&NumPathArrayElements,
|
||||||
&NumModeInfoArrayElements);
|
&NumModeInfoArrayElements);
|
||||||
|
|
||||||
@ -1297,12 +1312,13 @@ float win32_get_refresh_rate(void *data)
|
|||||||
ModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)
|
ModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)
|
||||||
malloc(sizeof(DISPLAYCONFIG_MODE_INFO) * NumModeInfoArrayElements);
|
malloc(sizeof(DISPLAYCONFIG_MODE_INFO) * NumModeInfoArrayElements);
|
||||||
|
|
||||||
result = QueryDisplayConfig(QDC_DATABASE_CURRENT,
|
result = pQueryDisplayConfig(QDC_DATABASE_CURRENT,
|
||||||
&NumPathArrayElements,
|
&NumPathArrayElements,
|
||||||
PathInfoArray,
|
PathInfoArray,
|
||||||
&NumModeInfoArrayElements,
|
&NumModeInfoArrayElements,
|
||||||
ModeInfoArray,
|
ModeInfoArray,
|
||||||
&TopologyID);
|
&TopologyID);
|
||||||
|
|
||||||
if (result == ERROR_SUCCESS && NumPathArrayElements >= 1)
|
if (result == ERROR_SUCCESS && NumPathArrayElements >= 1)
|
||||||
{
|
{
|
||||||
refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator /
|
refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator /
|
||||||
|
Loading…
Reference in New Issue
Block a user