浏览代码

Xbox GDKX support (#5869)

* Xbox GDK support (14 squashed commits)

* Added basic keyboard testing

* Update readme

* Code review fixes

* Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
chalonverse 3 年之前
父节点
当前提交
f317d619cc
共有 77 个文件被更改,包括 2573 次插入74 次删除
  1. 1 0
      .gitignore
  2. 64 0
      VisualC-GDK/SDL.sln
  3. 242 6
      VisualC-GDK/SDL/SDL.vcxproj
  4. 12 0
      VisualC-GDK/SDL/SDL.vcxproj.filters
  5. 124 0
      VisualC-GDK/SDLmain/SDLmain.vcxproj
  6. 124 0
      VisualC-GDK/SDLtest/SDLtest.vcxproj
  7. 2 0
      VisualC-GDK/clean.sh
  8. 二进制
      VisualC-GDK/logos/SplashScreenImage.png
  9. 262 1
      VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj
  10. 24 2
      VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj.filters
  11. 0 0
      VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config
  12. 35 0
      VisualC-GDK/tests/testgamecontroller/xboxone/MicrosoftGame.config
  13. 29 0
      VisualC-GDK/tests/testgamecontroller/xboxseries/MicrosoftGame.config
  14. 1 0
      VisualC-GDK/tests/testgdk/PackageLayout.xml
  15. 105 1
      VisualC-GDK/tests/testgdk/src/testgdk.cpp
  16. 235 1
      VisualC-GDK/tests/testgdk/testgdk.vcxproj
  17. 25 2
      VisualC-GDK/tests/testgdk/testgdk.vcxproj.filters
  18. 0 0
      VisualC-GDK/tests/testgdk/wingdk/MicrosoftGame.config
  19. 29 0
      VisualC-GDK/tests/testgdk/xboxone/MicrosoftGame.config
  20. 29 0
      VisualC-GDK/tests/testgdk/xboxseries/MicrosoftGame.config
  21. 229 1
      VisualC-GDK/tests/testsprite2/testsprite2.vcxproj
  22. 24 2
      VisualC-GDK/tests/testsprite2/testsprite2.vcxproj.filters
  23. 0 0
      VisualC-GDK/tests/testsprite2/wingdk/MicrosoftGame.config
  24. 29 0
      VisualC-GDK/tests/testsprite2/xboxone/MicrosoftGame.config
  25. 29 0
      VisualC-GDK/tests/testsprite2/xboxseries/MicrosoftGame.config
  26. 2 2
      docs/README-gdk.md
  27. 2 0
      include/SDL_config.h
  28. 267 0
      include/SDL_config_xbox.h
  29. 7 1
      include/SDL_platform.h
  30. 4 0
      src/SDL.c
  31. 9 6
      src/core/windows/SDL_windows.c
  32. 14 0
      src/core/windows/SDL_windows.h
  33. 11 2
      src/core/windows/SDL_xinput.c
  34. 16 0
      src/core/windows/SDL_xinput.h
  35. 1 1
      src/dynapi/SDL_dynapi.c
  36. 1 1
      src/events/SDL_mouse.c
  37. 6 0
      src/file/SDL_rwops.c
  38. 19 0
      src/filesystem/windows/SDL_sysfilesystem.c
  39. 9 0
      src/haptic/SDL_syshaptic.h
  40. 9 0
      src/haptic/windows/SDL_dinputhaptic_c.h
  41. 9 0
      src/haptic/windows/SDL_windowshaptic.c
  42. 10 0
      src/haptic/windows/SDL_windowshaptic_c.h
  43. 11 1
      src/haptic/windows/SDL_xinputhaptic.c
  44. 9 0
      src/haptic/windows/SDL_xinputhaptic_c.h
  45. 10 0
      src/joystick/SDL_joystick_c.h
  46. 10 0
      src/joystick/SDL_sysjoystick.h
  47. 10 0
      src/joystick/windows/SDL_dinputjoystick_c.h
  48. 46 6
      src/joystick/windows/SDL_windowsjoystick.c
  49. 10 0
      src/joystick/windows/SDL_windowsjoystick_c.h
  50. 19 2
      src/joystick/windows/SDL_xinputjoystick.c
  51. 10 0
      src/joystick/windows/SDL_xinputjoystick_c.h
  52. 9 0
      src/misc/windows/SDL_sysurl.c
  53. 73 11
      src/render/direct3d12/SDL_render_d3d12.c
  54. 27 0
      src/render/direct3d12/SDL_render_d3d12_xbox.cpp
  55. 22 0
      src/render/direct3d12/SDL_render_d3d12_xbox.h
  56. 2 8
      src/render/direct3d12/SDL_shaders_d3d12.c
  57. 29 0
      src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp
  58. 29 0
      src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp
  59. 2 0
      src/stdlib/SDL_malloc.c
  60. 1 1
      src/test/SDL_test_common.c
  61. 10 0
      src/thread/SDL_systhread.h
  62. 1 1
      src/timer/windows/SDL_systimer.c
  63. 1 1
      src/video/SDL_video.c
  64. 1 1
      src/video/windows/SDL_windowsclipboard.c
  65. 32 2
      src/video/windows/SDL_windowsevents.c
  66. 1 1
      src/video/windows/SDL_windowsframebuffer.c
  67. 1 1
      src/video/windows/SDL_windowskeyboard.c
  68. 1 1
      src/video/windows/SDL_windowsmessagebox.c
  69. 1 1
      src/video/windows/SDL_windowsmodes.c
  70. 1 1
      src/video/windows/SDL_windowsmouse.c
  71. 1 1
      src/video/windows/SDL_windowsopengl.c
  72. 1 1
      src/video/windows/SDL_windowsopengles.c
  73. 1 1
      src/video/windows/SDL_windowsshape.c
  74. 57 0
      src/video/windows/SDL_windowsvideo.c
  75. 11 1
      src/video/windows/SDL_windowsvideo.h
  76. 71 2
      src/video/windows/SDL_windowswindow.c
  77. 2 0
      src/video/windows/SDL_windowswindow.h

+ 1 - 0
.gitignore

@@ -96,6 +96,7 @@ VisualC/visualtest/testsprite2.exe
 VisualC/visualtest/testsprite2_sample.actions
 VisualC/visualtest/testsprite2_sample.actions
 VisualC/visualtest/testsprite2_sample.config
 VisualC/visualtest/testsprite2_sample.config
 VisualC/visualtest/testsprite2_sample.parameters
 VisualC/visualtest/testsprite2_sample.parameters
+VisualC-GDK/**/Layout
 
 
 # for Android
 # for Android
 android-project/local.properties
 android-project/local.properties

+ 64 - 0
VisualC-GDK/SDL.sln

@@ -19,39 +19,103 @@ EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Gaming.Desktop.x64 = Debug|Gaming.Desktop.x64
 		Debug|Gaming.Desktop.x64 = Debug|Gaming.Desktop.x64
+		Debug|Gaming.Xbox.Scarlett.x64 = Debug|Gaming.Xbox.Scarlett.x64
+		Debug|Gaming.Xbox.XboxOne.x64 = Debug|Gaming.Xbox.XboxOne.x64
 		Release|Gaming.Desktop.x64 = Release|Gaming.Desktop.x64
 		Release|Gaming.Desktop.x64 = Release|Gaming.Desktop.x64
+		Release|Gaming.Xbox.Scarlett.x64 = Release|Gaming.Xbox.Scarlett.x64
+		Release|Gaming.Xbox.XboxOne.x64 = Release|Gaming.Xbox.XboxOne.x64
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64
+		{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64
+		{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.Scarlett.x64.Deploy.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.XboxOne.x64.Deploy.0 = Debug|Gaming.Xbox.XboxOne.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64
 		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.Scarlett.x64.Deploy.0 = Release|Gaming.Xbox.Scarlett.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64
+		{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.XboxOne.x64.Deploy.0 = Release|Gaming.Xbox.XboxOne.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64
+		{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.Scarlett.x64.Deploy.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.XboxOne.x64.Deploy.0 = Debug|Gaming.Xbox.XboxOne.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64
 		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.Scarlett.x64.Deploy.0 = Release|Gaming.Xbox.Scarlett.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64
+		{55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.XboxOne.x64.Deploy.0 = Release|Gaming.Xbox.XboxOne.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.Scarlett.x64.Deploy.0 = Debug|Gaming.Xbox.Scarlett.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.XboxOne.x64.Deploy.0 = Debug|Gaming.Xbox.XboxOne.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64
 		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.Scarlett.x64.Deploy.0 = Release|Gaming.Xbox.Scarlett.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64
+		{1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.XboxOne.x64.Deploy.0 = Release|Gaming.Xbox.XboxOne.x64
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE

+ 242 - 6
VisualC-GDK/SDL/SDL.vcxproj

@@ -5,10 +5,26 @@
       <Configuration>Debug</Configuration>
       <Configuration>Debug</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
       <Configuration>Release</Configuration>
       <Configuration>Release</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   </ItemGroup>
   <PropertyGroup Label="Globals">
   <PropertyGroup Label="Globals">
     <ProjectName>SDL2</ProjectName>
     <ProjectName>SDL2</ProjectName>
@@ -21,10 +37,26 @@
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   </ImportGroup>
@@ -32,23 +64,59 @@
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" Label="PropertySheets">
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
   <PropertyGroup>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
@@ -78,6 +146,62 @@
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/SDL.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>DLL_EXPORT;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_xs.lib;uuid.lib;vcruntimed.lib;msvcrtd.lib;ucrtd.lib;msvcprtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/SDL.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>DLL_EXPORT;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_x.lib;uuid.lib;vcruntimed.lib;msvcrtd.lib;ucrtd.lib;msvcprtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -107,6 +231,64 @@
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/SDL.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_xs.lib;uuid.lib;vcruntime.lib;msvcrt.lib;ucrt.lib;msvcprt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/SDL.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_x.lib;uuid.lib;vcruntime.lib;msvcrt.lib;ucrt.lib;msvcprt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\begin_code.h" />
     <ClInclude Include="..\..\include\begin_code.h" />
     <ClInclude Include="..\..\include\close_code.h" />
     <ClInclude Include="..\..\include\close_code.h" />
@@ -242,6 +424,7 @@
     <ClInclude Include="..\..\src\misc\SDL_sysurl.h" />
     <ClInclude Include="..\..\src\misc\SDL_sysurl.h" />
     <ClInclude Include="..\..\src\power\SDL_syspower.h" />
     <ClInclude Include="..\..\src\power\SDL_syspower.h" />
     <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
     <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
+    <ClInclude Include="..\..\src\render\direct3d12\SDL_render_d3d12_xbox.h" />
     <ClInclude Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.h" />
     <ClInclude Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.h" />
     <ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
     <ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
     <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
     <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
@@ -264,6 +447,9 @@
     <ClInclude Include="..\..\src\SDL_dataqueue.h" />
     <ClInclude Include="..\..\src\SDL_dataqueue.h" />
     <ClInclude Include="..\..\src\SDL_error_c.h" />
     <ClInclude Include="..\..\src\SDL_error_c.h" />
     <ClCompile Include="..\..\src\core\gdk\SDL_gdk.cpp" />
     <ClCompile Include="..\..\src\core\gdk\SDL_gdk.cpp" />
+    <ClCompile Include="..\..\src\render\direct3d12\SDL_render_d3d12_xbox.cpp" />
+    <ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12_xboxone.cpp" />
+    <ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12_xboxseries.cpp" />
     <ClCompile Include="..\..\src\SDL_guid.c" />
     <ClCompile Include="..\..\src\SDL_guid.c" />
     <ClInclude Include="..\..\src\SDL_hints_c.h" />
     <ClInclude Include="..\..\src\SDL_hints_c.h" />
     <ClInclude Include="..\..\src\SDL_internal.h" />
     <ClInclude Include="..\..\src\SDL_internal.h" />
@@ -353,7 +539,16 @@
     <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi_win32.c" />
     <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi_win32.c" />
     <ClCompile Include="..\..\src\core\windows\SDL_hid.c" />
     <ClCompile Include="..\..\src\core\windows\SDL_hid.c" />
     <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
     <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
-    <ClCompile Include="..\..\src\core\windows\SDL_xinput.c" />
+    <ClCompile Include="..\..\src\core\windows\SDL_xinput.c">
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+    </ClCompile>
     <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
     <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
     <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
     <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
     <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
     <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
@@ -371,8 +566,26 @@
     <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
     <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
     <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
     <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
     <ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
     <ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
-    <ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
-    <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
+    <ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c">
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+    </ClCompile>
+    <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c">
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+    </ClCompile>
     <ClCompile Include="..\..\src\hidapi\SDL_hidapi.c" />
     <ClCompile Include="..\..\src\hidapi\SDL_hidapi.c" />
     <ClCompile Include="..\..\src\joystick\controller_type.c" />
     <ClCompile Include="..\..\src\joystick\controller_type.c" />
     <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
     <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
@@ -392,9 +605,27 @@
     <ClCompile Include="..\..\src\joystick\virtual\SDL_virtualjoystick.c" />
     <ClCompile Include="..\..\src\joystick\virtual\SDL_virtualjoystick.c" />
     <ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
     <ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
     <ClCompile Include="..\..\src\joystick\windows\SDL_rawinputjoystick.c" />
     <ClCompile Include="..\..\src\joystick\windows\SDL_rawinputjoystick.c" />
-    <ClCompile Include="..\..\src\joystick\windows\SDL_windowsjoystick.c" />
+    <ClCompile Include="..\..\src\joystick\windows\SDL_windowsjoystick.c">
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+    </ClCompile>
     <ClCompile Include="..\..\src\joystick\windows\SDL_windows_gaming_input.c" />
     <ClCompile Include="..\..\src\joystick\windows\SDL_windows_gaming_input.c" />
-    <ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c" />
+    <ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c">
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">stdcpp17</LanguageStandard>
+      <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">stdcpp17</LanguageStandard>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+    </ClCompile>
     <ClCompile Include="..\..\src\libm\e_atan2.c" />
     <ClCompile Include="..\..\src\libm\e_atan2.c" />
     <ClCompile Include="..\..\src\libm\e_exp.c" />
     <ClCompile Include="..\..\src\libm\e_exp.c" />
     <ClCompile Include="..\..\src\libm\e_fmod.c" />
     <ClCompile Include="..\..\src\libm\e_fmod.c" />
@@ -423,7 +654,12 @@
     <ClCompile Include="..\..\src\power\SDL_power.c" />
     <ClCompile Include="..\..\src\power\SDL_power.c" />
     <ClCompile Include="..\..\src\power\windows\SDL_syspower.c" />
     <ClCompile Include="..\..\src\power\windows\SDL_syspower.c" />
     <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
     <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
-    <ClCompile Include="..\..\src\render\direct3d12\SDL_render_d3d12.c" />
+    <ClCompile Include="..\..\src\render\direct3d12\SDL_render_d3d12.c">
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
+      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
+    </ClCompile>
     <ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.c" />
     <ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.c" />
     <ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
     <ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
     <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
     <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />

+ 12 - 0
VisualC-GDK/SDL/SDL.vcxproj.filters

@@ -836,6 +836,9 @@
     <ClInclude Include="..\..\src\core\gdk\SDL_gdk.h">
     <ClInclude Include="..\..\src\core\gdk\SDL_gdk.h">
       <Filter>core\gdk</Filter>
       <Filter>core\gdk</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="..\..\src\render\direct3d12\SDL_render_d3d12_xbox.h">
+      <Filter>render\direct3d12</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
     <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
@@ -1348,6 +1351,15 @@
     <ClCompile Include="..\..\src\core\gdk\SDL_gdk.cpp">
     <ClCompile Include="..\..\src\core\gdk\SDL_gdk.cpp">
       <Filter>core\gdk</Filter>
       <Filter>core\gdk</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="..\..\src\render\direct3d12\SDL_render_d3d12_xbox.cpp">
+      <Filter>render\direct3d12</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12_xboxone.cpp">
+      <Filter>render\direct3d12</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12_xboxseries.cpp">
+      <Filter>render\direct3d12</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\src\main\windows\version.rc" />
     <ResourceCompile Include="..\..\src\main\windows\version.rc" />

+ 124 - 0
VisualC-GDK/SDLmain/SDLmain.vcxproj

@@ -5,10 +5,26 @@
       <Configuration>Debug</Configuration>
       <Configuration>Debug</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
       <Configuration>Release</Configuration>
       <Configuration>Release</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\main\gdk\SDL_gdk_main.c" />
     <ClCompile Include="..\..\src\main\gdk\SDL_gdk_main.c" />
@@ -24,10 +40,26 @@
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   </ImportGroup>
@@ -35,23 +67,59 @@
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
   <PropertyGroup>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
     <Midl />
     <Midl />
@@ -67,6 +135,34 @@
       <OmitDefaultLibName>true</OmitDefaultLibName>
       <OmitDefaultLibName>true</OmitDefaultLibName>
     </ClCompile>
     </ClCompile>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
+    <Midl />
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
+    <Midl />
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
     <Midl />
     <Midl />
     <ClCompile>
     <ClCompile>
@@ -81,6 +177,34 @@
       <OmitDefaultLibName>true</OmitDefaultLibName>
       <OmitDefaultLibName>true</OmitDefaultLibName>
     </ClCompile>
     </ClCompile>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
+    <Midl />
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
+    <Midl />
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
   </ImportGroup>

+ 124 - 0
VisualC-GDK/SDLtest/SDLtest.vcxproj

@@ -5,10 +5,26 @@
       <Configuration>Debug</Configuration>
       <Configuration>Debug</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
       <Configuration>Release</Configuration>
       <Configuration>Release</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   </ItemGroup>
   <PropertyGroup Label="Globals">
   <PropertyGroup Label="Globals">
     <ProjectName>SDL2test</ProjectName>
     <ProjectName>SDL2test</ProjectName>
@@ -21,10 +37,26 @@
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   </ImportGroup>
@@ -32,23 +64,59 @@
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
   <PropertyGroup>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
     <Midl />
     <Midl />
@@ -64,6 +132,34 @@
       <OmitDefaultLibName>true</OmitDefaultLibName>
       <OmitDefaultLibName>true</OmitDefaultLibName>
     </ClCompile>
     </ClCompile>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
+    <Midl />
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
+    <Midl />
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
     <Midl />
     <Midl />
     <ClCompile>
     <ClCompile>
@@ -78,6 +174,34 @@
       <OmitDefaultLibName>true</OmitDefaultLibName>
       <OmitDefaultLibName>true</OmitDefaultLibName>
     </ClCompile>
     </ClCompile>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
+    <Midl />
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
+    <Midl />
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+  </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\test\SDL_test_assert.c" />
     <ClCompile Include="..\..\src\test\SDL_test_assert.c" />
     <ClCompile Include="..\..\src\test\SDL_test_common.c" />
     <ClCompile Include="..\..\src\test\SDL_test_common.c" />

+ 2 - 0
VisualC-GDK/clean.sh

@@ -2,3 +2,5 @@
 find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete
 find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete
 find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -delete
 find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -delete
 find . -depth -type d \( -name Gaming.Desktop.x64 \) -exec rm -rv {} \;
 find . -depth -type d \( -name Gaming.Desktop.x64 \) -exec rm -rv {} \;
+find . -depth -type d \( -name Gaming.Xbox.Scarlett.x64 \) -exec rm -rv {} \;
+find . -depth -type d \( -name Gaming.Xbox.XboxOne.x64 \) -exec rm -rv {} \;

二进制
VisualC-GDK/logos/SplashScreenImage.png


+ 262 - 1
VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj

@@ -5,10 +5,26 @@
       <Configuration>Debug</Configuration>
       <Configuration>Debug</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
       <Configuration>Release</Configuration>
       <Configuration>Release</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   </ItemGroup>
   <PropertyGroup Label="Globals">
   <PropertyGroup Label="Globals">
     <ProjectGuid>{55812185-D13C-4022-9C81-32E0F4A08305}</ProjectGuid>
     <ProjectGuid>{55812185-D13C-4022-9C81-32E0F4A08305}</ProjectGuid>
@@ -20,10 +36,28 @@
     <ConfigurationType>Application</ConfigurationType>
     <ConfigurationType>Application</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <ConfigurationType>Application</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   </ImportGroup>
@@ -31,23 +65,59 @@
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
   <PropertyGroup>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
@@ -72,6 +142,52 @@
       <AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/testgamecontroller.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/testgamecontroller.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -98,6 +214,58 @@
       <AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/testgamecontroller.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/testgamecontroller.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\SDL\SDL.vcxproj">
     <ProjectReference Include="..\..\SDL\SDL.vcxproj">
       <Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
       <Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
@@ -115,43 +283,107 @@
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="..\..\..\test\axis.bmp">
     <CopyFileToFolders Include="..\..\..\test\axis.bmp">
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
     </CopyFileToFolders>
     </CopyFileToFolders>
     <CopyFileToFolders Include="..\..\..\test\button.bmp">
     <CopyFileToFolders Include="..\..\..\test\button.bmp">
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
     </CopyFileToFolders>
     </CopyFileToFolders>
     <CopyFileToFolders Include="..\..\..\test\controllermap.bmp">
     <CopyFileToFolders Include="..\..\..\test\controllermap.bmp">
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
     </CopyFileToFolders>
     </CopyFileToFolders>
     <CopyFileToFolders Include="..\..\..\test\controllermap_back.bmp">
     <CopyFileToFolders Include="..\..\..\test\controllermap_back.bmp">
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 </Command>
 </Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -159,8 +391,12 @@
     <ClCompile Include="..\..\..\test\testutils.c" />
     <ClCompile Include="..\..\..\test\testutils.c" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <CopyFileToFolders Include="MicrosoftGame.config">
+    <CopyFileToFolders Include="wingdk\MicrosoftGame.config">
       <FileType>Document</FileType>
       <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -175,8 +411,33 @@
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
     <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
       <FileType>Document</FileType>
       <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+    </CopyFileToFolders>
+  </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
+      <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="xboxone\MicrosoftGame.config">
+      <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+    </CopyFileToFolders>
+  </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="..\..\logos\SplashScreenImage.png" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
   </ImportGroup>

+ 24 - 2
VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj.filters

@@ -21,13 +21,35 @@
     <CopyFileToFolders Include="..\..\logos\Logo480x480.png">
     <CopyFileToFolders Include="..\..\logos\Logo480x480.png">
       <Filter>logos</Filter>
       <Filter>logos</Filter>
     </CopyFileToFolders>
     </CopyFileToFolders>
-    <CopyFileToFolders Include="MicrosoftGame.config" />
+    <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
+      <Filter>wingdk</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="wingdk\MicrosoftGame.config">
+      <Filter>wingdk</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
+      <Filter>xboxseries</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="xboxone\MicrosoftGame.config">
+      <Filter>xboxone</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="..\..\logos\SplashScreenImage.png">
+      <Filter>logos</Filter>
+    </CopyFileToFolders>
     <CopyFileToFolders Include="PackageLayout.xml" />
     <CopyFileToFolders Include="PackageLayout.xml" />
-    <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Filter Include="logos">
     <Filter Include="logos">
       <UniqueIdentifier>{5e858cf0-6fba-498d-b33d-11c8ecbb79c7}</UniqueIdentifier>
       <UniqueIdentifier>{5e858cf0-6fba-498d-b33d-11c8ecbb79c7}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="xboxseries">
+      <UniqueIdentifier>{5790a250-283e-4f51-8f28-6a977d3c7a6c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="wingdk">
+      <UniqueIdentifier>{a4d235e4-4017-4193-af62-ecb2ac249be4}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="xboxone">
+      <UniqueIdentifier>{e704dcb9-c83c-4c94-a139-b0f3e3f428f2}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 0 - 0
VisualC-GDK/tests/testgamecontroller/MicrosoftGame.config → VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config


+ 35 - 0
VisualC-GDK/tests/testgamecontroller/xboxone/MicrosoftGame.config

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Game configVersion="1">
+
+	<!-- Set these to the correct identifiers from Partner Center -->
+	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+		Version="1.0.0.0"
+		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+
+	<ExecutableList>
+		<Executable Name="testgamecontroller.exe"
+					TargetDeviceFamily="XboxOne"
+					Id="Game" />
+	</ExecutableList>
+
+	<DesktopRegistration>
+		<DependencyList>
+			<KnownDependency Name="VC14"/>
+		</DependencyList>
+	</DesktopRegistration>
+
+	<!-- Set these to the correct values from Partner Center -->
+	<TitleId>7325F784</TitleId>
+	<MSAAppId>0000000000000000</MSAAppId>
+
+	<ShellVisuals DefaultDisplayName="testgamecontroller"
+					PublisherDisplayName="SDL"
+					Square480x480Logo="Logo480x480.png"
+					Square150x150Logo="Logo150x150.png"
+					Square44x44Logo="Logo44x44.png"
+					SplashScreenImage="SplashScreenImage.png"
+					Description="testgamecontroller"
+					ForegroundText="light"
+					BackgroundColor="#000000"
+					StoreLogo="Logo100x100.png"/>
+</Game>

+ 29 - 0
VisualC-GDK/tests/testgamecontroller/xboxseries/MicrosoftGame.config

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Game configVersion="1">
+
+	<!-- Set these to the correct identifiers from Partner Center -->
+	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+		Version="1.0.0.0"
+		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+
+	<ExecutableList>
+		<Executable Name="testgamecontroller.exe"
+					TargetDeviceFamily="Scarlett"
+					Id="Game" />
+	</ExecutableList>
+
+	<!-- Set these to the correct values from Partner Center -->
+	<TitleId>7325F784</TitleId>
+	<MSAAppId>0000000000000000</MSAAppId>
+
+	<ShellVisuals DefaultDisplayName="testgamecontroller"
+					PublisherDisplayName="SDL"
+					Square480x480Logo="Logo480x480.png"
+					Square150x150Logo="Logo150x150.png"
+					Square44x44Logo="Logo44x44.png"
+					SplashScreenImage="SplashScreenImage.png"
+					Description="testgamecontroller"
+					ForegroundText="light"
+					BackgroundColor="#000000"
+					StoreLogo="Logo100x100.png"/>
+</Game>

+ 1 - 0
VisualC-GDK/tests/testgdk/PackageLayout.xml

@@ -3,6 +3,7 @@
     <FileGroup DestinationPath="." SourcePath="." Include="testgdk.exe" />
     <FileGroup DestinationPath="." SourcePath="." Include="testgdk.exe" />
     <FileGroup DestinationPath="." SourcePath="." Include="MicrosoftGame.config" />
     <FileGroup DestinationPath="." SourcePath="." Include="MicrosoftGame.config" />
     <FileGroup DestinationPath="." SourcePath="." Include="*.bmp" />
     <FileGroup DestinationPath="." SourcePath="." Include="*.bmp" />
+    <FileGroup DestinationPath="." SourcePath="." Include="*.wav" />
     <FileGroup DestinationPath="." SourcePath="." Include="*.png" />
     <FileGroup DestinationPath="." SourcePath="." Include="*.png" />
     <FileGroup DestinationPath="." SourcePath="." Include="*.dll" />
     <FileGroup DestinationPath="." SourcePath="." Include="*.dll" />
   </Chunk>
   </Chunk>

+ 105 - 1
VisualC-GDK/tests/testgdk/src/testgdk.cpp

@@ -44,11 +44,32 @@ static SDL_BlendMode blendMode = SDL_BLENDMODE_BLEND;
 
 
 int done;
 int done;
 
 
+static struct
+{
+    SDL_AudioSpec spec;
+    Uint8 *sound;    /* Pointer to wave data */
+    Uint32 soundlen; /* Length of wave data */
+    int soundpos;    /* Current play position */
+} wave;
+
+static SDL_AudioDeviceID device;
+
+static void
+close_audio()
+{
+    if (device != 0) {
+        SDL_CloseAudioDevice(device);
+        device = 0;
+    }
+}
+
 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
 static void
 static void
 quit(int rc)
 quit(int rc)
 {
 {
     SDL_free(sprites);
     SDL_free(sprites);
+    close_audio();
+    SDL_FreeWAV(wave.sound);
     SDLTest_CommonQuit(state);
     SDLTest_CommonQuit(state);
     /* If rc is 0, just let main return normally rather than calling exit.
     /* If rc is 0, just let main return normally rather than calling exit.
      * This allows testing of platforms where SDL_main is required and does meaningful cleanup.
      * This allows testing of platforms where SDL_main is required and does meaningful cleanup.
@@ -58,6 +79,51 @@ quit(int rc)
     }
     }
 }
 }
 
 
+static void
+open_audio()
+{
+    /* Initialize fillerup() variables */
+    device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0);
+    if (!device) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
+        SDL_FreeWAV(wave.sound);
+        quit(2);
+    }
+
+    /* Let the audio run */
+    SDL_PauseAudioDevice(device, SDL_FALSE);
+}
+
+static void
+reopen_audio()
+{
+    close_audio();
+    open_audio();
+}
+
+void SDLCALL
+fillerup(void *unused, Uint8 *stream, int len)
+{
+    Uint8 *waveptr;
+    int waveleft;
+
+    /* Set up the pointers */
+    waveptr = wave.sound + wave.soundpos;
+    waveleft = wave.soundlen - wave.soundpos;
+
+    /* Go! */
+    while (waveleft <= len) {
+        SDL_memcpy(stream, waveptr, waveleft);
+        stream += waveleft;
+        len -= waveleft;
+        waveptr = wave.sound;
+        waveleft = wave.soundlen;
+        wave.soundpos = 0;
+    }
+    SDL_memcpy(stream, waveptr, len);
+    wave.soundpos += len;
+}
+
 void
 void
 UserLoggedIn(XUserHandle user)
 UserLoggedIn(XUserHandle user)
 {
 {
@@ -285,7 +351,17 @@ loop()
 
 
     /* Check for events */
     /* Check for events */
     while (SDL_PollEvent(&event)) {
     while (SDL_PollEvent(&event)) {
+        if (event.type == SDL_KEYDOWN && !event.key.repeat) {
+            SDL_Log("Initial SDL_KEYDOWN: %s", SDL_GetScancodeName(event.key.keysym.scancode));
+        }
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+        /* On Xbox, ignore the keydown event because the features aren't supported */
+        if (event.type != SDL_KEYDOWN) {
+            SDLTest_CommonEvent(state, &event, &done);
+        }
+#else
         SDLTest_CommonEvent(state, &event, &done);
         SDLTest_CommonEvent(state, &event, &done);
+#endif
     }
     }
     for (i = 0; i < state->num_windows; ++i) {
     for (i = 0; i < state->num_windows; ++i) {
         if (state->windows[i] == NULL)
         if (state->windows[i] == NULL)
@@ -299,12 +375,13 @@ main(int argc, char *argv[])
 {
 {
     int i;
     int i;
     const char *icon = "icon.bmp";
     const char *icon = "icon.bmp";
+    char *soundname = NULL;
 
 
     /* Initialize parameters */
     /* Initialize parameters */
     num_sprites = NUM_SPRITES;
     num_sprites = NUM_SPRITES;
 
 
     /* Initialize test framework */
     /* Initialize test framework */
-    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
     if (!state) {
     if (!state) {
         return 1;
         return 1;
     }
     }
@@ -381,6 +458,31 @@ main(int argc, char *argv[])
         quit(2);
         quit(2);
     }
     }
 
 
+    soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
+
+    if (soundname == NULL) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
+        quit(1);
+    }
+
+    /* Load the wave file into memory */
+    if (SDL_LoadWAV(soundname, &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", soundname, SDL_GetError());
+        quit(1);
+    }
+
+    wave.spec.callback = fillerup;
+
+    /* Show the list of available drivers */
+    SDL_Log("Available audio drivers:");
+    for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
+        SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
+    }
+
+    SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
+
+    open_audio();
+
     /* Main render loop */
     /* Main render loop */
     done = 0;
     done = 0;
 
 
@@ -392,6 +494,8 @@ main(int argc, char *argv[])
     }
     }
 
 
     quit(0);
     quit(0);
+
+    SDL_free(soundname);
     return 0;
     return 0;
 }
 }
 
 

+ 235 - 1
VisualC-GDK/tests/testgdk/testgdk.vcxproj

@@ -5,10 +5,26 @@
       <Configuration>Debug</Configuration>
       <Configuration>Debug</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
       <Configuration>Release</Configuration>
       <Configuration>Release</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   </ItemGroup>
   <PropertyGroup Label="Globals">
   <PropertyGroup Label="Globals">
     <ProjectGuid>{1C9A3F71-35A5-4C56-B292-F4375B3C3649}</ProjectGuid>
     <ProjectGuid>{1C9A3F71-35A5-4C56-B292-F4375B3C3649}</ProjectGuid>
@@ -20,10 +36,28 @@
     <ConfigurationType>Application</ConfigurationType>
     <ConfigurationType>Application</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <ConfigurationType>Application</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   </ImportGroup>
@@ -31,23 +65,59 @@
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
   <PropertyGroup>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
@@ -76,6 +146,60 @@
       </Command>
       </Command>
     </PostBuildEvent>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -106,6 +230,66 @@
       </Command>
       </Command>
     </PostBuildEvent>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\SDL\SDL.vcxproj">
     <ProjectReference Include="..\..\SDL\SDL.vcxproj">
       <Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
       <Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
@@ -129,13 +313,29 @@
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="..\..\..\test\icon.bmp">
     <CopyFileToFolders Include="..\..\..\test\icon.bmp">
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 copy "%(FullPath)" "$(OutDir)\"</Command>
 copy "%(FullPath)" "$(OutDir)\"</Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 copy "%(FullPath)" "$(OutDir)\"</Command>
 copy "%(FullPath)" "$(OutDir)\"</Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -143,13 +343,21 @@ copy "%(FullPath)" "$(OutDir)\"</Command>
     <ClCompile Include="src\testgdk.cpp" />
     <ClCompile Include="src\testgdk.cpp" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <CopyFileToFolders Include="MicrosoftGame.config">
+    <CopyFileToFolders Include="wingdk\MicrosoftGame.config">
       <FileType>Document</FileType>
       <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
     <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
       <FileType>Document</FileType>
       <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -161,6 +369,32 @@ copy "%(FullPath)" "$(OutDir)\"</Command>
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="PackageLayout.xml" />
     <CopyFileToFolders Include="PackageLayout.xml" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
+      <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+    </CopyFileToFolders>
+  </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="..\..\..\test\sample.wav">
+      <FileType>Document</FileType>
+    </CopyFileToFolders>
+  </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="xboxone\MicrosoftGame.config">
+      <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+    </CopyFileToFolders>
+  </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="..\..\logos\SplashScreenImage.png" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
   </ImportGroup>

+ 25 - 2
VisualC-GDK/tests/testgdk/testgdk.vcxproj.filters

@@ -6,7 +6,6 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="..\..\..\test\icon.bmp" />
     <CopyFileToFolders Include="..\..\..\test\icon.bmp" />
-    <CopyFileToFolders Include="MicrosoftGame.config" />
     <CopyFileToFolders Include="..\..\logos\Logo44x44.png">
     <CopyFileToFolders Include="..\..\logos\Logo44x44.png">
       <Filter>logos</Filter>
       <Filter>logos</Filter>
     </CopyFileToFolders>
     </CopyFileToFolders>
@@ -19,12 +18,36 @@
     <CopyFileToFolders Include="..\..\logos\Logo480x480.png">
     <CopyFileToFolders Include="..\..\logos\Logo480x480.png">
       <Filter>logos</Filter>
       <Filter>logos</Filter>
     </CopyFileToFolders>
     </CopyFileToFolders>
-    <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll" />
+    <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
+      <Filter>wingdk</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="wingdk\MicrosoftGame.config">
+      <Filter>wingdk</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
+      <Filter>xboxseries</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="..\..\..\test\sample.wav" />
+    <CopyFileToFolders Include="xboxone\MicrosoftGame.config">
+      <Filter>xboxone</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="..\..\logos\SplashScreenImage.png">
+      <Filter>logos</Filter>
+    </CopyFileToFolders>
     <CopyFileToFolders Include="PackageLayout.xml" />
     <CopyFileToFolders Include="PackageLayout.xml" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Filter Include="logos">
     <Filter Include="logos">
       <UniqueIdentifier>{c3c871f2-c7b7-4025-8ba4-037dde717fe1}</UniqueIdentifier>
       <UniqueIdentifier>{c3c871f2-c7b7-4025-8ba4-037dde717fe1}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="wingdk">
+      <UniqueIdentifier>{1678a80d-0ee8-4f48-bf89-9462d82dd98a}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="xboxseries">
+      <UniqueIdentifier>{1b47b96b-507e-40ec-9c25-99b1a4d5b575}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="xboxone">
+      <UniqueIdentifier>{ac7aa2d5-f0f7-46eb-a548-5b6316f3b63b}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 0 - 0
VisualC-GDK/tests/testgdk/MicrosoftGame.config → VisualC-GDK/tests/testgdk/wingdk/MicrosoftGame.config


+ 29 - 0
VisualC-GDK/tests/testgdk/xboxone/MicrosoftGame.config

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Game configVersion="1">
+
+	<!-- Set these to the correct identifiers from Partner Center -->
+	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+		Version="1.0.0.0"
+		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+
+	<ExecutableList>
+		<Executable Name="testgdk.exe"
+					TargetDeviceFamily="XboxOne"
+					Id="Game" />
+	</ExecutableList>
+
+	<!-- Set these to the correct values from Partner Center -->
+	<TitleId>7325F784</TitleId>
+	<MSAAppId>0000000000000000</MSAAppId>
+
+	<ShellVisuals DefaultDisplayName="testgdk"
+					PublisherDisplayName="SDL"
+					Square480x480Logo="Logo480x480.png"
+					Square150x150Logo="Logo150x150.png"
+					Square44x44Logo="Logo44x44.png"
+					SplashScreenImage="SplashScreenImage.png"
+					Description="testgdk"
+					ForegroundText="light"
+					BackgroundColor="#000000"
+					StoreLogo="Logo100x100.png"/>
+</Game>

+ 29 - 0
VisualC-GDK/tests/testgdk/xboxseries/MicrosoftGame.config

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Game configVersion="1">
+
+	<!-- Set these to the correct identifiers from Partner Center -->
+	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+		Version="1.0.0.0"
+		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+
+	<ExecutableList>
+		<Executable Name="testgdk.exe"
+					TargetDeviceFamily="Scarlett"
+					Id="Game" />
+	</ExecutableList>
+
+	<!-- Set these to the correct values from Partner Center -->
+	<TitleId>7325F784</TitleId>
+	<MSAAppId>0000000000000000</MSAAppId>
+
+	<ShellVisuals DefaultDisplayName="testgdk"
+					PublisherDisplayName="SDL"
+					Square480x480Logo="Logo480x480.png"
+					Square150x150Logo="Logo150x150.png"
+					Square44x44Logo="Logo44x44.png"
+					SplashScreenImage="SplashScreenImage.png"
+					Description="testgdk"
+					ForegroundText="light"
+					BackgroundColor="#000000"
+					StoreLogo="Logo100x100.png"/>
+</Game>

+ 229 - 1
VisualC-GDK/tests/testsprite2/testsprite2.vcxproj

@@ -5,10 +5,26 @@
       <Configuration>Debug</Configuration>
       <Configuration>Debug</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Debug</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
     <ProjectConfiguration Include="Release|Gaming.Desktop.x64">
       <Configuration>Release</Configuration>
       <Configuration>Release</Configuration>
       <Platform>Gaming.Desktop.x64</Platform>
       <Platform>Gaming.Desktop.x64</Platform>
     </ProjectConfiguration>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.Scarlett.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.Scarlett.x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Gaming.Xbox.XboxOne.x64">
+      <Configuration>Release</Configuration>
+      <Platform>Gaming.Xbox.XboxOne.x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   </ItemGroup>
   <PropertyGroup Label="Globals">
   <PropertyGroup Label="Globals">
     <ProjectGuid>{40FB7794-D3C3-4CFE-BCF4-A80C96635682}</ProjectGuid>
     <ProjectGuid>{40FB7794-D3C3-4CFE-BCF4-A80C96635682}</ProjectGuid>
@@ -20,10 +36,28 @@
     <ConfigurationType>Application</ConfigurationType>
     <ConfigurationType>Application</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+    <UseDebugLibraries>true</UseDebugLibraries>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <ConfigurationType>Application</ConfigurationType>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
     <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
   </PropertyGroup>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   </ImportGroup>
@@ -31,23 +65,59 @@
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   </ImportGroup>
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
   <PropertyGroup>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(Platform)\$(Configuration)\</IntDir>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'" />
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
@@ -76,6 +146,60 @@
       </Command>
       </Command>
     </PostBuildEvent>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">
     <Midl>
     <Midl>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -106,6 +230,66 @@
       </Command>
       </Command>
     </PostBuildEvent>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/testsprite2.tlb</TypeLibraryName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>OldStyle</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalDependencies>xgameruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\SDL\SDL.vcxproj">
     <ProjectReference Include="..\..\SDL\SDL.vcxproj">
       <Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
       <Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
@@ -129,13 +313,29 @@
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="..\..\..\test\icon.bmp">
     <CopyFileToFolders Include="..\..\..\test\icon.bmp">
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 copy "%(FullPath)" "$(OutDir)\"</Command>
 copy "%(FullPath)" "$(OutDir)\"</Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
       <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
       <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">copy "%(FullPath)" "$(ProjectDir)\"
+copy "%(FullPath)" "$(OutDir)\"</Command>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">copy "%(FullPath)" "$(ProjectDir)\"
 copy "%(FullPath)" "$(OutDir)\"</Command>
 copy "%(FullPath)" "$(OutDir)\"</Command>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -143,13 +343,21 @@ copy "%(FullPath)" "$(OutDir)\"</Command>
     <ClCompile Include="..\..\..\test\testutils.c" />
     <ClCompile Include="..\..\..\test\testutils.c" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <CopyFileToFolders Include="MicrosoftGame.config">
+    <CopyFileToFolders Include="wingdk/MicrosoftGame.config">
       <FileType>Document</FileType>
       <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
     <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
       <FileType>Document</FileType>
       <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
     </CopyFileToFolders>
     </CopyFileToFolders>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -161,6 +369,26 @@ copy "%(FullPath)" "$(OutDir)\"</Command>
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="PackageLayout.xml" />
     <CopyFileToFolders Include="PackageLayout.xml" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
+      <FileType>Document</FileType>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
+    </CopyFileToFolders>
+  </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="xboxone\MicrosoftGame.config">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
+    </CopyFileToFolders>
+  </ItemGroup>
+  <ItemGroup>
+    <CopyFileToFolders Include="..\..\logos\SplashScreenImage.png" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
   </ImportGroup>

+ 24 - 2
VisualC-GDK/tests/testsprite2/testsprite2.vcxproj.filters

@@ -6,7 +6,6 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <CopyFileToFolders Include="..\..\..\test\icon.bmp" />
     <CopyFileToFolders Include="..\..\..\test\icon.bmp" />
-    <CopyFileToFolders Include="MicrosoftGame.config" />
     <CopyFileToFolders Include="..\..\logos\Logo44x44.png">
     <CopyFileToFolders Include="..\..\logos\Logo44x44.png">
       <Filter>logos</Filter>
       <Filter>logos</Filter>
     </CopyFileToFolders>
     </CopyFileToFolders>
@@ -19,12 +18,35 @@
     <CopyFileToFolders Include="..\..\logos\Logo480x480.png">
     <CopyFileToFolders Include="..\..\logos\Logo480x480.png">
       <Filter>logos</Filter>
       <Filter>logos</Filter>
     </CopyFileToFolders>
     </CopyFileToFolders>
-    <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll" />
+    <CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
+      <Filter>wingdk</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
+      <Filter>xboxseries</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="xboxone\MicrosoftGame.config">
+      <Filter>xboxone</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="wingdk/MicrosoftGame.config">
+      <Filter>wingdk</Filter>
+    </CopyFileToFolders>
+    <CopyFileToFolders Include="..\..\logos\SplashScreenImage.png">
+      <Filter>logos</Filter>
+    </CopyFileToFolders>
     <CopyFileToFolders Include="PackageLayout.xml" />
     <CopyFileToFolders Include="PackageLayout.xml" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Filter Include="logos">
     <Filter Include="logos">
       <UniqueIdentifier>{c3c871f2-c7b7-4025-8ba4-037dde717fe1}</UniqueIdentifier>
       <UniqueIdentifier>{c3c871f2-c7b7-4025-8ba4-037dde717fe1}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="wingdk">
+      <UniqueIdentifier>{c862dfc3-7803-4359-a31e-9dcda37e641a}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="xboxseries">
+      <UniqueIdentifier>{1671e83d-25b3-4eb5-bed0-5c52c80f4e49}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="xboxone">
+      <UniqueIdentifier>{9bf62acf-6661-43f9-bde3-0de9e1db4290}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 0 - 0
VisualC-GDK/tests/testsprite2/MicrosoftGame.config → VisualC-GDK/tests/testsprite2/wingdk/MicrosoftGame.config


+ 29 - 0
VisualC-GDK/tests/testsprite2/xboxone/MicrosoftGame.config

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Game configVersion="1">
+
+	<!-- Set these to the correct identifiers from Partner Center -->
+	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+		Version="1.0.0.0"
+		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+
+	<ExecutableList>
+		<Executable Name="testsprite2.exe"
+					TargetDeviceFamily="XboxOne"
+					Id="Game" />
+	</ExecutableList>
+
+	<!-- Set these to the correct values from Partner Center -->
+	<TitleId>7325F784</TitleId>
+	<MSAAppId>0000000000000000</MSAAppId>
+
+	<ShellVisuals DefaultDisplayName="testsprite2"
+					PublisherDisplayName="SDL"
+					Square480x480Logo="Logo480x480.png"
+					Square150x150Logo="Logo150x150.png"
+					Square44x44Logo="Logo44x44.png"
+					SplashScreenImage="SplashScreenImage.png"
+					Description="testsprite2"
+					ForegroundText="light"
+					BackgroundColor="#000000"
+					StoreLogo="Logo100x100.png"/>
+</Game>

+ 29 - 0
VisualC-GDK/tests/testsprite2/xboxseries/MicrosoftGame.config

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Game configVersion="1">
+
+	<!-- Set these to the correct identifiers from Partner Center -->
+	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+		Version="1.0.0.0"
+		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+
+	<ExecutableList>
+		<Executable Name="testsprite2.exe"
+					TargetDeviceFamily="Scarlett"
+					Id="Game" />
+	</ExecutableList>
+
+	<!-- Set these to the correct values from Partner Center -->
+	<TitleId>7325F784</TitleId>
+	<MSAAppId>0000000000000000</MSAAppId>
+
+	<ShellVisuals DefaultDisplayName="testsprite2"
+					PublisherDisplayName="SDL"
+					Square480x480Logo="Logo480x480.png"
+					Square150x150Logo="Logo150x150.png"
+					Square44x44Logo="Logo44x44.png"
+					Description="testsprite2"
+					SplashScreenImage="SplashScreenImage.png"
+					ForegroundText="light"
+					BackgroundColor="#000000"
+					StoreLogo="Logo100x100.png"/>
+</Game>

+ 2 - 2
docs/README-gdk.md

@@ -3,7 +3,7 @@ GDK
 
 
 This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
 This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
 
 
-At this time, only Windows GDK is supported. Xbox support is slated for the future.
+Windows (GDK) and  Xbox One/Xbox Series (GDKX) are supported. Although most of the Xbox code is included in the public SDL source code, NDA access is required for a small number of source files. If you have access to GDKX, these required Xbox files are posted on the GDK forums [here](https://forums.xboxlive.com/questions/130003/).
 
 
 
 
 Requirements
 Requirements
@@ -56,7 +56,7 @@ In your game's existing Visual Studio Solution, go to Build > Configuration Mana
 
 
 ### 2. Build SDL2 and SDL2main for GDK ###
 ### 2. Build SDL2 and SDL2main for GDK ###
 
 
-Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
+Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
 
 
 *Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built. 
 *Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built. 
 
 

+ 2 - 0
include/SDL_config.h

@@ -35,6 +35,8 @@
 #include "SDL_config_winrt.h"
 #include "SDL_config_winrt.h"
 #elif defined(__WINGDK__)
 #elif defined(__WINGDK__)
 #include "SDL_config_wingdk.h"
 #include "SDL_config_wingdk.h"
+#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
+#include "SDL_config_xbox.h"
 #elif defined(__MACOSX__)
 #elif defined(__MACOSX__)
 #include "SDL_config_macosx.h"
 #include "SDL_config_macosx.h"
 #elif defined(__IPHONEOS__)
 #elif defined(__IPHONEOS__)

+ 267 - 0
include/SDL_config_xbox.h

@@ -0,0 +1,267 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_wingdk_h_
+#define SDL_config_wingdk_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/* Windows GDK does not need Windows SDK version checks because it requires
+ * a recent version of the Windows 10 SDK. */
+
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+/* At this time, only recent MSVC or clang are supported by Windows GDK */
+#if defined(__clang__)
+#define HAVE_STDINT_H   1
+#elif defined(_MSC_VER)
+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
+typedef unsigned __int64 uintptr_t;
+#define _UINTPTR_T_DEFINED
+#endif
+#else /* !__clang__ && !_MSC_VER */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+#ifndef _SIZE_T_DEFINED_
+#define _SIZE_T_DEFINED_
+typedef unsigned int size_t;
+#endif
+typedef unsigned int uintptr_t;
+#endif /* __clang__ || _MSC_VER */
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
+/* GDK only supports 64-bit */
+# define SIZEOF_VOIDP 8
+
+#ifdef __clang__
+# define HAVE_GCC_ATOMICS 1
+#endif
+
+/*#define HAVE_DDRAW_H 1*/
+/*#define HAVE_DINPUT_H 1*/
+/*#define HAVE_DSOUND_H 1*/
+/* No SDK version checks needed for these because the SDK has to be new. */
+/* #define HAVE_DXGI_H 1 */
+#define HAVE_XINPUT_H 1
+/*#define HAVE_WINDOWS_GAMING_INPUT_H 1*/
+/*#define HAVE_D3D11_H 1*/
+/*#define HAVE_ROAPI_H 1*/
+#define HAVE_D3D12_H 1
+/*#define HAVE_SHELLSCALINGAPI_H 1*/
+#define HAVE_MMDEVICEAPI_H 1
+#define HAVE_AUDIOCLIENT_H 1
+/*#define HAVE_TPCSHRD_H  1*/
+/*#define HAVE_SENSORSAPI_H 1*/
+#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
+#define HAVE_IMMINTRIN_H 1
+#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
+# if __has_include(<immintrin.h>)
+#   define HAVE_IMMINTRIN_H 1
+# endif
+#endif
+
+/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
+#ifdef HAVE_LIBC
+/* Useful headers */
+#define STDC_HEADERS 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_QSORT 1
+#define HAVE_BSEARCH 1
+#define HAVE_ABS 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE__STRREV 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+/* #undef HAVE_STRTOK_R */
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE__STRICMP 1
+#define HAVE__STRNICMP 1
+#define HAVE__WCSICMP 1
+#define HAVE__WCSNICMP 1
+#define HAVE__WCSDUP 1
+#define HAVE_ACOS   1
+#define HAVE_ASIN   1
+#define HAVE_ATAN   1
+#define HAVE_ATAN2  1
+#define HAVE_CEIL   1
+#define HAVE_COS    1
+#define HAVE_EXP    1
+#define HAVE_FABS   1
+#define HAVE_FLOOR  1
+#define HAVE_FMOD   1
+#define HAVE_LOG    1
+#define HAVE_LOG10  1
+#define HAVE_POW    1
+#define HAVE_SIN    1
+#define HAVE_SQRT   1
+#define HAVE_TAN    1
+#define HAVE_ACOSF  1
+#define HAVE_ASINF  1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2F 1
+#define HAVE_CEILF  1
+#define HAVE__COPYSIGN 1
+#define HAVE_COSF   1
+#define HAVE_EXPF   1
+#define HAVE_FABSF  1
+#define HAVE_FLOORF 1
+#define HAVE_FMODF  1
+#define HAVE_LOGF   1
+#define HAVE_LOG10F 1
+#define HAVE_POWF   1
+#define HAVE_SINF   1
+#define HAVE_SQRTF  1
+#define HAVE_TANF   1
+#if defined(_MSC_VER)
+/* These functions were added with the VC++ 2013 C runtime library */
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_VSSCANF 1
+#define HAVE_LROUND 1
+#define HAVE_LROUNDF 1
+#define HAVE_ROUND 1
+#define HAVE_ROUNDF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_TRUNC  1
+#define HAVE_TRUNCF 1
+#define HAVE__FSEEKI64 1
+#ifdef _USE_MATH_DEFINES
+#define HAVE_M_PI 1
+#endif
+#else
+#define HAVE_M_PI 1
+#endif
+#else
+#define HAVE_STDARG_H   1
+#define HAVE_STDDEF_H   1
+#endif
+
+/* Enable various audio drivers */
+#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
+#define SDL_AUDIO_DRIVER_WASAPI 1
+#endif
+/*#define SDL_AUDIO_DRIVER_DSOUND 1*/
+/*#define SDL_AUDIO_DRIVER_WINMM  1*/
+#define SDL_AUDIO_DRIVER_DISK   1
+#define SDL_AUDIO_DRIVER_DUMMY  1
+
+/* Enable various input drivers */
+/*#define SDL_JOYSTICK_DINPUT 1*/
+/*#define SDL_JOYSTICK_HIDAPI 1*/
+/*#define SDL_JOYSTICK_RAWINPUT   1*/
+#define SDL_JOYSTICK_VIRTUAL    1
+#ifdef HAVE_WINDOWS_GAMING_INPUT_H
+#define SDL_JOYSTICK_WGI    1
+#endif
+#define SDL_JOYSTICK_XINPUT 1
+/*#define SDL_HAPTIC_DINPUT   1*/
+#define SDL_HAPTIC_XINPUT   1
+
+/* Enable the sensor driver */
+#ifdef HAVE_SENSORSAPI_H
+#define SDL_SENSOR_WINDOWS  1
+#else
+#define SDL_SENSOR_DUMMY    1
+#endif
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_WINDOWS  1
+
+/* Enable various threading systems */
+#define SDL_THREAD_GENERIC_COND_SUFFIX 1
+#define SDL_THREAD_WINDOWS  1
+
+/* Enable various timer systems */
+#define SDL_TIMER_WINDOWS   1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_DUMMY  1
+#define SDL_VIDEO_DRIVER_WINDOWS    1
+
+/* #ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D    1
+#endif*/
+#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
+#define SDL_VIDEO_RENDER_D3D11  1
+#endif
+#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
+#define SDL_VIDEO_RENDER_D3D12  1
+#endif
+
+/* Enable system power support */
+/*#define SDL_POWER_WINDOWS 1*/
+#define SDL_POWER_HARDWIRED 1
+
+/* Enable filesystem support */
+/* #define SDL_FILESYSTEM_WINDOWS 1*/
+#define SDL_FILESYSTEM_XBOX 1
+
+/* Disable IME as not supported yet (TODO: Xbox IME?) */
+#define SDL_DISABLE_WINDOWS_IME 1
+
+#endif /* SDL_config_wingdk_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 7 - 1
include/SDL_platform.h

@@ -172,6 +172,12 @@
 #elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
 #elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
 #undef __WINGDK__
 #undef __WINGDK__
 #define __WINGDK__ 1
 #define __WINGDK__ 1
+#elif defined(_GAMING_XBOX_XBOXONE)
+#undef __XBOXONE__
+#define __XBOXONE__ 1
+#elif defined(_GAMING_XBOX_SCARLETT)
+#undef __XBOXSERIES__
+#define __XBOXSERIES__ 1
 #else
 #else
 #undef __WINDOWS__
 #undef __WINDOWS__
 #define __WINDOWS__ 1
 #define __WINDOWS__ 1
@@ -183,7 +189,7 @@
 #define __WIN32__ 1
 #define __WIN32__ 1
 #endif
 #endif
 /* This is to support generic "any GDK" separate from a platform-specific GDK */
 /* This is to support generic "any GDK" separate from a platform-specific GDK */
-#if defined(__WINGDK__) || defined(__XBOXONEGDK__) || defined(__XBOXSERIESGDK__)
+#if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
 #undef __GDK__
 #undef __GDK__
 #define __GDK__ 1
 #define __GDK__ 1
 #endif
 #endif

+ 4 - 0
src/SDL.c

@@ -581,6 +581,10 @@ SDL_GetPlatform(void)
     return "WinRT";
     return "WinRT";
 #elif __WINGDK__
 #elif __WINGDK__
     return "WinGDK";
     return "WinGDK";
+#elif __XBOXONE__
+    return "Xbox One";
+#elif __XBOXSERIES__
+    return "Xbox Series";
 #elif __TVOS__
 #elif __TVOS__
     return "tvOS";
     return "tvOS";
 #elif __IPHONEOS__
 #elif __IPHONEOS__

+ 9 - 6
src/core/windows/SDL_windows.c

@@ -96,6 +96,9 @@ WIN_CoInitialize(void)
        attribute, which, AFAIK, should initialize COM.
        attribute, which, AFAIK, should initialize COM.
     */
     */
     return S_OK;
     return S_OK;
+#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    /* On Xbox, there's no need to call CoInitializeEx (and it's not implemented) */
+    return S_OK;
 #else
 #else
     HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
     HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
     if (hr == RPC_E_CHANGED_MODE) {
     if (hr == RPC_E_CHANGED_MODE) {
@@ -179,7 +182,7 @@ WIN_RoUninitialize(void)
 #endif
 #endif
 }
 }
 
 
-#ifndef __WINRT__
+#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 static BOOL
 static BOOL
 IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
 IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
 {
 {
@@ -203,7 +206,7 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP
 
 
 BOOL WIN_IsWindowsVistaOrGreater(void)
 BOOL WIN_IsWindowsVistaOrGreater(void)
 {
 {
-#ifdef __WINRT__
+#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
     return TRUE;
     return TRUE;
 #else
 #else
     return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
     return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
@@ -212,7 +215,7 @@ BOOL WIN_IsWindowsVistaOrGreater(void)
 
 
 BOOL WIN_IsWindows7OrGreater(void)
 BOOL WIN_IsWindows7OrGreater(void)
 {
 {
-#ifdef __WINRT__
+#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
     return TRUE;
     return TRUE;
 #else
 #else
     return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
     return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
@@ -221,7 +224,7 @@ BOOL WIN_IsWindows7OrGreater(void)
 
 
 BOOL WIN_IsWindows8OrGreater(void)
 BOOL WIN_IsWindows8OrGreater(void)
 {
 {
-#ifdef __WINRT__
+#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
     return TRUE;
     return TRUE;
 #else
 #else
     return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
     return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
@@ -252,8 +255,8 @@ WASAPI doesn't need this. This is just for DirectSound/WinMM.
 char *
 char *
 WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
 WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
 {
 {
-#if __WINRT__
-    return WIN_StringToUTF8(name);  /* No registry access on WinRT/UWP, go with what we've got. */
+#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    return WIN_StringToUTF8(name);  /* No registry access on WinRT/UWP and Xbox, go with what we've got. */
 #else
 #else
     static const GUID nullguid = { 0 };
     static const GUID nullguid = { 0 };
     const unsigned char *ptr;
     const unsigned char *ptr;

+ 14 - 0
src/core/windows/SDL_windows.h

@@ -50,6 +50,20 @@
 #undef _WIN32_WINNT
 #undef _WIN32_WINNT
 #define _WIN32_WINNT  0xA00
 #define _WIN32_WINNT  0xA00
 #define WINVER        _WIN32_WINNT
 #define WINVER        _WIN32_WINNT
+#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef STRICT
+#define STRICT
+#endif
+#ifndef UNICODE
+#define UNICODE 1
+#endif
+#undef WINVER
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0xA00
+#define WINVER       _WIN32_WINNT
 #endif
 #endif
 
 
 #include <windows.h>
 #include <windows.h>

+ 11 - 2
src/core/windows/SDL_xinput.c

@@ -22,6 +22,10 @@
 
 
 #include "SDL_xinput.h"
 #include "SDL_xinput.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 XInputGetState_t SDL_XInputGetState = NULL;
 XInputGetState_t SDL_XInputGetState = NULL;
 XInputSetState_t SDL_XInputSetState = NULL;
 XInputSetState_t SDL_XInputSetState = NULL;
@@ -33,7 +37,7 @@ static HANDLE s_pXInputDLL = 0;
 static int s_XInputDLLRefCount = 0;
 static int s_XInputDLLRefCount = 0;
 
 
 
 
-#ifdef __WINRT__
+#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
 
 
 int
 int
 WIN_LoadXInputDLL(void)
 WIN_LoadXInputDLL(void)
@@ -66,7 +70,7 @@ WIN_UnloadXInputDLL(void)
 {
 {
 }
 }
 
 
-#else /* !__WINRT__ */
+#else /* !(defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)) */
 
 
 int
 int
 WIN_LoadXInputDLL(void)
 WIN_LoadXInputDLL(void)
@@ -136,4 +140,9 @@ WIN_UnloadXInputDLL(void)
 
 
 #endif /* __WINRT__ */
 #endif /* __WINRT__ */
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 16 - 0
src/core/windows/SDL_xinput.h

@@ -26,7 +26,13 @@
 #include "SDL_windows.h"
 #include "SDL_windows.h"
 
 
 #ifdef HAVE_XINPUT_H
 #ifdef HAVE_XINPUT_H
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+/* Xbox supports an XInput wrapper which is a C++-only header... */
+#include <XInputOnGameInput.h>
+using namespace XInputOnGameInput;
+#else
 #include <xinput.h>
 #include <xinput.h>
+#endif
 #endif /* HAVE_XINPUT_H */
 #endif /* HAVE_XINPUT_H */
 
 
 #ifndef XUSER_MAX_COUNT
 #ifndef XUSER_MAX_COUNT
@@ -147,6 +153,11 @@
 #define BATTERY_LEVEL_FULL              0x03
 #define BATTERY_LEVEL_FULL              0x03
 #endif
 #endif
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* typedef's for XInput structs we use */
 /* typedef's for XInput structs we use */
 
 
 #ifndef HAVE_XINPUT_GAMEPAD_EX
 #ifndef HAVE_XINPUT_GAMEPAD_EX
@@ -243,6 +254,11 @@ extern XInputGetCapabilities_t SDL_XInputGetCapabilities;
 extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation;
 extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation;
 extern DWORD SDL_XInputVersion;  /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
 extern DWORD SDL_XInputVersion;  /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #define XINPUTGETSTATE          SDL_XInputGetState
 #define XINPUTGETSTATE          SDL_XInputGetState
 #define XINPUTSETSTATE          SDL_XInputSetState
 #define XINPUTSETSTATE          SDL_XInputSetState
 #define XINPUTGETCAPABILITIES   SDL_XInputGetCapabilities
 #define XINPUTGETCAPABILITIES   SDL_XInputGetCapabilities

+ 1 - 1
src/dynapi/SDL_dynapi.c

@@ -291,7 +291,7 @@ static void dynapi_warn(const char *msg)
 {
 {
     const char *caption = "SDL Dynamic API Failure!";
     const char *caption = "SDL Dynamic API Failure!";
     /* SDL_ShowSimpleMessageBox() is a too heavy for here. */
     /* SDL_ShowSimpleMessageBox() is a too heavy for here. */
-    #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
+    #if (defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR);
     MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR);
     #elif defined(HAVE_STDIO_H)
     #elif defined(HAVE_STDIO_H)
     fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg);
     fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg);

+ 1 - 1
src/events/SDL_mouse.c

@@ -55,7 +55,7 @@ SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *ol
     if (hint && *hint) {
     if (hint && *hint) {
         mouse->double_click_time = SDL_atoi(hint);
         mouse->double_click_time = SDL_atoi(hint);
     } else {
     } else {
-#if defined(__WIN32__) || defined(__GDK__)
+#if defined(__WIN32__) || defined(__WINGDK__)
         mouse->double_click_time = GetDoubleClickTime();
         mouse->double_click_time = GetDoubleClickTime();
 #elif defined(__OS2__)
 #elif defined(__OS2__)
         mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME);
         mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME);

+ 6 - 0
src/file/SDL_rwops.c

@@ -75,7 +75,9 @@
 static int SDLCALL
 static int SDLCALL
 windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
 windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     UINT old_error_mode;
     UINT old_error_mode;
+#endif
     HANDLE h;
     HANDLE h;
     DWORD r_right, w_right;
     DWORD r_right, w_right;
     DWORD must_exist, truncate;
     DWORD must_exist, truncate;
@@ -112,9 +114,11 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
     if (!context->hidden.windowsio.buffer.data) {
     if (!context->hidden.windowsio.buffer.data) {
         return SDL_OutOfMemory();
         return SDL_OutOfMemory();
     }
     }
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     /* Do not open a dialog box if failure */
     /* Do not open a dialog box if failure */
     old_error_mode =
     old_error_mode =
         SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
         SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
+#endif
 
 
     {
     {
         LPTSTR tstr = WIN_UTF8ToString(filename);
         LPTSTR tstr = WIN_UTF8ToString(filename);
@@ -125,8 +129,10 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
         SDL_free(tstr);
         SDL_free(tstr);
     }
     }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     /* restore old behavior */
     /* restore old behavior */
     SetErrorMode(old_error_mode);
     SetErrorMode(old_error_mode);
+#endif
 
 
     if (h == INVALID_HANDLE_VALUE) {
     if (h == INVALID_HANDLE_VALUE) {
         SDL_free(context->hidden.windowsio.buffer.data);
         SDL_free(context->hidden.windowsio.buffer.data);

+ 19 - 0
src/filesystem/windows/SDL_sysfilesystem.c

@@ -172,4 +172,23 @@ SDL_GetPrefPath(const char *org, const char *app)
 
 
 #endif /* SDL_FILESYSTEM_WINDOWS */
 #endif /* SDL_FILESYSTEM_WINDOWS */
 
 
+#ifdef SDL_FILESYSTEM_XBOX
+#include "SDL_filesystem.h"
+#include "SDL_error.h"
+char *
+SDL_GetBasePath(void)
+{
+    SDL_Unsupported();
+    return NULL;
+}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+    SDL_Unsupported();
+    return NULL;
+}
+#endif /* SDL_FILESYSTEM_XBOX */
+
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 9 - 0
src/haptic/SDL_syshaptic.h

@@ -26,6 +26,10 @@
 
 
 #include "SDL_haptic.h"
 #include "SDL_haptic.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 struct haptic_effect
 struct haptic_effect
 {
 {
@@ -203,6 +207,11 @@ extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic);
  */
  */
 extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);
 extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_syshaptic_h_ */
 #endif /* SDL_syshaptic_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 9 - 0
src/haptic/windows/SDL_dinputhaptic_c.h

@@ -23,6 +23,10 @@
 #include "SDL_haptic.h"
 #include "SDL_haptic.h"
 #include "SDL_windowshaptic_c.h"
 #include "SDL_windowshaptic_c.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 extern int SDL_DINPUT_HapticInit(void);
 extern int SDL_DINPUT_HapticInit(void);
 extern int SDL_DINPUT_HapticMaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance);
 extern int SDL_DINPUT_HapticMaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance);
@@ -44,4 +48,9 @@ extern int SDL_DINPUT_HapticPause(SDL_Haptic * haptic);
 extern int SDL_DINPUT_HapticUnpause(SDL_Haptic * haptic);
 extern int SDL_DINPUT_HapticUnpause(SDL_Haptic * haptic);
 extern int SDL_DINPUT_HapticStopAll(SDL_Haptic * haptic);
 extern int SDL_DINPUT_HapticStopAll(SDL_Haptic * haptic);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 9 - 0
src/haptic/windows/SDL_windowshaptic.c

@@ -37,6 +37,10 @@
 #include "SDL_dinputhaptic_c.h"
 #include "SDL_dinputhaptic_c.h"
 #include "SDL_xinputhaptic_c.h"
 #include "SDL_xinputhaptic_c.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 /*
 /*
  * Internal stuff.
  * Internal stuff.
@@ -466,6 +470,11 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
     }
     }
 }
 }
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT */
 #endif /* SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 10 - 0
src/haptic/windows/SDL_windowshaptic_c.h

@@ -28,6 +28,11 @@
 #include "../../core/windows/SDL_directx.h"
 #include "../../core/windows/SDL_directx.h"
 #include "../../core/windows/SDL_xinput.h"
 #include "../../core/windows/SDL_xinput.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
 /*
  * Haptic system hardware data.
  * Haptic system hardware data.
  */
  */
@@ -84,6 +89,11 @@ extern SDL_hapticlist_item *SDL_hapticlist;
 extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item);
 extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item);
 extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item);
 extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_windowshaptic_c_h_ */
 #endif /* SDL_windowshaptic_c_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 1
src/haptic/windows/SDL_xinputhaptic.c

@@ -35,6 +35,11 @@
 #include "../../joystick/windows/SDL_windowsjoystick_c.h"
 #include "../../joystick/windows/SDL_windowsjoystick_c.h"
 #include "../../thread/SDL_systhread.h"
 #include "../../thread/SDL_systhread.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
 /*
  * Internal stuff.
  * Internal stuff.
  */
  */
@@ -45,7 +50,7 @@ int
 SDL_XINPUT_HapticInit(void)
 SDL_XINPUT_HapticInit(void)
 {
 {
     if (SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE)) {
     if (SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE)) {
-        loaded_xinput = (WIN_LoadXInputDLL() == 0);
+        loaded_xinput = (WIN_LoadXInputDLL() == 0) ? SDL_TRUE : SDL_FALSE;
     }
     }
 
 
     /* If the joystick subsystem is active, it will manage adding XInput haptic devices */
     /* If the joystick subsystem is active, it will manage adding XInput haptic devices */
@@ -365,6 +370,11 @@ SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
     return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
     return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
 }
 }
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #else /* !SDL_HAPTIC_XINPUT */
 #else /* !SDL_HAPTIC_XINPUT */
 
 
 #include "../../core/windows/SDL_windows.h"
 #include "../../core/windows/SDL_windows.h"

+ 9 - 0
src/haptic/windows/SDL_xinputhaptic_c.h

@@ -23,6 +23,10 @@
 #include "SDL_haptic.h"
 #include "SDL_haptic.h"
 #include "SDL_windowshaptic_c.h"
 #include "SDL_windowshaptic_c.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 extern int SDL_XINPUT_HapticInit(void);
 extern int SDL_XINPUT_HapticInit(void);
 extern int SDL_XINPUT_HapticMaybeAddDevice(const DWORD dwUserid);
 extern int SDL_XINPUT_HapticMaybeAddDevice(const DWORD dwUserid);
@@ -44,4 +48,9 @@ extern int SDL_XINPUT_HapticPause(SDL_Haptic * haptic);
 extern int SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic);
 extern int SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic);
 extern int SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic);
 extern int SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 10 - 0
src/joystick/SDL_joystick_c.h

@@ -28,6 +28,11 @@
 #include "SDL_gamecontroller.h"
 #include "SDL_gamecontroller.h"
 #include "SDL_joystick.h"
 #include "SDL_joystick.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct _SDL_JoystickDriver;
 struct _SDL_JoystickDriver;
 
 
 /* Initialization and shutdown functions */
 /* Initialization and shutdown functions */
@@ -187,6 +192,11 @@ typedef struct _SDL_GamepadMapping
 extern SDL_bool SDL_PrivateJoystickGetAutoGamepadMapping(int device_index,
 extern SDL_bool SDL_PrivateJoystickGetAutoGamepadMapping(int device_index,
                                                          SDL_GamepadMapping *out);
                                                          SDL_GamepadMapping *out);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_joystick_c_h_ */
 #endif /* SDL_joystick_c_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 10 - 0
src/joystick/SDL_sysjoystick.h

@@ -27,6 +27,11 @@
 #include "SDL_joystick.h"
 #include "SDL_joystick.h"
 #include "SDL_joystick_c.h"
 #include "SDL_joystick_c.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* The SDL joystick structure */
 /* The SDL joystick structure */
 typedef struct _SDL_JoystickAxisInfo
 typedef struct _SDL_JoystickAxisInfo
 {
 {
@@ -230,6 +235,11 @@ extern SDL_JoystickDriver SDL_PS2_JoystickDriver;
 extern SDL_JoystickDriver SDL_PSP_JoystickDriver;
 extern SDL_JoystickDriver SDL_PSP_JoystickDriver;
 extern SDL_JoystickDriver SDL_VITA_JoystickDriver;
 extern SDL_JoystickDriver SDL_VITA_JoystickDriver;
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_sysjoystick_h_ */
 #endif /* SDL_sysjoystick_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 10 - 0
src/joystick/windows/SDL_dinputjoystick_c.h

@@ -20,6 +20,11 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int SDL_DINPUT_JoystickInit(void);
 extern int SDL_DINPUT_JoystickInit(void);
 extern void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
 extern void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
 extern SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor, Uint16 product, Uint16 version);
 extern SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor, Uint16 product, Uint16 version);
@@ -30,4 +35,9 @@ extern void SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick);
 extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick);
 extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick);
 extern void SDL_DINPUT_JoystickQuit(void);
 extern void SDL_DINPUT_JoystickQuit(void);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 46 - 6
src/joystick/windows/SDL_windowsjoystick.c

@@ -41,7 +41,7 @@
 #include "../SDL_sysjoystick.h"
 #include "../SDL_sysjoystick.h"
 #include "../../thread/SDL_systhread.h"
 #include "../../thread/SDL_systhread.h"
 #include "../../core/windows/SDL_windows.h"
 #include "../../core/windows/SDL_windows.h"
-#if !defined(__WINRT__)
+#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 #include <dbt.h>
 #include <dbt.h>
 #endif
 #endif
 
 
@@ -63,6 +63,11 @@
 
 
 #define CR_SUCCESS (0x00000000)
 #define CR_SUCCESS (0x00000000)
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 DECLARE_HANDLE(HCMNOTIFICATION);
 DECLARE_HANDLE(HCMNOTIFICATION);
 typedef HCMNOTIFICATION* PHCMNOTIFICATION;
 typedef HCMNOTIFICATION* PHCMNOTIFICATION;
 
 
@@ -141,7 +146,7 @@ static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB,
 
 
 JoyStick_DeviceData *SYS_Joystick;    /* array to hold joystick ID values */
 JoyStick_DeviceData *SYS_Joystick;    /* array to hold joystick ID values */
 
 
-#ifndef __WINRT__
+#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 static HMODULE cfgmgr32_lib_handle;
 static HMODULE cfgmgr32_lib_handle;
 static CM_Register_NotificationFunc CM_Register_Notification;
 static CM_Register_NotificationFunc CM_Register_Notification;
 static CM_Unregister_NotificationFunc CM_Unregister_Notification;
 static CM_Unregister_NotificationFunc CM_Unregister_Notification;
@@ -327,7 +332,14 @@ SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex
     return (lastret != -1) ? SDL_TRUE : SDL_FALSE;
     return (lastret != -1) ? SDL_TRUE : SDL_FALSE;
 }
 }
 
 
+#endif /* !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */
+
+
+#if !defined(__WINRT__)
+
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 static SDL_DeviceNotificationData s_notification_data;
 static SDL_DeviceNotificationData s_notification_data;
+#endif
 
 
 /* Function/thread to scan the system for joysticks. */
 /* Function/thread to scan the system for joysticks. */
 static int SDLCALL
 static int SDLCALL
@@ -338,13 +350,19 @@ SDL_JoystickThread(void *_data)
     SDL_zeroa(bOpenedXInputDevices);
     SDL_zeroa(bOpenedXInputDevices);
 #endif
 #endif
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (SDL_CreateDeviceNotification(&s_notification_data) < 0) {
     if (SDL_CreateDeviceNotification(&s_notification_data) < 0) {
         return -1;
         return -1;
     }
     }
+#endif
 
 
     SDL_LockMutex(s_mutexJoyStickEnum);
     SDL_LockMutex(s_mutexJoyStickEnum);
     while (s_bJoystickThreadQuit == SDL_FALSE) {
     while (s_bJoystickThreadQuit == SDL_FALSE) {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
         if (SDL_WaitForDeviceNotification(&s_notification_data, s_mutexJoyStickEnum) == SDL_FALSE) {
         if (SDL_WaitForDeviceNotification(&s_notification_data, s_mutexJoyStickEnum) == SDL_FALSE) {
+#else
+        {
+#endif
 #if SDL_JOYSTICK_XINPUT
 #if SDL_JOYSTICK_XINPUT
             /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */
             /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */
             SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000);
             SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000);
@@ -354,7 +372,7 @@ SDL_JoystickThread(void *_data)
                 for (userId = 0; userId < XUSER_MAX_COUNT; userId++) {
                 for (userId = 0; userId < XUSER_MAX_COUNT; userId++) {
                     XINPUT_CAPABILITIES capabilities;
                     XINPUT_CAPABILITIES capabilities;
                     const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities);
                     const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities);
-                    const SDL_bool available = (result == ERROR_SUCCESS);
+                    const SDL_bool available = (result == ERROR_SUCCESS) ? SDL_TRUE : SDL_FALSE;
                     if (bOpenedXInputDevices[userId] != available) {
                     if (bOpenedXInputDevices[userId] != available) {
                         s_bWindowsDeviceChanged = SDL_TRUE;
                         s_bWindowsDeviceChanged = SDL_TRUE;
                         bOpenedXInputDevices[userId] = available;
                         bOpenedXInputDevices[userId] = available;
@@ -367,9 +385,12 @@ SDL_JoystickThread(void *_data)
 #endif /* SDL_JOYSTICK_XINPUT */
 #endif /* SDL_JOYSTICK_XINPUT */
         }
         }
     }
     }
+
     SDL_UnlockMutex(s_mutexJoyStickEnum);
     SDL_UnlockMutex(s_mutexJoyStickEnum);
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     SDL_CleanupDeviceNotification(&s_notification_data);
     SDL_CleanupDeviceNotification(&s_notification_data);
+#endif
 
 
     return 1;
     return 1;
 }
 }
@@ -419,7 +440,7 @@ SDL_StopJoystickThread(void)
     s_joystickThread = NULL;
     s_joystickThread = NULL;
 }
 }
 
 
-#endif /* !__WINRT__ */
+#endif /* !defined(__WINRT__) */
 
 
 void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device)
 void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device)
 {
 {
@@ -453,7 +474,7 @@ WINDOWS_JoystickInit(void)
 
 
     WINDOWS_JoystickDetect();
     WINDOWS_JoystickDetect();
 
 
-#ifndef __WINRT__
+#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     SDL_CreateDeviceNotificationFunc();
     SDL_CreateDeviceNotificationFunc();
 
 
     s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, SDL_FALSE);
     s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, SDL_FALSE);
@@ -467,6 +488,14 @@ WINDOWS_JoystickInit(void)
         }
         }
     }
     }
 #endif
 #endif
+
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    /* On Xbox, force create the joystick thread for device detection (since other methods don't work */
+    s_bJoystickThread = SDL_TRUE;
+    if (SDL_StartJoystickThread() < 0) {
+        return -1;
+    }
+#endif
     return 0;
     return 0;
 }
 }
 
 
@@ -738,7 +767,7 @@ WINDOWS_JoystickQuit(void)
     }
     }
     SYS_Joystick = NULL;
     SYS_Joystick = NULL;
 
 
-#ifndef __WINRT__
+#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (s_bJoystickThread) {
     if (s_bJoystickThread) {
         SDL_StopJoystickThread();
         SDL_StopJoystickThread();
     } else {
     } else {
@@ -748,6 +777,12 @@ WINDOWS_JoystickQuit(void)
     SDL_CleanupDeviceNotificationFunc();
     SDL_CleanupDeviceNotificationFunc();
 #endif
 #endif
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    if (s_bJoystickThread) {
+        SDL_StopJoystickThread();
+    }
+#endif
+
     SDL_DINPUT_JoystickQuit();
     SDL_DINPUT_JoystickQuit();
     SDL_XINPUT_JoystickQuit();
     SDL_XINPUT_JoystickQuit();
 
 
@@ -784,6 +819,11 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver =
     WINDOWS_JoystickGetGamepadMapping
     WINDOWS_JoystickGetGamepadMapping
 };
 };
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #else
 #else
 
 
 #if SDL_JOYSTICK_RAWINPUT
 #if SDL_JOYSTICK_RAWINPUT

+ 10 - 0
src/joystick/windows/SDL_windowsjoystick_c.h

@@ -27,6 +27,11 @@
 
 
 #define MAX_INPUTS  256     /* each joystick can have up to 256 inputs */
 #define MAX_INPUTS  256     /* each joystick can have up to 256 inputs */
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct JoyStick_DeviceData
 typedef struct JoyStick_DeviceData
 {
 {
     SDL_JoystickGUID guid;
     SDL_JoystickGUID guid;
@@ -91,4 +96,9 @@ extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
 
 
 extern void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device);
 extern void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 19 - 2
src/joystick/windows/SDL_xinputjoystick.c

@@ -31,6 +31,11 @@
 #include "SDL_rawinputjoystick_c.h"
 #include "SDL_rawinputjoystick_c.h"
 #include "../hidapi/SDL_hidapijoystick_c.h"
 #include "../hidapi/SDL_hidapijoystick_c.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
 /*
  * Internal stuff.
  * Internal stuff.
  */
  */
@@ -45,6 +50,8 @@ SDL_XInputUseOldJoystickMapping()
     /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
     /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
     /* FIXME: Why are Win8/10 different here? -flibit */
     /* FIXME: Why are Win8/10 different here? -flibit */
     return (NTDDI_VERSION < NTDDI_WIN10);
     return (NTDDI_VERSION < NTDDI_WIN10);
+#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    return SDL_FALSE;
 #else
 #else
     static int s_XInputUseOldJoystickMapping = -1;
     static int s_XInputUseOldJoystickMapping = -1;
     if (s_XInputUseOldJoystickMapping < 0) {
     if (s_XInputUseOldJoystickMapping < 0) {
@@ -126,7 +133,7 @@ GetXInputName(const Uint8 userid, BYTE SubType)
 static void
 static void
 GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion)
 GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion)
 {
 {
-#ifndef __WINRT__   /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
+#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
 
 
     PRAWINPUTDEVICELIST devices = NULL;
     PRAWINPUTDEVICELIST devices = NULL;
     UINT i, j, device_count = 0;
     UINT i, j, device_count = 0;
@@ -386,7 +393,7 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde
         return SDL_SetError("Failed to obtain XInput device capabilities. Device disconnected?");
         return SDL_SetError("Failed to obtain XInput device capabilities. Device disconnected?");
     }
     }
     SDL_zero(state);
     SDL_zero(state);
-    joystick->hwdata->bXInputHaptic = (XINPUTSETSTATE(userId, &state) == ERROR_SUCCESS);
+    joystick->hwdata->bXInputHaptic = (XINPUTSETSTATE(userId, &state) == ERROR_SUCCESS) ? SDL_TRUE : SDL_FALSE;
     joystick->hwdata->userid = userId;
     joystick->hwdata->userid = userId;
 
 
     /* The XInput API has a hard coded button/axis mapping, so we just match it */
     /* The XInput API has a hard coded button/axis mapping, so we just match it */
@@ -541,6 +548,10 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
         result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation);
         result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation);
     }
     }
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    /* XInputOnGameInput doesn't ever change dwPacketNumber, so have to just update every frame */
+    UpdateXInputJoystickState(joystick, &XInputState, &XBatteryInformation);
+#else
     /* only fire events if the data changed from last time */
     /* only fire events if the data changed from last time */
     if (XInputState.dwPacketNumber && XInputState.dwPacketNumber != joystick->hwdata->dwPacketNumber) {
     if (XInputState.dwPacketNumber && XInputState.dwPacketNumber != joystick->hwdata->dwPacketNumber) {
         if (SDL_XInputUseOldJoystickMapping()) {
         if (SDL_XInputUseOldJoystickMapping()) {
@@ -550,6 +561,7 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
         }
         }
         joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber;
         joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber;
     }
     }
+#endif
 }
 }
 
 
 void
 void
@@ -565,6 +577,11 @@ SDL_XINPUT_JoystickQuit(void)
     }
     }
 }
 }
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #else /* !SDL_JOYSTICK_XINPUT */
 #else /* !SDL_JOYSTICK_XINPUT */
 
 
 typedef struct JoyStick_DeviceData JoyStick_DeviceData;
 typedef struct JoyStick_DeviceData JoyStick_DeviceData;

+ 10 - 0
src/joystick/windows/SDL_xinputjoystick_c.h

@@ -22,6 +22,11 @@
 
 
 #include "../../core/windows/SDL_xinput.h"
 #include "../../core/windows/SDL_xinput.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern SDL_bool SDL_XINPUT_Enabled(void);
 extern SDL_bool SDL_XINPUT_Enabled(void);
 extern int SDL_XINPUT_JoystickInit(void);
 extern int SDL_XINPUT_JoystickInit(void);
 extern void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
 extern void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
@@ -32,4 +37,9 @@ extern void SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick);
 extern void SDL_XINPUT_JoystickClose(SDL_Joystick * joystick);
 extern void SDL_XINPUT_JoystickClose(SDL_Joystick * joystick);
 extern void SDL_XINPUT_JoystickQuit(void);
 extern void SDL_XINPUT_JoystickQuit(void);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 9 - 0
src/misc/windows/SDL_sysurl.c

@@ -24,6 +24,14 @@
 
 
 #include <shellapi.h>
 #include <shellapi.h>
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+int
+SDL_SYS_OpenURL(const char *url)
+{
+    /* Not supported */
+    return SDL_Unsupported();
+}
+#else
 /* https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx */
 /* https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx */
 int
 int
 SDL_SYS_OpenURL(const char *url)
 SDL_SYS_OpenURL(const char *url)
@@ -49,6 +57,7 @@ SDL_SYS_OpenURL(const char *url)
     WIN_CoUninitialize();
     WIN_CoUninitialize();
     return (rc > ((HINSTANCE) 32)) ? 0 : WIN_SetError("Couldn't open given URL.");
     return (rc > ((HINSTANCE) 32)) ? 0 : WIN_SetError("Couldn't open given URL.");
 }
 }
+#endif
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */
 
 

+ 73 - 11
src/render/direct3d12/SDL_render_d3d12.c

@@ -38,10 +38,17 @@
 #include "../SDL_sysrender.h"
 #include "../SDL_sysrender.h"
 #include "../SDL_d3dmath.h"
 #include "../SDL_d3dmath.h"
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+#include "SDL_render_d3d12_xbox.h"
+#ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
+#define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 256
+#endif
+#else
 #include <d3d12.h>
 #include <d3d12.h>
 #include <dxgi1_6.h>
 #include <dxgi1_6.h>
 #include <dxgidebug.h>
 #include <dxgidebug.h>
 #include <d3d12sdklayers.h>
 #include <d3d12sdklayers.h>
+#endif
 
 
 #include "SDL_shaders_d3d12.h"
 #include "SDL_shaders_d3d12.h"
 
 
@@ -153,14 +160,18 @@ typedef struct
 {
 {
     void *hDXGIMod;
     void *hDXGIMod;
     void *hD3D12Mod;
     void *hD3D12Mod;
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    UINT64 frameToken;
+#else
     IDXGIFactory6 *dxgiFactory;
     IDXGIFactory6 *dxgiFactory;
     IDXGIAdapter4 *dxgiAdapter;
     IDXGIAdapter4 *dxgiAdapter;
+    IDXGIDebug *dxgiDebug;
+    IDXGISwapChain4 *swapChain;
+#endif
     ID3D12Device1 *d3dDevice;
     ID3D12Device1 *d3dDevice;
     ID3D12Debug *debugInterface;
     ID3D12Debug *debugInterface;
-    IDXGIDebug *dxgiDebug;
     ID3D12CommandQueue *commandQueue;
     ID3D12CommandQueue *commandQueue;
     ID3D12GraphicsCommandList2 *commandList;
     ID3D12GraphicsCommandList2 *commandList;
-    IDXGISwapChain4 *swapChain;
     DXGI_SWAP_EFFECT swapEffect;
     DXGI_SWAP_EFFECT swapEffect;
 
 
     /* Descriptor heaps */
     /* Descriptor heaps */
@@ -231,7 +242,7 @@ typedef struct
 static const GUID SDL_IID_IDXGIFactory6 = { 0xc1b6694f, 0xff09, 0x44a9, { 0xb0, 0x3c, 0x77, 0x90, 0x0a, 0x0a, 0x1d, 0x17 } };
 static const GUID SDL_IID_IDXGIFactory6 = { 0xc1b6694f, 0xff09, 0x44a9, { 0xb0, 0x3c, 0x77, 0x90, 0x0a, 0x0a, 0x1d, 0x17 } };
 static const GUID SDL_IID_IDXGIAdapter4 = { 0x3c8d99d1, 0x4fbf, 0x4181, { 0xa8, 0x2c, 0xaf, 0x66, 0xbf, 0x7b, 0xd2, 0x4e } };
 static const GUID SDL_IID_IDXGIAdapter4 = { 0x3c8d99d1, 0x4fbf, 0x4181, { 0xa8, 0x2c, 0xaf, 0x66, 0xbf, 0x7b, 0xd2, 0x4e } };
 static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
 static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
-static const GUID SDL_IID_ID3D12Device5 = { 0x8b4f173b, 0x2fea, 0x4b80, { 0x8f, 0x58, 0x43, 0x07, 0x19, 0x1a, 0xb9, 0x5d } };
+static const GUID SDL_IID_ID3D12Device1 = { 0x77acce80, 0x638e, 0x4e65, { 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e } };
 static const GUID SDL_IID_IDXGISwapChain4 = { 0x3D585D5A, 0xBD4A, 0x489E, { 0xB1, 0xF4, 0x3D, 0xBC, 0xB6, 0x45, 0x2F, 0xFB } };
 static const GUID SDL_IID_IDXGISwapChain4 = { 0x3D585D5A, 0xBD4A, 0x489E, { 0xB1, 0xF4, 0x3D, 0xBC, 0xB6, 0x45, 0x2F, 0xFB } };
 static const GUID SDL_IID_IDXGIDebug1 = { 0xc5a05f0c, 0x16f2, 0x4adf, { 0x9f, 0x4d, 0xa8, 0xc4, 0xd5, 0x8a, 0xc5, 0x50 } };
 static const GUID SDL_IID_IDXGIDebug1 = { 0xc5a05f0c, 0x16f2, 0x4adf, { 0x9f, 0x4d, 0xa8, 0xc4, 0xd5, 0x8a, 0xc5, 0x50 } };
 static const GUID SDL_IID_IDXGIInfoQueue = { 0xD67441C7,0x672A,0x476f, { 0x9E,0x82,0xCD,0x55,0xB4,0x49,0x49,0xCE } };
 static const GUID SDL_IID_IDXGIInfoQueue = { 0xD67441C7,0x672A,0x476f, { 0x9E,0x82,0xCD,0x55,0xB4,0x49,0x49,0xCE } };
@@ -307,8 +318,11 @@ D3D12_ReleaseAll(SDL_Renderer * renderer)
     if (data) {
     if (data) {
         int i;
         int i;
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
         SAFE_RELEASE(data->dxgiFactory);
         SAFE_RELEASE(data->dxgiFactory);
         SAFE_RELEASE(data->dxgiAdapter);
         SAFE_RELEASE(data->dxgiAdapter);
+        SAFE_RELEASE(data->swapChain);
+#endif
         SAFE_RELEASE(data->d3dDevice);
         SAFE_RELEASE(data->d3dDevice);
         SAFE_RELEASE(data->debugInterface);
         SAFE_RELEASE(data->debugInterface);
         SAFE_RELEASE(data->commandQueue);
         SAFE_RELEASE(data->commandQueue);
@@ -317,7 +331,6 @@ D3D12_ReleaseAll(SDL_Renderer * renderer)
         SAFE_RELEASE(data->textureRTVDescriptorHeap);
         SAFE_RELEASE(data->textureRTVDescriptorHeap);
         SAFE_RELEASE(data->srvDescriptorHeap);
         SAFE_RELEASE(data->srvDescriptorHeap);
         SAFE_RELEASE(data->samplerDescriptorHeap);
         SAFE_RELEASE(data->samplerDescriptorHeap);
-        SAFE_RELEASE(data->swapChain);
         SAFE_RELEASE(data->fence);
         SAFE_RELEASE(data->fence);
 
 
         for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) {
         for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) {
@@ -345,12 +358,14 @@ D3D12_ReleaseAll(SDL_Renderer * renderer)
         data->currentRenderTargetView.ptr = 0;
         data->currentRenderTargetView.ptr = 0;
         data->currentSampler.ptr = 0;
         data->currentSampler.ptr = 0;
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
         /* Check for any leaks if in debug mode */
         /* Check for any leaks if in debug mode */
         if (data->dxgiDebug) {
         if (data->dxgiDebug) {
             DXGI_DEBUG_RLO_FLAGS rloFlags = (DXGI_DEBUG_RLO_FLAGS)(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL);
             DXGI_DEBUG_RLO_FLAGS rloFlags = (DXGI_DEBUG_RLO_FLAGS)(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL);
             D3D_CALL(data->dxgiDebug, ReportLiveObjects, SDL_DXGI_DEBUG_ALL, rloFlags);
             D3D_CALL(data->dxgiDebug, ReportLiveObjects, SDL_DXGI_DEBUG_ALL, rloFlags);
             SAFE_RELEASE(data->dxgiDebug);
             SAFE_RELEASE(data->dxgiDebug);
         }
         }
+#endif
 
 
         /* Unload the D3D libraries.  This should be done last, in order
         /* Unload the D3D libraries.  This should be done last, in order
          * to prevent IUnknown::Release() calls from crashing.
          * to prevent IUnknown::Release() calls from crashing.
@@ -700,10 +715,12 @@ D3D12_CreateVertexBuffer(D3D12_RenderData *data, size_t vbidx, size_t size)
 static HRESULT
 static HRESULT
 D3D12_CreateDeviceResources(SDL_Renderer* renderer)
 D3D12_CreateDeviceResources(SDL_Renderer* renderer)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     typedef HRESULT(WINAPI* PFN_CREATE_DXGI_FACTORY)(UINT flags, REFIID riid, void** ppFactory);
     typedef HRESULT(WINAPI* PFN_CREATE_DXGI_FACTORY)(UINT flags, REFIID riid, void** ppFactory);
     PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc;
     PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc;
-    D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata;
     PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc;
     PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc;
+#endif
+    D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata;
     ID3D12Device* d3dDevice = NULL;
     ID3D12Device* d3dDevice = NULL;
     HRESULT result = S_OK;
     HRESULT result = S_OK;
     UINT creationFlags = 0;
     UINT creationFlags = 0;
@@ -728,6 +745,10 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
         DXGI_FORMAT_R8_UNORM
         DXGI_FORMAT_R8_UNORM
     };
     };
 
 
+    /* See if we need debug interfaces */
+    createDebug = SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE);
+
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     data->hDXGIMod = SDL_LoadObject("dxgi.dll");
     data->hDXGIMod = SDL_LoadObject("dxgi.dll");
     if (!data->hDXGIMod) {
     if (!data->hDXGIMod) {
         result = E_FAIL;
         result = E_FAIL;
@@ -752,9 +773,6 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
         goto done;
         goto done;
     }
     }
 
 
-    /* See if we need debug interfaces */
-    createDebug = SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE);
-
     if (createDebug) {
     if (createDebug) {
         PFN_D3D12_GET_DEBUG_INTERFACE D3D12GetDebugInterfaceFunc;
         PFN_D3D12_GET_DEBUG_INTERFACE D3D12GetDebugInterfaceFunc;
 
 
@@ -766,7 +784,15 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
         D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void**)&data->debugInterface);
         D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void**)&data->debugInterface);
         D3D_CALL(data->debugInterface, EnableDebugLayer);
         D3D_CALL(data->debugInterface, EnableDebugLayer);
     }
     }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    result = D3D12_XBOX_CreateDevice(&d3dDevice, createDebug);
