19#define DIRECTINPUT_VERSION 0x0700
87 IUnknown_AddRef(
object );
88 return IUnknown_Release(
object );
118 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_GetProperty() failed: %08x\n",
hr);
120 "expected %d..%d got %d..%d\n",
info->lMin,
info->lMax, diprg.
lMin, diprg.
lMax);
126 ok(
hr==
E_INVALIDARG,
"IDirectInputDevice_SetProperty() should have returned "
127 "E_INVALIDARG, returned: %08x\n",
hr);
130 ok(
hr==
DI_OK,
"IDirectInputDevice_SetProperty() failed: %08x\n",
hr);
134 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_GetProperty() failed: %08x\n",
hr);
135 ok(
info->dZone == dipdw.
dwData,
"deadzone invalid: expected %d got %d\n",
141 ok(
hr==
DI_OK,
"IDirectInputDevice_SetProperty() failed: %08x\n",
hr);
213 trace(
"controller supports '%s' effect\n",
id->name);
214 ok(
type ==
id->dieft,
"Invalid effect type, expected 0x%x, got 0x%x\n",
221 data->effect_count++;
223 data->guid = *
id->guid;
229 data->eff.cbTypeSpecificParams =
sizeof(specific.periodic);
230 data->eff.lpvTypeSpecificParams = &specific.periodic;
235 data->eff.cbTypeSpecificParams =
sizeof(specific.constant);
236 data->eff.lpvTypeSpecificParams = &specific.constant;
240 data->eff.cbTypeSpecificParams =
sizeof(specific.ramp);
241 data->eff.lpvTypeSpecificParams = &specific.ramp;
248 data->eff.cbTypeSpecificParams =
sizeof(specific.condition);
249 data->eff.lpvTypeSpecificParams = specific.condition;
250 for (
i = 0;
i < 2;
i++)
275 trace(
"---- Device Information ----\n"
276 "Product Name : %s\n"
277 "Instance Name : %s\n"
279 "GUID Product : %s\n"
280 "GUID Instance : %s\n"
281 "HID Page : 0x%04x\n"
282 "HID Usage : 0x%04x\n",
300 IDirectInputDeviceA *pJoystick;
314 char oldstate[248], curstate[248];
316 LONG direction[2] = {0, 0};
324 ok(
data->version >= 0x0300,
"Joysticks not supported in version 0x%04x\n",
data->version);
327 ok(
hr==
E_POINTER,
"IDirectInput_CreateDevice() should have returned "
328 "E_POINTER, returned: %08x\n",
hr);
331 ok(
hr==
E_POINTER,
"IDirectInput_CreateDevice() should have returned "
332 "E_POINTER, returned: %08x\n",
hr);
335 ok(
hr==
E_POINTER,
"IDirectInput_CreateDevice() should have returned "
336 "E_POINTER, returned: %08x\n",
hr);
340 ok(
hr==
DI_OK,
"IDirectInput_CreateDevice() failed: %08x\n",
hr);
344 trace(
"---- Controller Information ----\n"
345 "Product Name : %s\n"
346 "Instance Name : %s\n"
348 "GUID Product : %s\n"
349 "GUID Instance : %s\n"
350 "HID Page : 0x%04x\n"
351 "HID Usage : 0x%04x\n",
363 "Expected a game controller HID UsagePage and Usage, got page 0x%x usage 0x%x\n",
374 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_GetProperty() for DIPROP_JOYSTICKID failed\n");
377 memset(&dps, 0,
sizeof(dps));
383 ok(
SUCCEEDED(
hr),
"IDirectInput_GetProperty() for DIPROP_INSTANCENAME failed: %08x\n",
hr);
387 ok(!
lstrcmpW(nameBuffer, dps.
wsz),
"DIPROP_INSTANCENAME returned is wrong. Expected: %s Got: %s\n",
391 ok(
SUCCEEDED(
hr),
"IDirectInput_GetProperty() for DIPROP_PRODUCTNAME failed: %08x\n",
hr);
395 ok(!
lstrcmpW(nameBuffer, dps.
wsz),
"DIPROP_PRODUCTNAME returned is wrong. Expected: %s Got: %s\n",
399 memset(&dpg, 0,
sizeof(dpg));
405 ok(
SUCCEEDED(
hr),
"IDirectInput_GetProperty() for DIPROP_GUIDANDPATH failed: %08x\n",
hr);
408 static const WCHAR formatW[] = {
'\\',
'\\',
'?',
'\\',
'%',
'*',
'[',
'^',
'#',
']',
'#',
'v',
'i',
'd',
'_',
409 '%',
'0',
'4',
'x',
'&',
'p',
'i',
'd',
'_',
'%',
'0',
'4',
'x',0};
410 static const WCHAR miW[] = {
'm',
'i',
'_',0};
411 static const WCHAR igW[] = {
'i',
'g',
'_',0};
416 ok(
count == 2,
"DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: %i Path: %s\n",
419 "DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: %s\n",
424 ok(
hr==
E_POINTER,
"IDirectInputDevice_SetDataFormat() should have returned "
425 "E_POINTER, returned: %08x\n",
hr);
430 "returned DIERR_INVALIDPARAM, returned: %08x\n",
hr);
434 ok(
hr==
DI_OK,
"IDirectInputDevice_SetDataFormat() failed: %08x\n",
hr);
437 ok(
hr==
DI_OK,
"IDirectInputDevice_SetDataFormat() failed: %08x\n",
hr);
441 ok(
hr==
DI_OK,
"IDirectInputDevice_SetDataFormat() failed: %08x\n",
hr);
444 ok(
hr==
DI_OK,
"IDirectInputDevice_SetDataFormat() failed: %08x\n",
hr);
461 ok(
hr==
DI_OK,
"IDirectInputDevice_SetCooperativeLevel() failed: %08x\n",
hr);
466 "should have returned E_POINTER, returned: %08x\n",
hr);
471 "should have returned DIERR_INVALIDPARAM, returned: %08x\n",
hr);
473 caps.
dwSize =
sizeof(caps);
475 ok(
hr==
DI_OK,
"IDirectInputDevice_GetCapabilities() failed: %08x\n",
hr);
478 info.pJoystick = pJoystick;
485 ok(
hr==
DI_OK,
"IDirectInputDevice_EnumObjects() failed: %08x\n",
hr);
487 ok(caps.
dwAxes ==
info.axis,
"Number of enumerated axes (%d) doesn't match capabilities (%d)\n",
info.axis, caps.
dwAxes);
489 ok(caps.
dwPOVs ==
info.pov,
"Number of enumerated POVs (%d) doesn't match capabilities (%d)\n",
info.pov, caps.
dwPOVs);
493 ok(
hr==
DI_OK,
"IDirectInputDevice_SetDataFormat() failed: %08x\n",
hr);
498 ok(
hr==
DI_OK,
"IDirectInputDevice_EnumObjects() failed: %08x\n",
hr);
502 "should have returned E_POINTER, returned: %08x\n",
hr);
509 "should have returned DIERR_INVALIDPARAM, returned: %08x\n",
hr);
511 inst.
dwSize =
sizeof(inst);
513 ok(
hr==
DI_OK,
"IDirectInputDevice_GetDeviceInfo() failed: %08x\n",
hr);
515 inst3.
dwSize =
sizeof(inst3);
517 ok(
hr==
DI_OK,
"IDirectInputDevice_GetDeviceInfo() failed: %08x\n",
hr);
520 ok(
hr ==
S_FALSE,
"IDirectInputDevice_Unacquire() should have returned S_FALSE, got: %08x\n",
hr);
523 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
528 ok(
hr ==
S_FALSE,
"IDirectInputDevice_Acquire() should have returned S_FALSE, got: %08x\n",
hr);
533 ok(
hr ==
DI_OK,
"IDirectInputDevice_GetDeviceState() failed: %08x\n",
hr);
534 ok(js.
rgdwPOV[3] == -1,
"Default for unassigned POV should be -1 not: %d\n", js.
rgdwPOV[3]);
537 trace(
"Testing force feedback\n");
538 ZeroMemory(&effect_data,
sizeof(effect_data));
555 real_hWnd =
CreateWindowExA(0,
"EDIT",
"Test text", 0, 10, 10, 300, 300,
NULL,
NULL,
557 ok(real_hWnd!=0,
"CreateWindowExA failed: %p\n", real_hWnd);
560 ok(
hr==
DI_OK,
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
563 ok(
hr==
DI_OK,
"IDirectInputDevice_SetCooperativeLevel() failed: %08x\n",
hr);
565 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
570 ok(
hr==
DI_OK,
"IDirectInputDevice2_EnumEffects() failed: %08x\n",
hr);
577 effect_data.
guid = GUID_ConstantForce;
586 effect = (
void *)0xdeadbeef;
588 &effect_data.
eff, &effect,
NULL);
591 trace(
"force feedback supported with %d effects, using '%s' for test\n",
593 ok(
hr ==
DI_OK,
"IDirectInputDevice_CreateEffect() failed: %08x\n",
hr);
595 ok(cnt1 == cnt2,
"Ref count is wrong %d != %d\n", cnt1, cnt2);
605 ok(
hr==
DI_OK,
"IDirectInputEffect_Initialize failed: %08x\n",
hr);
608 ok(
hr==
DI_OK,
"IDirectInputEffect_SetParameters failed: %08x\n",
hr);
613 ok(
hr==
DI_OK,
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
615 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
617 ok(
hr==
DI_OK,
"IDirectInputEffect_SetParameters failed: %08x\n",
hr);
635 ok(
hr==
E_POINTER,
"IDirectInputEffect_GetEffectStatus() must fail with E_POINTER, got: %08x\n",
hr);
636 effect_status = 0xdeadbeef;
638 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectStatus() failed: %08x\n",
hr);
639 ok(effect_status==0,
"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
641 ok(
hr==
DI_OK,
"IDirectInputEffect_SetParameters failed: %08x\n",
hr);
643 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectStatus() failed: %08x\n",
hr);
644 todo_wine ok(effect_status!=0,
"IDirectInputEffect_GetEffectStatus() reported effect as stopped\n");
646 ok(
hr==
DI_OK,
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
648 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
650 ok(
hr==
DI_OK,
"IDirectInputEffect_Download() failed: %08x\n",
hr);
652 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectStatus() failed: %08x\n",
hr);
653 ok(effect_status==0,
"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
655 ok(
hr==
DI_OK,
"IDirectInputEffect_Start() failed: %08x\n",
hr);
657 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectStatus() failed: %08x\n",
hr);
659 todo_wine ok(effect_status!=0,
"IDirectInputEffect_GetEffectStatus() reported effect as stopped\n");
661 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectGuid() failed: %08x\n",
hr);
679 diprop_word.
diph.
dwSize =
sizeof(diprop_word);
684 ok(
hr==
DI_OK,
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
686 ok(
hr==
DI_OK,
"IDirectInputDevice2_GetProperty() failed: %08x\n",
hr);
690 ok(
hr==
DI_OK,
"IDirectInputDevice2_SetProperty() failed: %08x\n",
hr);
692 ok(
hr==
DI_OK,
"IDirectInputDevice2_GetProperty() failed: %08x\n",
hr);
695 trace(
"Acquiring in 2s, autocenter will be disabled.\n");
699 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
701 trace(
"Acquired.\n");
703 ok(
hr==
DI_OK,
"IDirectInputDevice2_GetProperty() failed: %08x\n",
hr);
706 trace(
"Releasing in 2s, autocenter will be re-enabled.\n");
710 ok(
hr==
DI_OK,
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
714 ok(
hr==
DI_OK,
"IDirectInputDevice2_GetProperty() failed: %08x\n",
hr);
717 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
719 ok(
hr==
DI_OK,
"IDirectInputDevice2_GetProperty() failed: %08x\n",
hr);
740 ok(
hr ==
DI_OK,
"IDirectInputDevice_Unacquire() should have returned S_FALSE, got: %08x\n",
hr);
743 ok(
hr==
DI_OK,
"IDirectInputDevice_SetProperty() failed: %08x\n",
hr);
745 ok(
hr==
DI_OK,
"IDirectInputDevice_GetProperty() failed: %08x\n",
hr);
748 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
751 ok(
hr==
DI_OK,
"IDirectInputDevice_SetProperty() failed: %08x\n",
hr);
753 ok(
hr==
DI_OK,
"IDirectInputDevice_GetProperty() failed: %08x\n",
hr);
761 ok(
hr==
DI_OK,
"IDirectInputDevice_SetProperty() failed: %08x\n",
hr);
763 ok(
hr==
DI_OK,
"IDirectInputDevice_GetProperty() failed: %08x\n",
hr);
765 dip_gain_set.
dwData = 10000;
767 ok(
hr==
DI_OK,
"IDirectInputDevice_SetProperty() failed: %08x\n",
hr);
769 ok(
hr==
DI_OK,
"IDirectInputDevice_GetProperty() failed: %08x\n",
hr);
772 dip_gain_set.
dwData = 10001;
774 ok(
hr==
DI_OK,
"IDirectInputDevice_SetProperty() failed: %08x\n",
hr);
776 ok(
hr==
DI_OK,
"IDirectInputDevice_GetProperty() failed: %08x\n",
hr);
789 ok(
hr==
DI_OK,
"IDirectInputEffect_Download() failed: %08x\n",
hr);
793 ok(
hr==
DI_OK,
"IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n",
hr);
795 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectStatus() failed: %08x\n",
hr);
796 ok(effect_status==0,
"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
798 ok(
hr==
DI_OK,
"IDirectInputEffect_Start() failed: %08x\n",
hr);
800 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectGuid() failed: %08x\n",
hr);
805 ok(
hr==
DI_OK,
"IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n",
hr);
809 ok(
hr==
DI_OK,
"IDirectInputEffect_Download() failed: %08x\n",
hr);
811 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectStatus() failed: %08x\n",
hr);
812 ok(effect_status==0,
"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
814 ok(
hr==
DI_OK,
"IDirectInputEffect_Start() failed: %08x\n",
hr);
816 ok(
hr==
DI_OK,
"IDirectInputEffect_GetEffectGuid() failed: %08x\n",
hr);
819 ref = IUnknown_Release(effect);
820 ok(
ref == 0,
"IDirectInputDevice_Release() reference count = %d\n",
ref);
823 ok(cnt1 == cnt2,
"Ref count is wrong %d != %d\n", cnt1, cnt2);
830 trace(
"No force feedback support\n");
831 ok(
hr==
DIERR_UNSUPPORTED,
"IDirectInputDevice_CreateEffect() must fail with DIERR_UNSUPPORTED, got: %08x\n",
hr);
832 ok(effect ==
NULL,
"effect must be NULL, got %p\n", effect);
838 ok(
hr==
DI_OK,
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
841 ok(
hr==
DI_OK,
"IDirectInputDevice_SetCooperativeLevel() failed: %08x\n",
hr);
844 ok(
hr==
DI_OK,
"IDirectInputDevice_Acquire() failed: %08x\n",
hr);
847 trace(
"You have 30 seconds to test all axes, sliders, POVs and buttons\n");
856 ok(
hr==
DI_OK,
"IDirectInputDevice_GetDeviceState() failed: %08x\n",
hr);
859 sprintf(curstate,
"X%5d Y%5d Z%5d Rx%5d Ry%5d Rz%5d "
860 "S0%5d S1%5d POV0%5d POV1%5d POV2%5d POV3%5d "
861 "B %d %d %d %d %d %d %d %d %d %d %d %d\n",
869 if (
strcmp(oldstate, curstate) != 0)
871 trace(
"%s\n", curstate);
872 strcpy(oldstate, curstate);
879 ok(
hr==
DI_OK,
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
883 ok(
ref==0,
"IDirectInputDevice_Release() reference count = %d\n",
ref);
896 trace(
"-- Testing Direct Input Version 0x%04x --\n",
version);
905 ok(
hr==
DI_OK,
"IDirectInput_EnumDevices() failed: %08x\n",
hr);
907 ok(
ref==0,
"IDirectInput_Release() reference count = %d\n",
ref);
909 trace(
" Version Not Supported\n");
923 ok(
hr==
DI_OK,
"IDirectInput_EnumDevices() failed: %08x\n",
hr);
925 ok(
ref==0,
"IDirectInput_Release() reference count = %d\n",
ref);
927 trace(
" Version Not Supported\n");
int strcmp(const char *String1, const char *String2)
HRESULT WINAPI DECLSPEC_HOTPATCH DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
#define MultiByteToWideChar
static const WCHAR version[]
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
GLuint GLuint GLsizei count
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
_Check_return_ _CRTIMP int __cdecl swscanf(_In_z_ const wchar_t *_Src, _In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define sprintf(buf, format,...)
static const BYTE ramp[17]
#define IsEqualGUID(rguid1, rguid2)
#define IsEqualIID(riid1, riid2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
CHAR tszInstanceName[MAX_PATH]
CHAR tszProductName[MAX_PATH]
LPVOID lpvTypeSpecificParams
DWORD cbTypeSpecificParams
IDirectInputDeviceA * pJoystick
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
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)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HWND WINAPI GetForegroundWindow(void)
HWND WINAPI GetDesktopWindow(void)
BOOL WINAPI DestroyWindow(_In_ HWND)