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
28 #include "wine/list.h"
29 #include "dinput_private.h"
42 int internal_format_size;
45 int *offsets; /* object offsets */
46 LPDIDATAFORMAT wine_df; /* wine internal data format */
47 LPDIDATAFORMAT user_df; /* user defined data format */
50 /* Device implementation */
51 typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl;
52 struct IDirectInputDeviceImpl
54 IDirectInputDevice8A IDirectInputDevice8A_iface;
55 IDirectInputDevice8W IDirectInputDevice8W_iface;
58 CRITICAL_SECTION crit;
59 IDirectInputImpl *dinput;
60 struct list entry; /* entry into IDirectInput devices list */
65 DI_EVENT_PROC event_proc; /* function to receive mouse & keyboard events */
67 LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
68 int queue_len; /* size of the queue - set in 'SetProperty' */
69 int queue_head; /* position to write new event into queue */
70 int queue_tail; /* next event to read from queue */
71 BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
73 DataFormat data_format; /* user data format and wine to user format converter */
76 extern BOOL get_app_key(HKEY*, HKEY*);
77 extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
79 /* Routines to do DataFormat / WineFormat conversions */
80 extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ;
81 extern void release_DataFormat(DataFormat *df) ;
82 extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, 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 find_property(const DataFormat *df, LPCDIPROPHEADER ph);
87 /* Common joystick stuff */
98 extern DWORD joystick_map_pov(const POINTL *p);
99 extern LONG joystick_map_axis(ObjProps *props, int val);
104 LPDIRECTINPUTEFFECT ref;
107 extern const GUID DInput_Wine_Keyboard_GUID;
108 extern const GUID DInput_Wine_Mouse_GUID;
110 /* Various debug tools */
111 extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) ;
112 extern void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi) ;
113 extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) ;
114 extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) ;
115 extern const char *_dump_dinput_GUID(const GUID *guid) ;
118 extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface);
119 extern HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface);
120 extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
121 extern HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface);
122 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df);
123 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df);
124 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags);
125 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags);
126 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, HANDLE hnd);
127 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE hnd);
128 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
129 extern ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface);
130 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj);
131 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj);
132 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface);
133 extern ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface);
134 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
135 LPDIRECTINPUTDEVICE8A iface,
136 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
139 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
140 LPDIRECTINPUTDEVICE8W iface,
141 LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
144 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph);
145 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph);
146 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph);
147 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph);
148 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
149 LPDIRECTINPUTDEVICE8A iface,
150 LPDIDEVICEOBJECTINSTANCEA pdidoi,
153 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
154 LPDIDEVICEOBJECTINSTANCEW pdidoi,
157 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
158 LPDWORD entries, DWORD flags);
159 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
160 LPDWORD entries, DWORD flags);
161 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags);
162 extern HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags);
163 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion,
165 extern HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion,
167 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff,
168 LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter);
169 extern HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff,
170 LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter);
171 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
172 LPDIRECTINPUTDEVICE8A iface,
173 LPDIENUMEFFECTSCALLBACKA lpCallback,
176 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
177 LPDIRECTINPUTDEVICE8W iface,
178 LPDIENUMEFFECTSCALLBACKW lpCallback,
181 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
182 LPDIRECTINPUTDEVICE8A iface,
183 LPDIEFFECTINFOA lpdei,
185 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
186 LPDIRECTINPUTDEVICE8W iface,
187 LPDIEFFECTINFOW lpdei,
189 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut);
190 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut);
191 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags);
192 extern HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags);
193 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface,
194 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
195 LPVOID lpvRef, DWORD dwFlags);
196 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface,
197 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
198 LPVOID lpvRef, DWORD dwFlags);
199 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc);
200 extern HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc);
201 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface);
202 extern HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface);
203 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData,
204 LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags);
205 extern HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData,
206 LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags);
207 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
209 LPDIENUMEFFECTSINFILECALLBACK pec,
212 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
213 LPCWSTR lpszFileName,
214 LPDIENUMEFFECTSINFILECALLBACK pec,
217 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
220 LPDIFILEEFFECT rgDiFileEft,
222 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
223 LPCWSTR lpszFileName,
225 LPDIFILEEFFECT rgDiFileEft,
227 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
228 LPDIACTIONFORMATA lpdiaf,
231 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
232 LPDIACTIONFORMATW lpdiaf,
233 LPCWSTR lpszUserName,
235 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
236 LPDIACTIONFORMATA lpdiaf,
239 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
240 LPDIACTIONFORMATW lpdiaf,
241 LPCWSTR lpszUserName,
243 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
244 LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
245 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
246 LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
248 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */