Commit e2e038e2 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

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

parent acc2b32a
...@@ -60,6 +60,7 @@ struct racing_wheel_statics ...@@ -60,6 +60,7 @@ struct racing_wheel_statics
{ {
IActivationFactory IActivationFactory_iface; IActivationFactory IActivationFactory_iface;
IRacingWheelStatics IRacingWheelStatics_iface; IRacingWheelStatics IRacingWheelStatics_iface;
IRacingWheelStatics2 IRacingWheelStatics2_iface;
ICustomGameControllerFactory ICustomGameControllerFactory_iface; ICustomGameControllerFactory ICustomGameControllerFactory_iface;
LONG ref; LONG ref;
}; };
...@@ -90,6 +91,12 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID ...@@ -90,6 +91,12 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID
return S_OK; return S_OK;
} }
if (IsEqualGUID( iid, &IID_IRacingWheelStatics2 ))
{
IInspectable_AddRef( (*out = &impl->IRacingWheelStatics2_iface) );
return S_OK;
}
if (IsEqualGUID( iid, &IID_ICustomGameControllerFactory )) if (IsEqualGUID( iid, &IID_ICustomGameControllerFactory ))
{ {
IInspectable_AddRef( (*out = &impl->ICustomGameControllerFactory_iface) ); IInspectable_AddRef( (*out = &impl->ICustomGameControllerFactory_iface) );
...@@ -214,6 +221,39 @@ static const struct IRacingWheelStaticsVtbl statics_vtbl = ...@@ -214,6 +221,39 @@ static const struct IRacingWheelStaticsVtbl statics_vtbl =
statics_get_RacingWheels, 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 ) DEFINE_IINSPECTABLE( controller_factory, ICustomGameControllerFactory, struct racing_wheel_statics, IActivationFactory_iface )
static HRESULT WINAPI controller_factory_CreateGameController( ICustomGameControllerFactory *iface, IGameControllerProvider *provider, static HRESULT WINAPI controller_factory_CreateGameController( ICustomGameControllerFactory *iface, IGameControllerProvider *provider,
...@@ -291,6 +331,7 @@ static struct racing_wheel_statics racing_wheel_statics = ...@@ -291,6 +331,7 @@ static struct racing_wheel_statics racing_wheel_statics =
{ {
{&factory_vtbl}, {&factory_vtbl},
{&statics_vtbl}, {&statics_vtbl},
{&statics2_vtbl},
{&controller_factory_vtbl}, {&controller_factory_vtbl},
1, 1,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment