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"
37 struct dinput_device_vtbl
39 void (*release
)( 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 LPDIENUMDEVICEOBJECTSCALLBACKW 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
69 DWORD calibration_mode
;
79 /* Device implementation */
82 IDirectInputDevice8W IDirectInputDevice8W_iface
;
83 IDirectInputDevice8A IDirectInputDevice8A_iface
;
86 CRITICAL_SECTION crit
;
87 struct dinput
*dinput
;
88 struct list entry
; /* entry into acquired device list */
90 DIDEVICEINSTANCEW instance
;
94 enum device_status status
;
96 BOOL use_raw_input
; /* use raw input instead of low-level messages */
97 RAWINPUTDEVICE raw_device
; /* raw device to (un)register */
99 LPDIDEVICEOBJECTDATA data_queue
; /* buffer for 'GetDeviceData'. */
100 int queue_len
; /* valid size of the queue */
101 int queue_head
; /* position to write new event into queue */
102 int queue_tail
; /* next event to read from queue */
103 BOOL overflow
; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
104 DWORD buffersize
; /* size of the queue - set in 'SetProperty' */
106 DIDATAFORMAT device_format
;
107 DIDATAFORMAT user_format
;
110 int num_actions
; /* number of actions mapped */
111 ActionMap
*action_map
; /* array of mappings */
113 /* internal device callbacks */
115 const struct dinput_device_vtbl
*vtbl
;
117 BYTE device_state_report_id
;
118 BYTE device_state
[DEVICE_STATE_MAX_SIZE
];
122 DWORD force_feedback_state
;
123 struct object_properties
*object_properties
;
126 extern void dinput_device_init( struct dinput_device
*device
, const struct dinput_device_vtbl
*vtbl
,
127 const GUID
*guid
, struct dinput
*dinput
);
128 extern HRESULT
dinput_device_init_device_format( IDirectInputDevice8W
*iface
);
129 extern void dinput_device_destroy( IDirectInputDevice8W
*iface
);
131 extern BOOL
get_app_key(HKEY
*, HKEY
*) DECLSPEC_HIDDEN
;
132 extern DWORD
get_config_key( HKEY
, HKEY
, const WCHAR
*, WCHAR
*, DWORD
) DECLSPEC_HIDDEN
;
133 extern BOOL
device_instance_is_disabled( DIDEVICEINSTANCEW
*instance
, BOOL
*override
) DECLSPEC_HIDDEN
;
135 /* Routines to do DataFormat / WineFormat conversions */
136 extern void queue_event( IDirectInputDevice8W
*iface
, int inst_id
, DWORD data
, DWORD time
, DWORD seq
) DECLSPEC_HIDDEN
;
138 extern const GUID dinput_pidvid_guid DECLSPEC_HIDDEN
;
140 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */