WinRT: build fixes
authorDavid Ludwig <dludwig@pobox.com>
Sat, 10 Dec 2016 15:23:17 -0500
changeset 106970cdc25111b6c
parent 10696 24c95c8f6a9a
child 10698 044ef09cda20
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
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj
VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj
VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
src/joystick/windows/SDL_xinputjoystick.c
     1.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Fri Dec 09 05:19:31 2016 -0800
     1.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Sat Dec 10 15:23:17 2016 -0500
     1.3 @@ -132,6 +132,7 @@
     1.4      <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
     1.5      <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
     1.6      <ClInclude Include="..\..\src\SDL_assert_c.h" />
     1.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h" />
     1.8      <ClInclude Include="..\..\src\SDL_error_c.h" />
     1.9      <ClInclude Include="..\..\src\SDL_fatal.h" />
    1.10      <ClInclude Include="..\..\src\SDL_hints_c.h" />
    1.11 @@ -265,6 +266,7 @@
    1.12      <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
    1.13      <ClCompile Include="..\..\src\SDL.c" />
    1.14      <ClCompile Include="..\..\src\SDL_assert.c" />
    1.15 +    <ClCompile Include="..\..\src\SDL_dataqueue.c" />
    1.16      <ClCompile Include="..\..\src\SDL_error.c" />
    1.17      <ClCompile Include="..\..\src\SDL_hints.c" />
    1.18      <ClCompile Include="..\..\src\SDL_log.c" />
     2.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Fri Dec 09 05:19:31 2016 -0800
     2.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Sat Dec 10 15:23:17 2016 -0500
     2.3 @@ -402,6 +402,9 @@
     2.4      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
     2.5        <Filter>Source Files</Filter>
     2.6      </ClInclude>
     2.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h">
     2.8 +      <Filter>Source Files</Filter>
     2.9 +    </ClInclude>
    2.10    </ItemGroup>
    2.11    <ItemGroup>
    2.12      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    2.13 @@ -719,5 +722,8 @@
    2.14      <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
    2.15        <Filter>Source Files</Filter>
    2.16      </ClCompile>
    2.17 +    <ClCompile Include="..\..\src\SDL_dataqueue.c">
    2.18 +      <Filter>Source Files</Filter>
    2.19 +    </ClCompile>
    2.20    </ItemGroup>
    2.21  </Project>
    2.22 \ No newline at end of file
     3.1 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj	Fri Dec 09 05:19:31 2016 -0800
     3.2 +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj	Sat Dec 10 15:23:17 2016 -0500
     3.3 @@ -250,6 +250,7 @@
     3.4      <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
     3.5      <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
     3.6      <ClInclude Include="..\..\src\SDL_assert_c.h" />
     3.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h" />
     3.8      <ClInclude Include="..\..\src\SDL_error_c.h" />
     3.9      <ClInclude Include="..\..\src\SDL_fatal.h" />
    3.10      <ClInclude Include="..\..\src\SDL_hints_c.h" />
    3.11 @@ -364,6 +365,7 @@
    3.12      <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
    3.13      <ClCompile Include="..\..\src\SDL.c" />
    3.14      <ClCompile Include="..\..\src\SDL_assert.c" />
    3.15 +    <ClCompile Include="..\..\src\SDL_dataqueue.c" />
    3.16      <ClCompile Include="..\..\src\SDL_error.c" />
    3.17      <ClCompile Include="..\..\src\SDL_hints.c" />
    3.18      <ClCompile Include="..\..\src\SDL_log.c" />
     4.1 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters	Fri Dec 09 05:19:31 2016 -0800
     4.2 +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters	Sat Dec 10 15:23:17 2016 -0500
     4.3 @@ -372,6 +372,9 @@
     4.4      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
     4.5        <Filter>Source Files</Filter>
     4.6      </ClInclude>
     4.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h">
     4.8 +      <Filter>Source Files</Filter>
     4.9 +    </ClInclude>
    4.10    </ItemGroup>
    4.11    <ItemGroup>
    4.12      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    4.13 @@ -677,5 +680,8 @@
    4.14      <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
    4.15        <Filter>Source Files</Filter>
    4.16      </ClCompile>
    4.17 +    <ClCompile Include="..\..\src\SDL_dataqueue.c">
    4.18 +      <Filter>Source Files</Filter>
    4.19 +    </ClCompile>
    4.20    </ItemGroup>
    4.21  </Project>
    4.22 \ No newline at end of file
     5.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Fri Dec 09 05:19:31 2016 -0800
     5.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Sat Dec 10 15:23:17 2016 -0500
     5.3 @@ -116,6 +116,7 @@
     5.4      <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
     5.5      <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
     5.6      <ClInclude Include="..\..\src\SDL_assert_c.h" />
     5.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h" />
     5.8      <ClInclude Include="..\..\src\SDL_error_c.h" />
     5.9      <ClInclude Include="..\..\src\SDL_fatal.h" />
    5.10      <ClInclude Include="..\..\src\SDL_hints_c.h" />
    5.11 @@ -230,6 +231,7 @@
    5.12      <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
    5.13      <ClCompile Include="..\..\src\SDL.c" />
    5.14      <ClCompile Include="..\..\src\SDL_assert.c" />
    5.15 +    <ClCompile Include="..\..\src\SDL_dataqueue.c" />
    5.16      <ClCompile Include="..\..\src\SDL_error.c" />
    5.17      <ClCompile Include="..\..\src\SDL_hints.c" />
    5.18      <ClCompile Include="..\..\src\SDL_log.c" />
     6.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Fri Dec 09 05:19:31 2016 -0800
     6.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Sat Dec 10 15:23:17 2016 -0500
     6.3 @@ -381,6 +381,9 @@
     6.4      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
     6.5        <Filter>Source Files</Filter>
     6.6      </ClInclude>
     6.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h">
     6.8 +      <Filter>Source Files</Filter>
     6.9 +    </ClInclude>
    6.10    </ItemGroup>
    6.11    <ItemGroup>
    6.12      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    6.13 @@ -689,5 +692,8 @@
    6.14      <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
    6.15        <Filter>Source Files</Filter>
    6.16      </ClCompile>
    6.17 +    <ClCompile Include="..\..\src\SDL_dataqueue.c">
    6.18 +      <Filter>Source Files</Filter>
    6.19 +    </ClCompile>
    6.20    </ItemGroup>
    6.21  </Project>
    6.22 \ No newline at end of file
     7.1 --- a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj	Fri Dec 09 05:19:31 2016 -0800
     7.2 +++ b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj	Sat Dec 10 15:23:17 2016 -0500
     7.3 @@ -129,6 +129,7 @@
     7.4      <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
     7.5      <ClCompile Include="..\..\src\SDL.c" />
     7.6      <ClCompile Include="..\..\src\SDL_assert.c" />
     7.7 +    <ClCompile Include="..\..\src\SDL_dataqueue.c" />
     7.8      <ClCompile Include="..\..\src\SDL_error.c" />
     7.9      <ClCompile Include="..\..\src\SDL_hints.c" />
    7.10      <ClCompile Include="..\..\src\SDL_log.c" />
    7.11 @@ -337,6 +338,7 @@
    7.12      <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
    7.13      <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
    7.14      <ClInclude Include="..\..\src\SDL_assert_c.h" />
    7.15 +    <ClInclude Include="..\..\src\SDL_dataqueue.h" />
    7.16      <ClInclude Include="..\..\src\SDL_error_c.h" />
    7.17      <ClInclude Include="..\..\src\SDL_fatal.h" />
    7.18      <ClInclude Include="..\..\src\SDL_hints_c.h" />
     8.1 --- a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters	Fri Dec 09 05:19:31 2016 -0800
     8.2 +++ b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters	Sat Dec 10 15:23:17 2016 -0500
     8.3 @@ -319,6 +319,9 @@
     8.4      <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
     8.5        <Filter>Source Files</Filter>
     8.6      </ClCompile>
     8.7 +    <ClCompile Include="..\..\src\SDL_dataqueue.c">
     8.8 +      <Filter>Source Files</Filter>
     8.9 +    </ClCompile>
    8.10    </ItemGroup>
    8.11    <ItemGroup>
    8.12      <ClInclude Include="..\..\include\begin_code.h">
    8.13 @@ -717,6 +720,9 @@
    8.14      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
    8.15        <Filter>Source Files</Filter>
    8.16      </ClInclude>
    8.17 +    <ClInclude Include="..\..\src\SDL_dataqueue.h">
    8.18 +      <Filter>Source Files</Filter>
    8.19 +    </ClInclude>
    8.20    </ItemGroup>
    8.21    <ItemGroup>
    8.22      <Filter Include="Header Files">
     9.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Fri Dec 09 05:19:31 2016 -0800
     9.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Sat Dec 10 15:23:17 2016 -0500
     9.3 @@ -131,6 +131,7 @@
     9.4      <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
     9.5      <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
     9.6      <ClInclude Include="..\..\src\SDL_assert_c.h" />
     9.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h" />
     9.8      <ClInclude Include="..\..\src\SDL_error_c.h" />
     9.9      <ClInclude Include="..\..\src\SDL_fatal.h" />
    9.10      <ClInclude Include="..\..\src\SDL_hints_c.h" />
    9.11 @@ -262,6 +263,7 @@
    9.12      <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
    9.13      <ClCompile Include="..\..\src\SDL.c" />
    9.14      <ClCompile Include="..\..\src\SDL_assert.c" />
    9.15 +    <ClCompile Include="..\..\src\SDL_dataqueue.c" />
    9.16      <ClCompile Include="..\..\src\SDL_error.c" />
    9.17      <ClCompile Include="..\..\src\SDL_hints.c" />
    9.18      <ClCompile Include="..\..\src\SDL_log.c" />
    10.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Fri Dec 09 05:19:31 2016 -0800
    10.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Sat Dec 10 15:23:17 2016 -0500
    10.3 @@ -393,6 +393,9 @@
    10.4      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h">
    10.5        <Filter>Source Files</Filter>
    10.6      </ClInclude>
    10.7 +    <ClInclude Include="..\..\src\SDL_dataqueue.h">
    10.8 +      <Filter>Source Files</Filter>
    10.9 +    </ClInclude>
   10.10    </ItemGroup>
   10.11    <ItemGroup>
   10.12      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
   10.13 @@ -713,5 +716,8 @@
   10.14      <ClCompile Include="..\..\src\video\winrt\SDL_winrtgamebar.cpp">
   10.15        <Filter>Source Files</Filter>
   10.16      </ClCompile>
   10.17 +    <ClCompile Include="..\..\src\SDL_dataqueue.c">
   10.18 +      <Filter>Source Files</Filter>
   10.19 +    </ClCompile>
   10.20    </ItemGroup>
   10.21  </Project>
   10.22 \ No newline at end of file
    11.1 --- a/src/joystick/windows/SDL_xinputjoystick.c	Fri Dec 09 05:19:31 2016 -0800
    11.2 +++ b/src/joystick/windows/SDL_xinputjoystick.c	Sat Dec 10 15:23:17 2016 -0500
    11.3 @@ -38,11 +38,16 @@
    11.4  static SDL_bool
    11.5  SDL_XInputUseOldJoystickMapping()
    11.6  {
    11.7 +#ifdef __WINRT__
    11.8 +    /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
    11.9 +    return SDL_TRUE;
   11.10 +#else
   11.11      static int s_XInputUseOldJoystickMapping = -1;
   11.12      if (s_XInputUseOldJoystickMapping < 0) {
   11.13          s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE);
   11.14      }
   11.15      return (s_XInputUseOldJoystickMapping > 0);
   11.16 +#endif
   11.17  }
   11.18  
   11.19  SDL_bool SDL_XINPUT_Enabled(void)
   11.20 @@ -110,6 +115,8 @@
   11.21  static void
   11.22  GuessXInputDevice(UINT device_index, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion)
   11.23  {
   11.24 +#ifndef __WINRT__   /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
   11.25 +
   11.26      PRAWINPUTDEVICELIST devices = NULL;
   11.27      UINT i, found_count = 0, device_count = 0;
   11.28  
   11.29 @@ -151,6 +158,7 @@
   11.30          }
   11.31      }
   11.32      SDL_free(devices);
   11.33 +#endif  /* ifndef __WINRT__ */
   11.34  }
   11.35  
   11.36  static void