[PATCH 5/5] windows.gaming.input: Implement IGamepadStatics2_FromGameController.
Rémi Bernon
rbernon at codeweavers.com
Tue Mar 8 03:55:26 CST 2022
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/windows.gaming.input/gamepad.c | 40 +++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/dlls/windows.gaming.input/gamepad.c b/dlls/windows.gaming.input/gamepad.c
index 3793021d22c..50008541281 100644
--- a/dlls/windows.gaming.input/gamepad.c
+++ b/dlls/windows.gaming.input/gamepad.c
@@ -27,6 +27,7 @@ struct gamepad_statics
{
IActivationFactory IActivationFactory_iface;
IGamepadStatics IGamepadStatics_iface;
+ IGamepadStatics2 IGamepadStatics2_iface;
ICustomGameControllerFactory ICustomGameControllerFactory_iface;
LONG ref;
};
@@ -57,6 +58,12 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID
return S_OK;
}
+ if (IsEqualGUID( iid, &IID_IGamepadStatics2 ))
+ {
+ IInspectable_AddRef( (*out = &impl->IGamepadStatics2_iface) );
+ return S_OK;
+ }
+
if (IsEqualGUID( iid, &IID_ICustomGameControllerFactory ))
{
IInspectable_AddRef( (*out = &impl->ICustomGameControllerFactory_iface) );
@@ -188,6 +195,38 @@ static const struct IGamepadStaticsVtbl statics_vtbl =
statics_get_Gamepads,
};
+DEFINE_IINSPECTABLE( statics2, IGamepadStatics2, struct gamepad_statics, IActivationFactory_iface )
+
+static HRESULT WINAPI statics2_FromGameController( IGamepadStatics2 *iface, IGameController *game_controller, IGamepad **value )
+{
+ struct gamepad_statics *impl = impl_from_IGamepadStatics2( iface );
+ IGameController *controller;
+ HRESULT hr;
+
+ TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value );
+
+ hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface,
+ game_controller, &controller );
+ if (FAILED(hr)) return hr;
+
+ hr = IGameController_QueryInterface( controller, &IID_IGamepad, (void **)value );
+ IGameController_Release( controller );
+ return hr;
+}
+
+static const struct IGamepadStatics2Vtbl statics2_vtbl =
+{
+ statics2_QueryInterface,
+ statics2_AddRef,
+ statics2_Release,
+ /* IInspectable methods */
+ statics2_GetIids,
+ statics2_GetRuntimeClassName,
+ statics2_GetTrustLevel,
+ /* IGamepadStatics2 methods */
+ statics2_FromGameController,
+};
+
DEFINE_IINSPECTABLE( controller_factory, ICustomGameControllerFactory, struct gamepad_statics, IActivationFactory_iface )
static HRESULT WINAPI controller_factory_CreateGameController( ICustomGameControllerFactory *iface, IGameControllerProvider *provider,
@@ -228,6 +267,7 @@ static struct gamepad_statics gamepad_statics =
{
{&factory_vtbl},
{&statics_vtbl},
+ {&statics2_vtbl},
{&controller_factory_vtbl},
1,
};
--
2.35.1
More information about the wine-devel
mailing list