2002-03-10 00:29:33 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2000 Lionel Ulmer
|
2002-06-14 02:39:44 +02:00
|
|
|
* Copyright 2000-2001 TransGaming Technologies Inc.
|
2002-03-10 00:29:33 +01: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 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*/
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
#ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
|
|
|
|
#define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
2000-11-05 21:25:02 +01:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "dinput.h"
|
2007-07-07 07:36:09 +02:00
|
|
|
#include "wine/list.h"
|
2007-06-27 14:58:08 +02:00
|
|
|
#include "dinput_private.h"
|
2000-11-05 21:25:02 +01:00
|
|
|
|
2011-07-02 06:07:15 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned int offset;
|
|
|
|
UINT_PTR uAppData;
|
|
|
|
} ActionMap;
|
|
|
|
|
2021-10-13 09:21:17 +02:00
|
|
|
struct dinput_device_vtbl
|
|
|
|
{
|
2021-10-20 11:29:33 +02:00
|
|
|
void (*release)( IDirectInputDevice8W *iface );
|
2021-10-20 11:29:30 +02:00
|
|
|
HRESULT (*poll)( IDirectInputDevice8W *iface );
|
2021-10-18 10:21:53 +02:00
|
|
|
HRESULT (*read)( IDirectInputDevice8W *iface );
|
|
|
|
HRESULT (*acquire)( IDirectInputDevice8W *iface );
|
|
|
|
HRESULT (*unacquire)( IDirectInputDevice8W *iface );
|
|
|
|
HRESULT (*enum_objects)( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context );
|
2021-10-19 09:20:02 +02:00
|
|
|
HRESULT (*get_property)( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header,
|
2021-11-18 09:53:17 +01:00
|
|
|
const DIDEVICEOBJECTINSTANCEW *instance );
|
2021-10-21 09:53:43 +02:00
|
|
|
HRESULT (*get_effect_info)( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid );
|
2021-10-21 09:53:45 +02:00
|
|
|
HRESULT (*create_effect)( IDirectInputDevice8W *iface, IDirectInputEffect **out );
|
2021-11-17 11:51:53 +01:00
|
|
|
HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command, BOOL unacquire );
|
2021-11-17 11:51:49 +01:00
|
|
|
HRESULT (*send_device_gain)( IDirectInputDevice8W *iface, LONG device_gain );
|
2021-10-21 09:53:47 +02:00
|
|
|
HRESULT (*enum_created_effect_objects)( IDirectInputDevice8W *iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback,
|
|
|
|
void *context, DWORD flags );
|
2021-10-13 09:21:17 +02:00
|
|
|
};
|
|
|
|
|
2021-10-18 10:21:52 +02:00
|
|
|
#define DEVICE_STATE_MAX_SIZE 1024
|
|
|
|
|
2021-11-18 09:53:12 +01:00
|
|
|
struct object_properties
|
|
|
|
{
|
|
|
|
LONG bit_size;
|
2021-11-18 09:53:19 +01:00
|
|
|
LONG physical_min;
|
|
|
|
LONG physical_max;
|
2021-11-18 09:53:12 +01:00
|
|
|
LONG logical_min;
|
|
|
|
LONG logical_max;
|
|
|
|
LONG range_min;
|
|
|
|
LONG range_max;
|
|
|
|
LONG deadzone;
|
|
|
|
LONG saturation;
|
2021-11-18 09:53:17 +01:00
|
|
|
DWORD calibration_mode;
|
2021-11-18 09:53:12 +01:00
|
|
|
};
|
|
|
|
|
2022-01-24 12:02:46 +01:00
|
|
|
enum device_status
|
|
|
|
{
|
|
|
|
STATUS_UNACQUIRED,
|
|
|
|
STATUS_ACQUIRED,
|
2022-01-24 12:02:47 +01:00
|
|
|
STATUS_UNPLUGGED,
|
2022-01-24 12:02:46 +01:00
|
|
|
};
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* Device implementation */
|
2021-10-27 09:40:59 +02:00
|
|
|
struct dinput_device
|
2000-11-05 21:25:02 +01:00
|
|
|
{
|
2011-01-09 23:44:19 +01:00
|
|
|
IDirectInputDevice8W IDirectInputDevice8W_iface;
|
2021-05-25 18:48:53 +02:00
|
|
|
IDirectInputDevice8A IDirectInputDevice8A_iface;
|
2006-10-15 19:29:30 +02:00
|
|
|
LONG ref;
|
|
|
|
GUID guid;
|
2006-12-01 18:56:00 +01:00
|
|
|
CRITICAL_SECTION crit;
|
2007-06-27 14:58:08 +02:00
|
|
|
IDirectInputImpl *dinput;
|
2020-06-08 09:47:08 +02:00
|
|
|
struct list entry; /* entry into acquired device list */
|
2006-10-15 19:29:48 +02:00
|
|
|
HANDLE hEvent;
|
2021-10-13 09:21:12 +02:00
|
|
|
DIDEVICEINSTANCEW instance;
|
2021-10-13 09:21:13 +02:00
|
|
|
DIDEVCAPS caps;
|
2006-10-15 19:30:07 +02:00
|
|
|
DWORD dwCoopLevel;
|
|
|
|
HWND win;
|
2022-01-24 12:02:46 +01:00
|
|
|
enum device_status status;
|
2006-12-04 18:54:05 +01:00
|
|
|
|
2020-08-10 11:04:15 +02:00
|
|
|
BOOL use_raw_input; /* use raw input instead of low-level messages */
|
|
|
|
RAWINPUTDEVICE raw_device; /* raw device to (un)register */
|
|
|
|
|
2006-12-04 18:54:05 +01:00
|
|
|
LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
|
2020-01-12 23:33:24 +01:00
|
|
|
int queue_len; /* valid size of the queue */
|
2006-12-04 18:54:05 +01: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 23:33:24 +01:00
|
|
|
DWORD buffersize; /* size of the queue - set in 'SetProperty' */
|
2006-12-12 16:57:54 +01:00
|
|
|
|
2021-10-29 09:40:41 +02:00
|
|
|
DIDATAFORMAT *device_format;
|
2021-10-28 10:12:32 +02:00
|
|
|
DIDATAFORMAT *user_format;
|
2011-07-02 06:06:54 +02:00
|
|
|
|
|
|
|
/* Action mapping */
|
|
|
|
int num_actions; /* number of actions mapped */
|
2011-07-02 06:07:15 +02:00
|
|
|
ActionMap *action_map; /* array of mappings */
|
2021-08-27 12:45:20 +02:00
|
|
|
|
2021-10-13 09:21:17 +02:00
|
|
|
/* internal device callbacks */
|
|
|
|
HANDLE read_event;
|
|
|
|
const struct dinput_device_vtbl *vtbl;
|
2021-10-18 10:21:52 +02:00
|
|
|
|
|
|
|
BYTE device_state_report_id;
|
|
|
|
BYTE device_state[DEVICE_STATE_MAX_SIZE];
|
2021-11-16 08:23:37 +01:00
|
|
|
|
|
|
|
BOOL autocenter;
|
2021-11-17 11:51:49 +01:00
|
|
|
LONG device_gain;
|
2021-12-01 12:44:58 +01:00
|
|
|
DWORD force_feedback_state;
|
2021-11-18 09:53:12 +01:00
|
|
|
struct object_properties *object_properties;
|
2000-11-05 21:25:02 +01:00
|
|
|
};
|
|
|
|
|
2021-10-27 09:40:59 +02:00
|
|
|
extern HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid,
|
|
|
|
IDirectInputImpl *dinput, void **out ) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT dinput_device_init( IDirectInputDevice8W *iface );
|
|
|
|
extern void dinput_device_destroy( IDirectInputDevice8W *iface );
|
2021-05-28 11:41:27 +02:00
|
|
|
|
2011-04-29 09:31:42 +02:00
|
|
|
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
|
2021-09-15 09:29:50 +02:00
|
|
|
extern DWORD get_config_key( HKEY, HKEY, const WCHAR *, WCHAR *, DWORD ) DECLSPEC_HIDDEN;
|
2021-10-11 10:10:55 +02:00
|
|
|
extern BOOL device_instance_is_disabled( DIDEVICEINSTANCEW *instance, BOOL *override ) DECLSPEC_HIDDEN;
|
2007-09-25 03:34:27 +02:00
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* Routines to do DataFormat / WineFormat conversions */
|
2021-05-25 18:48:53 +02:00
|
|
|
extern void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD time, DWORD seq ) DECLSPEC_HIDDEN;
|
2008-07-06 06:24:51 +02:00
|
|
|
|
2021-10-11 10:10:56 +02:00
|
|
|
extern const GUID dinput_pidvid_guid DECLSPEC_HIDDEN;
|
2019-08-13 23:40:38 +02:00
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
#endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */
|