From 5aa438e80aabe3570c0ef807d9b22bcd9835ced6 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 8 Aug 2022 14:52:19 -0700 Subject: [PATCH] WGI: fix interop with applications that have their own WGI code QI for Added/Removed events need to handle IAgileObject --- src/joystick/windows/SDL_windows_gaming_input.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/joystick/windows/SDL_windows_gaming_input.c b/src/joystick/windows/SDL_windows_gaming_input.c index a266d4b5c7..c32c889978 100644 --- a/src/joystick/windows/SDL_windows_gaming_input.c +++ b/src/joystick/windows/SDL_windows_gaming_input.c @@ -32,6 +32,7 @@ #define COBJMACROS #include "windows.gaming.input.h" #include +#include #include @@ -213,11 +214,15 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_QueryInter } *ppvObject = NULL; - if (WIN_IsEqualIID(riid, &IID_IUnknown) || WIN_IsEqualIID(riid, &IID_IEventHandler_RawGameController)) { + if (WIN_IsEqualIID(riid, &IID_IUnknown) || WIN_IsEqualIID(riid, &IID_IAgileObject) || WIN_IsEqualIID(riid, &IID_IEventHandler_RawGameController)) { *ppvObject = This; return S_OK; + } else if (WIN_IsEqualIID(riid, &IID_IMarshal)) { + // This seems complicated. Let's hope it doesn't happen. + return E_OUTOFMEMORY; + } else { + return E_NOINTERFACE; } - return E_NOINTERFACE; } static ULONG STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_AddRef(__FIEventHandler_1_Windows__CGaming__CInput__CRawGameController * This)