From d6bcec8f6abac03eee6d43cefda6637b642a4ef4 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Sat, 10 Dec 2016 15:23:17 -0500 Subject: [PATCH] WinRT: build fixes These fixes are lumped into two categories: 1. add new file, SDL_dataqueue.c, to UWP/WinRT build-inputs (via MSVC project files) 2. implement a temporary, hack-fix for a build error in SDL_xinputjoystick.c. Win32's Raw Input APIs are, unfortunately, not available for use in UWP/WinRT APIs. There does appear to be a replacement API, available in the Windows.Devices.HumanInterfaceDevice namespace. This fix should be sufficient to get SDL compiling again, without affecting Win32 builds, however using the UWP/WinRT API (in UWP/WinRT builds) would almost certainly be better (for UWP/WinRT builds). TODO: research Windows.Devices.HumanInterfaceDevice, and use that if and as appropriate. --- VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj | 2 ++ VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters | 6 ++++++ VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj | 2 ++ .../WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters | 6 ++++++ VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj | 2 ++ .../WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters | 6 ++++++ VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj | 2 ++ VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters | 6 ++++++ VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj | 2 ++ VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters | 6 ++++++ src/joystick/windows/SDL_xinputjoystick.c | 8 ++++++++ 11 files changed, 48 insertions(+) diff --git a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj index 3becf4b6e8023..5564b185ca041 100644 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj @@ -132,6 +132,7 @@ + @@ -265,6 +266,7 @@ + diff --git a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters index 9b4323d408ec4..bf2137adda881 100644 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters @@ -402,6 +402,9 @@ Source Files + + Source Files + @@ -719,5 +722,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj index a2af852d7ba2e..183e427f46cab 100644 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj @@ -250,6 +250,7 @@ + @@ -364,6 +365,7 @@ + diff --git a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters index 182e79e1dcee2..304c0472d05a0 100644 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters @@ -372,6 +372,9 @@ Source Files + + Source Files + @@ -677,5 +680,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj index 631c26c35e5bf..c291871b2bbeb 100644 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj @@ -116,6 +116,7 @@ + @@ -230,6 +231,7 @@ + diff --git a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters index 732f1e54158dd..badba57cc614c 100644 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters @@ -381,6 +381,9 @@ Source Files + + Source Files + @@ -689,5 +692,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj index 44a5eeb34ef33..f29cd42acd2a5 100644 --- a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj +++ b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj @@ -129,6 +129,7 @@ + @@ -337,6 +338,7 @@ + diff --git a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters index 7bdc9d547efc8..5c601be172bbe 100644 --- a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters +++ b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters @@ -319,6 +319,9 @@ Source Files + + Source Files + @@ -717,6 +720,9 @@ Source Files + + Source Files + diff --git a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj index 5c448c4c612ff..ec044385b64ca 100644 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj @@ -131,6 +131,7 @@ + @@ -262,6 +263,7 @@ + diff --git a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters index 5af736feecfa3..f6b398a97d4a8 100644 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters @@ -393,6 +393,9 @@ Source Files + + Source Files + @@ -713,5 +716,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c index 98dde0e219468..daf09216eea43 100644 --- a/src/joystick/windows/SDL_xinputjoystick.c +++ b/src/joystick/windows/SDL_xinputjoystick.c @@ -38,11 +38,16 @@ static SDL_bool s_bXInputEnabled = SDL_TRUE; static SDL_bool SDL_XInputUseOldJoystickMapping() { +#ifdef __WINRT__ + /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + return SDL_TRUE; +#else static int s_XInputUseOldJoystickMapping = -1; if (s_XInputUseOldJoystickMapping < 0) { s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE); } return (s_XInputUseOldJoystickMapping > 0); +#endif } SDL_bool SDL_XINPUT_Enabled(void) @@ -110,6 +115,8 @@ GetXInputName(const Uint8 userid, BYTE SubType) static void GuessXInputDevice(UINT device_index, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) { +#ifndef __WINRT__ /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + PRAWINPUTDEVICELIST devices = NULL; UINT i, found_count = 0, device_count = 0; @@ -151,6 +158,7 @@ GuessXInputDevice(UINT device_index, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersio } } SDL_free(devices); +#endif /* ifndef __WINRT__ */ } static void