diff --git a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj
index bf351e0b9..b325cd0b9 100644
--- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj
+++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj
@@ -234,6 +234,7 @@
+
@@ -333,6 +334,7 @@
+
diff --git a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters
index 7dabdc364..f52e56bf8 100644
--- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters
+++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters
@@ -357,6 +357,9 @@
Source Files
+
+ Source Files
+
@@ -644,5 +647,8 @@
Source Files
+
+ Source Files
+
\ No newline at end of file
diff --git a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
index 37937f3e3..ae13b9ccc 100644
--- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
+++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
@@ -100,6 +100,7 @@
+
@@ -204,7 +205,7 @@
-
+
diff --git a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
index 39c4331bc..b0e044d51 100644
--- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
+++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
@@ -381,6 +381,9 @@
Source Files
+
+ Source Files
+
@@ -485,9 +488,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -683,5 +683,8 @@
Source Files
+
+ Source Files
+
\ No newline at end of file
diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h
index 74ebfbcf2..d70a0bcd6 100644
--- a/include/SDL_config_winrt.h
+++ b/include/SDL_config_winrt.h
@@ -78,7 +78,9 @@ typedef unsigned int uintptr_t;
/* Useful headers */
#define HAVE_DXGI_H 1
+#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
#define HAVE_XINPUT_H 1
+#endif
#define HAVE_LIBC 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
diff --git a/src/core/windows/SDL_xinput.c b/src/core/windows/SDL_xinput.c
index 9b2a54fef..9dcac3644 100644
--- a/src/core/windows/SDL_xinput.c
+++ b/src/core/windows/SDL_xinput.c
@@ -35,6 +35,40 @@ static HANDLE s_pXInputDLL = 0;
static int s_XInputDLLRefCount = 0;
+#ifdef __WINRT__
+
+int
+WIN_LoadXInputDLL(void)
+{
+ /* Getting handles to system dlls (via LoadLibrary and its variants) is not
+ * supported on WinRT, thus, pointers to XInput's functions can't be
+ * retrieved via GetProcAddress.
+ *
+ * When on WinRT, assume that XInput is already loaded, and directly map
+ * its XInput.h-declared functions to the SDL_XInput* set of function
+ * pointers.
+ *
+ * Side-note: XInputGetStateEx is not available for use in WinRT.
+ * This seems to mean that support for the guide button is not available
+ * in WinRT, unfortunately.
+ */
+ SDL_XInputGetState = (XInputGetState_t)XInputGetState;
+ SDL_XInputSetState = (XInputSetState_t)XInputSetState;
+ SDL_XInputGetCapabilities = (XInputGetCapabilities_t)XInputGetCapabilities;
+
+ /* XInput 1.4 ships with Windows 8 and 8.1: */
+ SDL_XInputVersion = (1 << 16) | 4;
+
+ return 0;
+}
+
+void
+WIN_UnloadXInputDLL(void)
+{
+}
+
+#else /* !__WINRT__ */
+
int
WIN_LoadXInputDLL(void)
{
@@ -89,6 +123,7 @@ WIN_UnloadXInputDLL(void)
}
}
+#endif /* __WINRT__ */
#endif /* HAVE_XINPUT_H */
/* vi: set ts=4 sw=4 expandtab: */