2002-03-09 23:29:33 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2000 Lionel Ulmer
|
2002-06-14 00:39:44 +00:00
|
|
|
* Copyright 2000-2001 TransGaming Technologies Inc.
|
2002-03-09 23:29:33 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-09 23:29:33 +00:00
|
|
|
*/
|
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
#ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
|
|
|
|
#define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
|
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
2000-11-05 20:25:02 +00:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "dinput.h"
|
2007-07-07 05:36:09 +00:00
|
|
|
#include "wine/list.h"
|
2007-06-27 12:58:08 +00:00
|
|
|
#include "dinput_private.h"
|
2000-11-05 20:25:02 +00:00
|
|
|
|
2023-03-20 14:27:48 +00:00
|
|
|
struct dinput_device;
|
|
|
|
struct hid_value_caps;
|
|
|
|
|
|
|
|
typedef BOOL (*enum_object_callback)( struct dinput_device *impl, UINT index, struct hid_value_caps *caps,
|
|
|
|
const DIDEVICEOBJECTINSTANCEW *instance, void *data );
|
|
|
|
|
2021-10-13 07:21:17 +00:00
|
|
|
struct dinput_device_vtbl
|
|
|
|
{
|
2023-01-22 11:04:21 +00:00
|
|
|
void (*destroy)( IDirectInputDevice8W *iface );
|
2021-10-20 09:29:30 +00:00
|
|
|
HRESULT (*poll)( IDirectInputDevice8W *iface );
|
2021-10-18 08:21:53 +00:00
|
|
|
HRESULT (*read)( IDirectInputDevice8W *iface );
|
|
|
|
HRESULT (*acquire)( IDirectInputDevice8W *iface );
|
|
|
|
HRESULT (*unacquire)( IDirectInputDevice8W *iface );
|
|
|
|
HRESULT (*enum_objects)( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags,
|
2023-03-20 14:27:48 +00:00
|
|
|
enum_object_callback callback, void *context );
|
2021-10-19 07:20:02 +00:00
|
|
|
HRESULT (*get_property)( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header,
|
2021-11-18 08:53:17 +00:00
|
|
|
const DIDEVICEOBJECTINSTANCEW *instance );
|
2021-10-21 07:53:43 +00:00
|
|
|
HRESULT (*get_effect_info)( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid );
|
2021-10-21 07:53:45 +00:00
|
|
|
HRESULT (*create_effect)( IDirectInputDevice8W *iface, IDirectInputEffect **out );
|
2021-11-17 10:51:53 +00:00
|
|
|
HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command, BOOL unacquire );
|
2021-11-17 10:51:49 +00:00
|
|
|
HRESULT (*send_device_gain)( IDirectInputDevice8W *iface, LONG device_gain );
|
2021-10-21 07:53:47 +00:00
|
|
|
HRESULT (*enum_created_effect_objects)( IDirectInputDevice8W *iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback,
|
|
|
|
void *context, DWORD flags );
|
2021-10-13 07:21:17 +00:00
|
|
|
};
|
|
|
|
|
2021-10-18 08:21:52 +00:00
|
|
|
#define DEVICE_STATE_MAX_SIZE 1024
|
|
|
|
|
2021-11-18 08:53:12 +00:00
|
|
|
struct object_properties
|
|
|
|
{
|
|
|
|
LONG bit_size;
|
2021-11-18 08:53:19 +00:00
|
|
|
LONG physical_min;
|
|
|
|
LONG physical_max;
|
2021-11-18 08:53:12 +00:00
|
|
|
LONG logical_min;
|
|
|
|
LONG logical_max;
|
|
|
|
LONG range_min;
|
|
|
|
LONG range_max;
|
|
|
|
LONG deadzone;
|
|
|
|
LONG saturation;
|
2023-03-22 08:19:49 +00:00
|
|
|
UINT_PTR app_data;
|
2021-11-18 08:53:17 +00:00
|
|
|
DWORD calibration_mode;
|
2022-12-23 21:09:01 +00:00
|
|
|
DWORD granularity;
|
2021-11-18 08:53:12 +00:00
|
|
|
};
|
|
|
|
|
2022-01-24 11:02:46 +00:00
|
|
|
enum device_status
|
|
|
|
{
|
|
|
|
STATUS_UNACQUIRED,
|
|
|
|
STATUS_ACQUIRED,
|
2022-01-24 11:02:47 +00:00
|
|
|
STATUS_UNPLUGGED,
|
2022-01-24 11:02:46 +00:00
|
|
|
};
|
|
|
|
|
2021-10-27 07:40:59 +00:00
|
|
|
struct dinput_device
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
2011-01-09 22:44:19 +00:00
|
|
|
IDirectInputDevice8W IDirectInputDevice8W_iface;
|
2021-05-25 16:48:53 +00:00
|
|
|
IDirectInputDevice8A IDirectInputDevice8A_iface;
|
2023-01-22 11:04:21 +00:00
|
|
|
LONG internal_ref;
|
2006-10-15 17:29:30 +00:00
|
|
|
LONG ref;
|
2023-01-22 11:04:21 +00:00
|
|
|
|
2006-10-15 17:29:30 +00:00
|
|
|
GUID guid;
|
2006-12-01 17:56:00 +00:00
|
|
|
CRITICAL_SECTION crit;
|
2022-02-08 08:55:36 +00:00
|
|
|
struct dinput *dinput;
|
2020-06-08 07:47:08 +00:00
|
|
|
struct list entry; /* entry into acquired device list */
|
2006-10-15 17:29:48 +00:00
|
|
|
HANDLE hEvent;
|
2021-10-13 07:21:12 +00:00
|
|
|
DIDEVICEINSTANCEW instance;
|
2021-10-13 07:21:13 +00:00
|
|
|
DIDEVCAPS caps;
|
2006-10-15 17:30:07 +00:00
|
|
|
DWORD dwCoopLevel;
|
|
|
|
HWND win;
|
2022-01-24 11:02:46 +00:00
|
|
|
enum device_status status;
|
2020-08-10 09:04:15 +00:00
|
|
|
BOOL use_raw_input; /* use raw input instead of low-level messages */
|
2023-02-15 12:46:49 +00:00
|
|
|
HHOOK cbt_hook; /* CBT hook to track foreground changes */
|
2020-08-10 09:04:15 +00:00
|
|
|
|
2006-12-04 17:54:05 +00:00
|
|
|
LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
|
2020-01-12 22:33:24 +00:00
|
|
|
int queue_len; /* valid size of the queue */
|
2006-12-04 17:54:05 +00:00
|
|
|
int queue_head; /* position to write new event into queue */
|
|
|
|
int queue_tail; /* next event to read from queue */
|
|
|
|
BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
|
2020-01-12 22:33:24 +00:00
|
|
|
DWORD buffersize; /* size of the queue - set in 'SetProperty' */
|
2006-12-12 15:57:54 +00:00
|
|
|
|
2022-05-16 09:50:38 +00:00
|
|
|
DIDATAFORMAT device_format;
|
2022-05-16 09:50:39 +00:00
|
|
|
DIDATAFORMAT user_format;
|
2011-07-02 04:06:54 +00:00
|
|
|
|
2021-10-13 07:21:17 +00:00
|
|
|
/* internal device callbacks */
|
|
|
|
HANDLE read_event;
|
|
|
|
const struct dinput_device_vtbl *vtbl;
|
2021-10-18 08:21:52 +00:00
|
|
|
|
|
|
|
BYTE device_state_report_id;
|
|
|
|
BYTE device_state[DEVICE_STATE_MAX_SIZE];
|
2021-11-16 07:23:37 +00:00
|
|
|
|
|
|
|
BOOL autocenter;
|
2021-11-17 10:51:49 +00:00
|
|
|
LONG device_gain;
|
2021-12-01 11:44:58 +00:00
|
|
|
DWORD force_feedback_state;
|
2021-11-18 08:53:12 +00:00
|
|
|
struct object_properties *object_properties;
|
2000-11-05 20:25:02 +00:00
|
|
|
};
|
|
|
|
|
2022-05-16 09:50:45 +00:00
|
|
|
extern void dinput_device_init( struct dinput_device *device, const struct dinput_device_vtbl *vtbl,
|
|
|
|
const GUID *guid, struct dinput *dinput );
|
2023-01-22 11:04:21 +00:00
|
|
|
extern void dinput_device_internal_addref( struct dinput_device *device );
|
|
|
|
extern void dinput_device_internal_release( struct dinput_device *device );
|
|
|
|
|
2022-05-16 09:50:41 +00:00
|
|
|
extern HRESULT dinput_device_init_device_format( IDirectInputDevice8W *iface );
|
2023-03-20 14:07:46 +00:00
|
|
|
extern int dinput_device_object_index_from_id( IDirectInputDevice8W *iface, DWORD id );
|
2023-03-27 08:07:56 +00:00
|
|
|
extern BOOL device_object_matches_semantic( const DIDEVICEINSTANCEW *instance, const DIOBJECTDATAFORMAT *object,
|
|
|
|
DWORD semantic, BOOL exact );
|
2021-05-28 09:41:27 +00:00
|
|
|
|
2023-07-07 08:38:51 +00:00
|
|
|
extern BOOL get_app_key(HKEY*, HKEY*);
|
|
|
|
extern DWORD get_config_key( HKEY, HKEY, const WCHAR *, WCHAR *, DWORD );
|
|
|
|
extern BOOL device_instance_is_disabled( DIDEVICEINSTANCEW *instance, BOOL *override );
|
|
|
|
extern void queue_event( IDirectInputDevice8W *iface, int index, DWORD data, DWORD time, DWORD seq );
|
2008-07-06 04:24:51 +00:00
|
|
|
|
2023-07-07 08:38:51 +00:00
|
|
|
extern const GUID dinput_pidvid_guid;
|
2019-08-13 21:40:38 +00:00
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
#endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */
|