[PATCH 4/6] windows.gaming.input: Implement IRacingWheelStatics2 interface for RacingWheel.
Rémi Bernon
rbernon at codeweavers.com
Fri Apr 22 04:49:08 CDT 2022
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/windows.gaming.input/racing_wheel.c | 41 ++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/dlls/windows.gaming.input/racing_wheel.c b/dlls/windows.gaming.input/racing_wheel.c
index 818e46bab42..1fc39f64f19 100644
--- a/dlls/windows.gaming.input/racing_wheel.c
+++ b/dlls/windows.gaming.input/racing_wheel.c
@@ -60,6 +60,7 @@ struct racing_wheel_statics
{
IActivationFactory IActivationFactory_iface;
IRacingWheelStatics IRacingWheelStatics_iface;
+ IRacingWheelStatics2 IRacingWheelStatics2_iface;
ICustomGameControllerFactory ICustomGameControllerFactory_iface;
LONG ref;
};
@@ -90,6 +91,12 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID
return S_OK;
}
+ if (IsEqualGUID( iid, &IID_IRacingWheelStatics2 ))
+ {
+ IInspectable_AddRef( (*out = &impl->IRacingWheelStatics2_iface) );
+ return S_OK;
+ }
+
if (IsEqualGUID( iid, &IID_ICustomGameControllerFactory ))
{
IInspectable_AddRef( (*out = &impl->ICustomGameControllerFactory_iface) );
@@ -214,6 +221,39 @@ static const struct IRacingWheelStaticsVtbl statics_vtbl =
statics_get_RacingWheels,
};
+DEFINE_IINSPECTABLE( statics2, IRacingWheelStatics2, struct racing_wheel_statics, IActivationFactory_iface )
+
+static HRESULT WINAPI statics2_FromGameController( IRacingWheelStatics2 *iface, IGameController *game_controller, IRacingWheel **value )
+{
+ struct racing_wheel_statics *impl = impl_from_IRacingWheelStatics2( iface );
+ IGameController *controller;
+ HRESULT hr;
+
+ TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value );
+
+ *value = NULL;
+ hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface,
+ game_controller, &controller );
+ if (FAILED(hr) || !controller) return hr;
+
+ hr = IGameController_QueryInterface( controller, &IID_IRacingWheel, (void **)value );
+ IGameController_Release( controller );
+ return hr;
+}
+
+static const struct IRacingWheelStatics2Vtbl statics2_vtbl =
+{
+ statics2_QueryInterface,
+ statics2_AddRef,
+ statics2_Release,
+ /* IInspectable methods */
+ statics2_GetIids,
+ statics2_GetRuntimeClassName,
+ statics2_GetTrustLevel,
+ /* IRacingWheelStatics2 methods */
+ statics2_FromGameController,
+};
+
DEFINE_IINSPECTABLE( controller_factory, ICustomGameControllerFactory, struct racing_wheel_statics, IActivationFactory_iface )
static HRESULT WINAPI controller_factory_CreateGameController( ICustomGameControllerFactory *iface, IGameControllerProvider *provider,
@@ -291,6 +331,7 @@ static struct racing_wheel_statics racing_wheel_statics =
{
{&factory_vtbl},
{&statics_vtbl},
+ {&statics2_vtbl},
{&controller_factory_vtbl},
1,
};
--
2.35.1
More information about the wine-devel
mailing list