+    if (FAILED(result)) {
+        /* SDL Error is set by D3D12_XBOX_CreateDevice */
+        goto done;
+    }
+#else
     if (createDebug) {
     if (createDebug) {
 #ifdef __IDXGIInfoQueue_INTERFACE_DEFINED__
 #ifdef __IDXGIInfoQueue_INTERFACE_DEFINED__
         IDXGIInfoQueue *dxgiInfoQueue = NULL;
         IDXGIInfoQueue *dxgiInfoQueue = NULL;
@@ -818,7 +844,7 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
     
     
     result = D3D12CreateDeviceFunc((IUnknown *)data->dxgiAdapter,
     result = D3D12CreateDeviceFunc((IUnknown *)data->dxgiAdapter,
         D3D_FEATURE_LEVEL_11_0, /* Request minimum feature level 11.0 for maximum compatibility */
         D3D_FEATURE_LEVEL_11_0, /* Request minimum feature level 11.0 for maximum compatibility */
-        D3D_GUID(SDL_IID_ID3D12Device5),
+        D3D_GUID(SDL_IID_ID3D12Device1),
         (void **)&d3dDevice
         (void **)&d3dDevice
         );
         );
     if (FAILED(result)) {
     if (FAILED(result)) {
@@ -848,10 +874,11 @@ D3D12_CreateDeviceResources(SDL_Renderer* renderer)
 
 
         SAFE_RELEASE(infoQueue);
         SAFE_RELEASE(infoQueue);
     }
     }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
-    result = D3D_CALL(d3dDevice, QueryInterface, D3D_GUID(SDL_IID_ID3D12Device5), (void **)&data->d3dDevice);
+    result = D3D_CALL(d3dDevice, QueryInterface, D3D_GUID(SDL_IID_ID3D12Device1), (void **)&data->d3dDevice);
     if (FAILED(result)) {
     if (FAILED(result)) {
-        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device to ID3D12Device5"), result);
+        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device to ID3D12Device1"), result);
         goto done;
         goto done;
     }
     }
 
 
@@ -1120,6 +1147,7 @@ D3D12_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRec
     return 0;
     return 0;
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 static HRESULT
 static HRESULT
 D3D12_CreateSwapChain(SDL_Renderer * renderer, int w, int h)
 D3D12_CreateSwapChain(SDL_Renderer * renderer, int w, int h)
 {
 {
@@ -1187,6 +1215,7 @@ done:
     SAFE_RELEASE(swapChain);
     SAFE_RELEASE(swapChain);
     return result;
     return result;
 }
 }
+#endif
 
 
 static HRESULT D3D12_UpdateForWindowSizeChange(SDL_Renderer * renderer);
 static HRESULT D3D12_UpdateForWindowSizeChange(SDL_Renderer * renderer);
 
 
@@ -1246,6 +1275,7 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
         h = tmp;
         h = tmp;
     }
     }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (data->swapChain) {
     if (data->swapChain) {
         /* If the swap chain already exists, resize it. */
         /* If the swap chain already exists, resize it. */
         result = D3D_CALL(data->swapChain, ResizeBuffers,
         result = D3D_CALL(data->swapChain, ResizeBuffers,
@@ -1283,9 +1313,17 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
             }
             }
         }
         }
     }
     }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
     /* Get each back buffer render target and create render target views */
     /* Get each back buffer render target and create render target views */
     for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) {
     for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) {
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+        result = D3D12_XBOX_CreateBackBufferTarget(data->d3dDevice, renderer->window->w, renderer->window->h, (void **) &data->renderTargets[i]);
+        if (FAILED(result)) {
+            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D12_XBOX_CreateBackBufferTarget"), result);
+            goto done;
+        }
+#else
         result = D3D_CALL(data->swapChain, GetBuffer,
         result = D3D_CALL(data->swapChain, GetBuffer,
             i,
             i,
             D3D_GUID(SDL_IID_ID3D12Resource),
             D3D_GUID(SDL_IID_ID3D12Resource),
@@ -1295,6 +1333,7 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
             WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain4::GetBuffer"), result);
             WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain4::GetBuffer"), result);
             goto done;
             goto done;
         }
         }
+#endif
 
 
         SDL_zero(rtvDesc);
         SDL_zero(rtvDesc);
         rtvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
         rtvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
@@ -1307,7 +1346,11 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
     }
     }
 
 
     /* Set back buffer index to current buffer */
     /* Set back buffer index to current buffer */
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    data->currentBackBufferIndex = 0;
+#else
     data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex);
     data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex);
+#endif
 
 
     /* Set the swap chain target immediately, so that a target is always set
     /* Set the swap chain target immediately, so that a target is always set
      * even before we get to SetDrawState. Without this it's possible to hit
      * even before we get to SetDrawState. Without this it's possible to hit
@@ -1323,6 +1366,10 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
 
 
     data->viewportDirty = SDL_TRUE;
     data->viewportDirty = SDL_TRUE;
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    D3D12_XBOX_StartFrame(data->d3dDevice, &data->frameToken);
+#endif
+
 done:
 done:
     return result;
     return result;
 }
 }
@@ -2870,8 +2917,10 @@ static void
 D3D12_RenderPresent(SDL_Renderer * renderer)
 D3D12_RenderPresent(SDL_Renderer * renderer)
 {
 {
     D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata;
     D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     UINT syncInterval;
     UINT syncInterval;
     UINT presentFlags;
     UINT presentFlags;
+#endif
     HRESULT result;
     HRESULT result;
 
 
     /* Transition the render target to present state */
     /* Transition the render target to present state */
@@ -2885,6 +2934,9 @@ D3D12_RenderPresent(SDL_Renderer * renderer)
     result = D3D_CALL(data->commandList, Close);
     result = D3D_CALL(data->commandList, Close);
     D3D_CALL(data->commandQueue, ExecuteCommandLists, 1, (ID3D12CommandList * const *)&data->commandList);
     D3D_CALL(data->commandQueue, ExecuteCommandLists, 1, (ID3D12CommandList * const *)&data->commandList);
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    result = D3D12_XBOX_PresentFrame(data->commandQueue, data->frameToken, data->renderTargets[data->currentBackBufferIndex]);
+#else
     if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) {
     if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) {
         syncInterval = 1;
         syncInterval = 1;
         presentFlags = 0;
         presentFlags = 0;
@@ -2897,6 +2949,7 @@ D3D12_RenderPresent(SDL_Renderer * renderer)
      * rects to improve efficiency in certain scenarios.
      * rects to improve efficiency in certain scenarios.
      */
      */
     result = D3D_CALL(data->swapChain, Present, syncInterval, presentFlags);
     result = D3D_CALL(data->swapChain, Present, syncInterval, presentFlags);
+#endif
 
 
     if (FAILED(result) && result != DXGI_ERROR_WAS_STILL_DRAWING) {
     if (FAILED(result) && result != DXGI_ERROR_WAS_STILL_DRAWING) {
         /* If the device was removed either by a disconnect or a driver upgrade, we 
         /* If the device was removed either by a disconnect or a driver upgrade, we 
@@ -2923,7 +2976,12 @@ D3D12_RenderPresent(SDL_Renderer * renderer)
         }
         }
 
 
         data->fenceValue++;
         data->fenceValue++;
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+        data->currentBackBufferIndex++;
+        data->currentBackBufferIndex %= SDL_D3D12_NUM_BUFFERS;
+#else
         data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex);
         data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex);
+#endif
 
 
         /* Reset the command allocator and command list, and transition back to render target */
         /* Reset the command allocator and command list, and transition back to render target */
         D3D12_ResetCommandList(data);
         D3D12_ResetCommandList(data);
@@ -2932,6 +2990,10 @@ D3D12_RenderPresent(SDL_Renderer * renderer)
             D3D12_RESOURCE_STATE_PRESENT,
             D3D12_RESOURCE_STATE_PRESENT,
             D3D12_RESOURCE_STATE_RENDER_TARGET
             D3D12_RESOURCE_STATE_RENDER_TARGET
             );
             );
+
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+        D3D12_XBOX_StartFrame(data->d3dDevice, &data->frameToken);
+#endif
     }
     }
 }
 }
 
 

+ 27 - 0
src/render/direct3d12/SDL_render_d3d12_xbox.cpp

@@ -0,0 +1,27 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(__XBOXONE__) || defined(__XBOXSERIES__))
+#include "SDL_render_d3d12_xbox.h"
+
+#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info."
+#endif

+ 22 - 0
src/render/direct3d12/SDL_render_d3d12_xbox.h

@@ -0,0 +1,22 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info."

+ 2 - 8
src/render/direct3d12/SDL_shaders_d3d12.c

@@ -20,11 +20,10 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED
+#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
-#define COBJMACROS
 #include "../../core/windows/SDL_windows.h"
 #include "../../core/windows/SDL_windows.h"
 #include <d3d12.h>
 #include <d3d12.h>
 
 
@@ -59,11 +58,6 @@
 
 
      xxd --include <FILE>
      xxd --include <FILE>
   */
   */
-#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
-#define D3D12_USE_SHADER_MODEL_4_0_level_9_3
-#else
-#define D3D12_USE_SHADER_MODEL_4_0_level_9_1
-#endif
 
 
 /* The color-only-rendering pixel shader:
 /* The color-only-rendering pixel shader:
 
 
@@ -6962,6 +6956,6 @@ void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECO
     outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size;
     outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size;
 }
 }
 
 
-#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED  && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 29 - 0
src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp

@@ -0,0 +1,29 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__)
+
+#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info."
+
+#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 29 - 0
src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp

@@ -0,0 +1,29 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__)
+
+#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info."
+
+#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 0
src/stdlib/SDL_malloc.c

@@ -487,7 +487,9 @@ DEFAULT_MMAP_THRESHOLD       default: 256K
 #endif /* WIN32 */
 #endif /* WIN32 */
 
 
 #ifdef WIN32
 #ifdef WIN32
+#ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
+#endif
 #include <windows.h>
 #include <windows.h>
 #define HAVE_MMAP 1
 #define HAVE_MMAP 1
 #define HAVE_MORECORE 0
 #define HAVE_MORECORE 0

+ 1 - 1
src/test/SDL_test_common.c

@@ -1196,7 +1196,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
                     }
                     }
                 }
                 }
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
                 /* Print the D3D9 adapter index */
                 /* Print the D3D9 adapter index */
                 adapterIndex = SDL_Direct3D9GetAdapterIndex( i );
                 adapterIndex = SDL_Direct3D9GetAdapterIndex( i );
                 SDL_Log("D3D9 Adapter Index: %d", adapterIndex);
                 SDL_Log("D3D9 Adapter Index: %d", adapterIndex);

+ 10 - 0
src/thread/SDL_systhread.h

@@ -28,6 +28,11 @@
 #include "SDL_thread.h"
 #include "SDL_thread.h"
 #include "SDL_thread_c.h"
 #include "SDL_thread_c.h"
 
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* This function creates a thread, passing args to SDL_RunThread(),
 /* This function creates a thread, passing args to SDL_RunThread(),
    saves a system-dependent thread id in thread->id, and returns 0
    saves a system-dependent thread id in thread->id, and returns 0
    on success.
    on success.
@@ -65,6 +70,11 @@ extern SDL_Thread *
 SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name,
 SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name,
                          const size_t stacksize, void *data);
                          const size_t stacksize, void *data);
 
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_systhread_h_ */
 #endif /* SDL_systhread_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
src/timer/windows/SDL_systimer.c

@@ -41,7 +41,7 @@ static LARGE_INTEGER ticks_per_second;
 static void
 static void
 SDL_SetSystemTimerResolution(const UINT uPeriod)
 SDL_SetSystemTimerResolution(const UINT uPeriod)
 {
 {
-#ifndef __WINRT__
+#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     static UINT timer_period = 0;
     static UINT timer_period = 0;
 
 
     if (uPeriod != timer_period) {
     if (uPeriod != timer_period) {

+ 1 - 1
src/video/SDL_video.c

@@ -4390,7 +4390,7 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
         retval = 0;
         retval = 0;
     }
     }
 #endif
 #endif
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (retval == -1 &&
     if (retval == -1 &&
         SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) &&
         SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) &&
         WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
         WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {

+ 1 - 1
src/video/windows/SDL_windowsclipboard.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"
 #include "SDL_windowswindow.h"
 #include "SDL_windowswindow.h"

+ 32 - 2
src/video/windows/SDL_windowsevents.c

@@ -265,6 +265,7 @@ WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam)
     return code;
     return code;
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 static SDL_bool
 static SDL_bool
 WIN_ShouldIgnoreFocusClick()
 WIN_ShouldIgnoreFocusClick()
 {
 {
@@ -460,6 +461,7 @@ WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus)
         data->in_window_deactivation = SDL_FALSE;
         data->in_window_deactivation = SDL_FALSE;
     }
     }
 }
 }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 static BOOL
 static BOOL
 WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text)
 WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text)
@@ -502,6 +504,7 @@ ShouldGenerateWindowCloseOnAltF4(void)
     return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE);
     return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE);
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 /* We want to generate mouse events from mouse and pen, and touch events from touchscreens */
 /* We want to generate mouse events from mouse and pen, and touch events from touchscreens */
 #define MI_WP_SIGNATURE         0xFF515700
 #define MI_WP_SIGNATURE         0xFF515700
 #define MI_WP_SIGNATURE_MASK    0xFFFFFF00
 #define MI_WP_SIGNATURE_MASK    0xFFFFFF00
@@ -532,6 +535,7 @@ static SDL_MOUSE_EVENT_SOURCE GetMouseMessageSource()
     }
     }
     return SDL_MOUSE_EVENT_SOURCE_MOUSE;
     return SDL_MOUSE_EVENT_SOURCE_MOUSE;
 }
 }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 static SDL_WindowData *
 static SDL_WindowData *
 WIN_GetWindowDataFromHWND(HWND hwnd)
 WIN_GetWindowDataFromHWND(HWND hwnd)
@@ -550,6 +554,7 @@ WIN_GetWindowDataFromHWND(HWND hwnd)
     return NULL;
     return NULL;
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 LRESULT CALLBACK
 LRESULT CALLBACK
 WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
 WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
 {
 {
@@ -635,6 +640,7 @@ static void WIN_CheckICMProfileChanged(SDL_Window* window)
         }
         }
     }
     }
 }
 }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 LRESULT CALLBACK
 LRESULT CALLBACK
 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -657,10 +663,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
 
     /* Get the window data for the window */
     /* Get the window data for the window */
     data = WIN_GetWindowDataFromHWND(hwnd);
     data = WIN_GetWindowDataFromHWND(hwnd);
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (!data) {
     if (!data) {
         /* Fallback */
         /* Fallback */
         data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
         data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
     }
     }
+#endif
     if (!data) {
     if (!data) {
         return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
         return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
     }
     }
@@ -677,8 +685,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     }
     }
 #endif /* WMMSG_DEBUG */
 #endif /* WMMSG_DEBUG */
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
     if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
         return 0;
         return 0;
+#endif
 
 
     switch (msg) {
     switch (msg) {
 
 
@@ -692,6 +702,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         }
         }
         break;
         break;
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     case WM_NCACTIVATE:
     case WM_NCACTIVATE:
         {
         {
             /* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */
             /* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */
@@ -941,6 +952,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
 
         returnCode = 0;
         returnCode = 0;
         break;
         break;
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
     case WM_KEYDOWN:
     case WM_KEYDOWN:
     case WM_SYSKEYDOWN:
     case WM_SYSKEYDOWN:
@@ -1022,6 +1034,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         returnCode = 0;
         returnCode = 0;
         break;
         break;
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 #ifdef WM_INPUTLANGCHANGE
 #ifdef WM_INPUTLANGCHANGE
     case WM_INPUTLANGCHANGE:
     case WM_INPUTLANGCHANGE:
         {
         {
@@ -1621,6 +1634,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             return 0;
             return 0;
         }
         }
         break;
         break;
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
     }
     }
 
 
     /* If there's a window proc, assume it's going to handle messages */
     /* If there's a window proc, assume it's going to handle messages */
@@ -1633,6 +1647,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     }
     }
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 static void WIN_UpdateClipCursorForWindows()
 static void WIN_UpdateClipCursorForWindows()
 {
 {
     SDL_VideoDevice *_this = SDL_GetVideoDevice();
     SDL_VideoDevice *_this = SDL_GetVideoDevice();
@@ -1679,6 +1694,7 @@ static void WIN_UpdateMouseCapture()
         }
         }
     }
     }
 }
 }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 /* A message hook called before TranslateMessage() */
 /* A message hook called before TranslateMessage() */
 static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;
 static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;
@@ -1736,11 +1752,13 @@ WIN_SendWakeupEvent(_THIS, SDL_Window *window)
 void
 void
 WIN_PumpEvents(_THIS)
 WIN_PumpEvents(_THIS)
 {
 {
-    const Uint8 *keystate;
     MSG msg;
     MSG msg;
     DWORD end_ticks = GetTickCount() + 1;
     DWORD end_ticks = GetTickCount() + 1;
     int new_messages = 0;
     int new_messages = 0;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
+    const Uint8 *keystate;
     SDL_Window *focusWindow;
     SDL_Window *focusWindow;
+#endif
 
 
     if (g_WindowsEnableMessageLoop) {
     if (g_WindowsEnableMessageLoop) {
         while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
         while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
@@ -1748,6 +1766,7 @@ WIN_PumpEvents(_THIS)
                 g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
                 g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
             }
             }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
             /* Don't dispatch any mouse motion queued prior to or including the last mouse warp */
             /* Don't dispatch any mouse motion queued prior to or including the last mouse warp */
             if (msg.message == WM_MOUSEMOVE && SDL_last_warp_time) {
             if (msg.message == WM_MOUSEMOVE && SDL_last_warp_time) {
                 if (!SDL_TICKS_PASSED(msg.time, (SDL_last_warp_time + 1))) {
                 if (!SDL_TICKS_PASSED(msg.time, (SDL_last_warp_time + 1))) {
@@ -1757,6 +1776,7 @@ WIN_PumpEvents(_THIS)
                 /* This mouse message happened after the warp */
                 /* This mouse message happened after the warp */
                 SDL_last_warp_time = 0;
                 SDL_last_warp_time = 0;
             }
             }
+#endif !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
             /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
             /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
             TranslateMessage(&msg);
             TranslateMessage(&msg);
@@ -1777,6 +1797,7 @@ WIN_PumpEvents(_THIS)
         }
         }
     }
     }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     /* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
     /* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
        You won't get a KEYUP until both are released, and that keyup will only be for the second
        You won't get a KEYUP until both are released, and that keyup will only be for the second
        key you released. Take heroic measures and check the keystate as of the last handled event,
        key you released. Take heroic measures and check the keystate as of the last handled event,
@@ -1807,6 +1828,7 @@ WIN_PumpEvents(_THIS)
 
 
     /* Update mouse capture */
     /* Update mouse capture */
     WIN_UpdateMouseCapture();
     WIN_UpdateMouseCapture();
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 #ifdef __GDK__
 #ifdef __GDK__
     GDK_DispatchTaskQueue();
     GDK_DispatchTaskQueue();
@@ -1821,8 +1843,10 @@ HINSTANCE SDL_Instance = NULL;
 
 
 static void WIN_CleanRegisterApp(WNDCLASSEX wcex)
 static void WIN_CleanRegisterApp(WNDCLASSEX wcex)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (wcex.hIcon) DestroyIcon(wcex.hIcon);
     if (wcex.hIcon) DestroyIcon(wcex.hIcon);
     if (wcex.hIconSm) DestroyIcon(wcex.hIconSm);
     if (wcex.hIconSm) DestroyIcon(wcex.hIconSm);
+#endif
     SDL_free(SDL_Appname);
     SDL_free(SDL_Appname);
     SDL_Appname = NULL;
     SDL_Appname = NULL;
 }
 }
@@ -1831,9 +1855,11 @@ static void WIN_CleanRegisterApp(WNDCLASSEX wcex)
 int
 int
 SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
 SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
 {
 {
-    const char *hint;
     WNDCLASSEX wcex;
     WNDCLASSEX wcex;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
+    const char *hint;
     TCHAR path[MAX_PATH];
     TCHAR path[MAX_PATH];
+#endif
 
 
     /* Only do this once... */
     /* Only do this once... */
     if (app_registered) {
     if (app_registered) {
@@ -1865,6 +1891,7 @@ SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
     wcex.cbClsExtra     = 0;
     wcex.cbClsExtra     = 0;
     wcex.cbWndExtra     = 0;
     wcex.cbWndExtra     = 0;
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON);
     hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON);
     if (hint && *hint) {
     if (hint && *hint) {
         wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint)));
         wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint)));
@@ -1878,6 +1905,7 @@ SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
         GetModuleFileName(SDL_Instance, path, MAX_PATH);
         GetModuleFileName(SDL_Instance, path, MAX_PATH);
         ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1);
         ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1);
     }
     }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
     if (!RegisterClassEx(&wcex)) {
     if (!RegisterClassEx(&wcex)) {
         WIN_CleanRegisterApp(wcex);
         WIN_CleanRegisterApp(wcex);
@@ -1904,9 +1932,11 @@ SDL_UnregisterApp()
         wcex.hIcon = NULL;
         wcex.hIcon = NULL;
         wcex.hIconSm = NULL;
         wcex.hIconSm = NULL;
         /* Check for any registered window classes. */
         /* Check for any registered window classes. */
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
         if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) {
         if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) {
             UnregisterClass(SDL_Appname, SDL_Instance);
             UnregisterClass(SDL_Appname, SDL_Instance);
         }
         }
+#endif
         WIN_CleanRegisterApp(wcex);
         WIN_CleanRegisterApp(wcex);
     }
     }
 }
 }

+ 1 - 1
src/video/windows/SDL_windowsframebuffer.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"
 
 

+ 1 - 1
src/video/windows/SDL_windowskeyboard.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"
 #include "SDL_hints.h"
 #include "SDL_hints.h"

+ 1 - 1
src/video/windows/SDL_windowsmessagebox.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #ifdef HAVE_LIMITS_H
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #include <limits.h>

+ 1 - 1
src/video/windows/SDL_windowsmodes.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"
 #include "../../events/SDL_displayevents_c.h"
 #include "../../events/SDL_displayevents_c.h"

+ 1 - 1
src/video/windows/SDL_windowsmouse.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"
 
 

+ 1 - 1
src/video/windows/SDL_windowsopengl.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_loadso.h"
 #include "SDL_loadso.h"
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"

+ 1 - 1
src/video/windows/SDL_windowsopengles.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL
+#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsopengles.h"
 #include "SDL_windowsopengles.h"

+ 1 - 1
src/video/windows/SDL_windowsshape.c

@@ -20,7 +20,7 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#if SDL_VIDEO_DRIVER_WINDOWS
+#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 
 #include "SDL_windowsshape.h"
 #include "SDL_windowsshape.h"
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsvideo.h"

+ 57 - 0
src/video/windows/SDL_windowsvideo.c

@@ -65,6 +65,7 @@ UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const
     }
     }
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 static void WIN_SuspendScreenSaver(_THIS)
 static void WIN_SuspendScreenSaver(_THIS)
 {
 {
     if (_this->suspend_screensaver) {
     if (_this->suspend_screensaver) {
@@ -73,6 +74,11 @@ static void WIN_SuspendScreenSaver(_THIS)
         SetThreadExecutionState(ES_CONTINUOUS);
         SetThreadExecutionState(ES_CONTINUOUS);
     }
     }
 }
 }
+#endif
+
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+extern void D3D12_XBOX_GetResolution(Uint32 *width, Uint32 *height);
+#endif
 
 
 
 
 /* Windows driver bootstrap functions */
 /* Windows driver bootstrap functions */
@@ -83,12 +89,14 @@ WIN_DeleteDevice(SDL_VideoDevice * device)
     SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
     SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
 
 
     SDL_UnregisterApp();
     SDL_UnregisterApp();
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     if (data->userDLL) {
     if (data->userDLL) {
         SDL_UnloadObject(data->userDLL);
         SDL_UnloadObject(data->userDLL);
     }
     }
     if (data->shcoreDLL) {
     if (data->shcoreDLL) {
         SDL_UnloadObject(data->shcoreDLL);
         SDL_UnloadObject(data->shcoreDLL);
     }
     }
+#endif
     if (device->wakeup_lock) {
     if (device->wakeup_lock) {
         SDL_DestroyMutex(device->wakeup_lock);
         SDL_DestroyMutex(device->wakeup_lock);
     }
     }
@@ -119,6 +127,7 @@ WIN_CreateDevice(int devindex)
     device->driverdata = data;
     device->driverdata = data;
     device->wakeup_lock = SDL_CreateMutex();
     device->wakeup_lock = SDL_CreateMutex();
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     data->userDLL = SDL_LoadObject("USER32.DLL");
     data->userDLL = SDL_LoadObject("USER32.DLL");
     if (data->userDLL) {
     if (data->userDLL) {
         data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
         data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
@@ -145,19 +154,24 @@ WIN_CreateDevice(int devindex)
     } else {
     } else {
         SDL_ClearError();
         SDL_ClearError();
     }
     }
+#endif /* #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */
 
 
     /* Set the function pointers */
     /* Set the function pointers */
     device->VideoInit = WIN_VideoInit;
     device->VideoInit = WIN_VideoInit;
     device->VideoQuit = WIN_VideoQuit;
     device->VideoQuit = WIN_VideoQuit;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     device->GetDisplayBounds = WIN_GetDisplayBounds;
     device->GetDisplayBounds = WIN_GetDisplayBounds;
     device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds;
     device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds;
     device->GetDisplayDPI = WIN_GetDisplayDPI;
     device->GetDisplayDPI = WIN_GetDisplayDPI;
     device->GetDisplayModes = WIN_GetDisplayModes;
     device->GetDisplayModes = WIN_GetDisplayModes;
     device->SetDisplayMode = WIN_SetDisplayMode;
     device->SetDisplayMode = WIN_SetDisplayMode;
+#endif
     device->PumpEvents = WIN_PumpEvents;
     device->PumpEvents = WIN_PumpEvents;
     device->WaitEventTimeout = WIN_WaitEventTimeout;
     device->WaitEventTimeout = WIN_WaitEventTimeout;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     device->SendWakeupEvent = WIN_SendWakeupEvent;
     device->SendWakeupEvent = WIN_SendWakeupEvent;
     device->SuspendScreenSaver = WIN_SuspendScreenSaver;
     device->SuspendScreenSaver = WIN_SuspendScreenSaver;
+#endif
 
 
     device->CreateSDLWindow = WIN_CreateWindow;
     device->CreateSDLWindow = WIN_CreateWindow;
     device->CreateSDLWindowFrom = WIN_CreateWindowFrom;
     device->CreateSDLWindowFrom = WIN_CreateWindowFrom;
@@ -177,14 +191,17 @@ WIN_CreateDevice(int devindex)
     device->SetWindowResizable = WIN_SetWindowResizable;
     device->SetWindowResizable = WIN_SetWindowResizable;
     device->SetWindowAlwaysOnTop = WIN_SetWindowAlwaysOnTop;
     device->SetWindowAlwaysOnTop = WIN_SetWindowAlwaysOnTop;
     device->SetWindowFullscreen = WIN_SetWindowFullscreen;
     device->SetWindowFullscreen = WIN_SetWindowFullscreen;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     device->SetWindowGammaRamp = WIN_SetWindowGammaRamp;
     device->SetWindowGammaRamp = WIN_SetWindowGammaRamp;
     device->GetWindowICCProfile = WIN_GetWindowICCProfile;
     device->GetWindowICCProfile = WIN_GetWindowICCProfile;
     device->GetWindowGammaRamp = WIN_GetWindowGammaRamp;
     device->GetWindowGammaRamp = WIN_GetWindowGammaRamp;
     device->SetWindowMouseRect = WIN_SetWindowMouseRect;
     device->SetWindowMouseRect = WIN_SetWindowMouseRect;
     device->SetWindowMouseGrab = WIN_SetWindowMouseGrab;
     device->SetWindowMouseGrab = WIN_SetWindowMouseGrab;
     device->SetWindowKeyboardGrab = WIN_SetWindowKeyboardGrab;
     device->SetWindowKeyboardGrab = WIN_SetWindowKeyboardGrab;
+#endif
     device->DestroyWindow = WIN_DestroyWindow;
     device->DestroyWindow = WIN_DestroyWindow;
     device->GetWindowWMInfo = WIN_GetWindowWMInfo;
     device->GetWindowWMInfo = WIN_GetWindowWMInfo;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer;
     device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer;
     device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;
     device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;
     device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer;
     device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer;
@@ -196,6 +213,7 @@ WIN_CreateDevice(int devindex)
     device->shape_driver.CreateShaper = Win32_CreateShaper;
     device->shape_driver.CreateShaper = Win32_CreateShaper;
     device->shape_driver.SetWindowShape = Win32_SetWindowShape;
     device->shape_driver.SetWindowShape = Win32_SetWindowShape;
     device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape;
     device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape;
+#endif
 
 
 #if SDL_VIDEO_OPENGL_WGL
 #if SDL_VIDEO_OPENGL_WGL
     device->GL_LoadLibrary = WIN_GL_LoadLibrary;
     device->GL_LoadLibrary = WIN_GL_LoadLibrary;
@@ -229,6 +247,7 @@ WIN_CreateDevice(int devindex)
     device->Vulkan_GetDrawableSize = WIN_GL_GetDrawableSize;
     device->Vulkan_GetDrawableSize = WIN_GL_GetDrawableSize;
 #endif
 #endif
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     device->StartTextInput = WIN_StartTextInput;
     device->StartTextInput = WIN_StartTextInput;
     device->StopTextInput = WIN_StopTextInput;
     device->StopTextInput = WIN_StopTextInput;
     device->SetTextInputRect = WIN_SetTextInputRect;
     device->SetTextInputRect = WIN_SetTextInputRect;
@@ -238,6 +257,7 @@ WIN_CreateDevice(int devindex)
     device->SetClipboardText = WIN_SetClipboardText;
     device->SetClipboardText = WIN_SetClipboardText;
     device->GetClipboardText = WIN_GetClipboardText;
     device->GetClipboardText = WIN_GetClipboardText;
     device->HasClipboardText = WIN_HasClipboardText;
     device->HasClipboardText = WIN_HasClipboardText;
+#endif
 
 
     device->free = WIN_DeleteDevice;
     device->free = WIN_DeleteDevice;
 
 
@@ -252,6 +272,7 @@ VideoBootStrap WINDOWS_bootstrap = {
 static BOOL
 static BOOL
 WIN_DeclareDPIAwareUnaware(_THIS)
 WIN_DeclareDPIAwareUnaware(_THIS)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     SDL_VideoData* data = (SDL_VideoData*)_this->driverdata;
     SDL_VideoData* data = (SDL_VideoData*)_this->driverdata;
 
 
     if (data->SetProcessDpiAwarenessContext) {
     if (data->SetProcessDpiAwarenessContext) {
@@ -260,12 +281,14 @@ WIN_DeclareDPIAwareUnaware(_THIS)
         /* Windows 8.1 */
         /* Windows 8.1 */
         return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_DPI_UNAWARE));
         return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_DPI_UNAWARE));
     }
     }
+#endif
     return FALSE;
     return FALSE;
 }
 }
 
 
 static BOOL
 static BOOL
 WIN_DeclareDPIAwareSystem(_THIS)
 WIN_DeclareDPIAwareSystem(_THIS)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     SDL_VideoData* data = (SDL_VideoData*)_this->driverdata;
     SDL_VideoData* data = (SDL_VideoData*)_this->driverdata;
 
 
     if (data->SetProcessDpiAwarenessContext) {
     if (data->SetProcessDpiAwarenessContext) {
@@ -278,12 +301,14 @@ WIN_DeclareDPIAwareSystem(_THIS)
         /* Windows Vista */
         /* Windows Vista */
         return data->SetProcessDPIAware();
         return data->SetProcessDPIAware();
     }
     }
+#endif
     return FALSE;
     return FALSE;
 }
 }
 
 
 static BOOL
 static BOOL
 WIN_DeclareDPIAwarePerMonitor(_THIS)
 WIN_DeclareDPIAwarePerMonitor(_THIS)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
 
 
     if (data->SetProcessDpiAwarenessContext) {
     if (data->SetProcessDpiAwarenessContext) {
@@ -296,12 +321,16 @@ WIN_DeclareDPIAwarePerMonitor(_THIS)
         /* Older OS: fall back to system DPI aware */
         /* Older OS: fall back to system DPI aware */
         return WIN_DeclareDPIAwareSystem(_this);
         return WIN_DeclareDPIAwareSystem(_this);
     }
     }
+#endif
     return FALSE;
     return FALSE;
 }
 }
 
 
 static BOOL
 static BOOL
 WIN_DeclareDPIAwarePerMonitorV2(_THIS)
 WIN_DeclareDPIAwarePerMonitorV2(_THIS)
 {
 {
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    return FALSE;
+#else
     SDL_VideoData* data = (SDL_VideoData*)_this->driverdata;
     SDL_VideoData* data = (SDL_VideoData*)_this->driverdata;
 
 
     /* Declare DPI aware (may have been done in external code or a manifest, as well) */
     /* Declare DPI aware (may have been done in external code or a manifest, as well) */
@@ -332,6 +361,7 @@ WIN_DeclareDPIAwarePerMonitorV2(_THIS)
         /* Older OS: fall back to per-monitor (or system) */
         /* Older OS: fall back to per-monitor (or system) */
         return WIN_DeclareDPIAwarePerMonitor(_this);
         return WIN_DeclareDPIAwarePerMonitor(_this);
     }
     }
+#endif
 }
 }
 
 
 #ifdef HIGHDPI_DEBUG
 #ifdef HIGHDPI_DEBUG
@@ -402,17 +432,38 @@ WIN_VideoInit(_THIS)
     SDL_Log("DPI awareness: %s", WIN_GetDPIAwareness(_this));
     SDL_Log("DPI awareness: %s", WIN_GetDPIAwareness(_this));
 #endif
 #endif
 
 
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    /* For Xbox, we just need to create the single display */
+    {
+        SDL_VideoDisplay display;
+        SDL_DisplayMode current_mode;
+
+        SDL_zero(current_mode);
+        D3D12_XBOX_GetResolution(&current_mode.w, &current_mode.h);
+        current_mode.refresh_rate = 60;
+        current_mode.format = SDL_PIXELFORMAT_ARGB8888;
+
+        SDL_zero(display);
+        display.desktop_mode = current_mode;
+        display.current_mode = current_mode;
+        
+        SDL_AddVideoDisplay(&display, SDL_FALSE);
+    }
+#else /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
     if (WIN_InitModes(_this) < 0) {
     if (WIN_InitModes(_this) < 0) {
         return -1;
         return -1;
     }
     }
 
 
     WIN_InitKeyboard(_this);
     WIN_InitKeyboard(_this);
     WIN_InitMouse(_this);
     WIN_InitMouse(_this);
+#endif
 
 
     SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, UpdateWindowsEnableMessageLoop, NULL);
     SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, UpdateWindowsEnableMessageLoop, NULL);
     SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL);
     SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL);
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     data->_SDL_WAKEUP = RegisterWindowMessageA("_SDL_WAKEUP");
     data->_SDL_WAKEUP = RegisterWindowMessageA("_SDL_WAKEUP");
+#endif
 
 
     return 0;
     return 0;
 }
 }
@@ -420,12 +471,15 @@ WIN_VideoInit(_THIS)
 void
 void
 WIN_VideoQuit(_THIS)
 WIN_VideoQuit(_THIS)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     WIN_QuitModes(_this);
     WIN_QuitModes(_this);
     WIN_QuitKeyboard(_this);
     WIN_QuitKeyboard(_this);
     WIN_QuitMouse(_this);
     WIN_QuitMouse(_this);
