3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998,1999 Lionel Ulmer
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 /* This file contains all the Device specific functions that can be used as stubs
23 by real device implementations.
25 It also contains all the helper functions.
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
39 #include "device_private.h"
40 #include "dinput_private.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(dinput
);
44 static inline IDirectInputDeviceImpl
*impl_from_IDirectInputDevice8A(IDirectInputDevice8A
*iface
)
46 return CONTAINING_RECORD(iface
, IDirectInputDeviceImpl
, IDirectInputDevice8A_iface
);
48 static inline IDirectInputDeviceImpl
*impl_from_IDirectInputDevice8W(IDirectInputDevice8W
*iface
)
50 return CONTAINING_RECORD(iface
, IDirectInputDeviceImpl
, IDirectInputDevice8W_iface
);
53 static inline IDirectInputDevice8A
*IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl
*This
)
55 return &This
->IDirectInputDevice8A_iface
;
57 static inline IDirectInputDevice8W
*IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl
*This
)
59 return &This
->IDirectInputDevice8W_iface
;
62 /******************************************************************************
63 * Various debugging tools
65 static void _dump_cooperativelevel_DI(DWORD dwFlags
) {
66 if (TRACE_ON(dinput
)) {
72 #define FE(x) { x, #x}
76 FE(DISCL_NONEXCLUSIVE
),
80 TRACE(" cooperative level : ");
81 for (i
= 0; i
< (sizeof(flags
) / sizeof(flags
[0])); i
++)
82 if (flags
[i
].mask
& dwFlags
)
83 TRACE("%s ",flags
[i
].name
);
88 static void _dump_EnumObjects_flags(DWORD dwFlags
) {
89 if (TRACE_ON(dinput
)) {
96 #define FE(x) { x, #x}
102 FE(DIDFT_COLLECTION
),
104 FE(DIDFT_FFACTUATOR
),
105 FE(DIDFT_FFEFFECTTRIGGER
),
107 FE(DIDFT_VENDORDEFINED
),
112 type
= (dwFlags
& 0xFF0000FF);
113 instance
= ((dwFlags
>> 8) & 0xFFFF);
115 if (type
== DIDFT_ALL
) {
118 for (i
= 0; i
< (sizeof(flags
) / sizeof(flags
[0])); i
++) {
119 if (flags
[i
].mask
& type
) {
120 type
&= ~flags
[i
].mask
;
121 TRACE(" %s",flags
[i
].name
);
125 TRACE(" (unhandled: %08x)", type
);
128 TRACE(" / Instance: ");
129 if (instance
== ((DIDFT_ANYINSTANCE
>> 8) & 0xFFFF)) {
130 TRACE("DIDFT_ANYINSTANCE");
132 TRACE("%3d", instance
);
137 void _dump_DIPROPHEADER(LPCDIPROPHEADER diph
) {
138 if (TRACE_ON(dinput
)) {
139 TRACE(" - dwObj = 0x%08x\n", diph
->dwObj
);
140 TRACE(" - dwHow = %s\n",
141 ((diph
->dwHow
== DIPH_DEVICE
) ? "DIPH_DEVICE" :
142 ((diph
->dwHow
== DIPH_BYOFFSET
) ? "DIPH_BYOFFSET" :
143 ((diph
->dwHow
== DIPH_BYID
)) ? "DIPH_BYID" : "unknown")));
147 void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA
*ddoi
) {
148 TRACE(" - enumerating : %s ('%s') - %2d - 0x%08x - %s\n",
149 debugstr_guid(&ddoi
->guidType
), _dump_dinput_GUID(&ddoi
->guidType
), ddoi
->dwOfs
, ddoi
->dwType
, ddoi
->tszName
);
152 void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW
*ddoi
) {
153 TRACE(" - enumerating : %s ('%s'), - %2d - 0x%08x - %s\n",
154 debugstr_guid(&ddoi
->guidType
), _dump_dinput_GUID(&ddoi
->guidType
), ddoi
->dwOfs
, ddoi
->dwType
, debugstr_w(ddoi
->tszName
));
157 /* This function is a helper to convert a GUID into any possible DInput GUID out there */
158 const char *_dump_dinput_GUID(const GUID
*guid
) {
160 static const struct {
164 #define FE(x) { &x, #x}
177 FE(GUID_SysKeyboard
),
179 FE(GUID_ConstantForce
),
185 FE(GUID_SawtoothDown
),
195 for (i
= 0; i
< (sizeof(guids
) / sizeof(guids
[0])); i
++) {
196 if (IsEqualGUID(guids
[i
].guid
, guid
)) {
197 return guids
[i
].name
;
200 return debugstr_guid(guid
);
203 void _dump_DIDATAFORMAT(const DIDATAFORMAT
*df
) {
206 TRACE("Dumping DIDATAFORMAT structure:\n");
207 TRACE(" - dwSize: %d\n", df
->dwSize
);
208 if (df
->dwSize
!= sizeof(DIDATAFORMAT
)) {
209 WARN("Non-standard DIDATAFORMAT structure size %d\n", df
->dwSize
);
211 TRACE(" - dwObjsize: %d\n", df
->dwObjSize
);
212 if (df
->dwObjSize
!= sizeof(DIOBJECTDATAFORMAT
)) {
213 WARN("Non-standard DIOBJECTDATAFORMAT structure size %d\n", df
->dwObjSize
);
215 TRACE(" - dwFlags: 0x%08x (", df
->dwFlags
);
216 switch (df
->dwFlags
) {
217 case DIDF_ABSAXIS
: TRACE("DIDF_ABSAXIS"); break;
218 case DIDF_RELAXIS
: TRACE("DIDF_RELAXIS"); break;
219 default: TRACE("unknown"); break;
222 TRACE(" - dwDataSize: %d\n", df
->dwDataSize
);
223 TRACE(" - dwNumObjs: %d\n", df
->dwNumObjs
);
225 for (i
= 0; i
< df
->dwNumObjs
; i
++) {
226 TRACE(" - Object %d:\n", i
);
227 TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df
->rgodf
[i
].pguid
), _dump_dinput_GUID(df
->rgodf
[i
].pguid
));
228 TRACE(" * dwOfs: %d\n", df
->rgodf
[i
].dwOfs
);
229 TRACE(" * dwType: 0x%08x\n", df
->rgodf
[i
].dwType
);
230 TRACE(" "); _dump_EnumObjects_flags(df
->rgodf
[i
].dwType
); TRACE("\n");
231 TRACE(" * dwFlags: 0x%08x\n", df
->rgodf
[i
].dwFlags
);
235 /******************************************************************************
236 * Get the default and the app-specific config keys.
238 BOOL
get_app_key(HKEY
*defkey
, HKEY
*appkey
)
240 char buffer
[MAX_PATH
+16];
245 /* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
246 if (RegOpenKeyA(HKEY_CURRENT_USER
, "Software\\Wine\\DirectInput", defkey
))
249 len
= GetModuleFileNameA(0, buffer
, MAX_PATH
);
250 if (len
&& len
< MAX_PATH
)
254 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
255 if (!RegOpenKeyA(HKEY_CURRENT_USER
, "Software\\Wine\\AppDefaults", &tmpkey
))
257 char *p
, *appname
= buffer
;
258 if ((p
= strrchr(appname
, '/'))) appname
= p
+ 1;
259 if ((p
= strrchr(appname
, '\\'))) appname
= p
+ 1;
260 strcat(appname
, "\\DirectInput");
262 if (RegOpenKeyA(tmpkey
, appname
, appkey
)) *appkey
= 0;
267 return *defkey
|| *appkey
;
270 /******************************************************************************
271 * Get a config key from either the app-specific or the default config
273 DWORD
get_config_key( HKEY defkey
, HKEY appkey
, const char *name
,
274 char *buffer
, DWORD size
)
276 if (appkey
&& !RegQueryValueExA( appkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
279 if (defkey
&& !RegQueryValueExA( defkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
282 return ERROR_FILE_NOT_FOUND
;
285 /* Conversion between internal data buffer and external data buffer */
286 void fill_DataFormat(void *out
, DWORD size
, const void *in
, const DataFormat
*df
)
289 const char *in_c
= in
;
292 memset(out
, 0, size
);
293 if (df
->dt
== NULL
) {
294 /* This means that the app uses Wine's internal data format */
295 memcpy(out
, in
, min(size
, df
->internal_format_size
));
297 for (i
= 0; i
< df
->size
; i
++) {
298 if (df
->dt
[i
].offset_in
>= 0) {
299 switch (df
->dt
[i
].size
) {
301 TRACE("Copying (c) to %d from %d (value %d)\n",
302 df
->dt
[i
].offset_out
, df
->dt
[i
].offset_in
, *(in_c
+ df
->dt
[i
].offset_in
));
303 *(out_c
+ df
->dt
[i
].offset_out
) = *(in_c
+ df
->dt
[i
].offset_in
);
307 TRACE("Copying (s) to %d from %d (value %d)\n",
308 df
->dt
[i
].offset_out
, df
->dt
[i
].offset_in
, *((const short *)(in_c
+ df
->dt
[i
].offset_in
)));
309 *((short *)(out_c
+ df
->dt
[i
].offset_out
)) = *((const short *)(in_c
+ df
->dt
[i
].offset_in
));
313 TRACE("Copying (i) to %d from %d (value %d)\n",
314 df
->dt
[i
].offset_out
, df
->dt
[i
].offset_in
, *((const int *)(in_c
+ df
->dt
[i
].offset_in
)));
315 *((int *)(out_c
+ df
->dt
[i
].offset_out
)) = *((const int *)(in_c
+ df
->dt
[i
].offset_in
));
319 memcpy((out_c
+ df
->dt
[i
].offset_out
), (in_c
+ df
->dt
[i
].offset_in
), df
->dt
[i
].size
);
323 switch (df
->dt
[i
].size
) {
325 TRACE("Copying (c) to %d default value %d\n",
326 df
->dt
[i
].offset_out
, df
->dt
[i
].value
);
327 *(out_c
+ df
->dt
[i
].offset_out
) = (char) df
->dt
[i
].value
;
331 TRACE("Copying (s) to %d default value %d\n",
332 df
->dt
[i
].offset_out
, df
->dt
[i
].value
);
333 *((short *) (out_c
+ df
->dt
[i
].offset_out
)) = (short) df
->dt
[i
].value
;
337 TRACE("Copying (i) to %d default value %d\n",
338 df
->dt
[i
].offset_out
, df
->dt
[i
].value
);
339 *((int *) (out_c
+ df
->dt
[i
].offset_out
)) = df
->dt
[i
].value
;
343 memset((out_c
+ df
->dt
[i
].offset_out
), 0, df
->dt
[i
].size
);
351 void release_DataFormat(DataFormat
* format
)
353 TRACE("Deleting DataFormat: %p\n", format
);
355 HeapFree(GetProcessHeap(), 0, format
->dt
);
357 HeapFree(GetProcessHeap(), 0, format
->offsets
);
358 format
->offsets
= NULL
;
359 HeapFree(GetProcessHeap(), 0, format
->user_df
);
360 format
->user_df
= NULL
;
363 static inline LPDIOBJECTDATAFORMAT
dataformat_to_odf(LPCDIDATAFORMAT df
, int idx
)
365 if (idx
< 0 || idx
>= df
->dwNumObjs
) return NULL
;
366 return (LPDIOBJECTDATAFORMAT
)((LPBYTE
)df
->rgodf
+ idx
* df
->dwObjSize
);
369 static HRESULT
create_DataFormat(LPCDIDATAFORMAT asked_format
, DataFormat
*format
)
378 if (!format
->wine_df
) return DIERR_INVALIDPARAM
;
379 done
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, asked_format
->dwNumObjs
* sizeof(int));
380 dt
= HeapAlloc(GetProcessHeap(), 0, asked_format
->dwNumObjs
* sizeof(DataTransform
));
381 if (!dt
|| !done
) goto failed
;
383 if (!(format
->offsets
= HeapAlloc(GetProcessHeap(), 0, format
->wine_df
->dwNumObjs
* sizeof(int))))
386 if (!(format
->user_df
= HeapAlloc(GetProcessHeap(), 0, asked_format
->dwSize
)))
388 memcpy(format
->user_df
, asked_format
, asked_format
->dwSize
);
390 TRACE("Creating DataTransform :\n");
392 for (i
= 0; i
< format
->wine_df
->dwNumObjs
; i
++)
394 format
->offsets
[i
] = -1;
396 for (j
= 0; j
< asked_format
->dwNumObjs
; j
++) {
400 if (/* Check if the application either requests any GUID and if not, it if matches
401 * the GUID of the Wine object.
403 ((asked_format
->rgodf
[j
].pguid
== NULL
) ||
404 (format
->wine_df
->rgodf
[i
].pguid
== NULL
) ||
405 (IsEqualGUID(format
->wine_df
->rgodf
[i
].pguid
, asked_format
->rgodf
[j
].pguid
)))
407 (/* Then check if it accepts any instance id, and if not, if it matches Wine's
410 ((asked_format
->rgodf
[j
].dwType
& DIDFT_INSTANCEMASK
) == DIDFT_ANYINSTANCE
) ||
411 (DIDFT_GETINSTANCE(asked_format
->rgodf
[j
].dwType
) == 0x00FF) || /* This is mentionned in no DX docs, but it works fine - tested on WinXP */
412 (DIDFT_GETINSTANCE(asked_format
->rgodf
[j
].dwType
) == DIDFT_GETINSTANCE(format
->wine_df
->rgodf
[i
].dwType
)))
414 ( /* Then if the asked type matches the one Wine provides */
415 DIDFT_GETTYPE(asked_format
->rgodf
[j
].dwType
) & format
->wine_df
->rgodf
[i
].dwType
))
419 TRACE("Matching :\n");
420 TRACE(" - Asked (%d) :\n", j
);
421 TRACE(" * GUID: %s ('%s')\n",
422 debugstr_guid(asked_format
->rgodf
[j
].pguid
),
423 _dump_dinput_GUID(asked_format
->rgodf
[j
].pguid
));
424 TRACE(" * Offset: %3d\n", asked_format
->rgodf
[j
].dwOfs
);
425 TRACE(" * dwType: %08x\n", asked_format
->rgodf
[j
].dwType
);
426 TRACE(" "); _dump_EnumObjects_flags(asked_format
->rgodf
[j
].dwType
); TRACE("\n");
428 TRACE(" - Wine (%d) :\n", i
);
429 TRACE(" * GUID: %s ('%s')\n",
430 debugstr_guid(format
->wine_df
->rgodf
[i
].pguid
),
431 _dump_dinput_GUID(format
->wine_df
->rgodf
[i
].pguid
));
432 TRACE(" * Offset: %3d\n", format
->wine_df
->rgodf
[i
].dwOfs
);
433 TRACE(" * dwType: %08x\n", format
->wine_df
->rgodf
[i
].dwType
);
434 TRACE(" "); _dump_EnumObjects_flags(format
->wine_df
->rgodf
[i
].dwType
); TRACE("\n");
436 if (format
->wine_df
->rgodf
[i
].dwType
& DIDFT_BUTTON
)
437 dt
[index
].size
= sizeof(BYTE
);
439 dt
[index
].size
= sizeof(DWORD
);
440 dt
[index
].offset_in
= format
->wine_df
->rgodf
[i
].dwOfs
;
441 dt
[index
].offset_out
= asked_format
->rgodf
[j
].dwOfs
;
442 format
->offsets
[i
] = asked_format
->rgodf
[j
].dwOfs
;
444 next
= next
+ dt
[index
].size
;
446 if (format
->wine_df
->rgodf
[i
].dwOfs
!= dt
[index
].offset_out
)
455 TRACE("Setting to default value :\n");
456 for (j
= 0; j
< asked_format
->dwNumObjs
; j
++) {
458 TRACE(" - Asked (%d) :\n", j
);
459 TRACE(" * GUID: %s ('%s')\n",
460 debugstr_guid(asked_format
->rgodf
[j
].pguid
),
461 _dump_dinput_GUID(asked_format
->rgodf
[j
].pguid
));
462 TRACE(" * Offset: %3d\n", asked_format
->rgodf
[j
].dwOfs
);
463 TRACE(" * dwType: %08x\n", asked_format
->rgodf
[j
].dwType
);
464 TRACE(" "); _dump_EnumObjects_flags(asked_format
->rgodf
[j
].dwType
); TRACE("\n");
466 if (asked_format
->rgodf
[j
].dwType
& DIDFT_BUTTON
)
467 dt
[index
].size
= sizeof(BYTE
);
469 dt
[index
].size
= sizeof(DWORD
);
470 dt
[index
].offset_in
= -1;
471 dt
[index
].offset_out
= asked_format
->rgodf
[j
].dwOfs
;
472 if (asked_format
->rgodf
[j
].dwType
& DIDFT_POV
)
473 dt
[index
].value
= -1;
482 format
->internal_format_size
= format
->wine_df
->dwDataSize
;
483 format
->size
= index
;
485 HeapFree(GetProcessHeap(), 0, dt
);
490 HeapFree(GetProcessHeap(), 0, done
);
495 HeapFree(GetProcessHeap(), 0, done
);
496 HeapFree(GetProcessHeap(), 0, dt
);
498 HeapFree(GetProcessHeap(), 0, format
->offsets
);
499 format
->offsets
= NULL
;
500 HeapFree(GetProcessHeap(), 0, format
->user_df
);
501 format
->user_df
= NULL
;
503 return DIERR_OUTOFMEMORY
;
506 /* find an object by it's offset in a data format */
507 static int offset_to_object(const DataFormat
*df
, int offset
)
511 if (!df
->offsets
) return -1;
513 for (i
= 0; i
< df
->wine_df
->dwNumObjs
; i
++)
514 if (df
->offsets
[i
] == offset
) return i
;
519 int id_to_object(LPCDIDATAFORMAT df
, int id
)
524 for (i
= 0; i
< df
->dwNumObjs
; i
++)
525 if ((dataformat_to_odf(df
, i
)->dwType
& 0x00ffffff) == id
)
531 static int id_to_offset(const DataFormat
*df
, int id
)
533 int obj
= id_to_object(df
->wine_df
, id
);
535 return obj
>= 0 && df
->offsets
? df
->offsets
[obj
] : -1;
538 int find_property(const DataFormat
*df
, LPCDIPROPHEADER ph
)
542 case DIPH_BYID
: return id_to_object(df
->wine_df
, ph
->dwObj
);
543 case DIPH_BYOFFSET
: return offset_to_object(df
, ph
->dwObj
);
545 FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph
->dwHow
);
550 /******************************************************************************
551 * queue_event - add new event to the ring queue
554 void queue_event(LPDIRECTINPUTDEVICE8A iface
, int inst_id
, DWORD data
, DWORD time
, DWORD seq
)
556 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
557 int next_pos
, ofs
= id_to_offset(&This
->data_format
, inst_id
);
559 /* Event is being set regardless of the queue state */
560 if (This
->hEvent
) SetEvent(This
->hEvent
);
562 if (!This
->queue_len
|| This
->overflow
|| ofs
< 0) return;
564 next_pos
= (This
->queue_head
+ 1) % This
->queue_len
;
565 if (next_pos
== This
->queue_tail
)
567 TRACE(" queue overflowed\n");
568 This
->overflow
= TRUE
;
572 TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",
573 data
, ofs
, This
->queue_head
, This
->queue_len
);
575 This
->data_queue
[This
->queue_head
].dwOfs
= ofs
;
576 This
->data_queue
[This
->queue_head
].dwData
= data
;
577 This
->data_queue
[This
->queue_head
].dwTimeStamp
= time
;
578 This
->data_queue
[This
->queue_head
].dwSequence
= seq
;
579 This
->queue_head
= next_pos
;
580 /* Send event if asked */
583 /******************************************************************************
587 HRESULT WINAPI
IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface
)
589 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
592 if (!This
->data_format
.user_df
) return DIERR_INVALIDPARAM
;
593 if (This
->dwCoopLevel
& DISCL_FOREGROUND
&& This
->win
!= GetForegroundWindow())
594 return DIERR_OTHERAPPHASPRIO
;
596 EnterCriticalSection(&This
->crit
);
597 res
= This
->acquired
? S_FALSE
: DI_OK
;
601 This
->queue_head
= This
->queue_tail
= This
->overflow
= 0;
602 check_dinput_hooks(iface
);
604 LeaveCriticalSection(&This
->crit
);
609 HRESULT WINAPI
IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface
)
611 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
612 return IDirectInputDevice2WImpl_Acquire(IDirectInputDevice8W_from_impl(This
));
616 /******************************************************************************
620 HRESULT WINAPI
IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface
)
622 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
625 EnterCriticalSection(&This
->crit
);
626 res
= !This
->acquired
? DI_NOEFFECT
: DI_OK
;
629 check_dinput_hooks(iface
);
630 LeaveCriticalSection(&This
->crit
);
635 HRESULT WINAPI
IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface
)
637 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
638 return IDirectInputDevice2WImpl_Unacquire(IDirectInputDevice8W_from_impl(This
));
641 /******************************************************************************
642 * IDirectInputDeviceA
645 HRESULT WINAPI
IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface
, LPCDIDATAFORMAT df
)
647 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
650 if (!df
) return E_POINTER
;
651 TRACE("(%p) %p\n", This
, df
);
652 _dump_DIDATAFORMAT(df
);
654 if (df
->dwSize
!= sizeof(DIDATAFORMAT
)) return DIERR_INVALIDPARAM
;
655 if (This
->acquired
) return DIERR_ACQUIRED
;
657 EnterCriticalSection(&This
->crit
);
659 release_DataFormat(&This
->data_format
);
660 res
= create_DataFormat(df
, &This
->data_format
);
662 LeaveCriticalSection(&This
->crit
);
666 HRESULT WINAPI
IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface
, LPCDIDATAFORMAT df
)
668 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
669 return IDirectInputDevice2WImpl_SetDataFormat(IDirectInputDevice8W_from_impl(This
), df
);
672 /******************************************************************************
673 * SetCooperativeLevel
675 * Set cooperative level and the source window for the events.
677 HRESULT WINAPI
IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface
, HWND hwnd
, DWORD dwflags
)
679 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
681 TRACE("(%p) %p,0x%08x\n", This
, hwnd
, dwflags
);
682 _dump_cooperativelevel_DI(dwflags
);
684 if ((dwflags
& (DISCL_EXCLUSIVE
| DISCL_NONEXCLUSIVE
)) == 0 ||
685 (dwflags
& (DISCL_EXCLUSIVE
| DISCL_NONEXCLUSIVE
)) == (DISCL_EXCLUSIVE
| DISCL_NONEXCLUSIVE
) ||
686 (dwflags
& (DISCL_FOREGROUND
| DISCL_BACKGROUND
)) == 0 ||
687 (dwflags
& (DISCL_FOREGROUND
| DISCL_BACKGROUND
)) == (DISCL_FOREGROUND
| DISCL_BACKGROUND
))
688 return DIERR_INVALIDPARAM
;
690 if (dwflags
== (DISCL_NONEXCLUSIVE
| DISCL_BACKGROUND
))
691 hwnd
= GetDesktopWindow();
693 if (!hwnd
) return E_HANDLE
;
695 /* For security reasons native does not allow exclusive background level
696 for mouse and keyboard only */
697 if (dwflags
& DISCL_EXCLUSIVE
&& dwflags
& DISCL_BACKGROUND
&&
698 (IsEqualGUID(&This
->guid
, &GUID_SysMouse
) ||
699 IsEqualGUID(&This
->guid
, &GUID_SysKeyboard
)))
700 return DIERR_UNSUPPORTED
;
702 /* Store the window which asks for the mouse */
703 EnterCriticalSection(&This
->crit
);
705 This
->dwCoopLevel
= dwflags
;
706 LeaveCriticalSection(&This
->crit
);
711 HRESULT WINAPI
IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface
, HWND hwnd
, DWORD dwflags
)
713 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
714 return IDirectInputDevice2WImpl_SetCooperativeLevel(IDirectInputDevice8W_from_impl(This
), hwnd
, dwflags
);
717 /******************************************************************************
718 * SetEventNotification : specifies event to be sent on state change
720 HRESULT WINAPI
IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface
, HANDLE event
)
722 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
724 TRACE("(%p) %p\n", This
, event
);
726 EnterCriticalSection(&This
->crit
);
727 This
->hEvent
= event
;
728 LeaveCriticalSection(&This
->crit
);
732 HRESULT WINAPI
IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface
, HANDLE event
)
734 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
735 return IDirectInputDevice2WImpl_SetEventNotification(IDirectInputDevice8W_from_impl(This
), event
);
739 ULONG WINAPI
IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface
)
741 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
744 ref
= InterlockedDecrement(&(This
->ref
));
747 IDirectInputDevice_Unacquire(iface
);
748 /* Reset the FF state, free all effects, etc */
749 IDirectInputDevice8_SendForceFeedbackCommand(iface
, DISFFC_RESET
);
751 HeapFree(GetProcessHeap(), 0, This
->data_queue
);
753 /* Free data format */
754 HeapFree(GetProcessHeap(), 0, This
->data_format
.wine_df
->rgodf
);
755 HeapFree(GetProcessHeap(), 0, This
->data_format
.wine_df
);
756 release_DataFormat(&This
->data_format
);
758 EnterCriticalSection( &This
->dinput
->crit
);
759 list_remove( &This
->entry
);
760 LeaveCriticalSection( &This
->dinput
->crit
);
762 IDirectInput_Release(&This
->dinput
->IDirectInput7A_iface
);
763 This
->crit
.DebugInfo
->Spare
[0] = 0;
764 DeleteCriticalSection(&This
->crit
);
766 HeapFree(GetProcessHeap(), 0, This
);
771 ULONG WINAPI
IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface
)
773 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
774 return IDirectInputDevice2WImpl_Release(IDirectInputDevice8W_from_impl(This
));
777 HRESULT WINAPI
IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface
, REFIID riid
, LPVOID
*ppobj
)
779 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
781 TRACE("(%p this=%p,%s,%p)\n", iface
, This
, debugstr_guid(riid
), ppobj
);
782 if (IsEqualGUID(&IID_IUnknown
, riid
) ||
783 IsEqualGUID(&IID_IDirectInputDeviceA
, riid
) ||
784 IsEqualGUID(&IID_IDirectInputDevice2A
, riid
) ||
785 IsEqualGUID(&IID_IDirectInputDevice7A
, riid
) ||
786 IsEqualGUID(&IID_IDirectInputDevice8A
, riid
))
788 IDirectInputDevice2_AddRef(iface
);
789 *ppobj
= IDirectInputDevice8A_from_impl(This
);
792 if (IsEqualGUID(&IID_IDirectInputDeviceW
, riid
) ||
793 IsEqualGUID(&IID_IDirectInputDevice2W
, riid
) ||
794 IsEqualGUID(&IID_IDirectInputDevice7W
, riid
) ||
795 IsEqualGUID(&IID_IDirectInputDevice8W
, riid
))
797 IDirectInputDevice2_AddRef(iface
);
798 *ppobj
= IDirectInputDevice8W_from_impl(This
);
802 WARN("Unsupported interface!\n");
806 HRESULT WINAPI
IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface
, REFIID riid
, LPVOID
*ppobj
)
808 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
809 return IDirectInputDevice2WImpl_QueryInterface(IDirectInputDevice8W_from_impl(This
), riid
, ppobj
);
812 ULONG WINAPI
IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface
)
814 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
815 return InterlockedIncrement(&This
->ref
);
818 ULONG WINAPI
IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface
)
820 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
821 return IDirectInputDevice2WImpl_AddRef(IDirectInputDevice8W_from_impl(This
));
824 HRESULT WINAPI
IDirectInputDevice2AImpl_EnumObjects(LPDIRECTINPUTDEVICE8A iface
,
825 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
827 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
828 DIDEVICEOBJECTINSTANCEA ddoi
;
831 TRACE("(%p) %p,%p flags:%08x)\n", iface
, lpCallback
, lpvRef
, dwFlags
);
832 TRACE(" - flags = ");
833 _dump_EnumObjects_flags(dwFlags
);
836 /* Only the fields till dwFFMaxForce are relevant */
837 memset(&ddoi
, 0, sizeof(ddoi
));
838 ddoi
.dwSize
= FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA
, dwFFMaxForce
);
840 for (i
= 0; i
< This
->data_format
.wine_df
->dwNumObjs
; i
++)
842 LPDIOBJECTDATAFORMAT odf
= dataformat_to_odf(This
->data_format
.wine_df
, i
);
844 if (dwFlags
!= DIDFT_ALL
&& !(dwFlags
& DIEFT_GETTYPE(odf
->dwType
))) continue;
845 if (IDirectInputDevice_GetObjectInfo(iface
, &ddoi
, odf
->dwType
, DIPH_BYID
) != DI_OK
)
848 if (lpCallback(&ddoi
, lpvRef
) != DIENUM_CONTINUE
) break;
854 HRESULT WINAPI
IDirectInputDevice2WImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface
,
855 LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
857 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
858 DIDEVICEOBJECTINSTANCEW ddoi
;
861 TRACE("(%p) %p,%p flags:%08x)\n", iface
, lpCallback
, lpvRef
, dwFlags
);
862 TRACE(" - flags = ");
863 _dump_EnumObjects_flags(dwFlags
);
866 /* Only the fields till dwFFMaxForce are relevant */
867 memset(&ddoi
, 0, sizeof(ddoi
));
868 ddoi
.dwSize
= FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW
, dwFFMaxForce
);
870 for (i
= 0; i
< This
->data_format
.wine_df
->dwNumObjs
; i
++)
872 LPDIOBJECTDATAFORMAT odf
= dataformat_to_odf(This
->data_format
.wine_df
, i
);
874 if (dwFlags
!= DIDFT_ALL
&& !(dwFlags
& DIEFT_GETTYPE(odf
->dwType
))) continue;
875 if (IDirectInputDevice_GetObjectInfo(iface
, &ddoi
, odf
->dwType
, DIPH_BYID
) != DI_OK
)
878 if (lpCallback(&ddoi
, lpvRef
) != DIENUM_CONTINUE
) break;
884 /******************************************************************************
888 HRESULT WINAPI
IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface
, REFGUID rguid
, LPDIPROPHEADER pdiph
)
890 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
892 TRACE("(%p) %s,%p\n", iface
, debugstr_guid(rguid
), pdiph
);
893 _dump_DIPROPHEADER(pdiph
);
895 if (!IS_DIPROP(rguid
)) return DI_OK
;
897 switch (LOWORD(rguid
))
899 case (DWORD_PTR
) DIPROP_BUFFERSIZE
:
901 LPDIPROPDWORD pd
= (LPDIPROPDWORD
)pdiph
;
903 if (pdiph
->dwSize
!= sizeof(DIPROPDWORD
)) return DIERR_INVALIDPARAM
;
905 pd
->dwData
= This
->queue_len
;
906 TRACE("buffersize = %d\n", pd
->dwData
);
909 case (DWORD_PTR
) DIPROP_VIDPID
:
910 FIXME("DIPROP_VIDPID not implemented\n");
911 return DIERR_UNSUPPORTED
;
913 FIXME("Unknown property %s\n", debugstr_guid(rguid
));
914 return DIERR_INVALIDPARAM
;
920 HRESULT WINAPI
IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface
, REFGUID rguid
, LPDIPROPHEADER pdiph
)
922 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
923 return IDirectInputDevice2WImpl_GetProperty(IDirectInputDevice8W_from_impl(This
), rguid
, pdiph
);
926 /******************************************************************************
930 HRESULT WINAPI
IDirectInputDevice2WImpl_SetProperty(
931 LPDIRECTINPUTDEVICE8W iface
, REFGUID rguid
, LPCDIPROPHEADER pdiph
)
933 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
935 TRACE("(%p) %s,%p\n", iface
, debugstr_guid(rguid
), pdiph
);
936 _dump_DIPROPHEADER(pdiph
);
938 if (!IS_DIPROP(rguid
)) return DI_OK
;
940 switch (LOWORD(rguid
))
942 case (DWORD_PTR
) DIPROP_AXISMODE
:
944 LPCDIPROPDWORD pd
= (LPCDIPROPDWORD
)pdiph
;
946 if (pdiph
->dwSize
!= sizeof(DIPROPDWORD
)) return DIERR_INVALIDPARAM
;
947 if (pdiph
->dwHow
== DIPH_DEVICE
&& pdiph
->dwObj
) return DIERR_INVALIDPARAM
;
948 if (This
->acquired
) return DIERR_ACQUIRED
;
949 if (pdiph
->dwHow
!= DIPH_DEVICE
) return DIERR_UNSUPPORTED
;
950 if (!This
->data_format
.user_df
) return DI_OK
;
952 TRACE("Axis mode: %s\n", pd
->dwData
== DIPROPAXISMODE_ABS
? "absolute" :
955 EnterCriticalSection(&This
->crit
);
956 This
->data_format
.user_df
->dwFlags
&= ~DIDFT_AXIS
;
957 This
->data_format
.user_df
->dwFlags
|= pd
->dwData
== DIPROPAXISMODE_ABS
?
958 DIDF_ABSAXIS
: DIDF_RELAXIS
;
959 LeaveCriticalSection(&This
->crit
);
962 case (DWORD_PTR
) DIPROP_BUFFERSIZE
:
964 LPCDIPROPDWORD pd
= (LPCDIPROPDWORD
)pdiph
;
966 if (pdiph
->dwSize
!= sizeof(DIPROPDWORD
)) return DIERR_INVALIDPARAM
;
967 if (This
->acquired
) return DIERR_ACQUIRED
;
969 TRACE("buffersize = %d\n", pd
->dwData
);
971 EnterCriticalSection(&This
->crit
);
972 HeapFree(GetProcessHeap(), 0, This
->data_queue
);
974 This
->data_queue
= !pd
->dwData
? NULL
: HeapAlloc(GetProcessHeap(), 0,
975 pd
->dwData
* sizeof(DIDEVICEOBJECTDATA
));
976 This
->queue_head
= This
->queue_tail
= This
->overflow
= 0;
977 This
->queue_len
= pd
->dwData
;
979 LeaveCriticalSection(&This
->crit
);
983 WARN("Unknown property %s\n", debugstr_guid(rguid
));
984 return DIERR_UNSUPPORTED
;
990 HRESULT WINAPI
IDirectInputDevice2AImpl_SetProperty(
991 LPDIRECTINPUTDEVICE8A iface
, REFGUID rguid
, LPCDIPROPHEADER pdiph
)
993 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
994 return IDirectInputDevice2WImpl_SetProperty(IDirectInputDevice8W_from_impl(This
), rguid
, pdiph
);
997 HRESULT WINAPI
IDirectInputDevice2AImpl_GetObjectInfo(
998 LPDIRECTINPUTDEVICE8A iface
,
999 LPDIDEVICEOBJECTINSTANCEA pdidoi
,
1003 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1004 DIDEVICEOBJECTINSTANCEW didoiW
;
1008 (pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCEA
) &&
1009 pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCE_DX3A
)))
1010 return DIERR_INVALIDPARAM
;
1012 didoiW
.dwSize
= sizeof(didoiW
);
1013 res
= IDirectInputDevice2WImpl_GetObjectInfo(IDirectInputDevice8W_from_impl(This
), &didoiW
, dwObj
, dwHow
);
1016 DWORD dwSize
= pdidoi
->dwSize
;
1018 memset(pdidoi
, 0, pdidoi
->dwSize
);
1019 pdidoi
->dwSize
= dwSize
;
1020 pdidoi
->guidType
= didoiW
.guidType
;
1021 pdidoi
->dwOfs
= didoiW
.dwOfs
;
1022 pdidoi
->dwType
= didoiW
.dwType
;
1023 pdidoi
->dwFlags
= didoiW
.dwFlags
;
1029 HRESULT WINAPI
IDirectInputDevice2WImpl_GetObjectInfo(
1030 LPDIRECTINPUTDEVICE8W iface
,
1031 LPDIDEVICEOBJECTINSTANCEW pdidoi
,
1035 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1037 LPDIOBJECTDATAFORMAT odf
;
1040 TRACE("(%p) %d(0x%08x) -> %p\n", This
, dwHow
, dwObj
, pdidoi
);
1043 (pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCEW
) &&
1044 pdidoi
->dwSize
!= sizeof(DIDEVICEOBJECTINSTANCE_DX3W
)))
1045 return DIERR_INVALIDPARAM
;
1050 if (!This
->data_format
.offsets
) break;
1051 for (idx
= This
->data_format
.wine_df
->dwNumObjs
- 1; idx
>= 0; idx
--)
1052 if (This
->data_format
.offsets
[idx
] == dwObj
) break;
1055 dwObj
&= 0x00ffffff;
1056 for (idx
= This
->data_format
.wine_df
->dwNumObjs
- 1; idx
>= 0; idx
--)
1057 if ((dataformat_to_odf(This
->data_format
.wine_df
, idx
)->dwType
& 0x00ffffff) == dwObj
)
1062 FIXME("dwHow = DIPH_BYUSAGE not implemented\n");
1065 WARN("invalid parameter: dwHow = %08x\n", dwHow
);
1066 return DIERR_INVALIDPARAM
;
1068 if (idx
< 0) return DIERR_OBJECTNOTFOUND
;
1070 odf
= dataformat_to_odf(This
->data_format
.wine_df
, idx
);
1071 dwSize
= pdidoi
->dwSize
; /* save due to memset below */
1072 memset(pdidoi
, 0, pdidoi
->dwSize
);
1073 pdidoi
->dwSize
= dwSize
;
1074 if (odf
->pguid
) pdidoi
->guidType
= *odf
->pguid
;
1075 pdidoi
->dwOfs
= This
->data_format
.offsets
? This
->data_format
.offsets
[idx
] : odf
->dwOfs
;
1076 pdidoi
->dwType
= odf
->dwType
;
1077 pdidoi
->dwFlags
= odf
->dwFlags
;
1082 HRESULT WINAPI
IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface
, DWORD dodsize
,
1083 LPDIDEVICEOBJECTDATA dod
, LPDWORD entries
, DWORD flags
)
1085 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1086 HRESULT ret
= DI_OK
;
1089 TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n",
1090 This
, dod
, entries
, entries
? *entries
: 0, dodsize
, flags
);
1092 if (!This
->acquired
)
1093 return DIERR_NOTACQUIRED
;
1094 if (!This
->queue_len
)
1095 return DIERR_NOTBUFFERED
;
1096 if (dodsize
< sizeof(DIDEVICEOBJECTDATA_DX3
))
1097 return DIERR_INVALIDPARAM
;
1099 IDirectInputDevice2_Poll(iface
);
1100 EnterCriticalSection(&This
->crit
);
1102 len
= This
->queue_head
- This
->queue_tail
;
1103 if (len
< 0) len
+= This
->queue_len
;
1105 if ((*entries
!= INFINITE
) && (len
> *entries
)) len
= *entries
;
1110 for (i
= 0; i
< len
; i
++)
1112 int n
= (This
->queue_tail
+ i
) % This
->queue_len
;
1113 memcpy((char *)dod
+ dodsize
* i
, This
->data_queue
+ n
, dodsize
);
1119 ret
= DI_BUFFEROVERFLOW
;
1121 if (!(flags
& DIGDD_PEEK
))
1123 /* Advance reading position */
1124 This
->queue_tail
= (This
->queue_tail
+ len
) % This
->queue_len
;
1125 This
->overflow
= FALSE
;
1128 LeaveCriticalSection(&This
->crit
);
1130 TRACE("Returning %d events queued\n", *entries
);
1134 HRESULT WINAPI
IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface
, DWORD dodsize
,
1135 LPDIDEVICEOBJECTDATA dod
, LPDWORD entries
, DWORD flags
)
1137 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1138 return IDirectInputDevice2WImpl_GetDeviceData(IDirectInputDevice8W_from_impl(This
), dodsize
, dod
, entries
, flags
);
1141 HRESULT WINAPI
IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface
, HWND hwndOwner
, DWORD dwFlags
)
1143 FIXME("(this=%p,%p,0x%08x): stub!\n", iface
, hwndOwner
, dwFlags
);
1148 HRESULT WINAPI
IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface
, HWND hwndOwner
, DWORD dwFlags
)
1150 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1151 return IDirectInputDevice2WImpl_RunControlPanel(IDirectInputDevice8W_from_impl(This
), hwndOwner
, dwFlags
);
1154 HRESULT WINAPI
IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface
, HINSTANCE hinst
, DWORD dwVersion
,
1157 FIXME("(this=%p,%p,%d,%s): stub!\n", iface
, hinst
, dwVersion
, debugstr_guid(rguid
));
1161 HRESULT WINAPI
IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface
, HINSTANCE hinst
, DWORD dwVersion
,
1164 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1165 return IDirectInputDevice2WImpl_Initialize(IDirectInputDevice8W_from_impl(This
), hinst
, dwVersion
, rguid
);
1168 /******************************************************************************
1169 * IDirectInputDevice2A
1172 HRESULT WINAPI
IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface
, REFGUID rguid
, LPCDIEFFECT lpeff
,
1173 LPDIRECTINPUTEFFECT
*ppdef
, LPUNKNOWN pUnkOuter
)
1175 FIXME("(this=%p,%s,%p,%p,%p): stub!\n", iface
, debugstr_guid(rguid
), lpeff
, ppdef
, pUnkOuter
);
1179 HRESULT WINAPI
IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface
, REFGUID rguid
, LPCDIEFFECT lpeff
,
1180 LPDIRECTINPUTEFFECT
*ppdef
, LPUNKNOWN pUnkOuter
)
1182 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1183 return IDirectInputDevice2WImpl_CreateEffect(IDirectInputDevice8W_from_impl(This
), rguid
, lpeff
, ppdef
, pUnkOuter
);
1186 HRESULT WINAPI
IDirectInputDevice2AImpl_EnumEffects(
1187 LPDIRECTINPUTDEVICE8A iface
,
1188 LPDIENUMEFFECTSCALLBACKA lpCallback
,
1192 FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
1193 iface
, lpCallback
, lpvRef
, dwFlags
);
1198 HRESULT WINAPI
IDirectInputDevice2WImpl_EnumEffects(
1199 LPDIRECTINPUTDEVICE8W iface
,
1200 LPDIENUMEFFECTSCALLBACKW lpCallback
,
1204 FIXME("(this=%p,%p,%p,0x%08x): stub!\n",
1205 iface
, lpCallback
, lpvRef
, dwFlags
);
1210 HRESULT WINAPI
IDirectInputDevice2AImpl_GetEffectInfo(
1211 LPDIRECTINPUTDEVICE8A iface
,
1212 LPDIEFFECTINFOA lpdei
,
1215 FIXME("(this=%p,%p,%s): stub!\n",
1216 iface
, lpdei
, debugstr_guid(rguid
));
1220 HRESULT WINAPI
IDirectInputDevice2WImpl_GetEffectInfo(
1221 LPDIRECTINPUTDEVICE8W iface
,
1222 LPDIEFFECTINFOW lpdei
,
1225 FIXME("(this=%p,%p,%s): stub!\n",
1226 iface
, lpdei
, debugstr_guid(rguid
));
1230 HRESULT WINAPI
IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface
, LPDWORD pdwOut
)
1232 FIXME("(this=%p,%p): stub!\n", iface
, pdwOut
);
1236 HRESULT WINAPI
IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface
, LPDWORD pdwOut
)
1238 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1239 return IDirectInputDevice2WImpl_GetForceFeedbackState(IDirectInputDevice8W_from_impl(This
), pdwOut
);
1242 HRESULT WINAPI
IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface
, DWORD dwFlags
)
1244 TRACE("(%p) 0x%08x:\n", iface
, dwFlags
);
1248 HRESULT WINAPI
IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface
, DWORD dwFlags
)
1250 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1251 return IDirectInputDevice2WImpl_SendForceFeedbackCommand(IDirectInputDevice8W_from_impl(This
), dwFlags
);
1254 HRESULT WINAPI
IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface
,
1255 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
1257 FIXME("(this=%p,%p,%p,0x%08x): stub!\n", iface
, lpCallback
, lpvRef
, dwFlags
);
1261 HRESULT WINAPI
IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface
,
1262 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback
, LPVOID lpvRef
, DWORD dwFlags
)
1264 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1265 return IDirectInputDevice2WImpl_EnumCreatedEffectObjects(IDirectInputDevice8W_from_impl(This
), lpCallback
, lpvRef
, dwFlags
);
1268 HRESULT WINAPI
IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface
, LPDIEFFESCAPE lpDIEEsc
)
1270 FIXME("(this=%p,%p): stub!\n", iface
, lpDIEEsc
);
1274 HRESULT WINAPI
IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface
, LPDIEFFESCAPE lpDIEEsc
)
1276 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1277 return IDirectInputDevice2WImpl_Escape(IDirectInputDevice8W_from_impl(This
), lpDIEEsc
);
1280 HRESULT WINAPI
IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface
)
1282 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8W(iface
);
1284 if (!This
->acquired
) return DIERR_NOTACQUIRED
;
1285 /* Because wine devices do not need to be polled, just return DI_NOEFFECT */
1289 HRESULT WINAPI
IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface
)
1291 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1292 return IDirectInputDevice2WImpl_Poll(IDirectInputDevice8W_from_impl(This
));
1295 HRESULT WINAPI
IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface
, DWORD cbObjectData
,
1296 LPCDIDEVICEOBJECTDATA rgdod
, LPDWORD pdwInOut
,
1299 FIXME("(this=%p,0x%08x,%p,%p,0x%08x): stub!\n", iface
, cbObjectData
, rgdod
, pdwInOut
, dwFlags
);
1304 HRESULT WINAPI
IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface
, DWORD cbObjectData
,
1305 LPCDIDEVICEOBJECTDATA rgdod
, LPDWORD pdwInOut
,
1308 IDirectInputDeviceImpl
*This
= impl_from_IDirectInputDevice8A(iface
);
1309 return IDirectInputDevice2WImpl_SendDeviceData(IDirectInputDevice8W_from_impl(This
), cbObjectData
, rgdod
,
1313 HRESULT WINAPI
IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface
,
1314 LPCSTR lpszFileName
,
1315 LPDIENUMEFFECTSINFILECALLBACK pec
,
1319 FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface
, lpszFileName
, pec
, pvRef
, dwFlags
);
1324 HRESULT WINAPI
IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface
,
1325 LPCWSTR lpszFileName
,
1326 LPDIENUMEFFECTSINFILECALLBACK pec
,
1330 FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", iface
, debugstr_w(lpszFileName
), pec
, pvRef
, dwFlags
);
1335 HRESULT WINAPI
IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface
,
1336 LPCSTR lpszFileName
,
1338 LPDIFILEEFFECT rgDiFileEft
,
1341 FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface
, lpszFileName
, dwEntries
, rgDiFileEft
, dwFlags
);
1346 HRESULT WINAPI
IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface
,
1347 LPCWSTR lpszFileName
,
1349 LPDIFILEEFFECT rgDiFileEft
,
1352 FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", iface
, debugstr_w(lpszFileName
), dwEntries
, rgDiFileEft
, dwFlags
);
1357 HRESULT WINAPI
IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface
,
1358 LPDIACTIONFORMATA lpdiaf
,
1359 LPCSTR lpszUserName
,
1362 FIXME("(%p)->(%p,%s,%08x): stub !\n", iface
, lpdiaf
, lpszUserName
, dwFlags
);
1363 #define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
1366 X(DIDBAM_INITIALIZE
)
1367 X(DIDBAM_HWDEFAULTS
)
1369 _dump_diactionformatA(lpdiaf
);
1373 HRESULT WINAPI
IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface
,
1374 LPDIACTIONFORMATW lpdiaf
,
1375 LPCWSTR lpszUserName
,
1378 FIXME("(%p)->(%p,%s,%08x): stub !\n", iface
, lpdiaf
, debugstr_w(lpszUserName
), dwFlags
);
1379 #define X(x) if (dwFlags & x) FIXME("\tdwFlags =|"#x"\n");
1382 X(DIDBAM_INITIALIZE
)
1383 X(DIDBAM_HWDEFAULTS
)
1389 HRESULT WINAPI
IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface
,
1390 LPDIACTIONFORMATA lpdiaf
,
1391 LPCSTR lpszUserName
,
1394 FIXME("(%p)->(%p,%s,%08x): stub !\n", iface
, lpdiaf
, lpszUserName
, dwFlags
);
1399 HRESULT WINAPI
IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface
,
1400 LPDIACTIONFORMATW lpdiaf
,
1401 LPCWSTR lpszUserName
,
1404 FIXME("(%p)->(%p,%s,%08x): stub !\n", iface
, lpdiaf
, debugstr_w(lpszUserName
), dwFlags
);
1409 HRESULT WINAPI
IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface
,
1410 LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader
)
1412 FIXME("(%p)->(%p): stub !\n", iface
, lpdiDevImageInfoHeader
);
1417 HRESULT WINAPI
IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface
,
1418 LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader
)
1420 FIXME("(%p)->(%p): stub !\n", iface
, lpdiDevImageInfoHeader
);