windows.gaming.input: Implement IRacingWheelStatics2 interface for RacingWheel.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-04-22 11:49:08 +02:00 committed by Alexandre Julliard
parent acc2b32a5e
commit e2e038e231

View file

@ -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,
};