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

dinput: Avoid remapping already mapped objects in BuildActionMap.

parent 839a5379
......@@ -1866,6 +1866,23 @@ static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface,
if (!(mapped = calloc( impl->device_format.dwNumObjs, sizeof(*mapped) ))) return DIERR_OUTOFMEMORY;
/* check already mapped objects */
action_end = format->rgoAction + format->dwNumActions;
for (action = format->rgoAction; action < action_end; action++)
{
if (!action->dwHow || !action->dwObjID) continue;
if (!IsEqualGUID(&action->guidInstance, &impl->guid)) continue;
object_end = impl->device_format.rgodf + impl->device_format.dwNumObjs;
for (object = impl->device_format.rgodf; object < object_end; object++)
{
if (action->dwObjID != object->dwType) continue;
mapped[object - impl->device_format.rgodf] = TRUE;
break;
}
}
/* map any unmapped priority 1 objects */
action_end = format->rgoAction + format->dwNumActions;
for (action = format->rgoAction; action < action_end; action++)
{
......@@ -1886,6 +1903,7 @@ static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface,
}
}
/* map any unmapped priority 2 objects */
for (action = format->rgoAction; action < action_end; action++)
{
if (action->dwHow || (action->dwFlags & DIA_APPNOMAP)) continue; /* already mapped */
......
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