windowscodecs: Implement TiffFrameEncode_Commit.
[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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 #include "wine/list.h"
29 #include "dinput_private.h"
30
31 typedef struct
32 {
33     int size;
34     int offset_in;
35     int offset_out;
36     int value;
37 } DataTransform;
38
39 typedef struct
40 {
41     int                         size;
42     int                         internal_format_size;
43     DataTransform              *dt;
44
45     int                        *offsets;     /* object offsets */
46     LPDIDATAFORMAT              wine_df;     /* wine internal data format */
47     LPDIDATAFORMAT              user_df;     /* user defined data format */
48 } DataFormat;
49
50 /* Device implementation */
51 typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl;
52 struct IDirectInputDeviceImpl
53 {
54     IDirectInputDevice8A        IDirectInputDevice8A_iface;
55     IDirectInputDevice8W        IDirectInputDevice8W_iface;
56     LONG                        ref;
57     GUID                        guid;
58     CRITICAL_SECTION            crit;
59     IDirectInputImpl           *dinput;
60     struct list                 entry;       /* entry into IDirectInput devices list */
61     HANDLE                      hEvent;
62     DWORD                       dwCoopLevel;
63     HWND                        win;
64     int                         acquired;
65     DI_EVENT_PROC               event_proc;  /* function to receive mouse & keyboard events */
66
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' */
72
73     DataFormat                  data_format; /* user data format and wine to user format converter */
74 };
75
76 extern BOOL get_app_key(HKEY*, HKEY*);
77 extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
78
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);
86
87 /* Common joystick stuff */
88 typedef struct
89 {
90     LONG lDevMin;
91     LONG lDevMax;
92     LONG lMin;
93     LONG lMax;
94     LONG lDeadZone;
95     LONG lSaturation;
96 } ObjProps;
97
98 extern DWORD joystick_map_pov(const POINTL *p);
99 extern LONG joystick_map_axis(ObjProps *props, int val);
100
101 typedef struct
102 {
103     struct list entry;
104     LPDIRECTINPUTEFFECT ref;
105 } effect_list_item;
106
107 extern const GUID DInput_Wine_Keyboard_GUID;
108 extern const GUID DInput_Wine_Mouse_GUID;
109
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) ;
116
117 /* And the stubs */
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,
137         LPVOID lpvRef,
138         DWORD dwFlags) ;
139 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
140         LPDIRECTINPUTDEVICE8W iface,
141         LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
142         LPVOID lpvRef,
143         DWORD dwFlags) ;
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,
151         DWORD dwObj,
152         DWORD dwHow) ;
153 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, 
154                                                              LPDIDEVICEOBJECTINSTANCEW pdidoi,
155                                                              DWORD dwObj,
156                                                              DWORD dwHow);
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,
164                                                           REFGUID rguid);
165 extern HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion,
166                                                           REFGUID rguid);
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,
174         LPVOID lpvRef,
175         DWORD dwFlags) ;
176 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
177         LPDIRECTINPUTDEVICE8W iface,
178         LPDIENUMEFFECTSCALLBACKW lpCallback,
179         LPVOID lpvRef,
180         DWORD dwFlags) ;
181 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
182         LPDIRECTINPUTDEVICE8A iface,
183         LPDIEFFECTINFOA lpdei,
184         REFGUID rguid) ;
185 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
186         LPDIRECTINPUTDEVICE8W iface,
187         LPDIEFFECTINFOW lpdei,
188         REFGUID rguid) ;
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,
208                                                                  LPCSTR lpszFileName,
209                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
210                                                                  LPVOID pvRef,
211                                                                  DWORD dwFlags) ;
212 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
213                                                                  LPCWSTR lpszFileName,
214                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
215                                                                  LPVOID pvRef,
216                                                                  DWORD dwFlags) ;
217 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
218                                                                  LPCSTR lpszFileName,
219                                                                  DWORD dwEntries,
220                                                                  LPDIFILEEFFECT rgDiFileEft,
221                                                                  DWORD dwFlags) ;
222 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
223                                                                  LPCWSTR lpszFileName,
224                                                                  DWORD dwEntries,
225                                                                  LPDIFILEEFFECT rgDiFileEft,
226                                                                  DWORD dwFlags) ;
227 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
228                                                               LPDIACTIONFORMATA lpdiaf,
229                                                               LPCSTR lpszUserName,
230                                                               DWORD dwFlags);
231 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
232                                                               LPDIACTIONFORMATW lpdiaf,
233                                                               LPCWSTR lpszUserName,
234                                                               DWORD dwFlags);
235 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
236                                                             LPDIACTIONFORMATA lpdiaf,
237                                                             LPCSTR lpszUserName,
238                                                             DWORD dwFlags);
239 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
240                                                             LPDIACTIONFORMATW lpdiaf,
241                                                             LPCWSTR lpszUserName,
242                                                             DWORD dwFlags);
243 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
244                                                             LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
245 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
246                                                             LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
247
248 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */