ntdll/tests: Print 64bit integers as two 32 bit integers.
[wine/multimedia.git] / dlls / dinput / mouse.c
blob363d1b82fedb16504b167bb92f90acea600dc6f5
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 const IDirectInputDevice8AVtbl SysMouseAvt;
99 static const IDirectInputDevice8WVtbl 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 const void *lpVtbl;
112 LONG 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 HWND win;
130 DWORD dwCoopLevel;
131 POINT mapped_center;
132 DWORD win_centerX, win_centerY;
133 LPDIDEVICEOBJECTDATA data_queue;
134 int queue_head, queue_tail, queue_len;
135 BOOL overflow;
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 DWORD last_warped;
140 int acquired;
141 HANDLE hEvent;
142 CRITICAL_SECTION crit;
144 /* This is for mouse reporting. */
145 Wine_InternalMouseData m_state;
148 /* FIXME: This is ugly and not thread safe :/ */
149 static IDirectInputDevice8A* current_lock = NULL;
151 static GUID DInput_Wine_Mouse_GUID = { /* 9e573ed8-7734-11d2-8d4a-23903fb6bdf7 */
152 0x9e573ed8,
153 0x7734,
154 0x11d2,
155 {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
158 static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version) {
159 DWORD dwSize;
160 DIDEVICEINSTANCEA ddi;
162 dwSize = lpddi->dwSize;
164 TRACE("%ld %p\n", dwSize, lpddi);
166 memset(lpddi, 0, dwSize);
167 memset(&ddi, 0, sizeof(ddi));
169 ddi.dwSize = dwSize;
170 ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
171 ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */
172 if (version >= 0x0800)
173 ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
174 else
175 ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
176 strcpy(ddi.tszInstanceName, "Mouse");
177 strcpy(ddi.tszProductName, "Wine Mouse");
179 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
182 static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version) {
183 DWORD dwSize;
184 DIDEVICEINSTANCEW ddi;
186 dwSize = lpddi->dwSize;
188 TRACE("%ld %p\n", dwSize, lpddi);
190 memset(lpddi, 0, dwSize);
191 memset(&ddi, 0, sizeof(ddi));
193 ddi.dwSize = dwSize;
194 ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
195 ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */
196 if (version >= 0x0800)
197 ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
198 else
199 ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
200 MultiByteToWideChar(CP_ACP, 0, "Mouse", -1, ddi.tszInstanceName, MAX_PATH);
201 MultiByteToWideChar(CP_ACP, 0, "Wine Mouse", -1, ddi.tszProductName, MAX_PATH);
203 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
206 static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
208 if (id != 0)
209 return FALSE;
211 if ((dwDevType == 0) ||
212 ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
213 (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
214 TRACE("Enumerating the mouse device\n");
216 fill_mouse_dideviceinstanceA(lpddi, version);
218 return TRUE;
221 return FALSE;
224 static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
226 if (id != 0)
227 return FALSE;
229 if ((dwDevType == 0) ||
230 ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
231 (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
232 TRACE("Enumerating the mouse device\n");
234 fill_mouse_dideviceinstanceW(lpddi, version);
236 return TRUE;
239 return FALSE;
242 static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputImpl *dinput)
244 int offset_array[WINE_INTERNALMOUSE_NUM_OBJS] = {
245 FIELD_OFFSET(Wine_InternalMouseData, lX),
246 FIELD_OFFSET(Wine_InternalMouseData, lY),
247 FIELD_OFFSET(Wine_InternalMouseData, lZ),
248 FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 0,
249 FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 1,
250 FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 2
252 SysMouseImpl* newDevice;
253 newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
254 newDevice->ref = 1;
255 newDevice->lpVtbl = mvt;
256 InitializeCriticalSection(&(newDevice->crit));
257 memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
259 /* Per default, Wine uses its internal data format */
260 newDevice->df = (DIDATAFORMAT *) &Wine_InternalMouseFormat;
261 memcpy(newDevice->offset_array, offset_array, WINE_INTERNALMOUSE_NUM_OBJS * sizeof(int));
262 newDevice->wine_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
263 newDevice->wine_df->size = 0;
264 newDevice->wine_df->internal_format_size = Wine_InternalMouseFormat.dwDataSize;
265 newDevice->wine_df->dt = NULL;
266 newDevice->dinput = dinput;
268 return newDevice;
271 static HRESULT mousedev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
273 if ((IsEqualGUID(&GUID_SysMouse,rguid)) || /* Generic Mouse */
274 (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */
275 if ((riid == NULL) ||
276 IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
277 IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
278 IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
279 IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
280 *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysMouseAvt, dinput);
281 TRACE("Creating a Mouse device (%p)\n", *pdev);
282 return DI_OK;
283 } else
284 return DIERR_NOINTERFACE;
287 return DIERR_DEVICENOTREG;
290 static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
292 if ((IsEqualGUID(&GUID_SysMouse,rguid)) || /* Generic Mouse */
293 (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */
294 if ((riid == NULL) ||
295 IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
296 IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
297 IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
298 IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
299 *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysMouseWvt, dinput);
300 TRACE("Creating a Mouse device (%p)\n", *pdev);
301 return DI_OK;
302 } else
303 return DIERR_NOINTERFACE;
306 return DIERR_DEVICENOTREG;
309 const struct dinput_device mouse_device = {
310 "Wine mouse driver",
311 mousedev_enum_deviceA,
312 mousedev_enum_deviceW,
313 mousedev_create_deviceA,
314 mousedev_create_deviceW
317 /******************************************************************************
318 * SysMouseA (DInput Mouse support)
321 /******************************************************************************
322 * Release : release the mouse buffer.
324 static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
326 SysMouseImpl *This = (SysMouseImpl *)iface;
327 ULONG ref;
329 ref = InterlockedDecrement(&(This->ref));
330 if (ref)
331 return ref;
333 set_dinput_hook(WH_MOUSE_LL, NULL);
335 /* Free the data queue */
336 HeapFree(GetProcessHeap(),0,This->data_queue);
337 DeleteCriticalSection(&(This->crit));
339 /* Free the DataFormat */
340 if (This->df != &(Wine_InternalMouseFormat)) {
341 HeapFree(GetProcessHeap(), 0, This->df->rgodf);
342 HeapFree(GetProcessHeap(), 0, This->df);
345 HeapFree(GetProcessHeap(),0,This);
346 return 0;
350 /******************************************************************************
351 * SetCooperativeLevel : store the window in which we will do our
352 * grabbing.
354 static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel(
355 LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags
358 SysMouseImpl *This = (SysMouseImpl *)iface;
360 TRACE("(this=%p,%p,0x%08lx)\n",This,hwnd,dwflags);
362 if (TRACE_ON(dinput)) {
363 TRACE(" cooperative level : ");
364 _dump_cooperativelevel_DI(dwflags);
367 if (dwflags & DISCL_EXCLUSIVE && dwflags & DISCL_BACKGROUND) {
368 return DIERR_UNSUPPORTED;
371 /* Store the window which asks for the mouse */
372 if (!hwnd)
373 hwnd = GetDesktopWindow();
374 This->win = hwnd;
375 This->dwCoopLevel = dwflags;
377 return DI_OK;
381 /******************************************************************************
382 * SetDataFormat : the application can choose the format of the data
383 * the device driver sends back with GetDeviceState.
385 * For the moment, only the "standard" configuration (c_dfDIMouse) is supported
386 * in absolute and relative mode.
388 static HRESULT WINAPI SysMouseAImpl_SetDataFormat(
389 LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
392 SysMouseImpl *This = (SysMouseImpl *)iface;
394 TRACE("(this=%p,%p)\n",This,df);
396 _dump_DIDATAFORMAT(df);
398 /* Tests under windows show that a call to SetDataFormat always sets the mouse
399 in relative mode whatever the dwFlags value (DIDF_ABSAXIS/DIDF_RELAXIS).
400 To switch in absolute mode, SetProperty must be used. */
401 This->absolute = 0;
403 /* Store the new data format */
404 This->df = HeapAlloc(GetProcessHeap(),0,df->dwSize);
405 memcpy(This->df, df, df->dwSize);
406 This->df->rgodf = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*df->dwObjSize);
407 memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize);
409 /* Prepare all the data-conversion filters */
410 This->wine_df = create_DataFormat(&(Wine_InternalMouseFormat), df, This->offset_array);
412 return DI_OK;
415 /* low-level mouse hook */
416 static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lparam )
418 LRESULT ret;
419 MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
420 SysMouseImpl* This = (SysMouseImpl*) current_lock;
421 DWORD dwCoop;
422 int wdata;
424 if (code != HC_ACTION) return CallNextHookEx( 0, code, wparam, lparam );
426 EnterCriticalSection(&(This->crit));
427 dwCoop = This->dwCoopLevel;
429 if (wparam == WM_MOUSEMOVE) {
430 if (This->absolute) {
431 if (hook->pt.x != This->prevX)
432 GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x,
433 hook->time, This->dinput->evsequence);
434 if (hook->pt.y != This->prevY)
435 GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y,
436 hook->time, This->dinput->evsequence);
437 } else {
438 /* Now, warp handling */
439 if ((This->need_warp == WARP_STARTED) &&
440 (hook->pt.x == This->mapped_center.x) && (hook->pt.y == This->mapped_center.y)) {
441 /* Warp has been done... */
442 This->need_warp = WARP_DONE;
443 goto end;
446 /* Relative mouse input with absolute mouse event : the real fun starts here... */
447 if ((This->need_warp == WARP_NEEDED) ||
448 (This->need_warp == WARP_STARTED)) {
449 if (hook->pt.x != This->prevX)
450 GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x - This->prevX,
451 hook->time, This->dinput->evsequence);
452 if (hook->pt.y != This->prevY)
453 GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->prevY,
454 hook->time, This->dinput->evsequence);
455 } else {
456 /* This is the first time the event handler has been called after a
457 GetDeviceData or GetDeviceState. */
458 if (hook->pt.x != This->mapped_center.x) {
459 GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x - This->mapped_center.x,
460 hook->time, This->dinput->evsequence);
461 This->need_warp = WARP_NEEDED;
464 if (hook->pt.y != This->mapped_center.y) {
465 GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->mapped_center.y,
466 hook->time, This->dinput->evsequence);
467 This->need_warp = WARP_NEEDED;
472 This->prevX = hook->pt.x;
473 This->prevY = hook->pt.y;
475 if (This->absolute) {
476 This->m_state.lX = hook->pt.x;
477 This->m_state.lY = hook->pt.y;
478 } else {
479 This->m_state.lX = hook->pt.x - This->mapped_center.x;
480 This->m_state.lY = hook->pt.y - This->mapped_center.y;
484 TRACE(" msg %x pt %ld %ld (W=%d)\n",
485 wparam, hook->pt.x, hook->pt.y, (!This->absolute) && This->need_warp );
487 switch(wparam) {
488 case WM_LBUTTONDOWN:
489 GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x80,
490 hook->time, This->dinput->evsequence);
491 This->m_state.rgbButtons[0] = 0x80;
492 break;
493 case WM_LBUTTONUP:
494 GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x00,
495 hook->time, This->dinput->evsequence);
496 This->m_state.rgbButtons[0] = 0x00;
497 break;
498 case WM_RBUTTONDOWN:
499 GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x80,
500 hook->time, This->dinput->evsequence);
501 This->m_state.rgbButtons[1] = 0x80;
502 break;
503 case WM_RBUTTONUP:
504 GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x00,
505 hook->time, This->dinput->evsequence);
506 This->m_state.rgbButtons[1] = 0x00;
507 break;
508 case WM_MBUTTONDOWN:
509 GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x80,
510 hook->time, This->dinput->evsequence);
511 This->m_state.rgbButtons[2] = 0x80;
512 break;
513 case WM_MBUTTONUP:
514 GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x00,
515 hook->time, This->dinput->evsequence);
516 This->m_state.rgbButtons[2] = 0x00;
517 break;
518 case WM_MOUSEWHEEL:
519 wdata = (short)HIWORD(hook->mouseData);
520 GEN_EVENT(This->offset_array[WINE_MOUSE_Z_POSITION], wdata,
521 hook->time, This->dinput->evsequence);
522 This->m_state.lZ += wdata;
523 break;
526 TRACE("(X: %ld - Y: %ld L: %02x M: %02x R: %02x)\n",
527 This->m_state.lX, This->m_state.lY,
528 This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
530 This->dinput->evsequence++;
532 end:
533 /* Mouse moved -> send event if asked */
534 if (This->hEvent) SetEvent(This->hEvent);
536 LeaveCriticalSection(&(This->crit));
538 if (dwCoop & DISCL_NONEXCLUSIVE) {
539 /* Pass the events down to previous handlers (e.g. win32 input) */
540 ret = CallNextHookEx( 0, code, wparam, lparam );
541 } else {
542 /* Ignore message */
543 ret = 1;
545 return ret;
548 static void dinput_window_check(SysMouseImpl* This) {
549 RECT rect;
550 DWORD centerX, centerY;
552 /* make sure the window hasn't moved */
553 GetWindowRect(This->win, &rect);
554 centerX = (rect.right - rect.left) / 2;
555 centerY = (rect.bottom - rect.top ) / 2;
556 if (This->win_centerX != centerX || This->win_centerY != centerY) {
557 This->win_centerX = centerX;
558 This->win_centerY = centerY;
560 This->mapped_center.x = This->win_centerX;
561 This->mapped_center.y = This->win_centerY;
562 MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1);
566 /******************************************************************************
567 * Acquire : gets exclusive control of the mouse
569 static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
571 SysMouseImpl *This = (SysMouseImpl *)iface;
572 RECT rect;
573 POINT point;
575 TRACE("(this=%p)\n",This);
577 if (This->acquired)
578 return S_FALSE;
580 This->acquired = 1;
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;
599 This->m_state.rgbButtons[1] = GetKeyState(VK_RBUTTON) & 0x80;
600 This->m_state.rgbButtons[2] = GetKeyState(VK_MBUTTON) & 0x80;
602 /* Install our mouse hook */
603 if (This->dwCoopLevel & DISCL_EXCLUSIVE)
604 ShowCursor(FALSE); /* hide cursor */
605 set_dinput_hook(WH_MOUSE_LL, dinput_mouse_hook);
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 This->last_warped = GetCurrentTime();
621 #ifdef MOUSE_HACK
622 This->need_warp = WARP_DONE;
623 #else
624 This->need_warp = WARP_STARTED;
625 #endif
628 return DI_OK;
631 /******************************************************************************
632 * Unacquire : frees the mouse
634 static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
636 SysMouseImpl *This = (SysMouseImpl *)iface;
638 TRACE("(this=%p)\n",This);
640 if (0 == This->acquired) {
641 return DI_NOEFFECT;
644 set_dinput_hook(WH_MOUSE_LL, NULL);
645 if (This->dwCoopLevel & DISCL_EXCLUSIVE)
646 ShowCursor(TRUE); /* show cursor */
648 /* No more locks */
649 if (current_lock == (IDirectInputDevice8A*) This)
650 current_lock = NULL;
651 else
652 ERR("this(%p) != current_lock(%p)\n", This, current_lock);
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);
663 return DI_OK;
666 /******************************************************************************
667 * GetDeviceState : returns the "state" of the mouse.
669 * For the moment, only the "standard" return structure (DIMOUSESTATE) is
670 * supported.
672 static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
673 LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
675 SysMouseImpl *This = (SysMouseImpl *)iface;
677 if(This->acquired == 0) return DIERR_NOTACQUIRED;
679 EnterCriticalSection(&(This->crit));
680 TRACE("(this=%p,0x%08lx,%p):\n", This, len, ptr);
681 TRACE("(X: %ld - Y: %ld - Z: %ld L: %02x M: %02x R: %02x)\n",
682 This->m_state.lX, This->m_state.lY, This->m_state.lZ,
683 This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
685 /* Copy the current mouse state */
686 fill_DataFormat(ptr, &(This->m_state), This->wine_df);
688 /* Initialize the buffer when in relative mode */
689 if (This->absolute == 0) {
690 This->m_state.lX = 0;
691 This->m_state.lY = 0;
692 This->m_state.lZ = 0;
695 /* Check if we need to do a mouse warping */
696 if (This->need_warp == WARP_NEEDED && (GetCurrentTime() - This->last_warped > 10)) {
697 dinput_window_check(This);
698 TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
699 SetCursorPos( This->mapped_center.x, This->mapped_center.y );
700 This->last_warped = GetCurrentTime();
702 #ifdef MOUSE_HACK
703 This->need_warp = WARP_DONE;
704 #else
705 This->need_warp = WARP_STARTED;
706 #endif
709 LeaveCriticalSection(&(This->crit));
711 return DI_OK;
714 /******************************************************************************
715 * GetDeviceData : gets buffered input data.
717 static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
718 DWORD dodsize,
719 LPDIDEVICEOBJECTDATA dod,
720 LPDWORD entries,
721 DWORD flags
723 SysMouseImpl *This = (SysMouseImpl *)iface;
724 DWORD len;
725 int nqtail = 0;
727 TRACE("(%p)->(dods=%ld,dod=%p,entries=%p (%ld)%s,fl=0x%08lx%s)\n",This,dodsize,dod,
728 entries, *entries,*entries == INFINITE ? " (INFINITE)" : "",
729 flags, (flags & DIGDD_PEEK) ? " (DIGDD_PEEK)": "" );
731 if (This->acquired == 0) {
732 WARN(" application tries to get data from an unacquired device !\n");
733 return DIERR_NOTACQUIRED;
736 EnterCriticalSection(&(This->crit));
738 len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0)
739 + (This->queue_head - This->queue_tail);
740 if ((*entries != INFINITE) && (len > *entries)) len = *entries;
742 if (dod == NULL) {
743 *entries = len;
745 if (!(flags & DIGDD_PEEK)) {
746 if (len)
747 TRACE("Application discarding %ld event(s).\n", len);
749 nqtail = This->queue_tail + len;
750 while (nqtail >= This->queue_len) nqtail -= This->queue_len;
751 } else {
752 TRACE("Telling application that %ld event(s) are in the queue.\n", len);
754 } else {
755 if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3)) {
756 ERR("Wrong structure size !\n");
757 LeaveCriticalSection(&(This->crit));
758 return DIERR_INVALIDPARAM;
761 if (len)
762 TRACE("Application retrieving %ld event(s):\n", len);
764 *entries = 0;
765 nqtail = This->queue_tail;
766 while (len) {
767 /* Copy the buffered data into the application queue */
768 TRACE(" - queuing Offs:%2ld Data:%5ld TS:%8ld Seq:%8ld at address %p from queue tail %4d\n",
769 (This->data_queue)->dwOfs,
770 (This->data_queue)->dwData,
771 (This->data_queue)->dwTimeStamp,
772 (This->data_queue)->dwSequence,
773 (char *)dod + *entries * dodsize,
774 nqtail);
775 memcpy((char *)dod + *entries * dodsize, This->data_queue + nqtail, dodsize);
776 /* Advance position */
777 nqtail++;
778 if (nqtail >= This->queue_len)
779 nqtail -= This->queue_len;
780 (*entries)++;
781 len--;
784 if (!(flags & DIGDD_PEEK))
785 This->queue_tail = nqtail;
787 LeaveCriticalSection(&(This->crit));
789 /* Check if we need to do a mouse warping */
790 if (This->need_warp == WARP_NEEDED && (GetCurrentTime() - This->last_warped > 10)) {
791 dinput_window_check(This);
792 TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y);
793 SetCursorPos( This->mapped_center.x, This->mapped_center.y );
794 This->last_warped = GetCurrentTime();
796 #ifdef MOUSE_HACK
797 This->need_warp = WARP_DONE;
798 #else
799 This->need_warp = WARP_STARTED;
800 #endif
802 return DI_OK;
805 /******************************************************************************
806 * SetProperty : change input device properties
808 static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
809 REFGUID rguid,
810 LPCDIPROPHEADER ph)
812 SysMouseImpl *This = (SysMouseImpl *)iface;
814 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
816 if (!HIWORD(rguid)) {
817 switch (LOWORD(rguid)) {
818 case (DWORD) DIPROP_BUFFERSIZE: {
819 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
821 TRACE("buffersize = %ld\n",pd->dwData);
823 This->data_queue = HeapAlloc(GetProcessHeap(),0, pd->dwData * sizeof(DIDEVICEOBJECTDATA));
824 This->queue_head = 0;
825 This->queue_tail = 0;
826 This->queue_len = pd->dwData;
827 break;
829 case (DWORD) DIPROP_AXISMODE: {
830 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
831 This->absolute = !(pd->dwData);
832 TRACE("Using %s coordinates mode now\n", This->absolute ? "absolute" : "relative");
833 break;
835 default:
836 FIXME("Unknown type %p (%s)\n",rguid,debugstr_guid(rguid));
837 break;
841 return DI_OK;
844 /******************************************************************************
845 * GetProperty : get input device properties
847 static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
848 REFGUID rguid,
849 LPDIPROPHEADER pdiph)
851 SysMouseImpl *This = (SysMouseImpl *)iface;
853 TRACE("(this=%p,%s,%p)\n",
854 iface, debugstr_guid(rguid), pdiph);
856 if (TRACE_ON(dinput))
857 _dump_DIPROPHEADER(pdiph);
859 if (!HIWORD(rguid)) {
860 switch (LOWORD(rguid)) {
861 case (DWORD) DIPROP_BUFFERSIZE: {
862 LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
864 TRACE(" return buffersize = %d\n",This->queue_len);
865 pd->dwData = This->queue_len;
866 break;
869 case (DWORD) DIPROP_GRANULARITY: {
870 LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
872 /* We'll just assume that the app asks about the Z axis */
873 pr->dwData = WHEEL_DELTA;
875 break;
878 case (DWORD) DIPROP_RANGE: {
879 LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph;
881 if ((pdiph->dwHow == DIPH_BYID) &&
882 ((pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS)) ||
883 (pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS)))) {
884 /* Querying the range of either the X or the Y axis. As I do
885 not know the range, do as if the range were
886 unrestricted...*/
887 pr->lMin = DIPROPRANGE_NOMIN;
888 pr->lMax = DIPROPRANGE_NOMAX;
891 break;
894 default:
895 FIXME("Unknown type %p (%s)\n",rguid,debugstr_guid(rguid));
896 break;
900 return DI_OK;
905 /******************************************************************************
906 * SetEventNotification : specifies event to be sent on state change
908 static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
909 HANDLE hnd) {
910 SysMouseImpl *This = (SysMouseImpl *)iface;
912 TRACE("(this=%p,%p)\n",This,hnd);
914 This->hEvent = hnd;
916 return DI_OK;
919 /******************************************************************************
920 * GetCapabilities : get the device capablitites
922 static HRESULT WINAPI SysMouseAImpl_GetCapabilities(
923 LPDIRECTINPUTDEVICE8A iface,
924 LPDIDEVCAPS lpDIDevCaps)
926 SysMouseImpl *This = (SysMouseImpl *)iface;
927 DIDEVCAPS devcaps;
929 TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
931 if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
932 WARN("invalid parameter\n");
933 return DIERR_INVALIDPARAM;
936 devcaps.dwSize = lpDIDevCaps->dwSize;
937 devcaps.dwFlags = DIDC_ATTACHED;
938 if (This->dinput->dwVersion >= 0x0800)
939 devcaps.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
940 else
941 devcaps.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
942 devcaps.dwAxes = 3;
943 devcaps.dwButtons = 3;
944 devcaps.dwPOVs = 0;
945 devcaps.dwFFSamplePeriod = 0;
946 devcaps.dwFFMinTimeResolution = 0;
947 devcaps.dwFirmwareRevision = 100;
948 devcaps.dwHardwareRevision = 100;
949 devcaps.dwFFDriverVersion = 0;
951 memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
953 return DI_OK;
957 /******************************************************************************
958 * EnumObjects : enumerate the different buttons and axis...
960 static HRESULT WINAPI SysMouseAImpl_EnumObjects(
961 LPDIRECTINPUTDEVICE8A iface,
962 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
963 LPVOID lpvRef,
964 DWORD dwFlags)
966 SysMouseImpl *This = (SysMouseImpl *)iface;
967 DIDEVICEOBJECTINSTANCEA ddoi;
969 TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags);
970 if (TRACE_ON(dinput)) {
971 TRACE(" - flags = ");
972 _dump_EnumObjects_flags(dwFlags);
973 TRACE("\n");
976 /* Only the fields till dwFFMaxForce are relevant */
977 memset(&ddoi, 0, sizeof(ddoi));
978 ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
980 /* In a mouse, we have : two relative axis and three buttons */
981 if ((dwFlags == DIDFT_ALL) ||
982 (dwFlags & DIDFT_AXIS)) {
983 /* X axis */
984 ddoi.guidType = GUID_XAxis;
985 ddoi.dwOfs = This->offset_array[WINE_MOUSE_X_POSITION];
986 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS;
987 strcpy(ddoi.tszName, "X-Axis");
988 _dump_OBJECTINSTANCEA(&ddoi);
989 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
991 /* Y axis */
992 ddoi.guidType = GUID_YAxis;
993 ddoi.dwOfs = This->offset_array[WINE_MOUSE_Y_POSITION];
994 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
995 strcpy(ddoi.tszName, "Y-Axis");
996 _dump_OBJECTINSTANCEA(&ddoi);
997 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
999 /* Z axis */
1000 ddoi.guidType = GUID_ZAxis;
1001 ddoi.dwOfs = This->offset_array[WINE_MOUSE_Z_POSITION];
1002 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS;
1003 strcpy(ddoi.tszName, "Z-Axis");
1004 _dump_OBJECTINSTANCEA(&ddoi);
1005 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
1008 if ((dwFlags == DIDFT_ALL) ||
1009 (dwFlags & DIDFT_BUTTON)) {
1010 ddoi.guidType = GUID_Button;
1012 /* Left button */
1013 ddoi.dwOfs = This->offset_array[WINE_MOUSE_L_POSITION];
1014 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_L_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
1015 strcpy(ddoi.tszName, "Left-Button");
1016 _dump_OBJECTINSTANCEA(&ddoi);
1017 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
1019 /* Right button */
1020 ddoi.dwOfs = This->offset_array[WINE_MOUSE_R_POSITION];
1021 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_R_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
1022 strcpy(ddoi.tszName, "Right-Button");
1023 _dump_OBJECTINSTANCEA(&ddoi);
1024 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
1026 /* Middle button */
1027 ddoi.dwOfs = This->offset_array[WINE_MOUSE_M_POSITION];
1028 ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_M_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
1029 strcpy(ddoi.tszName, "Middle-Button");
1030 _dump_OBJECTINSTANCEA(&ddoi);
1031 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
1034 return DI_OK;
1037 static HRESULT WINAPI SysMouseWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef,DWORD dwFlags)
1039 SysMouseImpl *This = (SysMouseImpl *)iface;
1041 device_enumobjects_AtoWcb_data data;
1043 data.lpCallBack = lpCallback;
1044 data.lpvRef = lpvRef;
1046 return SysMouseAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
1049 /******************************************************************************
1050 * GetDeviceInfo : get information about a device's identity
1052 static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo(
1053 LPDIRECTINPUTDEVICE8A iface,
1054 LPDIDEVICEINSTANCEA pdidi)
1056 SysMouseImpl *This = (SysMouseImpl *)iface;
1057 TRACE("(this=%p,%p)\n", This, pdidi);
1059 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
1060 WARN(" dinput3 not supporte yet...\n");
1061 return DI_OK;
1064 fill_mouse_dideviceinstanceA(pdidi, This->dinput->dwVersion);
1066 return DI_OK;
1069 static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
1071 SysMouseImpl *This = (SysMouseImpl *)iface;
1072 TRACE("(this=%p,%p)\n", This, pdidi);
1074 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
1075 WARN(" dinput3 not supporte yet...\n");
1076 return DI_OK;
1079 fill_mouse_dideviceinstanceW(pdidi, This->dinput->dwVersion);
1081 return DI_OK;
1085 static const IDirectInputDevice8AVtbl SysMouseAvt =
1087 IDirectInputDevice2AImpl_QueryInterface,
1088 IDirectInputDevice2AImpl_AddRef,
1089 SysMouseAImpl_Release,
1090 SysMouseAImpl_GetCapabilities,
1091 SysMouseAImpl_EnumObjects,
1092 SysMouseAImpl_GetProperty,
1093 SysMouseAImpl_SetProperty,
1094 SysMouseAImpl_Acquire,
1095 SysMouseAImpl_Unacquire,
1096 SysMouseAImpl_GetDeviceState,
1097 SysMouseAImpl_GetDeviceData,
1098 SysMouseAImpl_SetDataFormat,
1099 SysMouseAImpl_SetEventNotification,
1100 SysMouseAImpl_SetCooperativeLevel,
1101 IDirectInputDevice2AImpl_GetObjectInfo,
1102 SysMouseAImpl_GetDeviceInfo,
1103 IDirectInputDevice2AImpl_RunControlPanel,
1104 IDirectInputDevice2AImpl_Initialize,
1105 IDirectInputDevice2AImpl_CreateEffect,
1106 IDirectInputDevice2AImpl_EnumEffects,
1107 IDirectInputDevice2AImpl_GetEffectInfo,
1108 IDirectInputDevice2AImpl_GetForceFeedbackState,
1109 IDirectInputDevice2AImpl_SendForceFeedbackCommand,
1110 IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
1111 IDirectInputDevice2AImpl_Escape,
1112 IDirectInputDevice2AImpl_Poll,
1113 IDirectInputDevice2AImpl_SendDeviceData,
1114 IDirectInputDevice7AImpl_EnumEffectsInFile,
1115 IDirectInputDevice7AImpl_WriteEffectToFile,
1116 IDirectInputDevice8AImpl_BuildActionMap,
1117 IDirectInputDevice8AImpl_SetActionMap,
1118 IDirectInputDevice8AImpl_GetImageInfo
1121 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1122 # define XCAST(fun) (typeof(SysMouseWvt.fun))
1123 #else
1124 # define XCAST(fun) (void*)
1125 #endif
1127 static const IDirectInputDevice8WVtbl SysMouseWvt =
1129 IDirectInputDevice2WImpl_QueryInterface,
1130 XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
1131 XCAST(Release)SysMouseAImpl_Release,
1132 XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities,
1133 SysMouseWImpl_EnumObjects,
1134 XCAST(GetProperty)SysMouseAImpl_GetProperty,
1135 XCAST(SetProperty)SysMouseAImpl_SetProperty,
1136 XCAST(Acquire)SysMouseAImpl_Acquire,
1137 XCAST(Unacquire)SysMouseAImpl_Unacquire,
1138 XCAST(GetDeviceState)SysMouseAImpl_GetDeviceState,
1139 XCAST(GetDeviceData)SysMouseAImpl_GetDeviceData,
1140 XCAST(SetDataFormat)SysMouseAImpl_SetDataFormat,
1141 XCAST(SetEventNotification)SysMouseAImpl_SetEventNotification,
1142 XCAST(SetCooperativeLevel)SysMouseAImpl_SetCooperativeLevel,
1143 IDirectInputDevice2WImpl_GetObjectInfo,
1144 SysMouseWImpl_GetDeviceInfo,
1145 XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
1146 XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
1147 XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
1148 IDirectInputDevice2WImpl_EnumEffects,
1149 IDirectInputDevice2WImpl_GetEffectInfo,
1150 XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
1151 XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
1152 XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
1153 XCAST(Escape)IDirectInputDevice2AImpl_Escape,
1154 XCAST(Poll)IDirectInputDevice2AImpl_Poll,
1155 XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
1156 IDirectInputDevice7WImpl_EnumEffectsInFile,
1157 IDirectInputDevice7WImpl_WriteEffectToFile,
1158 IDirectInputDevice8WImpl_BuildActionMap,
1159 IDirectInputDevice8WImpl_SetActionMap,
1160 IDirectInputDevice8WImpl_GetImageInfo
1162 #undef XCAST