+#endif
 }
 }
 
 
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 #define D3D_DEBUG_INFO
 #define D3D_DEBUG_INFO
 #include <d3d9.h>
 #include <d3d9.h>
 
 
@@ -526,6 +580,7 @@ SDL_Direct3D9GetAdapterIndex(int displayIndex)
         return adapterIndex;
         return adapterIndex;
     }
     }
 }
 }
+#endif /* !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */
 
 
 #if HAVE_DXGI_H
 #if HAVE_DXGI_H
 #define CINTERFACE
 #define CINTERFACE
@@ -640,6 +695,7 @@ SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
 SDL_bool
 SDL_bool
 WIN_IsPerMonitorV2DPIAware(_THIS)
 WIN_IsPerMonitorV2DPIAware(_THIS)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     SDL_VideoData* data = (SDL_VideoData*) _this->driverdata;
     SDL_VideoData* data = (SDL_VideoData*) _this->driverdata;
     
     
     if (data->AreDpiAwarenessContextsEqual && data->GetThreadDpiAwarenessContext) {
     if (data->AreDpiAwarenessContextsEqual && data->GetThreadDpiAwarenessContext) {
@@ -647,6 +703,7 @@ WIN_IsPerMonitorV2DPIAware(_THIS)
         return (SDL_bool)data->AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2,
         return (SDL_bool)data->AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2,
                                                             data->GetThreadDpiAwarenessContext());
                                                             data->GetThreadDpiAwarenessContext());
     }
     }
+#endif
     return SDL_FALSE;
     return SDL_FALSE;
 }
 }
 
 

+ 11 - 1
src/video/windows/SDL_windowsvideo.h

@@ -27,7 +27,7 @@
 
 
 #include "../SDL_sysvideo.h"
 #include "../SDL_sysvideo.h"
 
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1500)
+#if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 #include <msctf.h>
 #include <msctf.h>
 #else
 #else
 #include "SDL_msctf.h"
 #include "SDL_msctf.h"
@@ -41,11 +41,15 @@
 
 
 #include "SDL_windowsclipboard.h"
 #include "SDL_windowsclipboard.h"
 #include "SDL_windowsevents.h"
 #include "SDL_windowsevents.h"
+
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 #include "SDL_windowskeyboard.h"
 #include "SDL_windowskeyboard.h"
 #include "SDL_windowsmodes.h"
 #include "SDL_windowsmodes.h"
 #include "SDL_windowsmouse.h"
 #include "SDL_windowsmouse.h"
 #include "SDL_windowsopengl.h"
 #include "SDL_windowsopengl.h"
 #include "SDL_windowsopengles.h"
 #include "SDL_windowsopengles.h"
+#endif
+
 #include "SDL_windowswindow.h"
 #include "SDL_windowswindow.h"
 #include "SDL_events.h"
 #include "SDL_events.h"
 #include "SDL_loadso.h"
 #include "SDL_loadso.h"
@@ -330,6 +334,7 @@ typedef struct
     void *data;
     void *data;
 } TSFSink;
 } TSFSink;
 
 
+#ifndef SDL_DISABLE_WINDOWS_IME
 /* Definition from Win98DDK version of IMM.H */
 /* Definition from Win98DDK version of IMM.H */
 typedef struct tagINPUTCONTEXT2 {
 typedef struct tagINPUTCONTEXT2 {
     HWND hWnd;
     HWND hWnd;
@@ -353,6 +358,7 @@ typedef struct tagINPUTCONTEXT2 {
     DWORD fdwInit;
     DWORD fdwInit;
     DWORD dwReserve[3];
     DWORD dwReserve[3];
 } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
 } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
+#endif /* !SDL_DISABLE_WINDOWS_IME */
 
 
 /* Private display data */
 /* Private display data */
 
 
@@ -362,6 +368,7 @@ typedef struct SDL_VideoData
 
 
     DWORD clipboard_count;
     DWORD clipboard_count;
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Xbox doesn't support user32/shcore*/
     /* Touch input functions */
     /* Touch input functions */
     void* userDLL;
     void* userDLL;
     BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
     BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
@@ -384,9 +391,11 @@ typedef struct SDL_VideoData
                                         UINT             *dpiX,
                                         UINT             *dpiX,
                                         UINT             *dpiY );
                                         UINT             *dpiY );
     HRESULT (WINAPI *SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS dpiAwareness);
     HRESULT (WINAPI *SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS dpiAwareness);
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
     SDL_bool dpi_scaling_enabled;
     SDL_bool dpi_scaling_enabled;
 
 
+ #ifndef SDL_DISABLE_WINDOWS_IME
     SDL_bool ime_com_initialized;
     SDL_bool ime_com_initialized;
     struct ITfThreadMgr *ime_threadmgr;
     struct ITfThreadMgr *ime_threadmgr;
     SDL_bool ime_initialized;
     SDL_bool ime_initialized;
@@ -435,6 +444,7 @@ typedef struct SDL_VideoData
     TSFSink *ime_uielemsink;
     TSFSink *ime_uielemsink;
     TSFSink *ime_ippasink;
     TSFSink *ime_ippasink;
     LONG ime_uicontext;
     LONG ime_uicontext;
+#endif /* !SDL_DISABLE_WINDOWS_IME */
 
 
     BYTE pre_hook_key_state[256];
     BYTE pre_hook_key_state[256];
     UINT _SDL_WAKEUP;
     UINT _SDL_WAKEUP;

+ 71 - 2
src/video/windows/SDL_windowswindow.c

@@ -125,8 +125,10 @@ WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x
 {
 {
     SDL_VideoData* videodata = SDL_GetVideoDevice() ? SDL_GetVideoDevice()->driverdata : NULL;
     SDL_VideoData* videodata = SDL_GetVideoDevice() ? SDL_GetVideoDevice()->driverdata : NULL;
     RECT rect;
     RECT rect;
-    int dpi;
+    int dpi = 96;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     UINT frame_dpi;
     UINT frame_dpi;
+#endif
 
 
     /* Client rect, in SDL screen coordinates */
     /* Client rect, in SDL screen coordinates */
     *x = (use_current ? window->x : window->windowed.x);
     *x = (use_current ? window->x : window->windowed.x);
@@ -135,7 +137,9 @@ WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x
     *height = (use_current ? window->h : window->windowed.h);
     *height = (use_current ? window->h : window->windowed.h);
 
 
     /* Convert client rect from SDL coordinates to pixels (no-op if DPI scaling not enabled) */
     /* Convert client rect from SDL coordinates to pixels (no-op if DPI scaling not enabled) */
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     WIN_ScreenPointFromSDL(x, y, &dpi);
     WIN_ScreenPointFromSDL(x, y, &dpi);
+#endif
     /* Note, use the guessed DPI returned from WIN_ScreenPointFromSDL rather than the cached one in
     /* Note, use the guessed DPI returned from WIN_ScreenPointFromSDL rather than the cached one in
        data->scaling_dpi.
        data->scaling_dpi.
 
 
@@ -158,6 +162,9 @@ WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x
        expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
        expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
      */
      */
     if (!(window->flags & SDL_WINDOW_BORDERLESS)) {
     if (!(window->flags & SDL_WINDOW_BORDERLESS)) {
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+        AdjustWindowRectEx(&rect, style, menu, 0);
+#else
         if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) {
         if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) {
             /* With per-monitor v2, the window border/titlebar size depend on the DPI, so we need to call AdjustWindowRectExForDpi instead of 
             /* With per-monitor v2, the window border/titlebar size depend on the DPI, so we need to call AdjustWindowRectExForDpi instead of 
                AdjustWindowRectEx. */
                AdjustWindowRectEx. */
@@ -180,7 +187,8 @@ WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x
             videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, frame_dpi);
             videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, frame_dpi);
         } else {
         } else {
             AdjustWindowRectEx(&rect, style, menu, 0);
             AdjustWindowRectEx(&rect, style, menu, 0);
-        }
+        }  
+#endif
     }
     }
 
 
     /* Final rect in Windows screen space, including the frame */
     /* Final rect in Windows screen space, including the frame */
@@ -208,7 +216,11 @@ WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height
     BOOL menu;
     BOOL menu;
 
 
     style = GetWindowLong(hwnd, GWL_STYLE);
     style = GetWindowLong(hwnd, GWL_STYLE);
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    menu = FALSE;
+#else
     menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
     menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
+#endif
     WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current);
     WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current);
 }
 }
 
 
@@ -245,6 +257,9 @@ WIN_MouseRelativeModeCenterChanged(void *userdata, const char *name, const char
 static int
 static int
 WIN_GetScalingDPIForHWND(const SDL_VideoData *videodata, HWND hwnd)
 WIN_GetScalingDPIForHWND(const SDL_VideoData *videodata, HWND hwnd)
 {
 {
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    return 96;
+#else
     /* DPI scaling not requested? */
     /* DPI scaling not requested? */
     if (!videodata->dpi_scaling_enabled) {
     if (!videodata->dpi_scaling_enabled) {
         return 96;
         return 96;
@@ -277,6 +292,7 @@ WIN_GetScalingDPIForHWND(const SDL_VideoData *videodata, HWND hwnd)
         }
         }
         return 96;
         return 96;
     }
     }
+#endif
 }
 }
 
 
 static int
 static int
@@ -293,7 +309,9 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre
     data->window = window;
     data->window = window;
     data->hwnd = hwnd;
     data->hwnd = hwnd;
     data->parent = parent;
     data->parent = parent;
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 
     data->hdc = GetDC(hwnd);
     data->hdc = GetDC(hwnd);
+#endif
     data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
     data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
     data->created = created;
     data->created = created;
     data->high_surrogate = 0;
     data->high_surrogate = 0;
@@ -311,12 +329,14 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre
 
 
     window->driverdata = data;
     window->driverdata = data;
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 
     /* Associate the data with the window */
     /* Associate the data with the window */
     if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
     if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
         ReleaseDC(hwnd, data->hdc);
         ReleaseDC(hwnd, data->hdc);
         SDL_free(data);
         SDL_free(data);
         return WIN_SetError("SetProp() failed");
         return WIN_SetError("SetProp() failed");
     }
     }
+#endif
 
 
     /* Set up the window proc function */
     /* Set up the window proc function */
 #ifdef GWLP_WNDPROC
 #ifdef GWLP_WNDPROC
@@ -357,6 +377,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre
             }
             }
         }
         }
     }
     }
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 
     {
     {
         POINT point;
         POINT point;
         point.x = 0;
         point.x = 0;
@@ -369,6 +390,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre
             window->y = y;
             window->y = y;
         }
         }
     }
     }
+#endif
     {
     {
         DWORD style = GetWindowLong(hwnd, GWL_STYLE);
         DWORD style = GetWindowLong(hwnd, GWL_STYLE);
         if (style & WS_VISIBLE) {
         if (style & WS_VISIBLE) {
@@ -403,16 +425,22 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre
             window->flags &= ~SDL_WINDOW_MINIMIZED;
             window->flags &= ~SDL_WINDOW_MINIMIZED;
         }
         }
     }
     }
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    window->flags |= SDL_WINDOW_INPUT_FOCUS;
+#else
     if (GetFocus() == hwnd) {
     if (GetFocus() == hwnd) {
         window->flags |= SDL_WINDOW_INPUT_FOCUS;
         window->flags |= SDL_WINDOW_INPUT_FOCUS;
         SDL_SetKeyboardFocus(window);
         SDL_SetKeyboardFocus(window);
         WIN_UpdateClipCursor(window);
         WIN_UpdateClipCursor(window);
     }
     }
+#endif
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     /* Enable multi-touch */
     /* Enable multi-touch */
     if (videodata->RegisterTouchWindow) {
     if (videodata->RegisterTouchWindow) {
         videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM));
         videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM));
     }
     }
+#endif
 
 
     /* Force the SDL_WINDOW_ALLOW_HIGHDPI window flag if we are doing DPI scaling */
     /* Force the SDL_WINDOW_ALLOW_HIGHDPI window flag if we are doing DPI scaling */
     if (videodata->dpi_scaling_enabled) {
     if (videodata->dpi_scaling_enabled) {
@@ -432,11 +460,13 @@ static void CleanupWindowData(_THIS, SDL_Window * window)
     if (data) {
     if (data) {
         SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data);
         SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data);
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
         if (data->keyboard_hook) {
         if (data->keyboard_hook) {
             UnhookWindowsHookEx(data->keyboard_hook);
             UnhookWindowsHookEx(data->keyboard_hook);
         }
         }
         ReleaseDC(data->hwnd, data->hdc);
         ReleaseDC(data->hwnd, data->hdc);
         RemoveProp(data->hwnd, TEXT("SDL_WindowData"));
         RemoveProp(data->hwnd, TEXT("SDL_WindowData"));
+#endif
         if (data->created) {
         if (data->created) {
             DestroyWindow(data->hwnd);
             DestroyWindow(data->hwnd);
             if (data->parent) {
             if (data->parent) {
@@ -538,6 +568,9 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
 int
 int
 WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
 WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
 {
 {
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    return -1;
+#else
     HWND hwnd = (HWND) data;
     HWND hwnd = (HWND) data;
     LPTSTR title;
     LPTSTR title;
     int titleLen;
     int titleLen;
@@ -589,20 +622,24 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
     }
     }
 #endif
 #endif
     return 0;
     return 0;
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 }
 }
 
 
 void
 void
 WIN_SetWindowTitle(_THIS, SDL_Window * window)
 WIN_SetWindowTitle(_THIS, SDL_Window * window)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     LPTSTR title = WIN_UTF8ToString(window->title);
     LPTSTR title = WIN_UTF8ToString(window->title);
     SetWindowText(hwnd, title);
     SetWindowText(hwnd, title);
     SDL_free(title);
     SDL_free(title);
+#endif
 }
 }
 
 
 void
 void
 WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
 WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     HICON hicon = NULL;
     HICON hicon = NULL;
     BYTE *icon_bmp;
     BYTE *icon_bmp;
@@ -654,6 +691,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
 
 
     /* Set the icon in the task manager (should we do this?) */
     /* Set the icon in the task manager (should we do this?) */
     SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
     SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
+#endif
 }
 }
 
 
 void
 void
@@ -674,6 +712,21 @@ WIN_SetWindowSize(_THIS, SDL_Window * window)
 int
 int
 WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right)
 WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right)
 {
 {
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+    RECT rcClient;
+
+    /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left
+     * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */
+    GetClientRect(hwnd, &rcClient);
+
+    *top = rcClient.top;
+    *left = rcClient.left;
+    *bottom = rcClient.bottom;
+    *right = rcClient.right;
+
+    return 0;
+#else /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     RECT rcClient, rcWindow;
     RECT rcClient, rcWindow;
     POINT ptDiff;
     POINT ptDiff;
@@ -712,6 +765,7 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b
     *right  = rcWindow.right  - rcClient.right;
     *right  = rcWindow.right  - rcClient.right;
 
 
     return 0;
     return 0;
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 }
 }
 
 
 void
 void
@@ -740,6 +794,7 @@ WIN_HideWindow(_THIS, SDL_Window * window)
 void
 void
 WIN_RaiseWindow(_THIS, SDL_Window * window)
 WIN_RaiseWindow(_THIS, SDL_Window * window)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
     /* If desired, raise the window more forcefully.
     /* If desired, raise the window more forcefully.
      * Technique taken from http://stackoverflow.com/questions/916259/ .
      * Technique taken from http://stackoverflow.com/questions/916259/ .
      * Specifically, http://stackoverflow.com/a/34414846 .
      * Specifically, http://stackoverflow.com/a/34414846 .
@@ -772,6 +827,7 @@ WIN_RaiseWindow(_THIS, SDL_Window * window)
         SetFocus(hwnd);
         SetFocus(hwnd);
         SetActiveWindow(hwnd);
         SetActiveWindow(hwnd);
     }
     }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 }
 }
 
 
 void
 void
@@ -850,6 +906,7 @@ WIN_RestoreWindow(_THIS, SDL_Window * window)
 void
 void
 WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
 WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
 {
 {
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 
     SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
     SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     HWND hwnd = data->hwnd;
     HWND hwnd = data->hwnd;
@@ -932,8 +989,11 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display,
 #ifdef HIGHDPI_DEBUG
 #ifdef HIGHDPI_DEBUG
     SDL_Log("WIN_SetWindowFullscreen: %d finished. Set window to %d,%d, %dx%d", (int)fullscreen, x, y, w, h);
     SDL_Log("WIN_SetWindowFullscreen: %d finished. Set window to %d,%d, %dx%d", (int)fullscreen, x, y, w, h);
 #endif
 #endif
+
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 int
 int
 WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
 WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
 {
 {
@@ -1063,6 +1123,7 @@ WIN_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
         WIN_UngrabKeyboard(window);
         WIN_UngrabKeyboard(window);
     }
     }
 }
 }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 void
 void
 WIN_DestroyWindow(_THIS, SDL_Window * window)
 WIN_DestroyWindow(_THIS, SDL_Window * window)
@@ -1165,6 +1226,7 @@ SDL_HelperWindowDestroy(void)
     }
     }
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 void WIN_OnWindowEnter(_THIS, SDL_Window * window)
 void WIN_OnWindowEnter(_THIS, SDL_Window * window)
 {
 {
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
@@ -1277,10 +1339,14 @@ WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
 {
 {
     return 0;  /* just succeed, the real work is done elsewhere. */
     return 0;  /* just succeed, the real work is done elsewhere. */
 }
 }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 int
 int
 WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
 WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
 {
 {
+#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
+    return -1;
+#else
     const SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     const SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     const HWND hwnd = data->hwnd;
     const HWND hwnd = data->hwnd;
     const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
     const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
@@ -1309,6 +1375,7 @@ WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
     }
     }
 
 
     return 0;
     return 0;
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 }
 }
 
 
 /**
 /**
@@ -1366,6 +1433,7 @@ WIN_ClientPointFromSDL(const SDL_Window *window, int *x, int *y)
     *y = MulDiv(*y, data->scaling_dpi, 96);
     *y = MulDiv(*y, data->scaling_dpi, 96);
 }
 }
 
 
+#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 void
 void
 WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept)
 WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept)
 {
 {
@@ -1400,6 +1468,7 @@ WIN_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation)
 
 
     return 0;
     return 0;
 }
 }
+#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
 
 
 #endif /* SDL_VIDEO_DRIVER_WINDOWS */
 #endif /* SDL_VIDEO_DRIVER_WINDOWS */
 
 

+ 2 - 0
src/video/windows/SDL_windowswindow.h

@@ -25,6 +25,8 @@
 
 
 #if SDL_VIDEO_OPENGL_EGL   
 #if SDL_VIDEO_OPENGL_EGL   
 #include "../SDL_egl_c.h"
 #include "../SDL_egl_c.h"
+#else
+#include "../SDL_sysvideo.h"
 #endif
 #endif
 
 
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */