- some TRACEing improvements
[wine/testsucceed.git] / dlls / dinput / mouse.c
blob95624be94b5a47a10721c960569f0f6ec6d9dcfa
1 /* DirectInput Mouse device
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998,1999 Lionel Ulmer
5 * Copyright 2000-2001 TransGaming Technologies Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
23 #include "wine/port.h"
25 #include <stdarg.h>
26 #include <string.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "winerror.h"
33 #include "dinput.h"
35 #include "dinput_private.h"
36 #include "device_private.h"
37 #include "wine/debug.h"
38 #include "wine/unicode.h"
40 #define MOUSE_HACK
42 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
44 /* Wine mouse driver object instances */
45 #define WINE_MOUSE_X_AXIS_INSTANCE 0
46 #define WINE_MOUSE_Y_AXIS_INSTANCE 1
47 #define WINE_MOUSE_Z_AXIS_INSTANCE 2
48 #define WINE_MOUSE_L_BUTTON_INSTANCE 0
49 #define WINE_MOUSE_R_BUTTON_INSTANCE 1
50 #define WINE_MOUSE_M_BUTTON_INSTANCE 2
51 #define WINE_MOUSE_D_BUTTON_INSTANCE 3
53 /* ------------------------------- */
54 /* Wine mouse internal data format */
55 /* ------------------------------- */
57 /* Constants used to access the offset array */
58 #define WINE_MOUSE_X_POSITION 0
59 #define WINE_MOUSE_Y_POSITION 1
60 #define WINE_MOUSE_Z_POSITION 2
61 #define WINE_MOUSE_L_POSITION 3
62 #define WINE_MOUSE_R_POSITION 4
63 #define WINE_MOUSE_M_POSITION 5
65 typedef struct {
66 LONG lX;
67 LONG lY;
68 LONG lZ;
69 BYTE rgbButtons[4];
70 } Wine_InternalMouseData;
72 #define WINE_INTERNALMOUSE_NUM_OBJS 6
74 static const DIOBJECTDATAFORMAT Wine_InternalMouseObjectFormat[WINE_INTERNALMOUSE_NUM_OBJS] = {
75 { &GUID_XAxis, FIELD_OFFSET(Wine_InternalMouseData, lX),
76 DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 },
77 { &GUID_YAxis, FIELD_OFFSET(Wine_InternalMouseData, lY),
78 DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 },
79 { &GUID_ZAxis, FIELD_OFFSET(Wine_InternalMouseData, lZ),
80 DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 },
81 { &GUID_Button, (FIELD_OFFSET(Wine_InternalMouseData, rgbButtons)) + 0,
82 DIDFT_MAKEINSTANCE(WINE_MOUSE_L_BUTTON_INSTANCE) | DIDFT_PSHBUTTON, 0 },
83 { &GUID_Button, (FIELD_OFFSET(Wine_InternalMouseData, rgbButtons)) + 1,
84 DIDFT_MAKEINSTANCE(WINE_MOUSE_R_BUTTON_INSTANCE) | DIDFT_PSHBUTTON, 0 },
85 { &GUID_Button, (FIELD_OFFSET(Wine_InternalMouseData, rgbButtons)) + 2,
86 DIDFT_MAKEINSTANCE(WINE_MOUSE_M_BUTTON_INSTANCE) | DIDFT_PSHBUTTON, 0 }
89 static const DIDATAFORMAT Wine_InternalMouseFormat = {
90 0, /* dwSize - unused */
91 0, /* dwObjsize - unused */
92 0, /* dwFlags - unused */
93 sizeof(Wine_InternalMouseData),
94 WINE_INTERNALMOUSE_NUM_OBJS, /* dwNumObjs */
95 (LPDIOBJECTDATAFORMAT) Wine_InternalMouseObjectFormat
98 static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt;
99 static ICOM_VTABLE(IDirectInputDevice8W) SysMouseWvt;
101 typedef struct SysMouseImpl SysMouseImpl;
103 typedef enum {
104 WARP_DONE, /* Warping has been done */
105 WARP_NEEDED, /* Warping is needed */
106 WARP_STARTED /* Warping has been done, waiting for the warp event */
107 } WARP_STATUS;
109 struct SysMouseImpl
111 LPVOID lpVtbl;
112 DWORD ref;
113 GUID guid;
115 IDirectInputImpl *dinput;
117 /* The current data format and the conversion between internal
118 and external data formats */
119 DIDATAFORMAT *df;
120 DataFormat *wine_df;
121 int offset_array[WINE_INTERNALMOUSE_NUM_OBJS];
123 /* SysMouseAImpl */
124 BYTE absolute;
125 /* Previous position for relative moves */
126 LONG prevX, prevY;
127 /* These are used in case of relative -> absolute transitions */
128 POINT org_coords;
129 HHOOK hook;
130 HWND win;
131 DWORD dwCoopLevel;
132 POINT mapped_center;
133 DWORD win_centerX, win_centerY;
134 LPDIDEVICEOBJECTDATA data_queue;
135 int queue_head, queue_tail, queue_len;
136 /* warping: whether we need to move mouse back to middle once we
137 * reach window borders (for e.g. shooters, "surface movement" games) */
138 WARP_STATUS need_warp;
139 int acquired;
140 HANDLE hEvent;
141 CRITICAL_SECTION crit;
143 /* This is for mouse reporting. */
144 Wine_InternalMouseData m_state;
147 /* FIXME: This is ugly and not thread safe :/ */
148 static IDirectInputDevice8A* current_lock = NULL;
150 static GUID DInput_Wine_Mouse_GUID = { /* 9e573ed8-7734-11d2-8d4a-23903fb6bdf7 */
151 0x9e573ed8,
152 0x7734,
153 0x11d2,
154 {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
157 static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, int version) {
158 DWORD dwSize;
159 DIDEVICEINSTANCEA ddi;
161 dwSize = lpddi->dwSize;
163 TRACE("%ld %p\n", dwSize, lpddi);
165 memset(lpddi, 0, dwSize);
166 memset(&ddi, 0, sizeof(ddi));
168 ddi.dwSize = dwSize;
169 ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
170 ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */
171 if (version >= 8)
172 ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
173 else
174 ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
175 strcpy(ddi.tszInstanceName, "Mouse");
176 strcpy(ddi.tszProductName, "Wine Mouse");
178 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
181 static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, int version) {
182 DWORD dwSize;
183 DIDEVICEINSTANCEW ddi;
185 dwSize = lpddi->dwSize;
187 TRACE("%ld %p\n", dwSize, lpddi);
189 memset(lpddi, 0, dwSize);
190 memset(&ddi, 0, sizeof(ddi));
192 ddi.dwSize = dwSize;
193 ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
194 ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */
195 if (version >= 8)
196 ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
197 else
198 ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
199 MultiByteToWideChar(CP_ACP, 0, "Mouse", -1, ddi.tszInstanceName, MAX_PATH);
200 MultiByteToWideChar(CP_ACP, 0, "Wine Mouse", -1, ddi.tszProductName, MAX_PATH);
202 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
205 static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version)
207 if ((dwDevType == 0) ||
208 ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) ||
209 ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) {
210 TRACE("Enumerating the mouse device\n");
212 fill_mouse_dideviceinstanceA(lpddi, version);
214 return TRUE;
217 return FALSE;
220 static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version)
222 if ((dwDevType == 0) ||
223 ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) ||
224 ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) {
225 TRACE("Enumerating the mouse device\n");
227 fill_mouse_dideviceinstanceW(lpddi, version);
229 return TRUE;
232 return FALSE;
235 static SysMouseImpl *alloc_device(REFGUID rguid, LPVOID mvt, IDirectInputImpl *dinput)
237 int offset_array[WINE_INTERNALMOUSE_NUM_OBJS] = {
238 FIELD_OFFSET(Wine_InternalMouseData, lX),
239 FIELD_OFFSET(Wine_InternalMouseData, lY),
240 FIELD_OFFSET(Wine_InternalMouseData, lZ),
241 FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 0,
242 FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 1,
243 FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 2
245 SysMouseImpl* newDevice;
246 newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
247 newDevice->ref = 1;
248 newDevice->lpVtbl = mvt;
249 InitializeCriticalSection(&(newDevice->crit));
250 memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
252 /* Per default, Wine uses its internal data format */
253 newDevice->df = (DIDATAFORMAT *) &Wine_InternalMouseFormat;
254 memcpy(newDevice->offset_array, offset_array, WINE_INTERNALMOUSE_NUM_OBJS * sizeof(int));
255 newDevice->wine_df = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
256 newDevice->wine_df->size = 0;
257 newDevice->wine_df->internal_format_size = Wine_InternalMouseFormat.dwDataSize;
258 newDevice->wine_df->dt = NULL;
259 newDevice->dinput = dinput;
261 return newDevice;
264 static HRESULT mousedev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
266 if ((IsEqualGUID(&GUID_SysMouse,rguid)) || /* Generic Mouse */
267 (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */
268 if ((riid == NULL) ||
269 IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
270 IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
271 IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
272 IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
273 *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysMouseAvt, dinput);
274 TRACE("Creating a Mouse device (%p)\n", *pdev);
275 return DI_OK;
276 } else
277 return DIERR_NOINTERFACE;
280 return DIERR_DEVICENOTREG;
283 static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
285 if ((IsEqualGUID(&GUID_SysMouse,rguid)) || /* Generic Mouse */
286 (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */
287 if ((riid == NULL) ||
288 IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
289 IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
290 IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
291 IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
292 *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysMouseWvt, dinput);
293 TRACE("Creating a Mouse device (%p)\n", *pdev);
294 return DI_OK;
295 } else
296 return DIERR_NOINTERFACE;
299 return DIERR_DEVICENOTREG;
301 static dinput_device mousedev = {
302 100,
303 mousedev_enum_deviceA,
304 mousedev_enum_deviceW,
305 mousedev_create_deviceA,
306 mousedev_create_deviceW
309 DECL_GLOBAL_CONSTRUCTOR(mousedev_register) { dinput_register_device(&mousedev); }
311 /******************************************************************************
312 * SysMouseA (DInput Mouse support)
315 /******************************************************************************
316 * Release : release the mouse buffer.
318 static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
320 ICOM_THIS(SysMouseImpl,iface);
322 This->ref--;
323 if (This->ref)
324 return This->ref;
326 /* Free the data queue */
327 if (This->data_queue != NULL)
328 HeapFree(GetProcessHeap(),0,This->data_queue);
330 if (This->hook) {
331 UnhookWindowsHookEx( This->hook );
332 if (This->dwCoopLevel & DISCL_EXCLUSIVE)
333 ShowCursor(TRUE); /* show cursor */
335 DeleteCriticalSection(&(This->crit));
337 /* Free the DataFormat */
338 if (This->df != &(Wine_InternalMouseFormat)) {
339 HeapFree(GetProcessHeap(), 0, This->df->rgodf);
340 HeapFree(GetProcessHeap(), 0, This->df);
343 HeapFree(GetProcessHeap(),0,This);
344 return DI_OK;
348 /******************************************************************************
349 * SetCooperativeLevel : store the window in which we will do our
350 * grabbing.
352 static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel(
353 LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags
356 ICOM_THIS(SysMouseImpl,iface);
358 TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
360 if (TRACE_ON(dinput)) {
361 TRACE(" cooperative level : ");
362 _dump_cooperativelevel_DI(dwflags);
365 /* Store the window which asks for the mouse */
366 if (!hwnd)
367 hwnd = GetDesktopWindow();
368 This->win = hwnd;
369 This->dwCoopLevel = dwflags;
371 return DI_OK;
375 /******************************************************************************
376 * SetDataFormat : the application can choose the format of the data
377 * the device driver sends back with GetDeviceState.
379 * For the moment, only the "standard" configuration (c_dfDIMouse) is supported
380 * in absolute and relative mode.
382 static HRESULT WINAPI SysMouseAImpl_SetDataFormat(
383 LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
386 ICOM_THIS(SysMouseImpl,iface);
388 TRACE("(this=%p,%p)\n",This,df);
390 _dump_DIDATAFORMAT(df);
392 /* Tests under windows show that a call to SetDataFormat always sets the mouse
393 in relative mode whatever the dwFlags value (DIDF_ABSAXIS/DIDF_RELAXIS).
394 To switch in absolute mode, SetProperty must be used. */
395 This->absolute = 0;
397 /* Store the new data format */
398 This->df = HeapAlloc(GetProcessHeap(),0,df->dwSize);
399 memcpy(This->df, df, df->dwSize);
400 This->df->rgodf = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*df->dwObjSize);
401 memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize);
403 /* Prepare all the data-conversion filters */
404 This->wine_df = create_DataFormat(&(Wine_InternalMouseFormat), df, This->offset_array);
406 return DI_OK;
409 /* low-level mouse hook */
410 static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lparam )
412 LRESULT ret;
413 MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
414 SysMouseImpl* This = (SysMouseImpl*) current_lock;
415 DWORD dwCoop;
416 static long last_event = 0;
417 int wdata;
419 if (code != HC_ACTION) return CallNextHookEx( This->hook, code, wparam, lparam );
421 EnterCriticalSection(&(This->crit));
422 dwCoop = This->dwCoopLevel;
424 /* Only allow mouse events every 10 ms.
425 * This is to allow the cursor to start acceleration before
426 * the warps happen. But if it involves a mouse button event we
427 * allow it since we don't want to loose the clicks.
429 if (((GetCurrentTime() - last_event) < 10)
430 && wparam == WM_MOUSEMOVE)
431 goto end;
432 else last_event = GetCurrentTime();
434 /* Mouse moved -> send event if asked */
435 if (This->hEvent)
436 SetEvent(This->hEvent);
438 if (wparam == WM_MOUSEMOVE) {
439 if (This->absolute) {
440 if (hook->pt.x != This->prevX)
441 GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x, hook->time, 0);
442 if (hook->pt.y != This->prevY)
443 GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y, hook->time, 0);
444 } else {
445 /* Now, warp handling */
446 if ((This->need_warp == WARP_STARTED) &&
447 (hook->pt.x == This->mapped_center.x) && (hook->pt.y == This->mapped_center.y)) {
448 /* Warp has been done... */
449 This->need_warp = WARP_DONE;
450 goto end;
453 /* Relative mouse input with absolute mouse event : the real fun starts here... */
454 if ((This->need_warp == WARP_NEEDED) ||
455 (This->need_warp == WARP_STARTED)) {
456 if (hook->pt.x != This->prevX)
457 GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x - This->prevX,
458 hook->time, (This->dinput->evsequence)++);
459 if (hook->pt.y != This->prevY)
460 GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->prevY,
461 hook->time, (This->dinput->evsequence)++);
462 } else {
463 /* This is the first time the event handler has been called after a
464 GetDeviceData or GetDeviceState. */
465 if (hook->pt.x != This->mapped_center.x) {
466 GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x - This->mapped_center.x,
467 hook->time, (This->dinput->evsequence)++);
468 This->need_warp = WARP_NEEDED;
471 if (hook->pt.y != This->mapped_center.y) {
472 GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->mapped_center.y,
473 hook->time, (This->dinput->evsequence)++);
474 This->need_warp = WARP_NEEDED;
479 This->prevX = hook->pt.x;
480 This->prevY = hook->pt.y;
482 if (This->absolute) {
483 This->m_state.lX = hook->pt.x;
484 This->m_state.lY = hook->pt.y;
485 } else {
486 This->m_state.lX = hook->pt.x - This->mapped_center.x;
487 This->m_state.lY = hook->pt.y - This->mapped_center.y;
491 TRACE(" msg %x pt %ld %ld (W=%d)\n",
492 wparam, hook->pt.x, hook->pt.y, (!This->absolute) && This->need_warp );
494 switch(wparam) {
495 case WM_LBUTTONDOWN:
496 GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0xFF,
497 hook->time, This->dinput->evsequence++);
498 This->m_state.rgbButtons[0] = 0xFF;
499 break;
500 case WM_LBUTTONUP:
501 GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x00,
502 hook->time, This->dinput->evsequence++);
503 This->m_state.rgbButtons[0] = 0x00;
504 break;
505 case WM_RBUTTONDOWN:
506 GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0xFF,
507 hook->time, This->dinput->evsequence++);
508 This->m_state.rgbButtons[1] = 0xFF;
509 break;
510 case WM_RBUTTONUP:
511 GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x00,
512 hook->time, This->dinput->evsequence++);
513 This->m_state.rgbButtons[1] = 0x00;
514 break;
515 case WM_MBUTTONDOWN:
516 GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0xFF,
517 hook->time, This->dinput->evsequence++);
518 This->m_state.rgbButtons[2] = 0xFF;
519 break;
520 case WM_MBUTTONUP:
521 GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x00,
522 hook->time, This->dinput->evsequence++);
523 This->m_state.rgbButtons[2] = 0x00;
524 break;
525 case WM_MOUSEWHEEL:
526 wdata = (short)HIWORD(hook->mouseData);
527 GEN_EVENT(This->offset_array[WINE_MOUSE_Z_POSITION], wdata,
528 hook->time, This->dinput->evsequence++);
529 This->m_state.lZ += wdata;
530 break;
533 TRACE("(X: %ld - Y: %ld L: %02x M: %02x R: %02x)\n",
534 This->m_state.lX, This->m_state.lY,
535 This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
537 end:
538 LeaveCriticalSection(&(This->crit));
540 if (dwCoop & DISCL_NONEXCLUSIVE) {
541 /* Pass the events down to previous handlers (e.g. win32 input) */
542 ret = CallNextHookEx( This->hook, code, wparam, lparam );
543 } else {
544 /* Ignore message */
545 ret = 1;
547 return ret;
551 static void dinput_window_check(SysMouseImpl* This) {
552 RECT rect;
553 DWORD centerX, centerY;
555 /* make sure the window hasn't moved */
556 GetWindowRect(This->win, &rect);
557 centerX = (rect.right - rect.left) / 2;
558 centerY = (rect.bottom - rect.top ) / 2;
559 if (This->win_centerX != centerX || This->win_centerY != centerY) {
560 This->win_centerX = centerX;
561 This->win_centerY = centerY;
563 This->mapped_center.x = This->win_centerX;
564 This->mapped_center.y = This->win_centerY;
565 MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
569 /******************************************************************************
570 * Acquire : gets exclusive control of the mouse
572 static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
574 ICOM_THIS(SysMouseImpl,iface);
575 RECT rect;
577 TRACE("(this=%p)\n",This);
579 if (This->acquired == 0) {
580 POINT point;
582 /* Store (in a global variable) the current lock */
583 current_lock = (IDirectInputDevice8A*)This;
585 /* Init the mouse state */
586 GetCursorPos( &point );
587 if (This->absolute) {
588 This->m_state.lX = point.x;
589 This->m_state.lY = point.y;
590 This->prevX = point.x;
591 This->prevY = point.y;
592 } else {
593 This->m_state.lX = 0;
594 This->m_state.lY = 0;
595 This->org_coords = point;
597 This->m_state.lZ = 0;
598 This->m_state.rgbButtons[0] = ((GetKeyState(VK_LBUTTON) & 0x80) ? 0xFF : 0x00);
599 This->m_state.rgbButtons[1] = ((GetKeyState(VK_RBUTTON) & 0x80) ? 0xFF : 0x00);
600 This->m_state.rgbButtons[2] = ((GetKeyState(VK_MBUTTON) & 0x80) ? 0xFF : 0x00);
602 /* Install our mouse hook */
603 if (This->dwCoopLevel & DISCL_EXCLUSIVE)
604 ShowCursor(FALSE); /* hide cursor */
605 This->hook = SetWindowsHookExA( WH_MOUSE_LL, dinput_mouse_hook, DINPUT_instance, 0 );
607 /* Get the window dimension and find the center */
608 GetWindowRect(This->win, &rect);
609 This->win_centerX = (rect.right - rect.left) / 2;
610 This->win_centerY = (rect.bottom - rect.top ) / 2;
612 /* Warp the mouse to the center of the window */
613 if (This->absolute == 0) {
614 This->mapped_center.x = This->win_centerX;
615 This->mapped_center.y = This->win_centerY;
616 MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
617 TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
618 SetCursorPos( This->mapped_center.x, This->mapped_center.y );
619 #ifdef MOUSE_HACK
620 This->need_warp = WARP_DONE;
621 #else
622 This->need_warp = WARP_STARTED;
623 #endif
626 This->acquired = 1;
627 return DI_OK;
629 return S_FALSE;
632 /******************************************************************************
633 * Unacquire : frees the mouse
635 static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
637 ICOM_THIS(SysMouseImpl,iface);
639 TRACE("(this=%p)\n",This);
641 if (This->acquired) {
642 /* Reinstall previous mouse event handler */
643 if (This->hook) {
644 UnhookWindowsHookEx( This->hook );
645 This->hook = 0;
647 if (This->dwCoopLevel & DISCL_EXCLUSIVE)
648 ShowCursor(TRUE); /* show cursor */
651 /* No more locks */
652 current_lock = NULL;
654 /* Unacquire device */
655 This->acquired = 0;
657 /* And put the mouse cursor back where it was at acquire time */
658 if (This->absolute == 0) {
659 TRACE(" warping mouse back to (%ld , %ld)\n", This->org_coords.x, This->org_coords.y);
660 SetCursorPos(This->org_coords.x, This->org_coords.y);
662 } else {
663 return DI_NOEFFECT;
666 return DI_OK;
669 /******************************************************************************
670 * GetDeviceState : returns the "state" of the mouse.
672 * For the moment, only the "standard" return structure (DIMOUSESTATE) is
673 * supported.
675 static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
676 LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
678 ICOM_THIS(SysMouseImpl,iface);
680 EnterCriticalSection(&(This->crit));
681 TRACE("(this=%p,0x%08lx,%p): \n",This,len,ptr);
683 /* Copy the current mouse state */
684 fill_DataFormat(ptr, &(This->m_state), This->wine_df);
686 /* Initialize the buffer when in relative mode */
687 if (This->absolute == 0) {
688 This->m_state.lX = 0;
689 This->m_state.lY = 0;
690 This->m_state.lZ = 0;
693 /* Check if we need to do a mouse warping */
694 if (This->need_warp == WARP_NEEDED) {
695 dinput_window_check(This);
696 TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
697 SetCursorPos( This->mapped_center.x, This->mapped_center.y );
699 #ifdef MOUSE_HACK
700 This->need_warp = WARP_DONE;
701 #else
702 This->need_warp = WARP_STARTED;
703 #endif
706 LeaveCriticalSection(&(This->crit));
708 TRACE("(X: %ld - Y: %ld - Z: %ld L: %02x M: %02x R: %02x)\n",
709 This->m_state.lX, This->m_state.lY, This->m_state.lZ,
710 This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
712 return DI_OK;
715 /******************************************************************************
716 * GetDeviceState : gets buffered input data.
718 static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
719 DWORD dodsize,
720 LPDIDEVICEOBJECTDATA dod,
721 LPDWORD entries,
722 DWORD flags
724 ICOM_THIS(SysMouseImpl,iface);
725 DWORD len, nqtail;
727 TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags);
729 if (This->acquired == 0) {
730 WARN(" application tries to get data from an unacquired device !\n");
731 return DIERR_NOTACQUIRED;
734 EnterCriticalSection(&(This->crit));
736 len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0)
737 + (This->queue_head - This->queue_tail);
738 if (len > *entries) len = *entries;
740 if (dod == NULL) {
741 if (len)
742 TRACE("Application discarding %ld event(s).\n", len);
744 *entries = len;
745 nqtail = This->queue_tail + len;
746 while (nqtail >= This->queue_len) nqtail -= This->queue_len;
747 } else {
748 if (dodsize < sizeof(DIDEVICEOBJECTDATA)) {
749 ERR("Wrong structure size !\n");
750 LeaveCriticalSection(&(This->crit));
751 return DIERR_INVALIDPARAM;
754 if (len)
755 TRACE("Application retrieving %ld event(s).\n", len);
757 *entries = 0;
758 nqtail = This->queue_tail;
759 while (len) {
760 DWORD span = ((This->queue_head < nqtail) ? This->queue_len : This->queue_head) - nqtail;
761 if (span > len)
762 span = len;
764 /* Copy the buffered data into the application queue */
765 memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize);
766 /* Advance position */
767 nqtail += span;
768 if (nqtail >= This->queue_len) nqtail -= This->queue_len;
769 *entries += span;
770 len -= span;
773 if (!(flags & DIGDD_PEEK))
774 This->queue_tail = nqtail;
776 LeaveCriticalSection(&(This->crit));
778 /* Check if we need to do a mouse warping */
779 if (This->need_warp == WARP_NEEDED) {
780 dinput_window_check(This);
781 TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
782 SetCursorPos( This->mapped_center.x, This->mapped_center.y );
784 #ifdef MOUSE_HACK
785 This->need_warp = WARP_DONE;
786 #else
787 This->need_warp = WARP_STARTED;
788 #endif
790 return DI_OK;
793 /******************************************************************************
794 * SetProperty : change input device properties
796 static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
797 REFGUID rguid,
798 LPCDIPROPHEADER ph)
800 ICOM_THIS(SysMouseImpl,iface);
802 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
804 if (!HIWORD(rguid)) {
805 switch ((DWORD)rguid) {
806 case (DWORD) DIPROP_BUFFERSIZE: {
807 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
809 TRACE("buffersize = %ld\n",pd->dwData);
811 This->data_queue = (LPDIDEVICEOBJECTDATA)HeapAlloc(GetProcessHeap(),0,
812 pd->dwData * sizeof(DIDEVICEOBJECTDATA));
813 This->queue_head = 0;
814 This->queue_tail = 0;
815 This->queue_len = pd->dwData;
816 break;
818 case (DWORD) DIPROP_AXISMODE: {
819 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
820 This->absolute = !(pd->dwData);
821 TRACE("Using %s coordinates mode now\n", This->absolute ? "absolute" : "relative");
822 break;
824 default:
825 FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid));
826 break;
830 return DI_OK;
833 /******************************************************************************
834 * GetProperty : get input device properties
836 static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
837 REFGUID rguid,
838 LPDIPROPHEADER pdiph)
840 ICOM_THIS(SysMouseImpl,iface);
842 TRACE("(this=%p,%s,%p): stub!\n",
843 iface, debugstr_guid(rguid), pdiph);
845 if (TRACE_ON(dinput))
846 _dump_DIPROPHEADER(pdiph);
848 if (!HIWORD(rguid)) {
849 switch ((DWORD)rguid) {
850 case (DWORD) DIPROP_BUFFERSIZE: {
851 LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
853 TRACE(" return buffersize = %d\n",This->queue_len);
854 pd->dwData = This->queue_len;
855 break;
858 case (DWORD) DIPROP_GRANULARITY: {
859 LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
861 /* We'll just assume that the app asks about the Z axis */
862 pr->dwData = WHEEL_DELTA;
864 break;
867 case (DWORD) DIPROP_RANGE: {
868 LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph;
870 if ((pdiph->dwHow == DIPH_BYID) &&
871 ((pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS)) ||
872 (pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS)))) {
873 /* Querying the range of either the X or the Y axis. As I do
874 not know the range, do as if the range were
875 unrestricted...*/
876 pr->lMin = DIPROPRANGE_NOMIN;
877 pr->lMax = DIPROPRANGE_NOMAX;
880 break;
883 default:
884 FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid));
885 break;
889 return DI_OK;
894 /******************************************************************************
895 * SetEventNotification : specifies event to be sent on state change
897 static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
898 HANDLE hnd) {
899 ICOM_THIS(SysMouseImpl,iface);
901 TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
903 This->hEvent = hnd;
905 return DI_OK;
908 /******************************************************************************
909 * GetCapabilities : get the device capablitites
911 static HRESULT WINAPI SysMouseAImpl_GetCapabilities(
912 LPDIRECTINPUTDEVICE8A iface,
913 LPDIDEVCAPS lpDIDevCaps)
915 ICOM_THIS(SysMouseImpl,iface);
917 TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
919 if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) {
920 lpDIDevCaps->dwFlags = DIDC_ATTACHED;
921 if (This->dinput->version >= 8)
922 lpDIDevCaps->dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
923 else
924 lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
925 lpDIDevCaps->dwAxes = 3;
926 lpDIDevCaps->dwButtons = 3;
927 lpDIDevCaps->dwPOVs = 0;
928 lpDIDevCaps->dwFFSamplePeriod = 0;
929 lpDIDevCaps->dwFFMinTimeResolution = 0;
930 lpDIDevCaps->dwFirmwareRevision = 100;
931 lpDIDevCaps->dwHardwareRevision = 100;
932 lpDIDevCaps->dwFFDriverVersion = 0;
933 } else {
934 /* DirectX 3.0 */
935 FIXME("DirectX 3.0 not supported....\n");
938 return DI_OK;
942 /******************************************************************************
943 * EnumObjects : enumerate the different buttons and axis...
945 static HRESULT WINAPI SysMouseAImpl_EnumObjects(
946 LPDIRECTINPUTDEVICE8A iface,
947 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
948 LPVOID lpvRef,
949 DWORD dwFlags)
951 ICOM_THIS(SysMouseImpl,iface);
952 DIDEVICEOBJECTINSTANCEA ddoi;
954 TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags);
955 if (TRACE_ON(dinput)) {
956 TRACE(" - flags = ");
957 _dump_EnumObjects_flags(dwFlags);
958 TRACE("\n");
961 /* Only the fields till dwFFMaxForce are relevant */
962 memset(&ddoi, 0, sizeof(ddoi));
963 ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
965 /* In a mouse, we have : two relative axis and three buttons */
966 if ((dwFlags == DIDFT_ALL) ||
967 (dwFlags & DIDFT_AXIS)) {
968 /* X axis */
969 ddoi.guidType = GUID_XAxis;
970 ddoi.dwOfs = This->offset_array[WINE_MOUSE_X_POSITION];
971 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS;
972 strcpy(ddoi.tszName, "X-Axis");
973 _dump_OBJECTINSTANCEA(&ddoi);
974 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
976 /* Y axis */
977 ddoi.guidType = GUID_YAxis;
978 ddoi.dwOfs = This->offset_array[WINE_MOUSE_Y_POSITION];
979 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
980 strcpy(ddoi.tszName, "Y-Axis");
981 _dump_OBJECTINSTANCEA(&ddoi);
982 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
984 /* Z axis */
985 ddoi.guidType = GUID_ZAxis;
986 ddoi.dwOfs = This->offset_array[WINE_MOUSE_Z_POSITION];
987 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS;
988 strcpy(ddoi.tszName, "Z-Axis");
989 _dump_OBJECTINSTANCEA(&ddoi);
990 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
993 if ((dwFlags == DIDFT_ALL) ||
994 (dwFlags & DIDFT_BUTTON)) {
995 ddoi.guidType = GUID_Button;
997 /* Left button */
998 ddoi.dwOfs = This->offset_array[WINE_MOUSE_L_POSITION];
999 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_L_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
1000 strcpy(ddoi.tszName, "Left-Button");
1001 _dump_OBJECTINSTANCEA(&ddoi);
1002 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
1004 /* Right button */
1005 ddoi.dwOfs = This->offset_array[WINE_MOUSE_R_POSITION];
1006 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_R_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
1007 strcpy(ddoi.tszName, "Right-Button");
1008 _dump_OBJECTINSTANCEA(&ddoi);
1009 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
1011 /* Middle button */
1012 ddoi.dwOfs = This->offset_array[WINE_MOUSE_M_POSITION];
1013 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_M_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
1014 strcpy(ddoi.tszName, "Middle-Button");
1015 _dump_OBJECTINSTANCEA(&ddoi);
1016 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
1019 return DI_OK;
1022 static HRESULT WINAPI SysMouseWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef,DWORD dwFlags)
1024 ICOM_THIS(SysMouseImpl,iface);
1026 device_enumobjects_AtoWcb_data data;
1028 data.lpCallBack = lpCallback;
1029 data.lpvRef = lpvRef;
1031 return SysMouseAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
1034 /******************************************************************************
1035 * GetDeviceInfo : get information about a device's identity
1037 static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo(
1038 LPDIRECTINPUTDEVICE8A iface,
1039 LPDIDEVICEINSTANCEA pdidi)
1041 ICOM_THIS(SysMouseImpl,iface);
1042 TRACE("(this=%p,%p)\n", This, pdidi);
1044 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
1045 WARN(" dinput3 not supporte yet...\n");
1046 return DI_OK;
1049 fill_mouse_dideviceinstanceA(pdidi, This->dinput->version);
1051 return DI_OK;
1054 static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
1056 ICOM_THIS(SysMouseImpl,iface);
1057 TRACE("(this=%p,%p)\n", This, pdidi);
1059 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
1060 WARN(" dinput3 not supporte yet...\n");
1061 return DI_OK;
1064 fill_mouse_dideviceinstanceW(pdidi, This->dinput->version);
1066 return DI_OK;
1070 static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt =
1072 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1073 IDirectInputDevice2AImpl_QueryInterface,
1074 IDirectInputDevice2AImpl_AddRef,
1075 SysMouseAImpl_Release,
1076 SysMouseAImpl_GetCapabilities,
1077 SysMouseAImpl_EnumObjects,
1078 SysMouseAImpl_GetProperty,
1079 SysMouseAImpl_SetProperty,
1080 SysMouseAImpl_Acquire,
1081 SysMouseAImpl_Unacquire,
1082 SysMouseAImpl_GetDeviceState,
1083 SysMouseAImpl_GetDeviceData,
1084 SysMouseAImpl_SetDataFormat,
1085 SysMouseAImpl_SetEventNotification,
1086 SysMouseAImpl_SetCooperativeLevel,
1087 IDirectInputDevice2AImpl_GetObjectInfo,
1088 SysMouseAImpl_GetDeviceInfo,
1089 IDirectInputDevice2AImpl_RunControlPanel,
1090 IDirectInputDevice2AImpl_Initialize,
1091 IDirectInputDevice2AImpl_CreateEffect,
1092 IDirectInputDevice2AImpl_EnumEffects,
1093 IDirectInputDevice2AImpl_GetEffectInfo,
1094 IDirectInputDevice2AImpl_GetForceFeedbackState,
1095 IDirectInputDevice2AImpl_SendForceFeedbackCommand,
1096 IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
1097 IDirectInputDevice2AImpl_Escape,
1098 IDirectInputDevice2AImpl_Poll,
1099 IDirectInputDevice2AImpl_SendDeviceData,
1100 IDirectInputDevice7AImpl_EnumEffectsInFile,
1101 IDirectInputDevice7AImpl_WriteEffectToFile,
1102 IDirectInputDevice8AImpl_BuildActionMap,
1103 IDirectInputDevice8AImpl_SetActionMap,
1104 IDirectInputDevice8AImpl_GetImageInfo
1107 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1108 # define XCAST(fun) (typeof(SysMouseWvt.fun))
1109 #else
1110 # define XCAST(fun) (void*)
1111 #endif
1113 static ICOM_VTABLE(IDirectInputDevice8W) SysMouseWvt =
1115 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1116 IDirectInputDevice2WImpl_QueryInterface,
1117 XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
1118 XCAST(Release)SysMouseAImpl_Release,
1119 XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities,
1120 SysMouseWImpl_EnumObjects,
1121 XCAST(GetProperty)SysMouseAImpl_GetProperty,
1122 XCAST(SetProperty)SysMouseAImpl_SetProperty,
1123 XCAST(Acquire)SysMouseAImpl_Acquire,
1124 XCAST(Unacquire)SysMouseAImpl_Unacquire,
1125 XCAST(GetDeviceState)SysMouseAImpl_GetDeviceState,
1126 XCAST(GetDeviceData)SysMouseAImpl_GetDeviceData,
1127 XCAST(SetDataFormat)SysMouseAImpl_SetDataFormat,
1128 XCAST(SetEventNotification)SysMouseAImpl_SetEventNotification,
1129 XCAST(SetCooperativeLevel)SysMouseAImpl_SetCooperativeLevel,
1130 IDirectInputDevice2WImpl_GetObjectInfo,
1131 SysMouseWImpl_GetDeviceInfo,
1132 XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
1133 XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
1134 XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
1135 IDirectInputDevice2WImpl_EnumEffects,
1136 IDirectInputDevice2WImpl_GetEffectInfo,
1137 XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
1138 XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
1139 XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
1140 XCAST(Escape)IDirectInputDevice2AImpl_Escape,
1141 XCAST(Poll)IDirectInputDevice2AImpl_Poll,
1142 XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
1143 IDirectInputDevice7WImpl_EnumEffectsInFile,
1144 IDirectInputDevice7WImpl_WriteEffectToFile,
1145 IDirectInputDevice8WImpl_BuildActionMap,
1146 IDirectInputDevice8WImpl_SetActionMap,
1147 IDirectInputDevice8WImpl_GetImageInfo
1149 #undef XCAST