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
|
|
|
|
2006-12-12 16:57:54 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
int offset_in;
|
|
|
|
int offset_out;
|
|
|
|
int value;
|
|
|
|
} DataTransform;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
DataTransform *dt;
|
|
|
|
|
2006-12-12 16:58:02 +01:00
|
|
|
int *offsets; /* object offsets */
|
2007-01-10 14:50:52 +01:00
|
|
|
LPDIDATAFORMAT wine_df; /* wine internal data format */
|
2006-12-12 16:57:54 +01:00
|
|
|
} DataFormat;
|
|
|
|
|
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,
|
|
|
|
DIDEVICEOBJECTINSTANCEW *instance );
|
2021-10-19 09:20:06 +02:00
|
|
|
HRESULT (*set_property)( IDirectInputDevice8W *iface, DWORD property, const DIPROPHEADER *header,
|
|
|
|
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-10-21 09:53:46 +02:00
|
|
|
HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command );
|
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
|
|
|
|
|
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;
|
2006-12-01 18:54:42 +01:00
|
|
|
int acquired;
|
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
|
|
|
|
|
|
|
DataFormat data_format; /* user data format and wine to user format converter */
|
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];
|
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 */
|