1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

windows.gaming.input: Stub IRawGameController2 interface.

This commit is contained in:
Rémi Bernon 2022-02-21 15:18:15 +01:00 committed by Alexandre Julliard
parent 3dce01a204
commit e2b637c8dc
3 changed files with 81 additions and 14 deletions

View File

@ -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 );

View File

@ -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 );

View File

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