dinput: SetActionMap setting the device buffer.
This commit is contained in:
parent
636cc9acff
commit
2fe9f14b29
|
@ -1391,9 +1391,20 @@ HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface
|
|||
LPCSTR lpszUserName,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
FIXME("(%p)->(%p,%s,%08x): stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
|
||||
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||
DIACTIONFORMATW diafW;
|
||||
HRESULT hr;
|
||||
|
||||
return DI_OK;
|
||||
FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, lpszUserName, dwFlags);
|
||||
|
||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
||||
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
||||
|
||||
hr = IDirectInputDevice8WImpl_SetActionMap(&This->IDirectInputDevice8W_iface, &diafW, NULL, dwFlags);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
|
@ -1401,7 +1412,21 @@ HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface
|
|||
LPCWSTR lpszUserName,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
FIXME("(%p)->(%p,%s,%08x): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
||||
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
||||
DIPROPDWORD dp;
|
||||
|
||||
FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
||||
|
||||
if (This->acquired) return DIERR_ACQUIRED;
|
||||
|
||||
if (lpdiaf->dwBufferSize > 0)
|
||||
{
|
||||
dp.diph.dwSize = sizeof(DIPROPDWORD);
|
||||
dp.dwData = lpdiaf->dwBufferSize;
|
||||
dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
dp.diph.dwHow = DIPH_DEVICE;
|
||||
IDirectInputDevice8_SetProperty(iface, DIPROP_BUFFERSIZE, &dp.diph);
|
||||
}
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
|
|
@ -254,6 +254,60 @@ void _dump_diactionformatA(LPDIACTIONFORMATA lpdiActionFormat) {
|
|||
}
|
||||
}
|
||||
|
||||
void _copy_diactionformatAtoW(LPDIACTIONFORMATW to, LPDIACTIONFORMATA from)
|
||||
{
|
||||
int i;
|
||||
|
||||
to->dwSize = sizeof(DIACTIONFORMATW);
|
||||
to->dwActionSize = sizeof(DIACTIONW);
|
||||
to->dwDataSize = from->dwDataSize;
|
||||
to->dwNumActions = from->dwNumActions;
|
||||
to->guidActionMap = from->guidActionMap;
|
||||
to->dwGenre = from->dwGenre;
|
||||
to->dwBufferSize = from->dwBufferSize;
|
||||
to->lAxisMin = from->lAxisMin;
|
||||
to->lAxisMax = from->lAxisMax;
|
||||
to->dwCRC = from->dwCRC;
|
||||
to->ftTimeStamp = from->ftTimeStamp;
|
||||
|
||||
for (i=0; i < to->dwNumActions; i++)
|
||||
{
|
||||
to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
|
||||
to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
|
||||
to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
|
||||
to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
|
||||
to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
|
||||
to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
|
||||
}
|
||||
}
|
||||
|
||||
void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
|
||||
{
|
||||
int i;
|
||||
|
||||
to->dwSize = sizeof(DIACTIONFORMATA);
|
||||
to->dwActionSize = sizeof(DIACTIONA);
|
||||
to->dwDataSize = from->dwDataSize;
|
||||
to->dwNumActions = from->dwNumActions;
|
||||
to->guidActionMap = from->guidActionMap;
|
||||
to->dwGenre = from->dwGenre;
|
||||
to->dwBufferSize = from->dwBufferSize;
|
||||
to->lAxisMin = from->lAxisMin;
|
||||
to->lAxisMax = from->lAxisMax;
|
||||
to->dwCRC = from->dwCRC;
|
||||
to->ftTimeStamp = from->ftTimeStamp;
|
||||
|
||||
for (i=0; i < to->dwNumActions; i++)
|
||||
{
|
||||
to->rgoAction[i].uAppData = from->rgoAction[i].uAppData;
|
||||
to->rgoAction[i].dwSemantic = from->rgoAction[i].dwSemantic;
|
||||
to->rgoAction[i].dwFlags = from->rgoAction[i].dwFlags;
|
||||
to->rgoAction[i].guidInstance = from->rgoAction[i].guidInstance;
|
||||
to->rgoAction[i].dwObjID = from->rgoAction[i].dwObjID;
|
||||
to->rgoAction[i].dwHow = from->rgoAction[i].dwHow;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IDirectInputA_EnumDevices
|
||||
*/
|
||||
|
|
|
@ -63,6 +63,8 @@ extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W) DECLSPEC_HIDDEN;
|
|||
typedef int (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM);
|
||||
|
||||
extern void _dump_diactionformatA(LPDIACTIONFORMATA) DECLSPEC_HIDDEN;
|
||||
extern void _copy_diactionformatAtoW(LPDIACTIONFORMATW, LPDIACTIONFORMATA) DECLSPEC_HIDDEN;
|
||||
extern void _copy_diactionformatWtoA(LPDIACTIONFORMATA, LPDIACTIONFORMATW) DECLSPEC_HIDDEN;
|
||||
|
||||
#define IS_DIPROP(x) (((ULONG_PTR)(x) >> 16) == 0)
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ static BOOL CALLBACK enumeration_callback(
|
|||
|
||||
hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_BUFFERSIZE, &dp.diph);
|
||||
ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
|
||||
todo_wine ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%d\n", dp.dwData);
|
||||
ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%d\n", dp.dwData);
|
||||
|
||||
/* SetActionMap has set the data format so now it should work */
|
||||
hr = IDirectInputDevice8_Acquire(lpdid);
|
||||
|
|
Loading…
Reference in New Issue