dinput: Delete the action mapping registry key on SetActionMap.
[wine.git] / dlls / dinput / device_private.h
blob13201cc717805037af5184704bee2d5bd49fb753
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 struct dinput_device;
32 struct hid_value_caps;
34 typedef BOOL (*enum_object_callback)( struct dinput_device *impl, UINT index, struct hid_value_caps *caps,
35 const DIDEVICEOBJECTINSTANCEW *instance, void *data );
37 struct dinput_device_vtbl
39 void (*destroy)( IDirectInputDevice8W *iface );
40 HRESULT (*poll)( IDirectInputDevice8W *iface );
41 HRESULT (*read)( IDirectInputDevice8W *iface );
42 HRESULT (*acquire)( IDirectInputDevice8W *iface );
43 HRESULT (*unacquire)( IDirectInputDevice8W *iface );
44 HRESULT (*enum_objects)( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags,
45 enum_object_callback callback, void *context );
46 HRESULT (*get_property)( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header,
47 const DIDEVICEOBJECTINSTANCEW *instance );
48 HRESULT (*get_effect_info)( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid );
49 HRESULT (*create_effect)( IDirectInputDevice8W *iface, IDirectInputEffect **out );
50 HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command, BOOL unacquire );
51 HRESULT (*send_device_gain)( IDirectInputDevice8W *iface, LONG device_gain );
52 HRESULT (*enum_created_effect_objects)( IDirectInputDevice8W *iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback,
53 void *context, DWORD flags );
56 #define DEVICE_STATE_MAX_SIZE 1024
58 struct object_properties
60 LONG bit_size;
61 LONG physical_min;
62 LONG physical_max;
63 LONG logical_min;
64 LONG logical_max;
65 LONG range_min;
66 LONG range_max;
67 LONG deadzone;
68 LONG saturation;
69 UINT_PTR app_data;
70 DWORD calibration_mode;
71 DWORD granularity;
74 enum device_status
76 STATUS_UNACQUIRED,
77 STATUS_ACQUIRED,
78 STATUS_UNPLUGGED,
81 struct dinput_device
83 IDirectInputDevice8W IDirectInputDevice8W_iface;
84 IDirectInputDevice8A IDirectInputDevice8A_iface;
85 LONG internal_ref;
86 LONG ref;
88 GUID guid;
89 CRITICAL_SECTION crit;
90 struct dinput *dinput;
91 struct list entry; /* entry into acquired device list */
92 HANDLE hEvent;
93 DIDEVICEINSTANCEW instance;
94 DIDEVCAPS caps;
95 DWORD dwCoopLevel;
96 HWND win;
97 enum device_status status;
98 BOOL use_raw_input; /* use raw input instead of low-level messages */
99 HHOOK cbt_hook; /* CBT hook to track foreground changes */
101 LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
102 int queue_len; /* valid size of the queue */
103 int queue_head; /* position to write new event into queue */
104 int queue_tail; /* next event to read from queue */
105 BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
106 DWORD buffersize; /* size of the queue - set in 'SetProperty' */
108 DIDATAFORMAT device_format;
109 DIDATAFORMAT user_format;
111 /* internal device callbacks */
112 HANDLE read_event;
113 const struct dinput_device_vtbl *vtbl;
115 BYTE device_state_report_id;
116 BYTE device_state[DEVICE_STATE_MAX_SIZE];
118 BOOL autocenter;
119 LONG device_gain;
120 DWORD force_feedback_state;
121 struct object_properties *object_properties;
124 extern void dinput_device_init( struct dinput_device *device, const struct dinput_device_vtbl *vtbl,
125 const GUID *guid, struct dinput *dinput );
126 extern void dinput_device_internal_addref( struct dinput_device *device );
127 extern void dinput_device_internal_release( struct dinput_device *device );
129 extern HRESULT dinput_device_init_device_format( IDirectInputDevice8W *iface );
130 extern int dinput_device_object_index_from_id( IDirectInputDevice8W *iface, DWORD id );
131 extern BOOL device_object_matches_semantic( const DIDEVICEINSTANCEW *instance, const DIOBJECTDATAFORMAT *object,
132 DWORD semantic, BOOL exact );
134 extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
135 extern DWORD get_config_key( HKEY, HKEY, const WCHAR *, WCHAR *, DWORD ) DECLSPEC_HIDDEN;
136 extern BOOL device_instance_is_disabled( DIDEVICEINSTANCEW *instance, BOOL *override ) DECLSPEC_HIDDEN;
137 extern void queue_event( IDirectInputDevice8W *iface, int index, DWORD data, DWORD time, DWORD seq ) DECLSPEC_HIDDEN;
139 extern const GUID dinput_pidvid_guid DECLSPEC_HIDDEN;
141 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */