Fixed DLLMODE handling (--mode is now --subsystem and uses -Wb).
[wine] / dlls / dinput / device_private.h
1 /*
2  * Copyright 2000 Lionel Ulmer
3  * Copyright 2000-2001 TransGaming Technologies Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
21 #define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
22
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "dinput.h"
28
29 /* Device implementation */
30 typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
31 struct IDirectInputDevice2AImpl
32 {
33         ICOM_VFIELD(IDirectInputDevice2A);
34         DWORD                           ref;
35         GUID                            guid;
36 };
37
38 /* Routines to do DataFormat / WineFormat conversions */
39 typedef struct {
40   int size;
41   int offset_in;
42   int offset_out;
43   int value;
44 } DataTransform;
45
46 typedef struct {
47   int size;
48   int internal_format_size;
49   DataTransform *dt;
50 } DataFormat;
51 extern void fill_DataFormat(void *out, void *in, DataFormat *df) ;
52 extern DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) ;
53
54 /* Used to fill events in the queue */
55 #define GEN_EVENT(offset,data,xtime,seq)                                        \
56 {                                                                               \
57   /* If queue_len > 0, queuing is requested -> TRACE the event queued */        \
58   if (This->queue_len > 0) {                                                    \
59     DWORD nq;                                                                   \
60     TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",              \
61           (int) (data), (int) (offset),                                         \
62           (int) (This->queue_head), (int) (This->queue_len));                   \
63                                                                                 \
64     nq = This->queue_head+1;                                                    \
65     while (nq >= This->queue_len) nq -= This->queue_len;                        \
66     if ((offset >= 0) && (nq != This->queue_tail)) {                            \
67       This->data_queue[This->queue_head].dwOfs = offset;                        \
68       This->data_queue[This->queue_head].dwData = data;                         \
69       This->data_queue[This->queue_head].dwTimeStamp = xtime;                   \
70       This->data_queue[This->queue_head].dwSequence = seq;                      \
71       This->queue_head = nq;                                                    \
72     }                                                                           \
73   }                                                                             \
74 }
75
76 /**
77  * Callback Data used by specific callback 
78  *  for EnumObject on 'W' interfaces
79  */
80 typedef struct {
81   LPDIENUMDEVICEOBJECTSCALLBACKW lpCallBack;
82   LPVOID lpvRef;
83 } device_enumobjects_AtoWcb_data;
84
85 extern BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA, LPVOID);
86
87
88 /* Various debug tools */
89 extern void _dump_cooperativelevel_DI(DWORD dwFlags) ;
90 extern void _dump_EnumObjects_flags(DWORD dwFlags) ;
91 extern void _dump_DIPROPHEADER(DIPROPHEADER *diph) ;
92 extern void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) ;
93 extern void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) ;
94
95 /* And the stubs */
96 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
97         LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ;
98 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
99         LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ;
100 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
101         LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
102 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
103 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
104 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
105 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
106         LPDIRECTINPUTDEVICE8A iface) ;
107 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
108         LPDIRECTINPUTDEVICE8A iface,
109         LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
110         LPVOID lpvRef,
111         DWORD dwFlags) ;
112 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
113         LPDIRECTINPUTDEVICE8W iface,
114         LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
115         LPVOID lpvRef,
116         DWORD dwFlags) ;
117 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
118         LPDIRECTINPUTDEVICE8A iface,
119         REFGUID rguid,
120         LPDIPROPHEADER pdiph) ;
121 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
122         LPDIRECTINPUTDEVICE8A iface,
123         LPDIDEVICEOBJECTINSTANCEA pdidoi,
124         DWORD dwObj,
125         DWORD dwHow) ;
126 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, 
127                                                              LPDIDEVICEOBJECTINSTANCEW pdidoi,
128                                                              DWORD dwObj,
129                                                              DWORD dwHow);
130 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
131         LPDIRECTINPUTDEVICE8A iface,
132         LPDIDEVICEINSTANCEA pdidi) ;
133 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
134         LPDIRECTINPUTDEVICE8W iface,
135         LPDIDEVICEINSTANCEW pdidi) ;
136 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
137         LPDIRECTINPUTDEVICE8A iface,
138         HWND hwndOwner,
139         DWORD dwFlags) ;
140 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
141         LPDIRECTINPUTDEVICE8A iface,
142         HINSTANCE hinst,
143         DWORD dwVersion,
144         REFGUID rguid) ;
145 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
146         LPDIRECTINPUTDEVICE8A iface,
147         REFGUID rguid,
148         LPCDIEFFECT lpeff,
149         LPDIRECTINPUTEFFECT *ppdef,
150         LPUNKNOWN pUnkOuter) ;
151 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
152         LPDIRECTINPUTDEVICE8A iface,
153         LPDIENUMEFFECTSCALLBACKA lpCallback,
154         LPVOID lpvRef,
155         DWORD dwFlags) ;
156 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
157         LPDIRECTINPUTDEVICE8W iface,
158         LPDIENUMEFFECTSCALLBACKW lpCallback,
159         LPVOID lpvRef,
160         DWORD dwFlags) ;
161 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
162         LPDIRECTINPUTDEVICE8A iface,
163         LPDIEFFECTINFOA lpdei,
164         REFGUID rguid) ;
165 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
166         LPDIRECTINPUTDEVICE8W iface,
167         LPDIEFFECTINFOW lpdei,
168         REFGUID rguid) ;
169 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
170         LPDIRECTINPUTDEVICE8A iface,
171         LPDWORD pdwOut) ;
172 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
173         LPDIRECTINPUTDEVICE8A iface,
174         DWORD dwFlags) ;
175 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
176         LPDIRECTINPUTDEVICE8A iface,
177         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
178         LPVOID lpvRef,
179         DWORD dwFlags) ;
180 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
181         LPDIRECTINPUTDEVICE8A iface,
182         LPDIEFFESCAPE lpDIEEsc) ;
183 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
184         LPDIRECTINPUTDEVICE8A iface) ;
185 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
186         LPDIRECTINPUTDEVICE8A iface,
187         DWORD cbObjectData,
188         LPCDIDEVICEOBJECTDATA rgdod,
189         LPDWORD pdwInOut,
190         DWORD dwFlags) ;
191 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
192                                                                  LPCSTR lpszFileName,
193                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
194                                                                  LPVOID pvRef,
195                                                                  DWORD dwFlags) ;
196 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
197                                                                  LPCWSTR lpszFileName,
198                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
199                                                                  LPVOID pvRef,
200                                                                  DWORD dwFlags) ;
201 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
202                                                                  LPCSTR lpszFileName,
203                                                                  DWORD dwEntries,
204                                                                  LPDIFILEEFFECT rgDiFileEft,
205                                                                  DWORD dwFlags) ;
206 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
207                                                                  LPCWSTR lpszFileName,
208                                                                  DWORD dwEntries,
209                                                                  LPDIFILEEFFECT rgDiFileEft,
210                                                                  DWORD dwFlags) ;
211 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
212                                                               LPDIACTIONFORMATA lpdiaf,
213                                                               LPCSTR lpszUserName,
214                                                               DWORD dwFlags);
215 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
216                                                               LPDIACTIONFORMATW lpdiaf,
217                                                               LPCWSTR lpszUserName,
218                                                               DWORD dwFlags);
219 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
220                                                             LPDIACTIONFORMATA lpdiaf,
221                                                             LPCSTR lpszUserName,
222                                                             DWORD dwFlags);
223 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
224                                                             LPDIACTIONFORMATW lpdiaf,
225                                                             LPCWSTR lpszUserName,
226                                                             DWORD dwFlags);
227 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
228                                                             LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
229 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
230                                                             LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
231
232 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */