20#define DIRECTINPUT_VERSION 0x0800
39static const GUID ACTION_MAPPING_GUID = { 0x1, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
41static const GUID NULL_GUID = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } };
54 { 0, 0x01008A01 , 0, {
"Steer.\0" } },
56 { 1, 0x01000C01 , 0, {
"Upshift.\0" } },
73 int min_timeout = 100;
107 win_skip(
"We're not able to inject input into Windows dinput8 with events\n");
115 for (
i = 0;
i < 17;
i++)
135 ok(
hr ==
DI_OK && data_size == 1,
"GetDeviceData() failed: %08x cnt:%d\n",
hr, data_size);
141 int action_index,
DWORD expected_type,
DWORD expected_inst)
158 how = actions[action_index].
dwHow;
162 ok (
instance == expected_inst,
"Action not mapped correctly instance=%08x expected=%08x\n",
instance, expected_inst);
163 ok (
type == expected_type,
"Action type not mapped correctly type=%08x expected=%08x\n",
type, expected_type);
179 IDirectInputDevice8A *lpdid2;
198 data->keyboard = lpdid;
247 memset(&dp, 0,
sizeof(dp));
254 ok (dp.
dwData ==
data->lpdiaf->dwBufferSize,
"SetActionMap must set the buffer, buffersize=%d\n", dp.
dwData);
261 memset(&dpr, 0,
sizeof(dpr));
270 ok (dpr.
lMin ==
data->lpdiaf->lAxisMin,
"SetActionMap must set the min axis range expected=%d got=%d\n",
data->lpdiaf->lAxisMin, dpr.
lMin);
271 ok (dpr.
lMax ==
data->lpdiaf->lAxisMax,
"SetActionMap must set the max axis range expected=%d got=%d\n",
data->lpdiaf->lAxisMax, dpr.
lMax);
280 ok(
hr ==
DI_OK,
"GetDeviceData() failed hr=%08x\n",
hr);
306 win_skip(
"ActionMapping requires dinput8\n");
315 win_skip(
"ActionMapping requires dinput8\n");
321 memset (&af, 0,
sizeof(af));
343 data.username =
"Ninja Brian";
349 ok(
hwnd !=
NULL,
"failed to create window\n");
365 ok (
hr ==
DI_NOEFFECT,
"BuildActionMap should have no effect with no actions hr=%08x\n",
hr);
368 ok (
hr ==
DI_NOEFFECT,
"SetActionMap should have no effect with no actions to map hr=%08x\n",
hr);
376 ok (
hr !=
DI_NOEFFECT,
"SetActionMap should have effect as actionformat has changed hr=%08x\n",
hr);
379 ok (
hr ==
DI_NOEFFECT,
"SetActionMap should have no effect with no actions to map hr=%08x\n",
hr);
432 IDirectInputDevice8A *
pKey;
434 static const GUID mapping_guid = { 0xcafecafe, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
435 static const GUID other_guid = { 0xcafe, 0xcafe, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
445 static const DWORD other_results[] = {
455 win_skip(
"ActionMapping requires dinput8\n");
464 win_skip(
"ActionMapping requires dinput8\n");
471 ok (
SUCCEEDED(
hr),
"IDirectInput_Create device failed hr: 0x%08x\n",
hr);
474 memset (&af, 0,
sizeof(af));
498 skip (
"Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n");
552 skip (
"Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n");
565 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[0], af.
rgoAction[0].
dwObjID);
569 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[1], af.
rgoAction[1].
dwObjID);
585 skip (
"Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n");
600 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[0], af.
rgoAction[0].
dwObjID);
605 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[1], af.
rgoAction[1].
dwObjID);
617 IDirectInput8A *di =
NULL;
618 IDirectInputDevice8A *di_mouse, *di_keyboard;
619 UINT raw_devices_count;
620 RAWINPUTDEVICE raw_devices[3];
622 hwnd =
CreateWindowExA(
WS_EX_TOPMOST,
"static",
"dinput",
WS_POPUP |
WS_VISIBLE, 0, 0, 100, 100,
NULL,
NULL,
NULL,
NULL);
630 win_skip(
"test_mouse_keyboard requires dinput8\n");
638 win_skip(
"test_mouse_keyboard requires dinput8\n");
646 ok(
SUCCEEDED(
hr),
"IDirectInputDevice8_SetDataFormat failed: %08x\n",
hr);
651 ok(
SUCCEEDED(
hr),
"IDirectInputDevice8_SetDataFormat failed: %08x\n",
hr);
656 ok(raw_devices_count == 0,
"Unexpected raw devices registered: %d\n", raw_devices_count);
661 memset(raw_devices, 0,
sizeof(raw_devices));
664 ok(
hr == 1,
"GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n",
hr, raw_devices_count);
666 ok(raw_devices[0].usUsagePage == 1,
"Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
668 ok(raw_devices[0].usUsage == 6,
"Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
670 ok(raw_devices[0].
dwFlags == RIDEV_INPUTSINK,
"Unexpected raw device flags: %x\n", raw_devices[0].
dwFlags);
672 ok(raw_devices[0].hwndTarget !=
NULL,
"Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
678 ok(raw_devices_count == 0,
"Unexpected raw devices registered: %d\n", raw_devices_count);
680 if (raw_devices[0].hwndTarget !=
NULL)
682 WCHAR di_hwnd_class[] = {
'D',
'I',
'E',
'm',
'W',
'i',
'n',0};
686 di_hwnd = raw_devices[0].hwndTarget;
688 ok(
i ==
lstrlenW(di_hwnd_class),
"GetClassName returned incorrect length\n");
689 ok(!
lstrcmpW(di_hwnd_class,
str),
"GetClassName returned incorrect name for this window's class\n");
692 ok(
i ==
lstrlenW(di_hwnd_class),
"GetClassName returned incorrect length\n");
693 ok(!
lstrcmpW(di_hwnd_class,
str),
"GetClassName returned incorrect name for this window's class\n");
699 memset(raw_devices, 0,
sizeof(raw_devices));
702 ok(
hr == 1,
"GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n",
hr, raw_devices_count);
704 ok(raw_devices[0].usUsagePage == 1,
"Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
706 ok(raw_devices[0].usUsage == 2,
"Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
708 ok(raw_devices[0].
dwFlags == RIDEV_INPUTSINK,
"Unexpected raw device flags: %x\n", raw_devices[0].
dwFlags);
710 ok(raw_devices[0].hwndTarget == di_hwnd,
"Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
716 ok(raw_devices_count == 0,
"Unexpected raw devices registered: %d\n", raw_devices_count);
719 raw_devices[0].usUsagePage = 0x01;
720 raw_devices[0].usUsage = 0x05;
721 raw_devices[0].dwFlags = 0;
722 raw_devices[0].hwndTarget =
hwnd;
723 raw_devices[1].usUsagePage = 0x01;
724 raw_devices[1].usUsage = 0x06;
725 raw_devices[1].dwFlags = 0;
726 raw_devices[1].hwndTarget =
hwnd;
727 raw_devices[2].usUsagePage = 0x01;
728 raw_devices[2].usUsage = 0x02;
729 raw_devices[2].dwFlags = 0;
730 raw_devices[2].hwndTarget =
hwnd;
733 ok(
hr ==
TRUE,
"RegisterRawInputDevices failed\n");
740 memset(raw_devices, 0,
sizeof(raw_devices));
743 ok(
hr == 3,
"GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n",
hr, raw_devices_count);
745 ok(raw_devices[0].usUsagePage == 1,
"Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
747 ok(raw_devices[0].usUsage == 2,
"Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
749 ok(raw_devices[0].
dwFlags == RIDEV_INPUTSINK,
"Unexpected raw device flags: %x\n", raw_devices[0].
dwFlags);
751 ok(raw_devices[0].hwndTarget == di_hwnd,
"Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
753 ok(raw_devices[1].usUsagePage == 1,
"Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
755 ok(raw_devices[1].usUsage == 5,
"Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
756 ok(raw_devices[1].
dwFlags == 0,
"Unexpected raw device flags: %x\n", raw_devices[1].
dwFlags);
758 ok(raw_devices[1].hwndTarget ==
hwnd,
"Unexpected raw device target: %p\n", raw_devices[1].hwndTarget);
760 ok(raw_devices[2].usUsagePage == 1,
"Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
762 ok(raw_devices[2].usUsage == 6,
"Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
764 ok(raw_devices[2].
dwFlags == RIDEV_INPUTSINK,
"Unexpected raw device flags: %x\n", raw_devices[1].
dwFlags);
766 ok(raw_devices[2].hwndTarget == di_hwnd,
"Unexpected raw device target: %p\n", raw_devices[1].hwndTarget);
774 ok(raw_devices_count == 1,
"Unexpected raw devices registered: %d\n", raw_devices_count);
779 ok(
hr == 1,
"GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n",
hr, raw_devices_count);
781 ok(raw_devices[0].usUsagePage == 1,
"Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
783 ok(raw_devices[0].usUsage == 5,
"Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
784 ok(raw_devices[0].
dwFlags == 0,
"Unexpected raw device flags: %x\n", raw_devices[0].
dwFlags);
786 ok(raw_devices[0].hwndTarget ==
hwnd,
"Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
static struct _test_info results[8]
static HINSTANCE instance
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
#define INVALID_HANDLE_VALUE
#define MultiByteToWideChar
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI GetTickCount(VOID)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define IsEqualGUID(rguid1, rguid2)
IDirectInputDevice8A * mouse
IDirectInputDevice8A * keyboard
UINT WINAPI DECLSPEC_HOTPATCH GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, PUINT puiNumDevices, UINT cbSize)
BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(PCRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize)
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define REGDB_E_CLASSNOTREG
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MOUSEEVENTF_LEFTUP
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define MOUSEEVENTF_LEFTDOWN
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
BOOL WINAPI DestroyWindow(_In_ HWND)