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;
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* Device implementation */
|
|
|
|
typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
|
|
|
|
struct IDirectInputDevice2AImpl
|
|
|
|
{
|
2006-10-15 19:29:30 +02:00
|
|
|
const void *lpVtbl;
|
|
|
|
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;
|
2007-07-07 07:36:09 +02:00
|
|
|
struct list entry; /* entry into IDirectInput devices 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;
|
2007-07-07 07:36:30 +02:00
|
|
|
DI_EVENT_PROC event_proc; /* function to receive mouse & keyboard events */
|
2006-12-04 18:54:05 +01:00
|
|
|
|
|
|
|
LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
|
|
|
|
int queue_len; /* size of the queue - set in 'SetProperty' */
|
|
|
|
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' */
|
2006-12-12 16:57:54 +01:00
|
|
|
|
|
|
|
DataFormat data_format; /* user data format and wine to user format converter */
|
2000-11-05 21:25:02 +01:00
|
|
|
};
|
|
|
|
|
2007-09-25 03:34:32 +02:00
|
|
|
extern BOOL get_app_key(HKEY*, HKEY*);
|
2007-09-25 03:34:27 +02:00
|
|
|
extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
|
|
|
|
|
2000-11-05 21:25:02 +01:00
|
|
|
/* Routines to do DataFormat / WineFormat conversions */
|
2008-07-27 17:53:34 +02:00
|
|
|
extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ;
|
2004-09-02 22:09:54 +02:00
|
|
|
extern void release_DataFormat(DataFormat *df) ;
|
2009-11-30 05:07:25 +01:00
|
|
|
extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq);
|
2006-12-10 22:15:29 +01:00
|
|
|
/* Helper functions to work with data format */
|
2007-08-05 20:18:26 +02:00
|
|
|
extern int id_to_object(LPCDIDATAFORMAT df, int id);
|
2007-04-24 08:45:32 +02:00
|
|
|
extern int find_property(const DataFormat *df, LPCDIPROPHEADER ph);
|
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;
|
|
|
|
|
2010-08-30 22:19:22 +02:00
|
|
|
extern DWORD joystick_map_pov(const POINTL *p);
|
2007-08-05 20:24:04 +02:00
|
|
|
extern LONG joystick_map_axis(ObjProps *props, int val);
|
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;
|
|
|
|
|
2007-07-07 07:36:22 +02:00
|
|
|
extern const GUID DInput_Wine_Keyboard_GUID;
|
|
|
|
extern const GUID DInput_Wine_Mouse_GUID;
|
2000-11-05 21:25:02 +01:00
|
|
|
|
|
|
|
/* Various debug tools */
|
2004-08-31 20:51:23 +02:00
|
|
|
extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) ;
|
2007-04-24 08:45:32 +02:00
|
|
|
extern void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi) ;
|
|
|
|
extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) ;
|
2004-06-02 02:36:54 +02:00
|
|
|
extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) ;
|
|
|
|
extern const char *_dump_dinput_GUID(const GUID *guid) ;
|
2000-11-05 21:25:02 +01:00
|
|
|
|
|
|
|
/* And the stubs */
|
2006-12-01 18:54:42 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface);
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ;
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ;
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
|
|
|
|
extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
|
2000-11-05 21:25:02 +01:00
|
|
|
extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface) ;
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags) ;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags) ;
|
2006-12-04 18:54:05 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph);
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph);
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIDEVICEOBJECTINSTANCEA pdidoi,
|
|
|
|
DWORD dwObj,
|
|
|
|
DWORD dwHow) ;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEOBJECTINSTANCEW pdidoi,
|
|
|
|
DWORD dwObj,
|
|
|
|
DWORD dwHow);
|
2006-12-04 18:54:05 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags);
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
HWND hwndOwner,
|
|
|
|
DWORD dwFlags) ;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
HINSTANCE hinst,
|
|
|
|
DWORD dwVersion,
|
|
|
|
REFGUID rguid) ;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
REFGUID rguid,
|
|
|
|
LPCDIEFFECT lpeff,
|
|
|
|
LPDIRECTINPUTEFFECT *ppdef,
|
|
|
|
LPUNKNOWN pUnkOuter) ;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIENUMEFFECTSCALLBACKA lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags) ;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMEFFECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags) ;
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIEFFECTINFOA lpdei,
|
|
|
|
REFGUID rguid) ;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
|
|
|
|
LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIEFFECTINFOW lpdei,
|
|
|
|
REFGUID rguid) ;
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDWORD pdwOut) ;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
DWORD dwFlags) ;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags) ;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDIEFFESCAPE lpDIEEsc) ;
|
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface) ;
|
2000-11-05 21:25:02 +01:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
|
2002-06-14 02:39:44 +02:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
DWORD cbObjectData,
|
2002-06-14 02:39:44 +02:00
|
|
|
LPCDIDEVICEOBJECTDATA rgdod,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPDWORD pdwInOut,
|
|
|
|
DWORD dwFlags) ;
|
2002-06-14 02:39:44 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPCSTR lpszFileName,
|
|
|
|
LPDIENUMEFFECTSINFILECALLBACK pec,
|
|
|
|
LPVOID pvRef,
|
|
|
|
DWORD dwFlags) ;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPCWSTR lpszFileName,
|
|
|
|
LPDIENUMEFFECTSINFILECALLBACK pec,
|
|
|
|
LPVOID pvRef,
|
|
|
|
DWORD dwFlags) ;
|
2002-06-14 02:39:44 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 21:25:02 +01:00
|
|
|
LPCSTR lpszFileName,
|
|
|
|
DWORD dwEntries,
|
|
|
|
LPDIFILEEFFECT rgDiFileEft,
|
|
|
|
DWORD dwFlags) ;
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPCWSTR lpszFileName,
|
|
|
|
DWORD dwEntries,
|
|
|
|
LPDIFILEEFFECT rgDiFileEft,
|
|
|
|
DWORD dwFlags) ;
|
2002-06-14 02:39:44 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIACTIONFORMATA lpdiaf,
|
|
|
|
LPCSTR lpszUserName,
|
|
|
|
DWORD dwFlags);
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIACTIONFORMATW lpdiaf,
|
|
|
|
LPCWSTR lpszUserName,
|
|
|
|
DWORD dwFlags);
|
2002-06-14 02:39:44 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIACTIONFORMATA lpdiaf,
|
|
|
|
LPCSTR lpszUserName,
|
|
|
|
DWORD dwFlags);
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIACTIONFORMATW lpdiaf,
|
|
|
|
LPCWSTR lpszUserName,
|
|
|
|
DWORD dwFlags);
|
2002-06-14 02:39:44 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
|
2003-06-16 22:22:13 +02:00
|
|
|
extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
|
2000-11-05 21:25:02 +01:00
|
|
|
|
|
|
|
#endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */
|