mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
dinput: SetActionMap and queue_event setting mapped data.
This commit is contained in:
parent
b590090a48
commit
39684c7e3a
@ -604,6 +604,22 @@ void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD tim
|
||||
This->data_queue[This->queue_head].dwData = data;
|
||||
This->data_queue[This->queue_head].dwTimeStamp = time;
|
||||
This->data_queue[This->queue_head].dwSequence = seq;
|
||||
|
||||
/* Set uAppData by means of action mapping */
|
||||
if (This->num_actions > 0)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < This->num_actions; i++)
|
||||
{
|
||||
if (This->action_map[i].offset == ofs)
|
||||
{
|
||||
TRACE("Offset %d mapped to uAppData %lu\n", ofs, This->action_map[i].uAppData);
|
||||
This->data_queue[This->queue_head].uAppData = This->action_map[i].uAppData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
This->queue_head = next_pos;
|
||||
/* Send event if asked */
|
||||
}
|
||||
@ -783,6 +799,9 @@ ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
|
||||
HeapFree(GetProcessHeap(), 0, This->data_format.wine_df);
|
||||
release_DataFormat(&This->data_format);
|
||||
|
||||
/* Free action mapping */
|
||||
HeapFree(GetProcessHeap(), 0, This->action_map);
|
||||
|
||||
EnterCriticalSection( &This->dinput->crit );
|
||||
list_remove( &This->entry );
|
||||
LeaveCriticalSection( &This->dinput->crit );
|
||||
|
@ -47,6 +47,12 @@ typedef struct
|
||||
LPDIDATAFORMAT user_df; /* user defined data format */
|
||||
} DataFormat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int offset;
|
||||
UINT_PTR uAppData;
|
||||
} ActionMap;
|
||||
|
||||
/* Device implementation */
|
||||
typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl;
|
||||
struct IDirectInputDeviceImpl
|
||||
@ -74,6 +80,7 @@ struct IDirectInputDeviceImpl
|
||||
|
||||
/* Action mapping */
|
||||
int num_actions; /* number of actions mapped */
|
||||
ActionMap *action_map; /* array of mappings */
|
||||
};
|
||||
|
||||
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
|
||||
|
@ -609,6 +609,8 @@ static HRESULT WINAPI SysKeyboardWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
data_format.rgodf = (LPDIOBJECTDATAFORMAT)obj_df;
|
||||
data_format.dwNumObjs = num_actions;
|
||||
|
||||
This->base.action_map = HeapAlloc(GetProcessHeap(), 0, sizeof(ActionMap)*num_actions);
|
||||
|
||||
for (i = 0; i < lpdiaf->dwNumActions; i++)
|
||||
{
|
||||
if (IsEqualGUID(&This->base.guid, &lpdiaf->rgoAction[i].guidInstance))
|
||||
@ -616,6 +618,8 @@ static HRESULT WINAPI SysKeyboardWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
int instance = DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwObjID);
|
||||
memcpy(&obj_df[action], &c_dfDIKeyboard.rgodf[instance], c_dfDIKeyboard.dwObjSize);
|
||||
|
||||
This->base.action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
|
||||
This->base.action_map[action].offset = action;
|
||||
obj_df[action].dwOfs = action;
|
||||
action++;
|
||||
}
|
||||
|
@ -834,6 +834,7 @@ static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
DIDATAFORMAT data_format;
|
||||
DIOBJECTDATAFORMAT *obj_df = NULL;
|
||||
int i, action = 0, num_actions = 0;
|
||||
unsigned int offset = 0;
|
||||
|
||||
if (This->base.acquired) return DIERR_ACQUIRED;
|
||||
|
||||
@ -856,15 +857,18 @@ static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
data_format.rgodf = (LPDIOBJECTDATAFORMAT)obj_df;
|
||||
data_format.dwNumObjs = num_actions;
|
||||
|
||||
This->base.action_map = HeapAlloc(GetProcessHeap(), 0, sizeof(ActionMap)*num_actions);
|
||||
|
||||
for (i = 0; i < lpdiaf->dwNumActions; i++)
|
||||
{
|
||||
unsigned int offset = 0;
|
||||
|
||||
if (IsEqualGUID(&This->base.guid, &lpdiaf->rgoAction[i].guidInstance))
|
||||
{
|
||||
int instance = DIDFT_GETINSTANCE(lpdiaf->rgoAction[i].dwObjID);
|
||||
memcpy(&obj_df[action], &c_dfDIMouse.rgodf[instance], c_dfDIMouse.dwObjSize);
|
||||
|
||||
This->base.action_map[action].uAppData = lpdiaf->rgoAction[i].uAppData;
|
||||
This->base.action_map[action].offset = offset;
|
||||
obj_df[action].dwOfs = offset;
|
||||
offset += (obj_df[action].dwType & DIDFT_BUTTON) ? 1 : 4;
|
||||
|
||||
|
@ -89,7 +89,7 @@ static void test_device_input(
|
||||
return;
|
||||
}
|
||||
|
||||
todo_wine ok (obj_data.uAppData == expected, "Retrieval of action failed uAppData=%lu expected=%d\n", obj_data.uAppData, expected);
|
||||
ok (obj_data.uAppData == expected, "Retrieval of action failed uAppData=%lu expected=%d\n", obj_data.uAppData, expected);
|
||||
}
|
||||
|
||||
static void test_build_action_map(
|
||||
|
Loading…
Reference in New Issue
Block a user