Added LGPL standard comment, and copyright notices where necessary.
[wine] / dlls / dinput / device_private.h
1 /*
2  * Copyright 2000 Lionel Ulmer
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
20 #define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
21
22 #include "winbase.h"
23 #include "dinput.h"
24
25 /* Device implementation */
26 typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
27 struct IDirectInputDevice2AImpl
28 {
29         ICOM_VFIELD(IDirectInputDevice2A);
30         DWORD                           ref;
31         GUID                            guid;
32 };
33
34 /* Routines to do DataFormat / WineFormat conversions */
35 typedef struct {
36   int size;
37   int offset_in;
38   int offset_out;
39   int value;
40 } DataTransform;
41
42 typedef struct {
43   int size;
44   int internal_format_size;
45   DataTransform *dt;
46 } DataFormat;
47 extern void fill_DataFormat(void *out, void *in, DataFormat *df) ;
48 extern DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) ;
49
50 /* Used to fill events in the queue */
51 #define GEN_EVENT(offset,data,xtime,seq)                                        \
52 {                                                                               \
53   /* If queue_len > 0, queuing is requested -> TRACE the event queued */        \
54   if (This->queue_len > 0) {                                                    \
55     DWORD nq;                                                                   \
56     TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",              \
57           (int) (data), (int) (offset),                                         \
58           (int) (This->queue_head), (int) (This->queue_len));                   \
59                                                                                 \
60     nq = This->queue_head+1;                                                    \
61     while (nq >= This->queue_len) nq -= This->queue_len;                        \
62     if ((offset >= 0) && (nq != This->queue_tail)) {                            \
63       This->data_queue[This->queue_head].dwOfs = offset;                        \
64       This->data_queue[This->queue_head].dwData = data;                         \
65       This->data_queue[This->queue_head].dwTimeStamp = xtime;                   \
66       This->data_queue[This->queue_head].dwSequence = seq;                      \
67       This->queue_head = nq;                                                    \
68     }                                                                           \
69   }                                                                             \
70 }
71
72
73 /* Various debug tools */
74 extern void _dump_cooperativelevel_DI(DWORD dwFlags) ;
75 extern void _dump_EnumObjects_flags(DWORD dwFlags) ;
76 extern void _dump_DIPROPHEADER(DIPROPHEADER *diph) ;
77 extern void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) ;
78
79 /* And the stubs */
80 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
81         LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df ) ;
82 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
83         LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags ) ;
84 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
85         LPDIRECTINPUTDEVICE2A iface,HANDLE hnd ) ;
86 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE2A iface) ;
87 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
88         LPDIRECTINPUTDEVICE2A iface,REFIID riid,LPVOID *ppobj ) ;
89 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
90         LPDIRECTINPUTDEVICE2A iface) ;
91 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
92         LPDIRECTINPUTDEVICE2A iface,
93         LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
94         LPVOID lpvRef,
95         DWORD dwFlags) ;
96 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
97         LPDIRECTINPUTDEVICE2A iface,
98         REFGUID rguid,
99         LPDIPROPHEADER pdiph) ;
100 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
101         LPDIRECTINPUTDEVICE2A iface,
102         LPDIDEVICEOBJECTINSTANCEA pdidoi,
103         DWORD dwObj,
104         DWORD dwHow) ;
105 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
106         LPDIRECTINPUTDEVICE2A iface,
107         LPDIDEVICEINSTANCEA pdidi) ;
108 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
109         LPDIRECTINPUTDEVICE2A iface,
110         HWND hwndOwner,
111         DWORD dwFlags) ;
112 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
113         LPDIRECTINPUTDEVICE2A iface,
114         HINSTANCE hinst,
115         DWORD dwVersion,
116         REFGUID rguid) ;
117 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
118         LPDIRECTINPUTDEVICE2A iface,
119         REFGUID rguid,
120         LPCDIEFFECT lpeff,
121         LPDIRECTINPUTEFFECT *ppdef,
122         LPUNKNOWN pUnkOuter) ;
123 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
124         LPDIRECTINPUTDEVICE2A iface,
125         LPDIENUMEFFECTSCALLBACKA lpCallback,
126         LPVOID lpvRef,
127         DWORD dwFlags) ;
128 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
129         LPDIRECTINPUTDEVICE2A iface,
130         LPDIEFFECTINFOA lpdei,
131         REFGUID rguid) ;
132 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
133         LPDIRECTINPUTDEVICE2A iface,
134         LPDWORD pdwOut) ;
135 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
136         LPDIRECTINPUTDEVICE2A iface,
137         DWORD dwFlags) ;
138 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
139         LPDIRECTINPUTDEVICE2A iface,
140         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
141         LPVOID lpvRef,
142         DWORD dwFlags) ;
143 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
144         LPDIRECTINPUTDEVICE2A iface,
145         LPDIEFFESCAPE lpDIEEsc) ;
146 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
147         LPDIRECTINPUTDEVICE2A iface) ;
148 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
149         LPDIRECTINPUTDEVICE2A iface,
150         DWORD cbObjectData,
151         LPDIDEVICEOBJECTDATA rgdod,
152         LPDWORD pdwInOut,
153         DWORD dwFlags) ;
154 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE7A iface,
155                                                                  LPCSTR lpszFileName,
156                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
157                                                                  LPVOID pvRef,
158                                                                  DWORD dwFlags) ;
159 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE7A iface,
160                                                                  LPCSTR lpszFileName,
161                                                                  DWORD dwEntries,
162                                                                  LPDIFILEEFFECT rgDiFileEft,
163                                                                  DWORD dwFlags) ;
164
165 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */