kernel32: Fix a failing test in win95.
[wine/multimedia.git] / dlls / dinput / device_private.h
blob7b62a50f14dd6574aa3db4e5420304a4dd0672c0
1 /*
2 * Copyright 2000 Lionel Ulmer
3 * Copyright 2000-2001 TransGaming Technologies Inc.
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
21 #define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "dinput.h"
28 #include "wine/list.h"
29 #include "dinput_private.h"
31 typedef struct
33 int size;
34 int offset_in;
35 int offset_out;
36 int value;
37 } DataTransform;
39 typedef struct
41 int size;
42 int internal_format_size;
43 DataTransform *dt;
45 int *offsets; /* object offsets */
46 LPDIDATAFORMAT wine_df; /* wine internal data format */
47 LPDIDATAFORMAT user_df; /* user defined data format */
48 } DataFormat;
50 /* Device implementation */
51 typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
52 struct IDirectInputDevice2AImpl
54 const void *lpVtbl;
55 LONG ref;
56 GUID guid;
57 CRITICAL_SECTION crit;
58 IDirectInputImpl *dinput;
59 struct list entry; /* entry into IDirectInput devices list */
60 HANDLE hEvent;
61 DWORD dwCoopLevel;
62 HWND win;
63 int acquired;
64 DI_EVENT_PROC event_proc; /* function to receive mouse & keyboard events */
66 LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
67 int queue_len; /* size of the queue - set in 'SetProperty' */
68 int queue_head; /* position to write new event into queue */
69 int queue_tail; /* next event to read from queue */
70 BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
72 DataFormat data_format; /* user data format and wine to user format converter */
75 extern BOOL get_app_key(HKEY*, HKEY*);
76 extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
78 /* Routines to do DataFormat / WineFormat conversions */
79 extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ;
80 extern HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format);
81 extern void release_DataFormat(DataFormat *df) ;
82 extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq);
83 /* Helper functions to work with data format */
84 extern int id_to_object(LPCDIDATAFORMAT df, int id);
85 extern int id_to_offset(const DataFormat *df, int id);
86 extern int find_property(const DataFormat *df, LPCDIPROPHEADER ph);
88 /* Common joystick stuff */
89 typedef struct
91 LONG lDevMin;
92 LONG lDevMax;
93 LONG lMin;
94 LONG lMax;
95 LONG lDeadZone;
96 LONG lSaturation;
97 } ObjProps;
99 extern DWORD joystick_map_pov(POINTL *p);
100 extern LONG joystick_map_axis(ObjProps *props, int val);
102 typedef struct
104 struct list entry;
105 LPDIRECTINPUTEFFECT ref;
106 } effect_list_item;
109 * Callback Data used by specific callback
110 * for EnumObject on 'W' interfaces
112 typedef struct {
113 LPDIENUMDEVICEOBJECTSCALLBACKW lpCallBack;
114 LPVOID lpvRef;
115 } device_enumobjects_AtoWcb_data;
117 extern BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA, LPVOID);
119 extern const GUID DInput_Wine_Keyboard_GUID;
120 extern const GUID DInput_Wine_Mouse_GUID;
122 /* Various debug tools */
123 extern void _dump_cooperativelevel_DI(DWORD dwFlags) ;
124 extern void _dump_EnumObjects_flags(DWORD dwFlags) ;
125 extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) ;
126 extern void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi) ;
127 extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) ;
128 extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) ;
129 extern const char *_dump_dinput_GUID(const GUID *guid) ;
131 /* And the stubs */
132 extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface);
133 extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
134 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
135 LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ;
136 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
137 LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ;
138 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
139 LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
140 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
141 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
142 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
143 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
144 LPDIRECTINPUTDEVICE8A iface) ;
145 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
146 LPDIRECTINPUTDEVICE8A iface,
147 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
148 LPVOID lpvRef,
149 DWORD dwFlags) ;
150 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
151 LPDIRECTINPUTDEVICE8W iface,
152 LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
153 LPVOID lpvRef,
154 DWORD dwFlags) ;
155 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph);
156 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph);
157 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
158 LPDIRECTINPUTDEVICE8A iface,
159 LPDIDEVICEOBJECTINSTANCEA pdidoi,
160 DWORD dwObj,
161 DWORD dwHow) ;
162 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
163 LPDIDEVICEOBJECTINSTANCEW pdidoi,
164 DWORD dwObj,
165 DWORD dwHow);
166 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
167 DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags);
168 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
169 LPDIRECTINPUTDEVICE8A iface,
170 LPDIDEVICEINSTANCEA pdidi) ;
171 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
172 LPDIRECTINPUTDEVICE8W iface,
173 LPDIDEVICEINSTANCEW pdidi) ;
174 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
175 LPDIRECTINPUTDEVICE8A iface,
176 HWND hwndOwner,
177 DWORD dwFlags) ;
178 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
179 LPDIRECTINPUTDEVICE8A iface,
180 HINSTANCE hinst,
181 DWORD dwVersion,
182 REFGUID rguid) ;
183 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
184 LPDIRECTINPUTDEVICE8A iface,
185 REFGUID rguid,
186 LPCDIEFFECT lpeff,
187 LPDIRECTINPUTEFFECT *ppdef,
188 LPUNKNOWN pUnkOuter) ;
189 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
190 LPDIRECTINPUTDEVICE8A iface,
191 LPDIENUMEFFECTSCALLBACKA lpCallback,
192 LPVOID lpvRef,
193 DWORD dwFlags) ;
194 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
195 LPDIRECTINPUTDEVICE8W iface,
196 LPDIENUMEFFECTSCALLBACKW lpCallback,
197 LPVOID lpvRef,
198 DWORD dwFlags) ;
199 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
200 LPDIRECTINPUTDEVICE8A iface,
201 LPDIEFFECTINFOA lpdei,
202 REFGUID rguid) ;
203 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
204 LPDIRECTINPUTDEVICE8W iface,
205 LPDIEFFECTINFOW lpdei,
206 REFGUID rguid) ;
207 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
208 LPDIRECTINPUTDEVICE8A iface,
209 LPDWORD pdwOut) ;
210 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
211 LPDIRECTINPUTDEVICE8A iface,
212 DWORD dwFlags) ;
213 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
214 LPDIRECTINPUTDEVICE8A iface,
215 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
216 LPVOID lpvRef,
217 DWORD dwFlags) ;
218 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
219 LPDIRECTINPUTDEVICE8A iface,
220 LPDIEFFESCAPE lpDIEEsc) ;
221 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
222 LPDIRECTINPUTDEVICE8A iface) ;
223 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
224 LPDIRECTINPUTDEVICE8A iface,
225 DWORD cbObjectData,
226 LPCDIDEVICEOBJECTDATA rgdod,
227 LPDWORD pdwInOut,
228 DWORD dwFlags) ;
229 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
230 LPCSTR lpszFileName,
231 LPDIENUMEFFECTSINFILECALLBACK pec,
232 LPVOID pvRef,
233 DWORD dwFlags) ;
234 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
235 LPCWSTR lpszFileName,
236 LPDIENUMEFFECTSINFILECALLBACK pec,
237 LPVOID pvRef,
238 DWORD dwFlags) ;
239 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
240 LPCSTR lpszFileName,
241 DWORD dwEntries,
242 LPDIFILEEFFECT rgDiFileEft,
243 DWORD dwFlags) ;
244 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
245 LPCWSTR lpszFileName,
246 DWORD dwEntries,
247 LPDIFILEEFFECT rgDiFileEft,
248 DWORD dwFlags) ;
249 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
250 LPDIACTIONFORMATA lpdiaf,
251 LPCSTR lpszUserName,
252 DWORD dwFlags);
253 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
254 LPDIACTIONFORMATW lpdiaf,
255 LPCWSTR lpszUserName,
256 DWORD dwFlags);
257 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
258 LPDIACTIONFORMATA lpdiaf,
259 LPCSTR lpszUserName,
260 DWORD dwFlags);
261 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
262 LPDIACTIONFORMATW lpdiaf,
263 LPCWSTR lpszUserName,
264 DWORD dwFlags);
265 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
266 LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
267 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
268 LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
270 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */