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"
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
70 DWORD calibration_mode
;
83 IDirectInputDevice8W IDirectInputDevice8W_iface
;
84 IDirectInputDevice8A IDirectInputDevice8A_iface
;
89 CRITICAL_SECTION crit
;
90 struct dinput
*dinput
;
91 struct list entry
; /* entry into acquired device list */
93 DIDEVICEINSTANCEW instance
;
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 */
113 const struct dinput_device_vtbl
*vtbl
;
115 BYTE device_state_report_id
;
116 BYTE device_state
[DEVICE_STATE_MAX_SIZE
];
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
*);
135 extern DWORD
get_config_key( HKEY
, HKEY
, const WCHAR
*, WCHAR
*, DWORD
);
136 extern BOOL
device_instance_is_disabled( DIDEVICEINSTANCEW
*instance
, BOOL
*override
);
137 extern void queue_event( IDirectInputDevice8W
*iface
, int index
, DWORD data
, DWORD time
, DWORD seq
);
139 extern const GUID dinput_pidvid_guid
;
141 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */