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.
This commit is contained in:
David Ludwig 2016-12-10 15:23:17 -05:00
parent 454d9cb96d
commit d6bcec8f6a
11 changed files with 48 additions and 0 deletions

View File

@ -132,6 +132,7 @@
<ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" /> <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
<ClInclude Include="..\..\src\render\software\SDL_rotate.h" /> <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
<ClInclude Include="..\..\src\SDL_assert_c.h" /> <ClInclude Include="..\..\src\SDL_assert_c.h" />
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" /> <ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_fatal.h" /> <ClInclude Include="..\..\src\SDL_fatal.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" /> <ClInclude Include="..\..\src\SDL_hints_c.h" />
@ -265,6 +266,7 @@
<ClCompile Include="..\..\src\render\software\SDL_rotate.c" /> <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
<ClCompile Include="..\..\src\SDL.c" /> <ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\SDL_assert.c" /> <ClCompile Include="..\..\src\SDL_assert.c" />
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_error.c" /> <ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" /> <ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_log.c" /> <ClCompile Include="..\..\src\SDL_log.c" />

View File

@ -402,6 +402,9 @@
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h"> <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\SDL_dataqueue.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\atomic\SDL_atomic.c"> <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
@ -719,5 +722,8 @@
<ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp"> <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\SDL_dataqueue.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -250,6 +250,7 @@
<ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" /> <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
<ClInclude Include="..\..\src\render\software\SDL_rotate.h" /> <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
<ClInclude Include="..\..\src\SDL_assert_c.h" /> <ClInclude Include="..\..\src\SDL_assert_c.h" />
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" /> <ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_fatal.h" /> <ClInclude Include="..\..\src\SDL_fatal.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" /> <ClInclude Include="..\..\src\SDL_hints_c.h" />
@ -364,6 +365,7 @@
<ClCompile Include="..\..\src\render\software\SDL_rotate.c" /> <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
<ClCompile Include="..\..\src\SDL.c" /> <ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\SDL_assert.c" /> <ClCompile Include="..\..\src\SDL_assert.c" />
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_error.c" /> <ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" /> <ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_log.c" /> <ClCompile Include="..\..\src\SDL_log.c" />

View File

@ -372,6 +372,9 @@
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h"> <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\SDL_dataqueue.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\atomic\SDL_atomic.c"> <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
@ -677,5 +680,8 @@
<ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp"> <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\SDL_dataqueue.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -116,6 +116,7 @@
<ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" /> <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
<ClInclude Include="..\..\src\render\software\SDL_rotate.h" /> <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
<ClInclude Include="..\..\src\SDL_assert_c.h" /> <ClInclude Include="..\..\src\SDL_assert_c.h" />
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" /> <ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_fatal.h" /> <ClInclude Include="..\..\src\SDL_fatal.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" /> <ClInclude Include="..\..\src\SDL_hints_c.h" />
@ -230,6 +231,7 @@
<ClCompile Include="..\..\src\render\software\SDL_rotate.c" /> <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
<ClCompile Include="..\..\src\SDL.c" /> <ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\SDL_assert.c" /> <ClCompile Include="..\..\src\SDL_assert.c" />
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_error.c" /> <ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" /> <ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_log.c" /> <ClCompile Include="..\..\src\SDL_log.c" />

View File

@ -381,6 +381,9 @@
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h"> <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\SDL_dataqueue.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\atomic\SDL_atomic.c"> <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
@ -689,5 +692,8 @@
<ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp"> <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\SDL_dataqueue.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -129,6 +129,7 @@
<ClCompile Include="..\..\src\render\software\SDL_rotate.c" /> <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
<ClCompile Include="..\..\src\SDL.c" /> <ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\SDL_assert.c" /> <ClCompile Include="..\..\src\SDL_assert.c" />
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_error.c" /> <ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" /> <ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_log.c" /> <ClCompile Include="..\..\src\SDL_log.c" />
@ -337,6 +338,7 @@
<ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" /> <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
<ClInclude Include="..\..\src\render\software\SDL_rotate.h" /> <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
<ClInclude Include="..\..\src\SDL_assert_c.h" /> <ClInclude Include="..\..\src\SDL_assert_c.h" />
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" /> <ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_fatal.h" /> <ClInclude Include="..\..\src\SDL_fatal.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" /> <ClInclude Include="..\..\src\SDL_hints_c.h" />

View File

@ -319,6 +319,9 @@
<ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp"> <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\SDL_dataqueue.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\include\begin_code.h"> <ClInclude Include="..\..\include\begin_code.h">
@ -717,6 +720,9 @@
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h"> <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\SDL_dataqueue.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Header Files"> <Filter Include="Header Files">

View File

@ -131,6 +131,7 @@
<ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" /> <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
<ClInclude Include="..\..\src\render\software\SDL_rotate.h" /> <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
<ClInclude Include="..\..\src\SDL_assert_c.h" /> <ClInclude Include="..\..\src\SDL_assert_c.h" />
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" /> <ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_fatal.h" /> <ClInclude Include="..\..\src\SDL_fatal.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" /> <ClInclude Include="..\..\src\SDL_hints_c.h" />
@ -262,6 +263,7 @@
<ClCompile Include="..\..\src\render\software\SDL_rotate.c" /> <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
<ClCompile Include="..\..\src\SDL.c" /> <ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\SDL_assert.c" /> <ClCompile Include="..\..\src\SDL_assert.c" />
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_error.c" /> <ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" /> <ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_log.c" /> <ClCompile Include="..\..\src\SDL_log.c" />

View File

@ -393,6 +393,9 @@
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h"> <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\SDL_dataqueue.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\atomic\SDL_atomic.c"> <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
@ -713,5 +716,8 @@
<ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp"> <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\SDL_dataqueue.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -38,11 +38,16 @@ static SDL_bool s_bXInputEnabled = SDL_TRUE;
static SDL_bool static SDL_bool
SDL_XInputUseOldJoystickMapping() 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; static int s_XInputUseOldJoystickMapping = -1;
if (s_XInputUseOldJoystickMapping < 0) { if (s_XInputUseOldJoystickMapping < 0) {
s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE); s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE);
} }
return (s_XInputUseOldJoystickMapping > 0); return (s_XInputUseOldJoystickMapping > 0);
#endif
} }
SDL_bool SDL_XINPUT_Enabled(void) SDL_bool SDL_XINPUT_Enabled(void)
@ -110,6 +115,8 @@ GetXInputName(const Uint8 userid, BYTE SubType)
static void static void
GuessXInputDevice(UINT device_index, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) 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; PRAWINPUTDEVICELIST devices = NULL;
UINT i, found_count = 0, device_count = 0; 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); SDL_free(devices);
#endif /* ifndef __WINRT__ */
} }
static void static void