Rémi Bernon : windows.gaming.input: Implement IRacingWheelStatics2 interface for RacingWheel.
Alexandre Julliard
julliard at winehq.org
Fri Apr 22 14:46:04 CDT 2022
Module: wine
Branch: master
Commit: e2e038e231379e31c89dd1e41548e41ca06e5103
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e2e038e231379e31c89dd1e41548e41ca06e5103
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Apr 22 11:49:08 2022 +0200
windows.gaming.input: Implement IRacingWheelStatics2 interface for RacingWheel.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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,
};
More information about the wine-cvs
mailing list