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

windows.gaming.input: Query IGameController interface in TryGetFactoryControllerFromGameController.

parent eab7b95b
......@@ -1184,13 +1184,13 @@ static void test_windows_gaming_input(void)
IGameController_Release( tmp_game_controller );
next:
hr = IRawGameControllerStatics_FromGameController( statics, custom_controller.IGameController_outer, &tmp_raw_controller );
ok( hr == S_OK, "FromGameController returned %#lx\n", hr );
todo_wine
ok( tmp_raw_controller == raw_controller, "got controller %p\n", tmp_raw_controller );
if (tmp_raw_controller) IRawGameController_Release( tmp_raw_controller );
next:
IGameController_Release( game_controller );
IRawGameController_Release( raw_controller );
SetEvent( stop_event );
......
......@@ -5092,9 +5092,8 @@ static void test_windows_gaming_input(void)
hr = IRawGameControllerStatics_FromGameController( controller_statics, (IGameController *)raw_controller, &tmp_raw_controller );
ok( hr == S_OK, "FromGameController returned %#lx\n", hr );
todo_wine
ok( tmp_raw_controller == raw_controller, "got unexpected IGameController interface\n" );
if (tmp_raw_controller) IRawGameController_Release( tmp_raw_controller );
IRawGameController_Release( tmp_raw_controller );
IGameController_Release( game_controller );
IRawGameController_Release( raw_controller );
......
......@@ -372,14 +372,18 @@ statics2_TryGetFactoryControllerFromGameController( IGameControllerFactoryManage
IGameController *controller, IGameController **value )
{
struct controller *entry, *other;
IGameController *tmp_controller;
BOOL found = FALSE;
TRACE( "iface %p, factory %p, controller %p, value %p.\n", iface, factory, controller, value );
/* Spider Man Remastered passes a IRawGameController instead of IGameController, query the iface again */
if (FAILED(IGameController_QueryInterface( controller, &IID_IGameController, (void **)&tmp_controller ))) goto done;
EnterCriticalSection( &manager_cs );
LIST_FOR_EACH_ENTRY( entry, &controller_list, struct controller, entry )
if ((found = &entry->IGameController_iface == controller)) break;
if ((found = &entry->IGameController_iface == tmp_controller)) break;
if (!found) WARN( "Failed to find controller %p\n", controller );
else
......@@ -392,6 +396,9 @@ statics2_TryGetFactoryControllerFromGameController( IGameControllerFactoryManage
LeaveCriticalSection( &manager_cs );
IGameController_Release( tmp_controller );
done:
if (!found) *value = NULL;
return S_OK;
}
......
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