Fix support for Windows XP and up (#13904)
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled

This commit is contained in:
nightmareci
2025-09-08 13:00:26 -07:00
committed by GitHub
parent 3f196c0abe
commit 2f5bc17ea6
32 changed files with 1096 additions and 561 deletions
+2
View File
@@ -50,6 +50,7 @@ compile_commands.json
*.pc
test/*.test
wayland-generated-protocols
CMakeSettings.json
# for CLion
.idea
@@ -98,6 +99,7 @@ src/render/direct3d12/D3D12_*_One.h
src/render/direct3d12/D3D12_*_Series.h
src/gpu/d3d12/D3D12_*_One.h
src/gpu/d3d12/D3D12_*_Series.h
out/
# for Android
android-project/local.properties
+13 -14
View File
@@ -2172,7 +2172,7 @@ elseif(WINDOWS)
else()
set(PROCESSOR_ARCH "x86")
endif()
sdl_link_directories("$<BUILD_INTERFACE:$$ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}>")
sdl_link_directories("$<BUILD_INTERFACE:$ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}>")
sdl_include_directories(PRIVATE SYSTEM "$<BUILD_INTERFACE:$ENV{DXSDK_DIR}\\Include>")
endif()
endif()
@@ -2183,7 +2183,8 @@ elseif(WINDOWS)
check_c_source_compiles("
#include <windows.h>
#include <xinput.h>
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H)
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H
)
endif()
# headers needed elsewhere
@@ -2206,12 +2207,18 @@ elseif(WINDOWS)
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
check_include_file(shellscalingapi.h HAVE_SHELLSCALINGAPI_H)
check_c_source_compiles("
#include <shellscalingapi.h>
static void *ptr = GetDpiForMonitor;
int main (int argc, char **argv) { return 0; }
" HAVE_SHELLSCALINGAPI_H
)
check_c_source_compiles("
#include <windows.h>
#include <mfapi.h>
#include <mfidl.h>
#include <mfreadwrite.h>
static MFVideoPrimaries primaries = MFVideoPrimaries_DCI_P3;
int main(int argc, char **argv) { return 0; }
" HAVE_MFAPI_H
)
@@ -2255,7 +2262,7 @@ elseif(WINDOWS)
set(SDL_VIDEO_RENDER_D3D11 1)
set(HAVE_RENDER_D3D11 TRUE)
endif()
if(SDL_RENDER_D3D12)
if(SDL_RENDER_D3D12 AND HAVE_DXGI1_6_H)
set(SDL_VIDEO_RENDER_D3D12 1)
set(HAVE_RENDER_D3D12 TRUE)
endif()
@@ -3462,15 +3469,7 @@ endif()
sdl_glob_sources(${SDL3_SOURCE_DIR}/src/tray/*.c)
if(SDL_GPU)
if(HAVE_D3D11_H)
sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/gpu/d3d11/*.c"
"${SDL3_SOURCE_DIR}/src/gpu/d3d11/*.h"
)
set(SDL_GPU_D3D11 1)
set(HAVE_SDL_GPU TRUE)
endif()
if(WINDOWS)
if(HAVE_DXGI1_6_H)
sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/gpu/d3d12/*.c"
"${SDL3_SOURCE_DIR}/src/gpu/d3d12/*.h"
@@ -3486,7 +3485,7 @@ if(SDL_GPU)
set(SDL_GPU_VULKAN 1)
set(HAVE_SDL_GPU TRUE)
endif()
if(SDL_RENDER_GPU)
if(SDL_RENDER_GPU AND HAVE_SDL_GPU)
set(SDL_VIDEO_RENDER_GPU 1)
set(HAVE_RENDER_GPU TRUE)
endif()
File diff suppressed because it is too large Load Diff
+21 -1
View File
@@ -49,10 +49,30 @@
#include <SDL3/SDL_platform_defines.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#endif
#else
#include <stdint.h>
#endif
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
defined(SDL_INCLUDE_INTTYPES_H)
#include <inttypes.h>
+11 -11
View File
@@ -40,16 +40,16 @@ static bool SupportsIMMDevice = false;
// DirectX function pointers for audio
static SDL_SharedObject *DSoundDLL = NULL;
typedef HRESULT(WINAPI *fnDirectSoundCreate8)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN);
typedef HRESULT(WINAPI *fnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID);
typedef HRESULT(WINAPI *fnDirectSoundCaptureCreate8)(LPCGUID, LPDIRECTSOUNDCAPTURE8 *, LPUNKNOWN);
typedef HRESULT(WINAPI *fnDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW, LPVOID);
typedef HRESULT(WINAPI *fnGetDeviceID)(LPCGUID, LPGUID);
static fnDirectSoundCreate8 pDirectSoundCreate8 = NULL;
static fnDirectSoundEnumerateW pDirectSoundEnumerateW = NULL;
static fnDirectSoundCaptureCreate8 pDirectSoundCaptureCreate8 = NULL;
static fnDirectSoundCaptureEnumerateW pDirectSoundCaptureEnumerateW = NULL;
static fnGetDeviceID pGetDeviceID = NULL;
typedef HRESULT (WINAPI *pfnDirectSoundCreate8)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN);
typedef HRESULT (WINAPI *pfnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID);
typedef HRESULT (WINAPI *pfnDirectSoundCaptureCreate8)(LPCGUID, LPDIRECTSOUNDCAPTURE8 *, LPUNKNOWN);
typedef HRESULT (WINAPI *pfnDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW, LPVOID);
typedef HRESULT (WINAPI *pfnGetDeviceID)(LPCGUID, LPGUID);
static pfnDirectSoundCreate8 pDirectSoundCreate8 = NULL;
static pfnDirectSoundEnumerateW pDirectSoundEnumerateW = NULL;
static pfnDirectSoundCaptureCreate8 pDirectSoundCaptureCreate8 = NULL;
static pfnDirectSoundCaptureEnumerateW pDirectSoundCaptureEnumerateW = NULL;
static pfnGetDeviceID pGetDeviceID = NULL;
#include <initguid.h>
DEFINE_GUID(SDL_DSDEVID_DefaultPlayback, 0xdef00000, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03);
@@ -85,7 +85,7 @@ static bool DSOUND_Load(void)
// Now make sure we have DirectX 8 or better...
#define DSOUNDLOAD(f) \
{ \
p##f = (fn##f)SDL_LoadFunction(DSoundDLL, #f); \
p##f = (pfn##f)SDL_LoadFunction(DSoundDLL, #f); \
if (!p##f) \
loaded = false; \
}
+2 -2
View File
@@ -45,8 +45,8 @@
// handle to Avrt.dll--Vista and later!--for flagging the callback thread as "Pro Audio" (low latency).
static HMODULE libavrt = NULL;
typedef HANDLE(WINAPI *pfnAvSetMmThreadCharacteristicsW)(LPCWSTR, LPDWORD);
typedef BOOL(WINAPI *pfnAvRevertMmThreadCharacteristics)(HANDLE);
typedef HANDLE (WINAPI *pfnAvSetMmThreadCharacteristicsW)(LPCWSTR, LPDWORD);
typedef BOOL (WINAPI *pfnAvRevertMmThreadCharacteristics)(HANDLE);
static pfnAvSetMmThreadCharacteristicsW pAvSetMmThreadCharacteristicsW = NULL;
static pfnAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL;
@@ -324,18 +324,18 @@ static const GUID *SDLFmtToMFVidFmtGuid(SDL_PixelFormat format)
// mf.dll ...
static HMODULE libmf = NULL;
typedef HRESULT(WINAPI *pfnMFEnumDeviceSources)(IMFAttributes *,IMFActivate ***,UINT32 *);
typedef HRESULT(WINAPI *pfnMFCreateDeviceSource)(IMFAttributes *, IMFMediaSource **);
typedef HRESULT (WINAPI *pfnMFEnumDeviceSources)(IMFAttributes *,IMFActivate ***,UINT32 *);
typedef HRESULT (WINAPI *pfnMFCreateDeviceSource)(IMFAttributes *, IMFMediaSource **);
static pfnMFEnumDeviceSources pMFEnumDeviceSources = NULL;
static pfnMFCreateDeviceSource pMFCreateDeviceSource = NULL;
// mfplat.dll ...
static HMODULE libmfplat = NULL;
typedef HRESULT(WINAPI *pfnMFStartup)(ULONG, DWORD);
typedef HRESULT(WINAPI *pfnMFShutdown)(void);
typedef HRESULT(WINAPI *pfnMFCreateAttributes)(IMFAttributes **, UINT32);
typedef HRESULT(WINAPI *pfnMFCreateMediaType)(IMFMediaType **);
typedef HRESULT(WINAPI *pfnMFGetStrideForBitmapInfoHeader)(DWORD, DWORD, LONG *);
typedef HRESULT (WINAPI *pfnMFStartup)(ULONG, DWORD);
typedef HRESULT (WINAPI *pfnMFShutdown)(void);
typedef HRESULT (WINAPI *pfnMFCreateAttributes)(IMFAttributes **, UINT32);
typedef HRESULT (WINAPI *pfnMFCreateMediaType)(IMFMediaType **);
typedef HRESULT (WINAPI *pfnMFGetStrideForBitmapInfoHeader)(DWORD, DWORD, LONG *);
static pfnMFStartup pMFStartup = NULL;
static pfnMFShutdown pMFShutdown = NULL;
@@ -345,7 +345,7 @@ static pfnMFGetStrideForBitmapInfoHeader pMFGetStrideForBitmapInfoHeader = NULL;
// mfreadwrite.dll ...
static HMODULE libmfreadwrite = NULL;
typedef HRESULT(WINAPI *pfnMFCreateSourceReaderFromMediaSource)(IMFMediaSource *, IMFAttributes *, IMFSourceReader **);
typedef HRESULT (WINAPI *pfnMFCreateSourceReaderFromMediaSource)(IMFMediaSource *, IMFAttributes *, IMFSourceReader **);
static pfnMFCreateSourceReaderFromMediaSource pMFCreateSourceReaderFromMediaSource = NULL;
+4 -4
View File
@@ -38,15 +38,15 @@ bool SDL_InitGameInput(IGameInput **ppGameInput)
return false;
}
typedef HRESULT (WINAPI *GameInputCreate_t)(IGameInput **gameInput);
GameInputCreate_t GameInputCreateFunc = (GameInputCreate_t)SDL_LoadFunction(g_hGameInputDLL, "GameInputCreate");
if (!GameInputCreateFunc) {
typedef HRESULT (WINAPI *pfnGameInputCreate)(IGameInput **gameInput);
pfnGameInputCreate pGameInputCreate = (pfnGameInputCreate)SDL_LoadFunction(g_hGameInputDLL, "GameInputCreate");
if (!pGameInputCreate) {
SDL_UnloadObject(g_hGameInputDLL);
return false;
}
IGameInput *pGameInput = NULL;
HRESULT hr = GameInputCreateFunc(&pGameInput);
HRESULT hr = pGameInputCreate(&pGameInput);
if (FAILED(hr)) {
SDL_UnloadObject(g_hGameInputDLL);
return WIN_SetErrorFromHRESULT("GameInputCreate failed", hr);
-10
View File
@@ -37,16 +37,6 @@ typedef enum RO_INIT_TYPE
} RO_INIT_TYPE;
#endif
#ifndef _WIN32_WINNT_VISTA
#define _WIN32_WINNT_VISTA 0x0600
#endif
#ifndef _WIN32_WINNT_WIN7
#define _WIN32_WINNT_WIN7 0x0601
#endif
#ifndef _WIN32_WINNT_WIN8
#define _WIN32_WINNT_WIN8 0x0602
#endif
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#endif
+41 -6
View File
@@ -21,10 +21,39 @@
// This is an include file for windows.h with the SDL build settings
#ifndef _INCLUDED_WINDOWS_H
#define _INCLUDED_WINDOWS_H
#ifndef SDL_windows_h_
#define SDL_windows_h_
#ifdef SDL_PLATFORM_WIN32
#ifndef _WIN32_WINNT_NT4
#define _WIN32_WINNT_NT4 0x0400
#endif
#ifndef _WIN32_WINNT_WIN2K
#define _WIN32_WINNT_WIN2K 0x0500
#endif
#ifndef _WIN32_WINNT_WINXP
#define _WIN32_WINNT_WINXP 0x0501
#endif
#ifndef _WIN32_WINNT_WS03
#define _WIN32_WINNT_WS03 0x0502
#endif
#ifndef _WIN32_WINNT_VISTA
#define _WIN32_WINNT_VISTA 0x0600
#endif
#ifndef _WIN32_WINNT_WIN7
#define _WIN32_WINNT_WIN7 0x0601
#endif
#ifndef _WIN32_WINNT_WIN8
#define _WIN32_WINNT_WIN8 0x0602
#endif
#ifndef _WIN32_WINNT_WINBLUE
#define _WIN32_WINNT_WINBLUE 0x0603
#endif
#ifndef _WIN32_WINNT_WIN10
#define _WIN32_WINNT_WIN10 0x0A00
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
@@ -37,11 +66,17 @@
#undef WINVER
#undef _WIN32_WINNT
#if defined(SDL_VIDEO_RENDER_D3D12) || defined(HAVE_DXGI1_6_H)
#define _WIN32_WINNT 0xA00 // For D3D12, 0xA00 is required
#define _WIN32_WINNT _WIN32_WINNT_WIN10 // For D3D12, 0xA00 is required
#elif defined(HAVE_SHELLSCALINGAPI_H)
#define _WIN32_WINNT 0x603 // For DPI support
#define _WIN32_WINNT _WIN32_WINNT_WINBLUE // For DPI support
#elif defined(HAVE_ROAPI_H)
#define _WIN32_WINNT _WIN32_WINNT_WIN8
#elif defined(HAVE_SENSORSAPI_H)
#define _WIN32_WINNT _WIN32_WINNT_WIN7
#elif defined(HAVE_MMDEVICEAPI_H)
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#else
#define _WIN32_WINNT 0x501 // Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input
#define _WIN32_WINNT _WIN32_WINNT_WINXP // Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input
#endif
#define WINVER _WIN32_WINNT
@@ -173,4 +208,4 @@ extern int WIN_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCh
}
#endif
#endif // _INCLUDED_WINDOWS_H
#endif // SDL_windows_h_
File diff suppressed because it is too large Load Diff
+4
View File
@@ -29,6 +29,10 @@
#include "../../core/windows/SDL_windows.h"
#include "../SDL_sysfilesystem.h"
#ifndef COPY_FILE_NO_BUFFERING
#define COPY_FILE_NO_BUFFERING 0x00001000
#endif
bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata)
{
SDL_EnumerationResult result = SDL_ENUM_CONTINUE;
File diff suppressed because it is too large Load Diff
+33 -12
View File
@@ -416,11 +416,15 @@ void WINDOWS_JoystickDetect(void)
while (pCurList) {
JoyStick_DeviceData *pListNext = NULL;
if (!pCurList->bXInputDevice) {
#ifdef SDL_HAPTIC_DINPUT
#ifdef SDL_JOYSTICK_XINPUT
if (!pCurList->bXInputDevice) {
SDL_DINPUT_HapticMaybeRemoveDevice(&pCurList->dxdevice);
#endif
}
#else
SDL_DINPUT_HapticMaybeRemoveDevice(&pCurList->dxdevice);
#endif
#endif
SDL_PrivateJoystickRemoved(pCurList->nInstanceID);
@@ -432,11 +436,15 @@ void WINDOWS_JoystickDetect(void)
for (pCurList = SYS_Joystick; pCurList; pCurList = pCurList->pNext) {
if (pCurList->send_add_event) {
if (!pCurList->bXInputDevice) {
#ifdef SDL_HAPTIC_DINPUT
#ifdef SDL_JOYSTICK_XINPUT
if (!pCurList->bXInputDevice) {
SDL_DINPUT_HapticMaybeAddDevice(&pCurList->dxdevice);
#endif
}
#else
SDL_DINPUT_HapticMaybeAddDevice(&pCurList->dxdevice);
#endif
#endif
SDL_PrivateJoystickAdded(pCurList->nInstanceID);
@@ -489,16 +497,18 @@ static int WINDOWS_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
device = device->pNext;
}
#ifdef SDL_JOYSTICK_XINPUT
if (device->bXInputDevice) {
// The slot for XInput devices can change as controllers are seated
return SDL_XINPUT_GetSteamVirtualGamepadSlot(device->XInputUserId);
} else {
return device->steam_virtual_gamepad_slot;
}
#endif
return device->steam_virtual_gamepad_slot;
}
static int WINDOWS_JoystickGetDevicePlayerIndex(int device_index)
{
#ifdef SDL_JOYSTICK_XINPUT
JoyStick_DeviceData *device = SYS_Joystick;
int index;
@@ -507,6 +517,9 @@ static int WINDOWS_JoystickGetDevicePlayerIndex(int device_index)
}
return device->bXInputDevice ? (int)device->XInputUserId : -1;
#else
return -1;
#endif
}
static void WINDOWS_JoystickSetDevicePlayerIndex(int device_index, int player_index)
@@ -560,20 +573,22 @@ static bool WINDOWS_JoystickOpen(SDL_Joystick *joystick, int device_index)
}
joystick->hwdata->guid = device->guid;
#ifdef SDL_JOYSTICK_XINPUT
if (device->bXInputDevice) {
return SDL_XINPUT_JoystickOpen(joystick, device);
} else {
return SDL_DINPUT_JoystickOpen(joystick, device);
}
#endif
return SDL_DINPUT_JoystickOpen(joystick, device);
}
static bool WINDOWS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
{
#ifdef SDL_JOYSTICK_XINPUT
if (joystick->hwdata->bXInputDevice) {
return SDL_XINPUT_JoystickRumble(joystick, low_frequency_rumble, high_frequency_rumble);
} else {
return SDL_DINPUT_JoystickRumble(joystick, low_frequency_rumble, high_frequency_rumble);
}
#endif
return SDL_DINPUT_JoystickRumble(joystick, low_frequency_rumble, high_frequency_rumble);
}
static bool WINDOWS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
@@ -602,21 +617,27 @@ static void WINDOWS_JoystickUpdate(SDL_Joystick *joystick)
return;
}
#ifdef SDL_JOYSTICK_XINPUT
if (joystick->hwdata->bXInputDevice) {
SDL_XINPUT_JoystickUpdate(joystick);
} else {
SDL_DINPUT_JoystickUpdate(joystick);
return;
}
#endif
SDL_DINPUT_JoystickUpdate(joystick);
}
// Function to close a joystick after use
static void WINDOWS_JoystickClose(SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_XINPUT
if (joystick->hwdata->bXInputDevice) {
SDL_XINPUT_JoystickClose(joystick);
} else {
SDL_DINPUT_JoystickClose(joystick);
}
#else
SDL_DINPUT_JoystickClose(joystick);
#endif
SDL_free(joystick->hwdata);
}
@@ -37,9 +37,11 @@ typedef struct JoyStick_DeviceData
char *joystickname;
Uint8 send_add_event;
SDL_JoystickID nInstanceID;
#ifdef SDL_JOYSTICK_XINPUT
bool bXInputDevice;
BYTE SubType;
Uint8 XInputUserId;
#endif
DIDEVICEINSTANCE dxdevice;
char path[MAX_PATH];
int steam_virtual_gamepad_slot;
@@ -85,10 +87,12 @@ struct joystick_hwdata
LPDIRECTINPUTEFFECT ffeffect_ref;
#endif
#ifdef SDL_JOYSTICK_XINPUT
bool bXInputDevice; // true if this device supports using the xinput API rather than DirectInput
bool bXInputHaptic; // Supports force feedback via XInput.
Uint8 userid; // XInput userid index for this joystick
DWORD dwPacketNumber;
#endif
};
#ifdef SDL_JOYSTICK_DINPUT
+1 -1
View File
@@ -23,7 +23,7 @@
#include "../../core/windows/SDL_windows.h"
#include "../SDL_syslocale.h"
typedef BOOL(WINAPI *pfnGetUserPreferredUILanguages)(DWORD, PULONG, WCHAR *, PULONG);
typedef BOOL (WINAPI *pfnGetUserPreferredUILanguages)(DWORD, PULONG, WCHAR *, PULONG);
#ifndef MUI_LANGUAGE_NAME
#define MUI_LANGUAGE_NAME 0x8
#endif
+20 -20
View File
@@ -504,12 +504,12 @@ static ID3D11BlendState *D3D11_CreateBlendState(SDL_Renderer *renderer, SDL_Blen
// Create resources that depend on the device.
static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
{
typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory);
typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY2)(UINT flags, REFIID riid, void **ppFactory);
PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc = NULL;
PFN_CREATE_DXGI_FACTORY2 CreateDXGIFactory2Func = NULL;
typedef HRESULT (WINAPI *pfnCreateDXGIFactory)(REFIID riid, void **ppFactory);
typedef HRESULT (WINAPI *pfnCreateDXGIFactory2)(UINT flags, REFIID riid, void **ppFactory);
pfnCreateDXGIFactory pCreateDXGIFactory = NULL;
pfnCreateDXGIFactory2 pCreateDXGIFactory2 = NULL;
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc;
PFN_D3D11_CREATE_DEVICE pD3D11CreateDevice;
IDXGIAdapter *dxgiAdapter = NULL;
ID3D11Device *d3dDevice = NULL;
ID3D11DeviceContext *d3dContext = NULL;
@@ -549,10 +549,10 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
goto done;
}
CreateDXGIFactory2Func = (PFN_CREATE_DXGI_FACTORY2)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2");
if (!CreateDXGIFactory2Func) {
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
if (!CreateDXGIFactoryFunc) {
pCreateDXGIFactory2 = (pfnCreateDXGIFactory2)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2");
if (!pCreateDXGIFactory2) {
pCreateDXGIFactory = (pfnCreateDXGIFactory)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
if (!pCreateDXGIFactory) {
result = E_FAIL;
goto done;
}
@@ -564,8 +564,8 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
goto done;
}
D3D11CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
if (!D3D11CreateDeviceFunc) {
pD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
if (!pD3D11CreateDevice) {
result = E_FAIL;
goto done;
}
@@ -573,22 +573,22 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
if (createDebug) {
#ifdef __IDXGIInfoQueue_INTERFACE_DEFINED__
IDXGIInfoQueue *dxgiInfoQueue = NULL;
PFN_CREATE_DXGI_FACTORY2 DXGIGetDebugInterfaceFunc;
pfnCreateDXGIFactory2 pDXGIGetDebugInterface1;
// If the debug hint is set, also create the DXGI factory in debug mode
DXGIGetDebugInterfaceFunc = (PFN_CREATE_DXGI_FACTORY2)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1");
if (!DXGIGetDebugInterfaceFunc) {
pDXGIGetDebugInterface1 = (pfnCreateDXGIFactory2)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1");
if (!pDXGIGetDebugInterface1) {
result = E_FAIL;
goto done;
}
result = DXGIGetDebugInterfaceFunc(0, &SDL_IID_IDXGIDebug1, (void **)&data->dxgiDebug);
result = pDXGIGetDebugInterface1(0, &SDL_IID_IDXGIDebug1, (void **)&data->dxgiDebug);
if (FAILED(result)) {
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("DXGIGetDebugInterface1"), result);
goto done;
}
result = DXGIGetDebugInterfaceFunc(0, &SDL_IID_IDXGIInfoQueue, (void **)&dxgiInfoQueue);
result = pDXGIGetDebugInterface1(0, &SDL_IID_IDXGIInfoQueue, (void **)&dxgiInfoQueue);
if (FAILED(result)) {
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("DXGIGetDebugInterface1"), result);
goto done;
@@ -601,10 +601,10 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
creationFlags = DXGI_CREATE_FACTORY_DEBUG;
}
if (CreateDXGIFactory2Func) {
result = CreateDXGIFactory2Func(creationFlags, &SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory);
if (pCreateDXGIFactory2) {
result = pCreateDXGIFactory2(creationFlags, &SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory);
} else {
result = CreateDXGIFactoryFunc(&SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory);
result = pCreateDXGIFactory(&SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory);
}
if (FAILED(result)) {
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateDXGIFactory"), result);
@@ -657,7 +657,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
}
// Create the Direct3D 11 API device object and a corresponding context.
result = D3D11CreateDeviceFunc(
result = pD3D11CreateDevice(
dxgiAdapter,
driverType,
NULL,
+19 -19
View File
@@ -771,12 +771,12 @@ static HRESULT D3D12_CreateVertexBuffer(D3D12_RenderData *data, size_t vbidx, si
static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
{
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY)(UINT flags, REFIID riid, void **ppFactory);
PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc;
PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc;
typedef HRESULT (WINAPI *pfnCreateDXGIFactory2)(UINT flags, REFIID riid, void **ppFactory);
pfnCreateDXGIFactory2 pCreateDXGIFactory2;
PFN_D3D12_CREATE_DEVICE pD3D12CreateDevice;
#endif
typedef HANDLE(WINAPI * PFN_CREATE_EVENT_EX)(LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
PFN_CREATE_EVENT_EX CreateEventExFunc;
typedef HANDLE (WINAPI *pfnCreateEventExW)(LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
pfnCreateEventExW pCreateEventExW;
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
ID3D12Device *d3dDevice = NULL;
@@ -793,18 +793,18 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
createDebug = SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, false);
#ifdef SDL_PLATFORM_GDK
CreateEventExFunc = CreateEventExW;
pCreateEventExW = CreateEventExW;
#else
// CreateEventEx() arrived in Vista, so we need to load it with GetProcAddress for XP.
// CreateEventExW() arrived in Vista, so we need to load it with GetProcAddress for XP.
{
HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
CreateEventExFunc = NULL;
pCreateEventExW = NULL;
if (kernel32) {
CreateEventExFunc = (PFN_CREATE_EVENT_EX)GetProcAddress(kernel32, "CreateEventExW");
pCreateEventExW = (pfnCreateEventExW)GetProcAddress(kernel32, "CreateEventExW");
}
}
#endif
if (!CreateEventExFunc) {
if (!pCreateEventExW) {
result = E_FAIL;
goto done;
}
@@ -816,8 +816,8 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
goto done;
}
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2");
if (!CreateDXGIFactoryFunc) {
pCreateDXGIFactory2 = (pfnCreateDXGIFactory2)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2");
if (!pCreateDXGIFactory2) {
result = E_FAIL;
goto done;
}
@@ -828,8 +828,8 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
goto done;
}
D3D12CreateDeviceFunc = (PFN_D3D12_CREATE_DEVICE)SDL_LoadFunction(data->hD3D12Mod, "D3D12CreateDevice");
if (!D3D12CreateDeviceFunc) {
pD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)SDL_LoadFunction(data->hD3D12Mod, "D3D12CreateDevice");
if (!pD3D12CreateDevice) {
result = E_FAIL;
goto done;
}
@@ -858,10 +858,10 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
if (createDebug) {
#ifdef __IDXGIInfoQueue_INTERFACE_DEFINED__
IDXGIInfoQueue *dxgiInfoQueue = NULL;
PFN_CREATE_DXGI_FACTORY DXGIGetDebugInterfaceFunc;
pfnCreateDXGIFactory2 DXGIGetDebugInterfaceFunc;
// If the debug hint is set, also create the DXGI factory in debug mode
DXGIGetDebugInterfaceFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1");
DXGIGetDebugInterfaceFunc = (pfnCreateDXGIFactory2)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1");
if (!DXGIGetDebugInterfaceFunc) {
result = E_FAIL;
goto done;
@@ -886,7 +886,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
creationFlags = DXGI_CREATE_FACTORY_DEBUG;
}
result = CreateDXGIFactoryFunc(creationFlags, D3D_GUID(SDL_IID_IDXGIFactory6), (void **)&data->dxgiFactory);
result = pCreateDXGIFactory2(creationFlags, D3D_GUID(SDL_IID_IDXGIFactory6), (void **)&data->dxgiFactory);
if (FAILED(result)) {
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateDXGIFactory"), result);
goto done;
@@ -903,7 +903,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
goto done;
}
result = D3D12CreateDeviceFunc((IUnknown *)data->dxgiAdapter,
result = pD3D12CreateDevice((IUnknown *)data->dxgiAdapter,
D3D_FEATURE_LEVEL_11_0, // Request minimum feature level 11.0 for maximum compatibility
D3D_GUID(SDL_IID_ID3D12Device1),
(void **)&d3dDevice);
@@ -1051,7 +1051,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
data->fenceValue++;
data->fenceEvent = CreateEventExFunc(NULL, NULL, 0, EVENT_MODIFY_STATE | SYNCHRONIZE);
data->fenceEvent = pCreateEventExW(NULL, NULL, 0, EVENT_MODIFY_STATE | SYNCHRONIZE);
if (!data->fenceEvent) {
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateEventEx"), result);
goto done;
+4 -4
View File
@@ -56,10 +56,10 @@ typedef struct CONDITION_VARIABLE
} CONDITION_VARIABLE, *PCONDITION_VARIABLE;
#endif
typedef VOID(WINAPI *pfnWakeConditionVariable)(PCONDITION_VARIABLE);
typedef VOID(WINAPI *pfnWakeAllConditionVariable)(PCONDITION_VARIABLE);
typedef BOOL(WINAPI *pfnSleepConditionVariableSRW)(PCONDITION_VARIABLE, PSRWLOCK, DWORD, ULONG);
typedef BOOL(WINAPI *pfnSleepConditionVariableCS)(PCONDITION_VARIABLE, PCRITICAL_SECTION, DWORD);
typedef VOID (WINAPI *pfnWakeConditionVariable)(PCONDITION_VARIABLE);
typedef VOID (WINAPI *pfnWakeAllConditionVariable)(PCONDITION_VARIABLE);
typedef BOOL (WINAPI *pfnSleepConditionVariableSRW)(PCONDITION_VARIABLE, PSRWLOCK, DWORD, ULONG);
typedef BOOL (WINAPI *pfnSleepConditionVariableCS)(PCONDITION_VARIABLE, PCRITICAL_SECTION, DWORD);
static pfnWakeConditionVariable pWakeConditionVariable = NULL;
static pfnWakeAllConditionVariable pWakeAllConditionVariable = NULL;
+4 -4
View File
@@ -39,10 +39,10 @@ SDL_mutex_impl_t SDL_mutex_impl_active = { 0 };
* Implementation based on Slim Reader/Writer (SRW) Locks for Win 7 and newer.
*/
typedef VOID(WINAPI *pfnInitializeSRWLock)(PSRWLOCK);
typedef VOID(WINAPI *pfnReleaseSRWLockExclusive)(PSRWLOCK);
typedef VOID(WINAPI *pfnAcquireSRWLockExclusive)(PSRWLOCK);
typedef BOOLEAN(WINAPI *pfnTryAcquireSRWLockExclusive)(PSRWLOCK);
typedef VOID (WINAPI *pfnInitializeSRWLock)(PSRWLOCK);
typedef VOID (WINAPI *pfnReleaseSRWLockExclusive)(PSRWLOCK);
typedef VOID (WINAPI *pfnAcquireSRWLockExclusive)(PSRWLOCK);
typedef BOOLEAN (WINAPI *pfnTryAcquireSRWLockExclusive)(PSRWLOCK);
static pfnInitializeSRWLock pInitializeSRWLock = NULL;
static pfnReleaseSRWLockExclusive pReleaseSRWLockExclusive = NULL;
static pfnAcquireSRWLockExclusive pAcquireSRWLockExclusive = NULL;
+7 -7
View File
@@ -27,13 +27,13 @@
// This header makes sure SRWLOCK is actually declared, even on ancient WinSDKs.
#include "SDL_sysmutex_c.h"
typedef VOID(WINAPI *pfnInitializeSRWLock)(PSRWLOCK);
typedef VOID(WINAPI *pfnReleaseSRWLockShared)(PSRWLOCK);
typedef VOID(WINAPI *pfnAcquireSRWLockShared)(PSRWLOCK);
typedef BOOLEAN(WINAPI *pfnTryAcquireSRWLockShared)(PSRWLOCK);
typedef VOID(WINAPI *pfnReleaseSRWLockExclusive)(PSRWLOCK);
typedef VOID(WINAPI *pfnAcquireSRWLockExclusive)(PSRWLOCK);
typedef BOOLEAN(WINAPI *pfnTryAcquireSRWLockExclusive)(PSRWLOCK);
typedef VOID (WINAPI *pfnInitializeSRWLock)(PSRWLOCK);
typedef VOID (WINAPI *pfnReleaseSRWLockShared)(PSRWLOCK);
typedef VOID (WINAPI *pfnAcquireSRWLockShared)(PSRWLOCK);
typedef BOOLEAN (WINAPI *pfnTryAcquireSRWLockShared)(PSRWLOCK);
typedef VOID (WINAPI *pfnReleaseSRWLockExclusive)(PSRWLOCK);
typedef VOID (WINAPI *pfnAcquireSRWLockExclusive)(PSRWLOCK);
typedef BOOLEAN (WINAPI *pfnTryAcquireSRWLockExclusive)(PSRWLOCK);
static pfnInitializeSRWLock pInitializeSRWLock = NULL;
static pfnReleaseSRWLockShared pReleaseSRWLockShared = NULL;
+2 -2
View File
@@ -60,8 +60,8 @@ static SDL_sem_impl_t SDL_sem_impl_active = { 0 };
// APIs not available on WinPhone 8.1
// https://www.microsoft.com/en-us/download/details.aspx?id=47328
typedef BOOL(WINAPI *pfnWaitOnAddress)(volatile VOID *, PVOID, SIZE_T, DWORD);
typedef VOID(WINAPI *pfnWakeByAddressSingle)(PVOID);
typedef BOOL (WINAPI *pfnWaitOnAddress)(volatile VOID *, PVOID, SIZE_T, DWORD);
typedef VOID (WINAPI *pfnWakeByAddressSingle)(PVOID);
static pfnWaitOnAddress pWaitOnAddress = NULL;
static pfnWakeByAddressSingle pWakeByAddressSingle = NULL;
+1 -1
View File
@@ -108,7 +108,7 @@ static LONG NTAPI EmptyVectoredExceptionHandler(EXCEPTION_POINTERS *info)
}
}
typedef HRESULT(WINAPI *pfnSetThreadDescription)(HANDLE, PCWSTR);
typedef HRESULT (WINAPI *pfnSetThreadDescription)(HANDLE, PCWSTR);
void SDL_SYS_SetupThread(const char *name)
{
+1 -1
View File
@@ -30,7 +30,7 @@
#define WINDOWS_TICK 10000000ULL
#define UNIX_EPOCH_OFFSET_SEC 11644473600ULL
typedef void(WINAPI *pfnGetSystemTimePreciseAsFileTime)(FILETIME *);
typedef void (WINAPI *pfnGetSystemTimePreciseAsFileTime)(FILETIME *);
void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
+72 -54
View File
@@ -24,54 +24,27 @@
#include "../../core/windows/SDL_windows.h"
/* CREATE_WAITABLE_TIMER_HIGH_RESOLUTION flag was added in Windows 10 version 1803. */
#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x2
#endif
Uint64 SDL_GetPerformanceCounter(void)
{
LARGE_INTEGER counter;
const BOOL rc = QueryPerformanceCounter(&counter);
SDL_assert(rc != 0); // this should _never_ fail if you're on XP or later.
return (Uint64)counter.QuadPart;
}
typedef HANDLE (WINAPI *CreateWaitableTimerExW_t)(LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess);
static CreateWaitableTimerExW_t pCreateWaitableTimerExW;
typedef BOOL (WINAPI *SetWaitableTimerEx_t)(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay);
static SetWaitableTimerEx_t pSetWaitableTimerEx;
Uint64 SDL_GetPerformanceFrequency(void)
{
LARGE_INTEGER frequency;
const BOOL rc = QueryPerformanceFrequency(&frequency);
SDL_assert(rc != 0); // this should _never_ fail if you're on XP or later.
return (Uint64)frequency.QuadPart;
}
static void SDL_CleanupWaitableHandle(void *handle)
{
CloseHandle(handle);
}
static HANDLE SDL_GetWaitableTimer(void)
{
static SDL_TLSID TLS_timer_handle;
HANDLE timer;
if (!pCreateWaitableTimerExW || !pSetWaitableTimerEx) {
static bool initialized;
if (!initialized) {
HMODULE module = GetModuleHandle(TEXT("kernel32.dll"));
if (module) {
pCreateWaitableTimerExW = (CreateWaitableTimerExW_t)GetProcAddress(module, "CreateWaitableTimerExW");
pSetWaitableTimerEx = (SetWaitableTimerEx_t)GetProcAddress(module, "SetWaitableTimerEx");
}
initialized = true;
}
if (!pCreateWaitableTimerExW || !pSetWaitableTimerEx) {
return NULL;
}
}
timer = SDL_GetTLS(&TLS_timer_handle);
if (!timer) {
timer = pCreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
if (timer) {
SDL_SetTLS(&TLS_timer_handle, timer, SDL_CleanupWaitableHandle);
}
}
return timer;
}
static HANDLE SDL_GetWaitableEvent(void)
{
static SDL_TLSID TLS_event_handle;
@@ -87,20 +60,65 @@ static HANDLE SDL_GetWaitableEvent(void)
return event;
}
Uint64 SDL_GetPerformanceCounter(void)
{
LARGE_INTEGER counter;
const BOOL rc = QueryPerformanceCounter(&counter);
SDL_assert(rc != 0); // this should _never_ fail if you're on XP or later.
return (Uint64)counter.QuadPart;
}
/* CREATE_WAITABLE_TIMER_HIGH_RESOLUTION flag was added in Windows 10 version 1803. */
#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x2
#endif
Uint64 SDL_GetPerformanceFrequency(void)
typedef HANDLE (WINAPI *pfnCreateWaitableTimerExW)(LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess);
static pfnCreateWaitableTimerExW pCreateWaitableTimerExW;
#if WINVER < _WIN32_WINNT_WIN7
typedef struct _REASON_CONTEXT REASON_CONTEXT;
typedef REASON_CONTEXT * PREASON_CONTEXT;
#endif
typedef BOOL (WINAPI *pfnSetWaitableTimerEx)(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay);
static pfnSetWaitableTimerEx pSetWaitableTimerEx;
typedef HANDLE (WINAPI *pfnCreateWaitableTimerW)(LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCWSTR lpTimerName);
static pfnCreateWaitableTimerW pCreateWaitableTimerW;
typedef BOOL (WINAPI *pfnSetWaitableTimer)(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume);
static pfnSetWaitableTimer pSetWaitableTimer;
static HANDLE SDL_GetWaitableTimer(void)
{
LARGE_INTEGER frequency;
const BOOL rc = QueryPerformanceFrequency(&frequency);
SDL_assert(rc != 0); // this should _never_ fail if you're on XP or later.
return (Uint64)frequency.QuadPart;
static SDL_TLSID TLS_timer_handle;
HANDLE timer;
static bool initialized;
if (!initialized) {
HMODULE module = GetModuleHandle(TEXT("kernel32.dll"));
if (module) {
pCreateWaitableTimerExW = (pfnCreateWaitableTimerExW)GetProcAddress(module, "CreateWaitableTimerExW"); // Windows 7 and up
if (!pCreateWaitableTimerExW) {
pCreateWaitableTimerW = (pfnCreateWaitableTimerW)GetProcAddress(module, "CreateWaitableTimerW");
}
pSetWaitableTimerEx = (pfnSetWaitableTimerEx)GetProcAddress(module, "SetWaitableTimerEx"); // Windows Vista and up
if (!pSetWaitableTimerEx) {
pSetWaitableTimer = (pfnSetWaitableTimer)GetProcAddress(module, "SetWaitableTimer");
}
initialized =
(pCreateWaitableTimerExW || pCreateWaitableTimerW) &&
(pSetWaitableTimerEx || pSetWaitableTimer);
}
if (!initialized) {
return NULL;
}
}
timer = SDL_GetTLS(&TLS_timer_handle);
if (!timer) {
if (pCreateWaitableTimerExW) {
timer = pCreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
} else {
timer = pCreateWaitableTimerW(NULL, TRUE, NULL);
}
if (timer) {
SDL_SetTLS(&TLS_timer_handle, timer, SDL_CleanupWaitableHandle);
}
}
return timer;
}
void SDL_SYS_DelayNS(Uint64 ns)
@@ -109,7 +127,7 @@ void SDL_SYS_DelayNS(Uint64 ns)
if (timer) {
LARGE_INTEGER due_time;
due_time.QuadPart = -((LONGLONG)ns / 100);
if (pSetWaitableTimerEx(timer, &due_time, 0, NULL, NULL, NULL, 0)) {
if ((pSetWaitableTimerEx && pSetWaitableTimerEx(timer, &due_time, 0, NULL, NULL, NULL, 0)) || pSetWaitableTimer(timer, &due_time, 0, NULL, NULL, 0)) {
WaitForSingleObject(timer, INFINITE);
}
return;
+4 -1
View File
@@ -2410,10 +2410,13 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
break;
#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
default:
break;
}
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
if (msg == data->videodata->WM_TASKBAR_BUTTON_CREATED) {
if (msg && msg == data->videodata->WM_TASKBAR_BUTTON_CREATED) {
data->taskbar_button_created = true;
WIN_ApplyWindowProgress(SDL_GetVideoDevice(), data->window);
}
+10 -10
View File
@@ -944,7 +944,7 @@ bool WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
TASKDIALOG_BUTTON *pButtons;
TASKDIALOG_BUTTON *pButton;
HMODULE hComctl32;
TASKDIALOGINDIRECTPROC pfnTaskDialogIndirect;
TASKDIALOGINDIRECTPROC pTaskDialogIndirect;
HRESULT hr;
char *ampescape = NULL;
size_t ampescapesize = 0;
@@ -958,11 +958,11 @@ bool WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
}
HMODULE hUser32 = GetModuleHandle(TEXT("user32.dll"));
typedef DPI_AWARENESS_CONTEXT (WINAPI * SetThreadDpiAwarenessContext_t)(DPI_AWARENESS_CONTEXT);
SetThreadDpiAwarenessContext_t SetThreadDpiAwarenessContextFunc = (SetThreadDpiAwarenessContext_t)GetProcAddress(hUser32, "SetThreadDpiAwarenessContext");
typedef DPI_AWARENESS_CONTEXT (WINAPI *pfnSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
pfnSetThreadDpiAwarenessContext pSetThreadDpiAwarenessContext = (pfnSetThreadDpiAwarenessContext)GetProcAddress(hUser32, "SetThreadDpiAwarenessContext");
DPI_AWARENESS_CONTEXT previous_context = DPI_AWARENESS_CONTEXT_UNAWARE;
if (SetThreadDpiAwarenessContextFunc) {
previous_context = SetThreadDpiAwarenessContextFunc(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
if (pSetThreadDpiAwarenessContext) {
previous_context = pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
}
// If we cannot load comctl32.dll use the old messagebox!
@@ -979,8 +979,8 @@ bool WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
If you don't want to bother with manifests, put this #pragma in your app's source code somewhere:
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
*/
pfnTaskDialogIndirect = (TASKDIALOGINDIRECTPROC)GetProcAddress(hComctl32, "TaskDialogIndirect");
if (!pfnTaskDialogIndirect) {
pTaskDialogIndirect = (TASKDIALOGINDIRECTPROC)GetProcAddress(hComctl32, "TaskDialogIndirect");
if (!pTaskDialogIndirect) {
FreeLibrary(hComctl32);
result = WIN_ShowOldMessageBox(messageboxdata, buttonID);
goto done;
@@ -1049,7 +1049,7 @@ bool WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
TaskConfig.pButtons = pButtons;
// Show the Task Dialog
hr = pfnTaskDialogIndirect(&TaskConfig, &nButton, NULL, NULL);
hr = pTaskDialogIndirect(&TaskConfig, &nButton, NULL, NULL);
// Free everything
FreeLibrary(hComctl32);
@@ -1077,8 +1077,8 @@ bool WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
}
done:
if (SetThreadDpiAwarenessContextFunc) {
SetThreadDpiAwarenessContextFunc(previous_context);
if (pSetThreadDpiAwarenessContext) {
pSetThreadDpiAwarenessContext(previous_context);
}
return result;
}
+9 -6
View File
@@ -34,6 +34,9 @@
#ifndef CDS_FULLSCREEN
#define CDS_FULLSCREEN 0
#endif
#ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96
#endif
// #define DEBUG_MODES
// #define HIGHDPI_DEBUG_VERBOSE
@@ -247,9 +250,9 @@ static void WIN_GetRefreshRate(void *dxgi_output, DEVMODEW *mode, int *numerator
static float WIN_GetContentScale(SDL_VideoDevice *_this, HMONITOR hMonitor)
{
const SDL_VideoData *videodata = (const SDL_VideoData *)_this->internal;
int dpi = 0;
const SDL_VideoData *videodata = (const SDL_VideoData *)_this->internal;
if (videodata->GetDpiForMonitor) {
UINT hdpi_uint, vdpi_uint;
if (videodata->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi_uint, &vdpi_uint) == S_OK) {
@@ -391,21 +394,21 @@ WIN_GetDisplayNameVista_failed:
#ifdef HAVE_DXGI1_6_H
static bool WIN_GetMonitorDESC1(HMONITOR hMonitor, DXGI_OUTPUT_DESC1 *desc)
{
typedef HRESULT (WINAPI * PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory);
PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc = NULL;
typedef HRESULT (WINAPI *pfnCreateDXGIFactory1)(REFIID riid, void **ppFactory);
pfnCreateDXGIFactory1 pCreateDXGIFactory1 = NULL;
SDL_SharedObject *hDXGIMod = NULL;
bool found = false;
hDXGIMod = SDL_LoadObject("dxgi.dll");
if (hDXGIMod) {
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(hDXGIMod, "CreateDXGIFactory1");
pCreateDXGIFactory1 = (pfnCreateDXGIFactory1)SDL_LoadFunction(hDXGIMod, "CreateDXGIFactory1");
}
if (CreateDXGIFactoryFunc) {
if (pCreateDXGIFactory1) {
static const GUID SDL_IID_IDXGIFactory1 = { 0x770aae78, 0xf26f, 0x4dba, { 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87 } };
static const GUID SDL_IID_IDXGIOutput6 = { 0x068346e8, 0xaaec, 0x4b84, { 0xad, 0xd7, 0x13, 0x7f, 0x51, 0x3f, 0x77, 0xa1 } };
IDXGIFactory1 *dxgiFactory;
if (SUCCEEDED(CreateDXGIFactoryFunc(&SDL_IID_IDXGIFactory1, (void **)&dxgiFactory))) {
if (SUCCEEDED(pCreateDXGIFactory1(&SDL_IID_IDXGIFactory1, (void **)&dxgiFactory))) {
IDXGIAdapter1 *dxgiAdapter;
UINT adapter = 0;
while (!found && SUCCEEDED(IDXGIFactory1_EnumAdapters1(dxgiFactory, adapter, &dxgiAdapter))) {
+106 -22
View File
@@ -38,6 +38,93 @@
#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
#include <shobjidl.h>
#ifndef __ITaskbarList3_FWD_DEFINED__
typedef struct ITaskbarList3 ITaskbarList3;
#endif
#ifndef __ITaskbarList3_INTERFACE_DEFINED__
typedef enum TBPFLAG
{
TBPF_NOPROGRESS = 0x0,
TBPF_INDETERMINATE = 0x1,
TBPF_NORMAL = 0x2,
TBPF_ERROR = 0x4,
TBPF_PAUSED = 0x8
} TBPFLAG;
typedef enum THUMBBUTTONMASK
{
THB_BITMAP = 0x1,
THB_ICON = 0x2,
THB_TOOLTIP = 0x4,
THB_FLAGS = 0x8
} THUMBBUTTONMASK;
typedef enum THUMBBUTTONFLAGS
{
THBF_ENABLED = 0x0,
THBF_DISABLED = 0x1,
THBF_DISMISSONCLICK = 0x2,
THBF_NOBACKGROUND = 0x4,
THBF_HIDDEN = 0x8,
THBF_NONINTERACTIVE = 0x10
} THUMBBUTTONFLAGS;
#if defined(_MSC_VER)
#pragma warning(disable: 4103)
#endif
#pragma pack(push, 8)
typedef struct THUMBBUTTON
{
THUMBBUTTONMASK dwMask;
UINT iId;
UINT iBitmap;
HICON hIcon;
WCHAR szTip[260];
THUMBBUTTONFLAGS dwFlags;
} THUMBBUTTON;
typedef struct THUMBBUTTON *LPTHUMBBUTTON;
#pragma pack(pop)
#ifndef HIMAGELIST
struct _IMAGELIST;
typedef struct _IMAGELIST *HIMAGELIST;
#endif
typedef struct ITaskbarList3Vtbl
{
HRESULT (__stdcall *QueryInterface)(ITaskbarList3 *This, REFIID riid, void **ppvObject);
ULONG (__stdcall *AddRef)(ITaskbarList3 *This);
ULONG (__stdcall *Release)(ITaskbarList3 *This);
HRESULT (__stdcall *HrInit)(ITaskbarList3 *This);
HRESULT (__stdcall *AddTab)(ITaskbarList3 *This, HWND hwnd);
HRESULT (__stdcall *DeleteTab)(ITaskbarList3 *This, HWND hwnd);
HRESULT (__stdcall *ActivateTab)(ITaskbarList3 *This, HWND hwnd);
HRESULT (__stdcall *SetActiveAlt)(ITaskbarList3 *This, HWND hwnd);
HRESULT (__stdcall *MarkFullscreenWindow)(ITaskbarList3 *This, HWND hwnd, BOOL fFullscreen);
HRESULT (__stdcall *SetProgressValue)(ITaskbarList3 *This, HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal);
HRESULT (__stdcall *SetProgressState)(ITaskbarList3 *This, HWND hwnd, TBPFLAG tbpFlags);
HRESULT (__stdcall *RegisterTab)(ITaskbarList3 *This, HWND hwndTab, HWND hwndMDI);
HRESULT (__stdcall *UnregisterTab)(ITaskbarList3 *This, HWND hwndTab);
HRESULT (__stdcall *SetTabOrder)(ITaskbarList3 *This, HWND hwndTab, HWND hwndInsertBefore);
HRESULT (__stdcall *SetTabActive)(ITaskbarList3 *This, HWND hwndTab, HWND hwndMDI, DWORD dwReserved);
HRESULT (__stdcall *ThumbBarAddButtons)(ITaskbarList3 *This, HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton);
HRESULT (__stdcall *ThumbBarUpdateButtons)(ITaskbarList3 *This, HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton);
HRESULT (__stdcall *ThumbBarSetImageList)(ITaskbarList3 *This, HWND hwnd, HIMAGELIST himl);
HRESULT (__stdcall *SetOverlayIcon)(ITaskbarList3 *This, HWND hwnd, HICON hIcon, LPCWSTR pszDescription);
HRESULT (__stdcall *SetThumbnailTooltip)(ITaskbarList3 *This, HWND hwnd, LPCWSTR pszTip);
HRESULT (__stdcall *SetThumbnailClip)(ITaskbarList3 *This, HWND hwnd, RECT *prcClip);
} ITaskbarList3Vtbl;
struct ITaskbarList3
{
ITaskbarList3Vtbl *lpVtbl;
};
#endif // #ifndef __ITaskbarList3_INTERFACE_DEFINED__
#endif
#ifdef SDL_GDK_TEXTINPUT
@@ -204,14 +291,14 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
data->dxgiDLL = SDL_LoadObject("DXGI.DLL");
if (data->dxgiDLL) {
/* *INDENT-OFF* */ // clang-format off
typedef HRESULT (WINAPI *CreateDXGI_t)(REFIID riid, void **ppFactory);
typedef HRESULT (WINAPI *pfnCreateDXGI)(REFIID riid, void **ppFactory);
/* *INDENT-ON* */ // clang-format on
CreateDXGI_t CreateDXGI;
pfnCreateDXGI pCreateDXGI;
CreateDXGI = (CreateDXGI_t)SDL_LoadFunction(data->dxgiDLL, "CreateDXGIFactory");
if (CreateDXGI) {
pCreateDXGI = (pfnCreateDXGI)SDL_LoadFunction(data->dxgiDLL, "CreateDXGIFactory");
if (pCreateDXGI) {
GUID dxgiGUID = { 0x7b7166ec, 0x21c7, 0x44ae, { 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 } };
CreateDXGI(&dxgiGUID, (void **)&data->pDXGIFactory);
pCreateDXGI(&dxgiGUID, (void **)&data->pDXGIFactory);
}
}
#endif
@@ -374,7 +461,6 @@ static BOOL WIN_DeclareDPIAwareUnaware(SDL_VideoDevice *_this)
static BOOL WIN_DeclareDPIAwareSystem(SDL_VideoDevice *_this)
{
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
SDL_VideoData *data = _this->internal;
if (data->SetProcessDpiAwarenessContext) {
@@ -386,9 +472,9 @@ static BOOL WIN_DeclareDPIAwareSystem(SDL_VideoDevice *_this)
} else if (data->SetProcessDPIAware) {
// Windows Vista
return data->SetProcessDPIAware();
} else {
return FALSE;
}
#endif
return FALSE;
}
static BOOL WIN_DeclareDPIAwarePerMonitor(SDL_VideoDevice *_this)
@@ -552,9 +638,7 @@ static bool WIN_VideoInit(SDL_VideoDevice *_this)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
data->_SDL_WAKEUP = RegisterWindowMessageA("_SDL_WAKEUP");
#endif
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
data->WM_TASKBAR_BUTTON_CREATED = RegisterWindowMessageA("TaskbarButtonCreated");
data->WM_TASKBAR_BUTTON_CREATED = WIN_IsWindows7OrGreater() ? RegisterWindowMessageA("TaskbarButtonCreated") : 0;
#endif
return true;
@@ -580,7 +664,7 @@ void WIN_VideoQuit(SDL_VideoDevice *_this)
WIN_QuitMouse(_this);
if (data->taskbar_list) {
IUnknown_Release(data->taskbar_list);
data->taskbar_list->lpVtbl->Release(data->taskbar_list);
data->taskbar_list = NULL;
}
@@ -621,18 +705,18 @@ bool D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface)
*pD3DDLL = SDL_LoadObject("D3D9.DLL");
if (*pD3DDLL) {
/* *INDENT-OFF* */ // clang-format off
typedef IDirect3D9 *(WINAPI *Direct3DCreate9_t)(UINT SDKVersion);
typedef HRESULT (WINAPI* Direct3DCreate9Ex_t)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
typedef IDirect3D9 *(WINAPI *pfnDirect3DCreate9)(UINT SDKVersion);
typedef HRESULT (WINAPI *pfnDirect3DCreate9Ex)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
/* *INDENT-ON* */ // clang-format on
Direct3DCreate9_t Direct3DCreate9Func;
pfnDirect3DCreate9 pDirect3DCreate9;
if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_USE_D3D9EX, false)) {
Direct3DCreate9Ex_t Direct3DCreate9ExFunc;
pfnDirect3DCreate9Ex pDirect3DCreate9Ex;
Direct3DCreate9ExFunc = (Direct3DCreate9Ex_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9Ex");
if (Direct3DCreate9ExFunc) {
pDirect3DCreate9Ex = (pfnDirect3DCreate9Ex)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9Ex");
if (pDirect3DCreate9Ex) {
IDirect3D9Ex *pDirect3D9ExInterface;
HRESULT hr = Direct3DCreate9ExFunc(D3D_SDK_VERSION, &pDirect3D9ExInterface);
HRESULT hr = pDirect3DCreate9Ex(D3D_SDK_VERSION, &pDirect3D9ExInterface);
if (SUCCEEDED(hr)) {
const GUID IDirect3D9_GUID = { 0x81bdcbca, 0x64d4, 0x426d, { 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c } };
hr = IDirect3D9Ex_QueryInterface(pDirect3D9ExInterface, &IDirect3D9_GUID, (void **)pDirect3D9Interface);
@@ -644,9 +728,9 @@ bool D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface)
}
}
Direct3DCreate9Func = (Direct3DCreate9_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9");
if (Direct3DCreate9Func) {
*pDirect3D9Interface = Direct3DCreate9Func(D3D_SDK_VERSION);
pDirect3DCreate9 = (pfnDirect3DCreate9)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9");
if (pDirect3DCreate9) {
*pDirect3D9Interface = pDirect3DCreate9(D3D_SDK_VERSION);
if (*pDirect3D9Interface) {
return true;
}
+124 -20
View File
@@ -66,7 +66,7 @@
#define USER_DEFAULT_SCREEN_DPI 96
#endif
#if WINVER < 0x0601
#if WINVER < _WIN32_WINNT_WIN7
// Touch input definitions
#define TWF_FINETOUCH 1
#define TWF_WANTPALM 2
@@ -287,7 +287,100 @@ typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME
#define QDC_ONLY_ACTIVE_PATHS 0x00000002
#endif // WINVER < 0x0601
#endif // WINVER < _WIN32_WINNT_WIN7
#if WINVER < _WIN32_WINNT_WIN8
// Pen input definitions
#define POINTER_MESSAGE_FLAG_NEW 0x00000001
#define POINTER_MESSAGE_FLAG_INRANGE 0x00000002
#define POINTER_MESSAGE_FLAG_INCONTACT 0x00000004
#define POINTER_MESSAGE_FLAG_FIRSTBUTTON 0x00000010
#define POINTER_MESSAGE_FLAG_SECONDBUTTON 0x00000020
#define POINTER_MESSAGE_FLAG_THIRDBUTTON 0x00000040
#define POINTER_MESSAGE_FLAG_FOURTHBUTTON 0x00000080
#define POINTER_MESSAGE_FLAG_FIFTHBUTTON 0x00000100
#define POINTER_MESSAGE_FLAG_PRIMARY 0x00002000
#define POINTER_MESSAGE_FLAG_CONFIDENCE 0x00004000
#define POINTER_MESSAGE_FLAG_CANCELED 0x00008000
#define GET_POINTERID_WPARAM(wParam) (LOWORD(wParam))
#define IS_POINTER_FLAG_SET_WPARAM(wParam, flag) (((DWORD)HIWORD(wParam) & (flag)) == (flag))
#define IS_POINTER_INCONTACT_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_INCONTACT)
#define IS_POINTER_FIRSTBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_FIRSTBUTTON)
typedef DWORD POINTER_INPUT_TYPE;
enum tagPOINTER_INPUT_TYPE
{
PT_POINTER = 1,
PT_TOUCH,
PT_PEN,
PT_MOUSE,
PT_TOUCHPAD
};
typedef UINT32 POINTER_FLAGS;
typedef UINT32 PEN_FLAGS;
#define PEN_FLAG_NONE 0x00000000
#define PEN_FLAG_BARREL 0x00000001
#define PEN_FLAG_INVERTED 0x00000002
#define PEN_FLAG_ERASER 0x00000004
typedef UINT32 PEN_MASK;
#define PEN_MASK_NONE 0x00000000
#define PEN_MASK_PRESSURE 0x00000001
#define PEN_MASK_ROTATION 0x00000002
#define PEN_MASK_TILT_X 0x00000004
#define PEN_MASK_TILT_Y 0x00000008
typedef enum tagPOINTER_BUTTON_CHANGE_TYPE
{
POINTER_CHANGE_NONE,
POINTER_CHANGE_FIRSTBUTTON_DOWN,
POINTER_CHANGE_FIRSTBUTTON_UP,
POINTER_CHANGE_SECONDBUTTON_DOWN,
POINTER_CHANGE_SECONDBUTTON_UP,
POINTER_CHANGE_THIRDBUTTON_DOWN,
POINTER_CHANGE_THIRDBUTTON_UP,
POINTER_CHANGE_FOURTHBUTTON_DOWN,
POINTER_CHANGE_FOURTHBUTTON_UP,
POINTER_CHANGE_FIFTHBUTTON_DOWN,
POINTER_CHANGE_FIFTHBUTTON_UP
} POINTER_BUTTON_CHANGE_TYPE;
typedef struct tagPOINTER_INFO
{
POINTER_INPUT_TYPE pointerType;
UINT32 pointerId;
UINT32 frameId;
POINTER_FLAGS pointerFlags;
HANDLE sourceDevice;
HWND hwndTarget;
POINT ptPixelLocation;
POINT ptHimetricLocation;
POINT ptPixelLocationRaw;
POINT ptHimetricLocationRaw;
DWORD dwTime;
UINT32 historyCount;
INT32 InputData;
DWORD dwKeyStates;
UINT64 PerformanceCount;
POINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
} POINTER_INFO;
typedef struct tagPOINTER_PEN_INFO
{
POINTER_INFO pointerInfo;
PEN_FLAGS penFlags;
PEN_MASK penMask;
UINT32 pressure;
UINT32 rotation;
INT32 tiltX;
INT32 tiltY;
} POINTER_PEN_INFO;
#endif // WINVER < _WIN32_WINNT_WIN8
#ifndef HAVE_SHELLSCALINGAPI_H
@@ -431,12 +524,39 @@ struct SDL_VideoData
DWORD clipboard_count;
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) // Xbox doesn't support user32/shcore
// Touch input functions
SDL_SharedObject *userDLL;
// DisplayConfig functions
/* *INDENT-OFF* */ // clang-format off
LONG (WINAPI *GetDisplayConfigBufferSizes)( UINT32, UINT32 *, UINT32 *);
LONG (WINAPI *QueryDisplayConfig)( UINT32, UINT32 *, DISPLAYCONFIG_PATH_INFO*, UINT32 *, DISPLAYCONFIG_MODE_INFO*, DISPLAYCONFIG_TOPOLOGY_ID*);
LONG (WINAPI *DisplayConfigGetDeviceInfo)( DISPLAYCONFIG_DEVICE_INFO_HEADER*);
/* *INDENT-ON* */ // clang-format on
// Touch input functions
/* *INDENT-OFF* */ // clang-format off
BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
/* *INDENT-ON* */ // clang-format on
// DWM functions
SDL_SharedObject *dwmapiDLL;
/* *INDENT-OFF* */ // clang-format off
HRESULT (WINAPI *DwmFlush)(void);
HRESULT (WINAPI *DwmEnableBlurBehindWindow)(HWND hwnd, const DWM_BLURBEHIND *pBlurBehind);
HRESULT (WINAPI *DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
/* *INDENT-ON* */ // clang-format on
// Pen input functions
/* *INDENT-OFF* */ // clang-format off
BOOL (WINAPI *GetPointerType)(UINT32 pointerId, POINTER_INPUT_TYPE *pointerType);
BOOL (WINAPI *GetPointerPenInfo)(UINT32 pointerId, POINTER_PEN_INFO *penInfo);
/* *INDENT-ON* */ // clang-format on
// DPI functions
SDL_SharedObject *shcoreDLL;
/* *INDENT-OFF* */ // clang-format off
BOOL (WINAPI *SetProcessDPIAware)( void );
BOOL (WINAPI *SetProcessDpiAwarenessContext)( DPI_AWARENESS_CONTEXT );
DPI_AWARENESS_CONTEXT (WINAPI *SetThreadDpiAwarenessContext)( DPI_AWARENESS_CONTEXT );
@@ -447,27 +567,11 @@ struct SDL_VideoData
UINT (WINAPI *GetDpiForWindow)( HWND );
BOOL (WINAPI *AreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT);
BOOL (WINAPI *IsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
// DisplayConfig functions
LONG (WINAPI *GetDisplayConfigBufferSizes)( UINT32, UINT32 *, UINT32 *);
LONG (WINAPI *QueryDisplayConfig)( UINT32, UINT32 *, DISPLAYCONFIG_PATH_INFO*, UINT32 *, DISPLAYCONFIG_MODE_INFO*, DISPLAYCONFIG_TOPOLOGY_ID*);
LONG (WINAPI *DisplayConfigGetDeviceInfo)( DISPLAYCONFIG_DEVICE_INFO_HEADER*);
/* *INDENT-ON* */ // clang-format on
SDL_SharedObject *shcoreDLL;
/* *INDENT-OFF* */ // clang-format off
HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor,
MONITOR_DPI_TYPE dpiType,
UINT *dpiX,
UINT *dpiY );
HRESULT (WINAPI *SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS dpiAwareness);
BOOL (WINAPI *GetPointerType)(UINT32 pointerId, POINTER_INPUT_TYPE *pointerType);
BOOL (WINAPI *GetPointerPenInfo)(UINT32 pointerId, POINTER_PEN_INFO *penInfo);
SDL_SharedObject *dwmapiDLL;
/* *INDENT-OFF* */ // clang-format off
HRESULT (WINAPI *DwmFlush)(void);
HRESULT (WINAPI *DwmEnableBlurBehindWindow)(HWND hwnd, const DWM_BLURBEHIND *pBlurBehind);
HRESULT (WINAPI *DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
/* *INDENT-ON* */ // clang-format on
#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
@@ -541,7 +645,7 @@ struct SDL_VideoData
BYTE pre_hook_key_state[256];
UINT _SDL_WAKEUP;
#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
UINT WM_TASKBAR_BUTTON_CREATED;
ITaskbarList3 *taskbar_list;
#endif
+2 -2
View File
@@ -141,7 +141,7 @@ static DWORD GetWindowStyleEx(SDL_Window *window)
return style;
}
#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
static ITaskbarList3 *GetTaskbarList(SDL_Window *window)
{
const SDL_WindowData *data = window->internal;
@@ -2158,7 +2158,7 @@ bool WIN_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperat
bool WIN_ApplyWindowProgress(SDL_VideoDevice *_this, SDL_Window *window)
{
#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
SDL_WindowData *data = window->internal;
if (!data->taskbar_button_created) {
return true;
+22
View File
@@ -5,6 +5,28 @@
#include <windows.h>
#include <dbghelp.h>
#ifndef STATUS_HEAP_CORRUPTION
#define STATUS_HEAP_CORRUPTION ((DWORD)0xC0000374L)
#endif
#ifndef EXCEPTION_UNWINDING
#define EXCEPTION_UNWINDING 0x2
#endif
#ifndef EXCEPTION_EXIT_UNWIND
#define EXCEPTION_EXIT_UNWIND 0x4
#endif
#ifndef EXCEPTION_STACK_INVALID
#define EXCEPTION_STACK_INVALID 0x8
#endif
#ifndef EXCEPTION_NESTED_CALL
#define EXCEPTION_NESTED_CALL 0x10
#endif
#ifndef EXCEPTION_TARGET_UNWIND
#define EXCEPTION_TARGET_UNWIND 0x20
#endif
#ifndef EXCEPTION_COLLIDED_UNWIND
#define EXCEPTION_COLLIDED_UNWIND 0x40
#endif
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>