Prechádzať zdrojové kódy

attempt to fix uwp build

Ozkan Sezer 3 rokov pred
rodič
commit
312c899f4f

+ 2 - 0
src/core/windows/SDL_windows.c

@@ -120,6 +120,7 @@ WIN_CoUninitialize(void)
 #endif
 #endif
 }
 }
 
 
+#ifndef __WINRT__
 void *
 void *
 WIN_LoadComBaseFunction(const char *name)
 WIN_LoadComBaseFunction(const char *name)
 {
 {
@@ -136,6 +137,7 @@ WIN_LoadComBaseFunction(const char *name)
         return NULL;
         return NULL;
     }
     }
 }
 }
+#endif
 
 
 HRESULT
 HRESULT
 WIN_RoInitialize(void)
 WIN_RoInitialize(void)

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

@@ -63,8 +63,10 @@ extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
 /* Sets an error message based on GetLastError(). Always return -1. */
 /* Sets an error message based on GetLastError(). Always return -1. */
 extern int WIN_SetError(const char *prefix);
 extern int WIN_SetError(const char *prefix);
 
 
+#if !defined(__WINRT__)
 /* Load a function from combase.dll */
 /* Load a function from combase.dll */
 void *WIN_LoadComBaseFunction(const char *name);
 void *WIN_LoadComBaseFunction(const char *name);
+#endif
 
 
 /* Wrap up the oddities of CoInitialize() into a common function. */
 /* Wrap up the oddities of CoInitialize() into a common function. */
 extern HRESULT WIN_CoInitialize(void);
 extern HRESULT WIN_CoInitialize(void);

+ 6 - 0
src/joystick/windows/SDL_rawinputjoystick.c

@@ -62,6 +62,7 @@ typedef struct WindowsGamingInputGamepadState WindowsGamingInputGamepadState;
 #define GamepadButtons_GUIDE 0x40000000
 #define GamepadButtons_GUIDE 0x40000000
 #define COBJMACROS
 #define COBJMACROS
 #include "windows.gaming.input.h"
 #include "windows.gaming.input.h"
+#include <roapi.h>
 #endif
 #endif
 
 
 #if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI)
 #if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI)
@@ -576,8 +577,13 @@ RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx)
             typedef HRESULT (WINAPI *WindowsCreateStringReference_t)(PCWSTR sourceString, UINT32 length, HSTRING_HEADER *hstringHeader, HSTRING* string);
             typedef HRESULT (WINAPI *WindowsCreateStringReference_t)(PCWSTR sourceString, UINT32 length, HSTRING_HEADER *hstringHeader, HSTRING* string);
             typedef HRESULT (WINAPI *RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void** factory);
             typedef HRESULT (WINAPI *RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void** factory);
 
 
+#ifdef __WINRT__
+            WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = WindowsCreateStringReference;
+            RoGetActivationFactory_t RoGetActivationFactoryFunc = RoGetActivationFactory;
+#else
             WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)WIN_LoadComBaseFunction("WindowsCreateStringReference");
             WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)WIN_LoadComBaseFunction("WindowsCreateStringReference");
             RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)WIN_LoadComBaseFunction("RoGetActivationFactory");
             RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)WIN_LoadComBaseFunction("RoGetActivationFactory");
+#endif
             if (WindowsCreateStringReferenceFunc && RoGetActivationFactoryFunc) {
             if (WindowsCreateStringReferenceFunc && RoGetActivationFactoryFunc) {
                 PCWSTR pNamespace = L"Windows.Gaming.Input.Gamepad";
                 PCWSTR pNamespace = L"Windows.Gaming.Input.Gamepad";
                 HSTRING_HEADER hNamespaceStringHeader;
                 HSTRING_HEADER hNamespaceStringHeader;