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

dinput: Rewrite IDirectInput8_EnumDevicesBySemantics.

Simplifying and fixing it.
parent cb987646
......@@ -1785,7 +1785,7 @@ static HRESULT WINAPI dinput_device_WriteEffectToFile( IDirectInputDevice8W *ifa
return DI_OK;
}
static BOOL object_matches_semantic( const DIDEVICEINSTANCEW *instance, const DIOBJECTDATAFORMAT *object,
BOOL device_object_matches_semantic( const DIDEVICEINSTANCEW *instance, const DIOBJECTDATAFORMAT *object,
DWORD semantic, BOOL exact )
{
DWORD value = semantic & 0xff, axis = (semantic >> 15) & 3, type;
......@@ -1885,7 +1885,7 @@ static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface,
for (object = impl->device_format.rgodf; object < object_end; object++)
{
if (mapped[object - impl->device_format.rgodf]) continue;
if (!object_matches_semantic( &impl->instance, object, action->dwSemantic, TRUE )) continue;
if (!device_object_matches_semantic( &impl->instance, object, action->dwSemantic, TRUE )) continue;
if ((action->dwFlags & DIA_FORCEFEEDBACK) && !(object->dwType & DIDFT_FFACTUATOR)) continue;
action->dwObjID = object->dwType;
action->guidInstance = impl->guid;
......@@ -1904,7 +1904,7 @@ static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface,
for (object = impl->device_format.rgodf; object < object_end; object++)
{
if (mapped[object - impl->device_format.rgodf]) continue;
if (!object_matches_semantic( &impl->instance, object, action->dwSemantic, FALSE )) continue;
if (!device_object_matches_semantic( &impl->instance, object, action->dwSemantic, FALSE )) continue;
if ((action->dwFlags & DIA_FORCEFEEDBACK) && !(object->dwType & DIDFT_FFACTUATOR)) continue;
action->dwObjID = object->dwType;
action->guidInstance = impl->guid;
......
......@@ -128,6 +128,8 @@ extern void dinput_device_internal_release( struct dinput_device *device );
extern HRESULT dinput_device_init_device_format( IDirectInputDevice8W *iface );
extern int dinput_device_object_index_from_id( IDirectInputDevice8W *iface, DWORD id );
extern BOOL device_object_matches_semantic( const DIDEVICEINSTANCEW *instance, const DIOBJECTDATAFORMAT *object,
DWORD semantic, BOOL exact );
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
extern DWORD get_config_key( HKEY, HKEY, const WCHAR *, WCHAR *, DWORD ) DECLSPEC_HIDDEN;
......
......@@ -445,7 +445,7 @@ static BOOL CALLBACK enum_devices_by_semantic( const DIDEVICEINSTANCEW *instance
if (remaining == 2)
{
expect_instance = &expect_joystick;
todo_wine ok( flags == (context ? 3 : 0), "got flags %#lx\n", flags );
ok( flags == (context ? 3 : 0), "got flags %#lx\n", flags );
}
else if (remaining == 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