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

windows.gaming.input: Stub IRawGameController2 interface.

parent 3dce01a2
......@@ -5069,7 +5069,6 @@ static void test_windows_gaming_input(void)
check_interface( raw_controller, &IID_IInspectable, TRUE );
check_interface( raw_controller, &IID_IAgileObject, TRUE );
check_interface( raw_controller, &IID_IRawGameController, TRUE );
todo_wine
check_interface( raw_controller, &IID_IRawGameController2, TRUE );
check_interface( raw_controller, &IID_IGameController, TRUE );
check_interface( raw_controller, &IID_IGamepad, FALSE );
......@@ -5082,7 +5081,6 @@ static void test_windows_gaming_input(void)
check_interface( game_controller, &IID_IInspectable, TRUE );
check_interface( game_controller, &IID_IAgileObject, TRUE );
check_interface( game_controller, &IID_IRawGameController, TRUE );
todo_wine
check_interface( game_controller, &IID_IRawGameController2, TRUE );
check_interface( game_controller, &IID_IGameController, TRUE );
check_interface( game_controller, &IID_IGamepad, FALSE );
......@@ -5100,23 +5098,31 @@ static void test_windows_gaming_input(void)
IGameController_Release( game_controller );
hr = IRawGameController_QueryInterface( raw_controller, &IID_IRawGameController2, (void **)&raw_controller2 );
todo_wine
ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
if (hr != S_OK) goto skip_tests;
hr = IRawGameController2_get_DisplayName( raw_controller2, &str );
todo_wine
ok( hr == S_OK, "get_DisplayName returned %#lx\n", hr );
buffer = pWindowsGetStringRawBuffer( str, &length );
ok( !wcscmp( buffer, L"HID-compliant game controller" ),
"get_DisplayName returned %s\n", debugstr_wn( buffer, length ) );
pWindowsDeleteString( str );
if (hr == S_OK)
{
buffer = pWindowsGetStringRawBuffer( str, &length );
todo_wine
ok( !wcscmp( buffer, L"HID-compliant game controller" ),
"get_DisplayName returned %s\n", debugstr_wn( buffer, length ) );
pWindowsDeleteString( str );
}
hr = IRawGameController2_get_NonRoamableId( raw_controller2, &str );
todo_wine
ok( hr == S_OK, "get_NonRoamableId returned %#lx\n", hr );
buffer = pWindowsGetStringRawBuffer( str, &length );
ok( !wcsncmp( buffer, L"{wgi/nrid/", 10 ),
"get_NonRoamableId returned %s\n", debugstr_wn( buffer, length ) );
pWindowsDeleteString( str );
if (hr == S_OK)
{
buffer = pWindowsGetStringRawBuffer( str, &length );
todo_wine
ok( !wcsncmp( buffer, L"{wgi/nrid/", 10 ),
"get_NonRoamableId returned %s\n", debugstr_wn( buffer, length ) );
pWindowsDeleteString( str );
}
/* FIXME: What kind of HID reports are needed to make this work? */
hr = IRawGameController2_get_SimpleHapticsControllers( raw_controller2, &haptics_controllers );
......@@ -5127,8 +5133,6 @@ static void test_windows_gaming_input(void)
IVectorView_SimpleHapticsController_Release( haptics_controllers );
IRawGameController2_Release( raw_controller2 );
skip_tests:
IRawGameController_Release( raw_controller );
hr = IRawGameControllerStatics_remove_RawGameControllerAdded( controller_statics, controller_added_token );
......
......@@ -61,6 +61,7 @@ struct controller
IGameControllerImpl IGameControllerImpl_iface;
IGameControllerInputSink IGameControllerInputSink_iface;
IRawGameController IRawGameController_iface;
IRawGameController2 IRawGameController2_iface;
IGameController *IGameController_outer;
LONG ref;
......@@ -99,6 +100,12 @@ static HRESULT WINAPI controller_QueryInterface( IGameControllerImpl *iface, REF
return S_OK;
}
if (IsEqualGUID( iid, &IID_IRawGameController2 ))
{
IInspectable_AddRef( (*out = &impl->IRawGameController2_iface) );
return S_OK;
}
FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
*out = NULL;
return E_NOINTERFACE;
......@@ -330,6 +337,58 @@ static const struct IRawGameControllerVtbl raw_controller_vtbl =
raw_controller_GetSwitchKind,
};
DEFINE_IINSPECTABLE_OUTER( raw_controller_2, IRawGameController2, struct controller, IGameController_outer )
static HRESULT WINAPI raw_controller_2_get_SimpleHapticsControllers( IRawGameController2 *iface, IVectorView_SimpleHapticsController** value)
{
static const struct vector_iids iids =
{
.vector = &IID_IVector_SimpleHapticsController,
.view = &IID_IVectorView_SimpleHapticsController,
.iterable = &IID_IIterable_SimpleHapticsController,
.iterator = &IID_IIterator_SimpleHapticsController,
};
IVector_SimpleHapticsController *vector;
HRESULT hr;
FIXME( "iface %p, value %p stub!\n", iface, value );
if (SUCCEEDED(hr = vector_create( &iids, (void **)&vector )))
{
hr = IVector_SimpleHapticsController_GetView( vector, value );
IVector_SimpleHapticsController_Release( vector );
}
return hr;
}
static HRESULT WINAPI raw_controller_2_get_NonRoamableId( IRawGameController2 *iface, HSTRING* value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static HRESULT WINAPI raw_controller_2_get_DisplayName( IRawGameController2 *iface, HSTRING* value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static const struct IRawGameController2Vtbl raw_controller_2_vtbl =
{
raw_controller_2_QueryInterface,
raw_controller_2_AddRef,
raw_controller_2_Release,
/* IInspectable methods */
raw_controller_2_GetIids,
raw_controller_2_GetRuntimeClassName,
raw_controller_2_GetTrustLevel,
/* IRawGameController2 methods */
raw_controller_2_get_SimpleHapticsControllers,
raw_controller_2_get_NonRoamableId,
raw_controller_2_get_DisplayName,
};
struct controller_statics
{
IActivationFactory IActivationFactory_iface;
......@@ -525,6 +584,7 @@ static HRESULT WINAPI controller_factory_CreateGameController( ICustomGameContro
impl->IGameControllerImpl_iface.lpVtbl = &controller_vtbl;
impl->IGameControllerInputSink_iface.lpVtbl = &input_sink_vtbl;
impl->IRawGameController_iface.lpVtbl = &raw_controller_vtbl;
impl->IRawGameController2_iface.lpVtbl = &raw_controller_2_vtbl;
impl->ref = 1;
TRACE( "created RawGameController %p\n", impl );
......
......@@ -30,7 +30,10 @@ namespace Windows.Devices.Haptics {
runtimeclass SimpleHapticsController;
declare {
interface Windows.Foundation.Collections.IIterator<Windows.Devices.Haptics.SimpleHapticsController *>;
interface Windows.Foundation.Collections.IIterable<Windows.Devices.Haptics.SimpleHapticsController *>;
interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Haptics.SimpleHapticsController *>;
interface Windows.Foundation.Collections.IVector<Windows.Devices.Haptics.SimpleHapticsController *>;
interface Windows.Foundation.Collections.IVectorView<Windows.Devices.Haptics.SimpleHapticsControllerFeedback *>;
}
......
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