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;
|
|
|
|
int internal_format_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:58:02 +01:00
|
|
|
LPDIDATAFORMAT user_df; /* user defined 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;
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* Device implementation */
|
2011-01-03 15:25:07 +01:00
|
|
|
typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl;
|
|
|
|
struct IDirectInputDeviceImpl
|
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;
|
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 */
|
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 */
|
2000-11-05 21:25:02 +01:00
|
|
|
};
|
|
|
|
|
2021-05-28 11:41:28 +02:00
|
|
|
extern HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl *vtbl, const GUID *guid,
|
2021-05-28 11:41:27 +02:00
|
|
|
IDirectInputImpl *dinput, void **out ) DECLSPEC_HIDDEN;
|
2021-05-28 11:41:28 +02:00
|
|
|
extern const IDirectInputDevice8AVtbl dinput_device_a_vtbl DECLSPEC_HIDDEN;
|
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;
|
|
|
|
extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD) DECLSPEC_HIDDEN;
|
2007-09-25 03:34:27 +02:00
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* Routines to do DataFormat / WineFormat conversions */
|
2011-04-29 09:31:42 +02:00
|
|
|
extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) DECLSPEC_HIDDEN;
|
|
|
|
extern void release_DataFormat(DataFormat *df) DECLSPEC_HIDDEN;
|
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;
|
2006-12-10 22:15:29 +01:00
|
|
|
/* Helper functions to work with data format */
|
2011-04-29 09:31:42 +02:00
|
|
|
extern int id_to_object(LPCDIDATAFORMAT df, int id) DECLSPEC_HIDDEN;
|
|
|
|
extern int find_property(const DataFormat *df, LPCDIPROPHEADER ph) DECLSPEC_HIDDEN;
|
2000-11-05 21:25:02 +01:00
|
|
|
|
2007-08-05 20:22:49 +02:00
|
|
|
/* Common joystick stuff */
|
2007-08-05 20:24:04 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
LONG lDevMin;
|
|
|
|
LONG lDevMax;
|
|
|
|
LONG lMin;
|
|
|
|
LONG lMax;
|
|
|
|
LONG lDeadZone;
|
|
|
|
LONG lSaturation;
|
|
|
|
} ObjProps;
|
|
|
|
|
2011-04-29 09:31:42 +02:00
|
|
|
extern DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN;
|
|
|
|
extern LONG joystick_map_axis(ObjProps *props, int val) DECLSPEC_HIDDEN;
|
2007-08-05 20:22:49 +02:00
|
|
|
|
2008-07-06 06:24:51 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct list entry;
|
|
|
|
LPDIRECTINPUTEFFECT ref;
|
|
|
|
} effect_list_item;
|
|
|
|
|
2019-08-13 23:40:38 +02:00
|
|
|
extern const GUID DInput_PIDVID_Product_GUID DECLSPEC_HIDDEN;
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* Various debug tools */
|
2011-04-29 09:31:42 +02:00
|
|
|
extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) DECLSPEC_HIDDEN;
|
|
|
|
extern void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi) DECLSPEC_HIDDEN;
|
|
|
|
extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) DECLSPEC_HIDDEN;
|
|
|
|
extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) DECLSPEC_HIDDEN;
|
|
|
|
extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
2000-11-05 21:25:02 +01:00
|
|
|
|
2011-07-21 20:36:31 +02:00
|
|
|
extern LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type) DECLSPEC_HIDDEN;
|
2011-07-02 06:06:37 +02:00
|
|
|
|
2011-08-24 04:42:49 +02:00
|
|
|
extern HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
|
2011-08-24 04:42:50 +02:00
|
|
|
extern HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
|
2011-08-24 04:42:49 +02:00
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* And the stubs */
|
2011-04-29 09:31:42 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE hnd) DECLSPEC_HIDDEN;
|
|
|
|
extern ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
|
|
|
|
extern ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID lpvRef,
|
2011-04-29 09:31:42 +02:00
|
|
|
DWORD dwFlags) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEOBJECTINSTANCEW pdidoi,
|
|
|
|
DWORD dwObj,
|
2011-04-29 09:31:42 +02:00
|
|
|
DWORD dwHow) DECLSPEC_HIDDEN;
|
2011-01-09 23:43:55 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
|
2011-04-29 09:31:42 +02:00
|
|
|
LPDWORD entries, DWORD flags) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags) DECLSPEC_HIDDEN;
|
2011-01-09 23:43:55 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion,
|
2011-04-29 09:31:42 +02:00
|
|
|
REFGUID rguid) DECLSPEC_HIDDEN;
|
2011-01-09 23:43:55 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff,
|
2011-04-29 09:31:42 +02:00
|
|
|
LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMEFFECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID lpvRef,
|
2011-04-29 09:31:42 +02:00
|
|
|
DWORD dwFlags) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIEFFECTINFOW lpdei,
|
2011-04-29 09:31:42 +02:00
|
|
|
REFGUID rguid) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags) DECLSPEC_HIDDEN;
|
2011-01-09 23:43:55 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
|
2011-04-29 09:31:42 +02:00
|
|
|
LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
|
2011-01-09 23:43:55 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData,
|
2011-04-29 09:31:42 +02:00
|
|
|
LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPCWSTR lpszFileName,
|
|
|
|
LPDIENUMEFFECTSINFILECALLBACK pec,
|
|
|
|
LPVOID pvRef,
|
2011-04-29 09:31:42 +02:00
|
|
|
DWORD dwFlags) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPCWSTR lpszFileName,
|
|
|
|
DWORD dwEntries,
|
|
|
|
LPDIFILEEFFECT rgDiFileEft,
|
2011-04-29 09:31:42 +02:00
|
|
|
DWORD dwFlags) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIACTIONFORMATW lpdiaf,
|
|
|
|
LPCWSTR lpszUserName,
|
2011-04-29 09:31:42 +02:00
|
|
|
DWORD dwFlags) DECLSPEC_HIDDEN;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
|
2011-04-29 09:31:42 +02:00
|
|
|
LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) DECLSPEC_HIDDEN;
|
2000-11-05 21:25:02 +01:00
|
|
|
|
|
|
|
#endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */
|