winrt: Don't use LoadLibraryA on WinRT. This removes the CM_Register_Notification code on WinRT. Note that this API _is_ available to UWP apps as of Windows 10.0.17763 (version 1809, released October 2018), according to: https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-devices-config-l1-1-1dll So it might be worth readding with some sort of preprocessor check for minimum targeted version, or whatever is appropriate for WinRT development.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c
index 65d0280..a3c3aff 100644
--- a/src/joystick/windows/SDL_windowsjoystick.c
+++ b/src/joystick/windows/SDL_windowsjoystick.c
@@ -141,7 +141,7 @@ static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB,
JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */
-
+#ifndef __WINRT__
static HMODULE cfgmgr32_lib_handle;
static CM_Register_NotificationFunc CM_Register_Notification;
static CM_Unregister_NotificationFunc CM_Unregister_Notification;
@@ -195,8 +195,6 @@ SDL_CreateDeviceNotificationFunc(void)
return SDL_FALSE;
}
-#ifndef __WINRT__
-
typedef struct
{
HRESULT coinitialized;
@@ -455,9 +453,9 @@ WINDOWS_JoystickInit(void)
WINDOWS_JoystickDetect();
+#ifndef __WINRT__
SDL_CreateDeviceNotificationFunc();
-#ifndef __WINRT__
s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, SDL_FALSE);
if (s_bJoystickThread) {
if (SDL_StartJoystickThread() < 0) {
@@ -731,9 +729,9 @@ WINDOWS_JoystickQuit(void)
} else {
SDL_CleanupDeviceNotification(&s_notification_data);
}
-#endif
SDL_CleanupDeviceNotificationFunc();
+#endif
SDL_DINPUT_JoystickQuit();
SDL_XINPUT_JoystickQuit();