diff --git a/reactos/include/dinput.h b/reactos/include/dinput.h new file mode 100644 index 00000000000..c2f5458635c --- /dev/null +++ b/reactos/include/dinput.h @@ -0,0 +1,2349 @@ +/* + * Copyright (C) the Wine project + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +//#ifndef __DINPUT_INCLUDED__ +//#define __DINPUT_INCLUDED__ + +#ifndef __WINE_DINPUT_H +#define __WINE_DINPUT_H + +#ifndef DIJ_RINGZERO +#include +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include +#endif + +#endif /* DIJ_RINGZERO */ + +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0800 +#endif +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION DIRECTINPUT_HEADER_VERSION +#endif + +//#ifndef DIJ_RINGZERO +/* Classes */ +DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice, 0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(CLSID_DirectInput8, 0x25E609E4,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice8, 0x25E609E5,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + + + +/* Interfaces */ +DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2A, 0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2W, 0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput7A, 0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput7W, 0x9A4CB685,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput8A, 0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInput8W, 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); + +DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2A, 0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2W, 0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice7A, 0x57D7C6BC,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice7W, 0x57D7C6BD,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice8A, 0x54D41080,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDevice8W, 0x54D41081,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputEffect, 0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + + +/* Predefined object types */ +DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RxAxis,0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RyAxis,0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RzAxis,0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Slider,0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Button,0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Unknown,0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + + +/* Predefined product GUIDs */ +DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboard, 0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Joystick, 0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm, 0x6F1D2B80,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm2, 0x6F1D2B81,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm, 0x6F1D2B82,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm2,0x6F1D2B83,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + + +/* predefined forcefeedback effects */ +DEFINE_GUID(GUID_ConstantForce, 0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_RampForce, 0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Square, 0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Sine, 0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Triangle, 0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothUp, 0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothDown, 0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Spring, 0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Damper, 0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Inertia, 0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Friction, 0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_CustomForce, 0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +//#endif /* DIJ_RINGZERO */ + +// ok yes ? +typedef struct IDirectInputA *LPDIRECTINPUTA; +typedef struct IDirectInputW *LPDIRECTINPUTW; +typedef struct IDirectInput2A *LPDIRECTINPUT2A; +typedef struct IDirectInput2W *LPDIRECTINPUT2W; +typedef struct IDirectInput7A *LPDIRECTINPUT7A; +typedef struct IDirectInput7W *LPDIRECTINPUT7W; +typedef struct IDirectInput8A *LPDIRECTINPUT8A; +typedef struct IDirectInput8W *LPDIRECTINPUT8W; +typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; +typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; +typedef struct IDirectInputDevice2A *LPDIRECTINPUTDEVICE2A; +typedef struct IDirectInputDevice2W *LPDIRECTINPUTDEVICE2W; +typedef struct IDirectInputDevice7A *LPDIRECTINPUTDEVICE7A; +typedef struct IDirectInputDevice7W *LPDIRECTINPUTDEVICE7W; +typedef struct IDirectInputDevice8A *LPDIRECTINPUTDEVICE8A; +typedef struct IDirectInputDevice8W *LPDIRECTINPUTDEVICE8W; +typedef struct IDirectInputEffect *LPDIRECTINPUTEFFECT; +typedef struct SysKeyboardA SysKeyboardA,*LPSYSKEYBOARDA; +typedef struct SysMouseA SysMouseA,*LPSYSMOUSEA; + +#ifdef UNICODE +#define IID_IDirectInputDevice IID_IDirectInputDeviceW +#define IDirectInputDevice IDirectInputDeviceW +#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl +#else +#define IID_IDirectInputDevice IID_IDirectInputDeviceA +#define IDirectInputDevice IDirectInputDeviceA +#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl +#endif + +#ifdef UNICODE +#define IID_IDirectInput2 IID_IDirectInput2W +#define IDirectInput2 IDirectInput2W +#define IDirectInput2Vtbl IDirectInput2WVtbl +#else +#define IID_IDirectInput2 IID_IDirectInput2A +#define IDirectInput2 IDirectInput2A +#define IDirectInput2Vtbl IDirectInput2AVtbl +#endif + +#ifdef UNICODE +#define IID_IDirectInput7 IID_IDirectInput7W +#define IDirectInput7 IDirectInput7W +#define IDirectInput7Vtbl IDirectInput7WVtbl +#else +#define IID_IDirectInput7 IID_IDirectInput7A +#define IDirectInput7 IDirectInput7A +#define IDirectInput7Vtbl IDirectInput7AVtbl +#endif + +#ifdef UNICODE +#define IID_IDirectInputDevice IID_IDirectInputDeviceW +#define IDirectInputDevice IDirectInputDeviceW +#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl +#else +#define IID_IDirectInputDevice IID_IDirectInputDeviceA +#define IDirectInputDevice IDirectInputDeviceA +#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl +#endif + +#ifdef UNICODE +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2W +#define IDirectInputDevice2 IDirectInputDevice2W +#define IDirectInputDevice2Vtbl IDirectInputDevice2WVtbl +#else +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2A +#define IDirectInputDevice2 IDirectInputDevice2A +#define IDirectInputDevice2Vtbl IDirectInputDevice2AVtbl +#endif + +#ifdef UNICODE +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7W +#define IDirectInputDevice7 IDirectInputDevice7W +#define IDirectInputDevice7Vtbl IDirectInputDevice7WVtbl +#else +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7A +#define IDirectInputDevice7 IDirectInputDevice7A +#define IDirectInputDevice7Vtbl IDirectInputDevice7AVtbl +#endif + +#ifdef UNICODE +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8W +#define IDirectInputDevice8 IDirectInputDevice8W +#define IDirectInputDevice8Vtbl IDirectInputDevice8WVtbl +#else +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8A +#define IDirectInputDevice8 IDirectInputDevice8A +#define IDirectInputDevice8Vtbl IDirectInputDevice8AVtbl +#endif + +// need to be fix +// #define IID_IDirectInput WINELIB_NAME_AW(IID_IDirectInput) +// DECL_WINELIB_TYPE_AW(LPDIRECTINPUT) +// #define IID_IDirectInput2 WINELIB_NAME_AW(IID_IDirectInput2) +// DECL_WINELIB_TYPE_AW(LPDIRECTINPUT2) +// #define IID_IDirectInput7 WINELIB_NAME_AW(IID_IDirectInput7) +// DECL_WINELIB_TYPE_AW(LPDIRECTINPUT7) +//#define IID_IDirectInputDevice WINELIB_NAME_AW(IID_IDirectInputDevice) +//DECL_WINELIB_TYPE_AW(LPDIRECTINPUTDEVICE) +//#define IID_IDirectInputDevice2 WINELIB_NAME_AW(IID_IDirectInputDevice2) +//DECL_WINELIB_TYPE_AW(LPDIRECTINPUTDEVICE2) + +// #define IID_IDirectInputDevice7 WINELIB_NAME_AW(IID_IDirectInputDevice7) +// DECL_WINELIB_TYPE_AW(LPDIRECTINPUTDEVICE7) + +//#define IID_IDirectInputDevice8 WINELIB_NAME_AW(IID_IDirectInputDevice8) +//DECL_WINELIB_TYPE_AW(LPDIRECTINPUTDEVICE8) + + +#define DI_OK S_OK +#define DI_NOTATTACHED S_FALSE +#define DI_BUFFEROVERFLOW S_FALSE +#define DI_PROPNOEFFECT S_FALSE +#define DI_NOEFFECT S_FALSE +#define DI_POLLEDDEVICE ((HRESULT)0x00000002L) +#define DI_DOWNLOADSKIPPED ((HRESULT)0x00000003L) +#define DI_EFFECTRESTARTED ((HRESULT)0x00000004L) +#define DI_TRUNCATED ((HRESULT)0x00000008L) +#define DI_TRUNCATEDANDRESTARTED ((HRESULT)0x0000000CL) + +#define DIERR_OLDDIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) +#define DIERR_BETADIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) +#define DIERR_BADDRIVERVER \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) +#define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG +#define DIERR_NOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) +#define DIERR_OBJECTNOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) +#define DIERR_INVALIDPARAM E_INVALIDARG +#define DIERR_NOINTERFACE E_NOINTERFACE +#define DIERR_GENERIC E_FAIL +#define DIERR_OUTOFMEMORY E_OUTOFMEMORY +#define DIERR_UNSUPPORTED E_NOTIMPL +#define DIERR_NOTINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) +#define DIERR_ALREADYINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) +#define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION +#define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED +#define DIERR_INPUTLOST \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) +#define DIERR_ACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) +#define DIERR_NOTACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) +#define DIERR_READONLY E_ACCESSDENIED +#define DIERR_HANDLEEXISTS E_ACCESSDENIED +#ifndef E_PENDING +#define E_PENDING 0x8000000AL +#endif +#define DIERR_INSUFFICIENTPRIVS 0x80040200L +#define DIERR_DEVICEFULL 0x80040201L +#define DIERR_MOREDATA 0x80040202L +#define DIERR_NOTDOWNLOADED 0x80040203L +#define DIERR_HASEFFECTS 0x80040204L +#define DIERR_NOTEXCLUSIVEACQUIRED 0x80040205L +#define DIERR_INCOMPLETEEFFECT 0x80040206L +#define DIERR_NOTBUFFERED 0x80040207L +#define DIERR_EFFECTPLAYING 0x80040208L +#define DIERR_UNPLUGGED 0x80040209L +#define DIERR_REPORTFULL 0x8004020AL + +#define DIENUM_STOP 0 +#define DIENUM_CONTINUE 1 + +#define DIEDFL_ALLDEVICES 0x00000000 +#define DIEDFL_ATTACHEDONLY 0x00000000 +#define DIEDFL_FORCEFEEDBACK 0x00000100 +#define DIEDFL_INCLUDEALIASES 0x00010000 +#define DIEDFL_INCLUDEPHANTOMS 0x00020000 +#define DIEDFL_INCLUDEHIDDEN 0x00040000 + +#define DIDEVTYPE_DEVICE 1 +#define DIDEVTYPE_MOUSE 2 +#define DIDEVTYPE_KEYBOARD 3 +#define DIDEVTYPE_JOYSTICK 4 +#define DIDEVTYPE_HID 0x00010000 + +#define DI8DEVCLASS_ALL 0 +#define DI8DEVCLASS_DEVICE 1 +#define DI8DEVCLASS_POINTER 2 +#define DI8DEVCLASS_KEYBOARD 3 +#define DI8DEVCLASS_GAMECTRL 4 + +#define DI8DEVTYPE_DEVICE 0x11 +#define DI8DEVTYPE_MOUSE 0x12 +#define DI8DEVTYPE_KEYBOARD 0x13 +#define DI8DEVTYPE_JOYSTICK 0x14 +#define DI8DEVTYPE_GAMEPAD 0x15 +#define DI8DEVTYPE_DRIVING 0x16 +#define DI8DEVTYPE_FLIGHT 0x17 +#define DI8DEVTYPE_1STPERSON 0x18 +#define DI8DEVTYPE_DEVICECTRL 0x19 +#define DI8DEVTYPE_SCREENPOINTER 0x1A +#define DI8DEVTYPE_REMOTE 0x1B +#define DI8DEVTYPE_SUPPLEMENTAL 0x1C + +#define DIDEVTYPEMOUSE_UNKNOWN 1 +#define DIDEVTYPEMOUSE_TRADITIONAL 2 +#define DIDEVTYPEMOUSE_FINGERSTICK 3 +#define DIDEVTYPEMOUSE_TOUCHPAD 4 +#define DIDEVTYPEMOUSE_TRACKBALL 5 + +#define DIDEVTYPEKEYBOARD_UNKNOWN 0 +#define DIDEVTYPEKEYBOARD_PCXT 1 +#define DIDEVTYPEKEYBOARD_OLIVETTI 2 +#define DIDEVTYPEKEYBOARD_PCAT 3 +#define DIDEVTYPEKEYBOARD_PCENH 4 +#define DIDEVTYPEKEYBOARD_NOKIA1050 5 +#define DIDEVTYPEKEYBOARD_NOKIA9140 6 +#define DIDEVTYPEKEYBOARD_NEC98 7 +#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DIDEVTYPEKEYBOARD_NEC98106 9 +#define DIDEVTYPEKEYBOARD_JAPAN106 10 +#define DIDEVTYPEKEYBOARD_JAPANAX 11 +#define DIDEVTYPEKEYBOARD_J3100 12 + +#define DIDEVTYPEJOYSTICK_UNKNOWN 1 +#define DIDEVTYPEJOYSTICK_TRADITIONAL 2 +#define DIDEVTYPEJOYSTICK_FLIGHTSTICK 3 +#define DIDEVTYPEJOYSTICK_GAMEPAD 4 +#define DIDEVTYPEJOYSTICK_RUDDER 5 +#define DIDEVTYPEJOYSTICK_WHEEL 6 +#define DIDEVTYPEJOYSTICK_HEADTRACKER 7 + +#define DI8DEVTYPEMOUSE_UNKNOWN 1 +#define DI8DEVTYPEMOUSE_TRADITIONAL 2 +#define DI8DEVTYPEMOUSE_FINGERSTICK 3 +#define DI8DEVTYPEMOUSE_TOUCHPAD 4 +#define DI8DEVTYPEMOUSE_TRACKBALL 5 +#define DI8DEVTYPEMOUSE_ABSOLUTE 6 + +#define DI8DEVTYPEKEYBOARD_UNKNOWN 0 +#define DI8DEVTYPEKEYBOARD_PCXT 1 +#define DI8DEVTYPEKEYBOARD_OLIVETTI 2 +#define DI8DEVTYPEKEYBOARD_PCAT 3 +#define DI8DEVTYPEKEYBOARD_PCENH 4 +#define DI8DEVTYPEKEYBOARD_NOKIA1050 5 +#define DI8DEVTYPEKEYBOARD_NOKIA9140 6 +#define DI8DEVTYPEKEYBOARD_NEC98 7 +#define DI8DEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DI8DEVTYPEKEYBOARD_NEC98106 9 +#define DI8DEVTYPEKEYBOARD_JAPAN106 10 +#define DI8DEVTYPEKEYBOARD_JAPANAX 11 +#define DI8DEVTYPEKEYBOARD_J3100 12 + +#define DI8DEVTYPE_LIMITEDGAMESUBTYPE 1 + +#define DI8DEVTYPEJOYSTICK_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEJOYSTICK_STANDARD 2 + +#define DI8DEVTYPEGAMEPAD_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEGAMEPAD_STANDARD 2 +#define DI8DEVTYPEGAMEPAD_TILT 3 + +#define DI8DEVTYPEDRIVING_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEDRIVING_COMBINEDPEDALS 2 +#define DI8DEVTYPEDRIVING_DUALPEDALS 3 +#define DI8DEVTYPEDRIVING_THREEPEDALS 4 +#define DI8DEVTYPEDRIVING_HANDHELD 5 + +#define DI8DEVTYPEFLIGHT_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEFLIGHT_STICK 2 +#define DI8DEVTYPEFLIGHT_YOKE 3 +#define DI8DEVTYPEFLIGHT_RC 4 + +#define DI8DEVTYPE1STPERSON_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPE1STPERSON_UNKNOWN 2 +#define DI8DEVTYPE1STPERSON_SIXDOF 3 +#define DI8DEVTYPE1STPERSON_SHOOTER 4 + +#define DI8DEVTYPESCREENPTR_UNKNOWN 2 +#define DI8DEVTYPESCREENPTR_LIGHTGUN 3 +#define DI8DEVTYPESCREENPTR_LIGHTPEN 4 +#define DI8DEVTYPESCREENPTR_TOUCH 5 + +#define DI8DEVTYPEREMOTE_UNKNOWN 2 + +#define DI8DEVTYPEDEVICECTRL_UNKNOWN 2 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION 3 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED 4 + +#define DI8DEVTYPESUPPLEMENTAL_UNKNOWN 2 +#define DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER 3 +#define DI8DEVTYPESUPPLEMENTAL_HEADTRACKER 4 +#define DI8DEVTYPESUPPLEMENTAL_HANDTRACKER 5 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE 6 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTER 7 +#define DI8DEVTYPESUPPLEMENTAL_THROTTLE 8 +#define DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE 9 +#define DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS 10 +#define DI8DEVTYPESUPPLEMENTAL_DUALPEDALS 11 +#define DI8DEVTYPESUPPLEMENTAL_THREEPEDALS 12 +#define DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS 13 + +#define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +#define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) + +typedef struct DIDEVICEOBJECTINSTANCE_DX3A { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3A, *LPDIDEVICEOBJECTINSTANCE_DX3A; +typedef const DIDEVICEOBJECTINSTANCE_DX3A *LPCDIDEVICEOBJECTINSTANCE_DX3A; +typedef struct DIDEVICEOBJECTINSTANCE_DX3W { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3W, *LPDIDEVICEOBJECTINSTANCE_DX3W; +typedef const DIDEVICEOBJECTINSTANCE_DX3W *LPCDIDEVICEOBJECTINSTANCE_DX3W; + +DECL_WINELIB_TYPE_AW(DIDEVICEOBJECTINSTANCE_DX3) +DECL_WINELIB_TYPE_AW(LPDIDEVICEOBJECTINSTANCE_DX3) +DECL_WINELIB_TYPE_AW(LPCDIDEVICEOBJECTINSTANCE_DX3) + +typedef struct DIDEVICEOBJECTINSTANCEA { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReserved; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; +typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; + +typedef struct DIDEVICEOBJECTINSTANCEW { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReserved; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; +typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; + +DECL_WINELIB_TYPE_AW(DIDEVICEOBJECTINSTANCE) +DECL_WINELIB_TYPE_AW(LPDIDEVICEOBJECTINSTANCE) +DECL_WINELIB_TYPE_AW(LPCDIDEVICEOBJECTINSTANCE) + +typedef struct DIDEVICEINSTANCE_DX3A { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3A, *LPDIDEVICEINSTANCE_DX3A; +typedef const DIDEVICEINSTANCE_DX3A *LPCDIDEVICEINSTANCE_DX3A; +typedef struct DIDEVICEINSTANCE_DX3W { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3W, *LPDIDEVICEINSTANCE_DX3W; +typedef const DIDEVICEINSTANCE_DX3W *LPCDIDEVICEINSTANCE_DX3W; + +DECL_WINELIB_TYPE_AW(DIDEVICEINSTANCE_DX3) +DECL_WINELIB_TYPE_AW(LPDIDEVICEINSTANCE_DX3) +DECL_WINELIB_TYPE_AW(LPCDIDEVICEINSTANCE_DX3) + +typedef struct DIDEVICEINSTANCEA { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; +typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; + +typedef struct DIDEVICEINSTANCEW { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; +typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; + +DECL_WINELIB_TYPE_AW(DIDEVICEINSTANCE) +DECL_WINELIB_TYPE_AW(LPDIDEVICEINSTANCE) +DECL_WINELIB_TYPE_AW(LPCDIDEVICEINSTANCE) + +typedef BOOL (CALLBACK *LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA,LPVOID); +typedef BOOL (CALLBACK *LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW,LPVOID); +DECL_WINELIB_TYPE_AW(LPDIENUMDEVICESCALLBACK) + +#if DIRECTINPUT_VERSION >= 0x0800 +typedef BOOL (CALLBACK *LPDIENUMDEVICESBYSEMANTICSCBA)(LPCDIDEVICEINSTANCEA,LPDIRECTINPUTDEVICE8A,DWORD,DWORD,LPVOID); +typedef BOOL (CALLBACK *LPDIENUMDEVICESBYSEMANTICSCBW)(LPCDIDEVICEINSTANCEW,LPDIRECTINPUTDEVICE8W,DWORD,DWORD,LPVOID); +DECL_WINELIB_TYPE_AW(LPDIENUMDEVICESBYSEMANTICSCB) +#endif + +typedef BOOL (CALLBACK *LPDICONFIGUREDEVICESCALLBACK)(LPUNKNOWN,LPVOID); + +typedef BOOL (CALLBACK *LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA,LPVOID); +typedef BOOL (CALLBACK *LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW,LPVOID); +DECL_WINELIB_TYPE_AW(LPDIENUMDEVICEOBJECTSCALLBACK) + +typedef BOOL (CALLBACK *LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID); + +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE +#define DIK_SLEEP 0xDF +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +#define DIDFT_ALL 0x00000000 +#define DIDFT_RELAXIS 0x00000001 +#define DIDFT_ABSAXIS 0x00000002 +#define DIDFT_AXIS 0x00000003 +#define DIDFT_PSHBUTTON 0x00000004 +#define DIDFT_TGLBUTTON 0x00000008 +#define DIDFT_BUTTON 0x0000000C +#define DIDFT_POV 0x00000010 +#define DIDFT_COLLECTION 0x00000040 +#define DIDFT_NODATA 0x00000080 +#define DIDFT_ANYINSTANCE 0x00FFFF00 +#define DIDFT_INSTANCEMASK DIDFT_ANYINSTANCE +#define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8) +#define DIDFT_GETTYPE(n) LOBYTE(n) +#define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8) +#define DIDFT_FFACTUATOR 0x01000000 +#define DIDFT_FFEFFECTTRIGGER 0x02000000 +#define DIDFT_OUTPUT 0x10000000 +#define DIDFT_VENDORDEFINED 0x04000000 +#define DIDFT_ALIAS 0x08000000 +#ifndef DIDFT_OPTIONAL +#define DIDFT_OPTIONAL 0x80000000 +#endif +#define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8) +#define DIDFT_NOCOLLECTION 0x00FFFF00 +#define DIDF_ABSAXIS 0x00000001 +#define DIDF_RELAXIS 0x00000002 + +#define DIGDD_PEEK 0x00000001 + +typedef struct DIDEVICEOBJECTDATA_DX3 { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +} DIDEVICEOBJECTDATA_DX3,*LPDIDEVICEOBJECTDATA_DX3; +typedef const DIDEVICEOBJECTDATA_DX3 *LPCDIDEVICEOBJECTDATA_DX3; + +typedef struct DIDEVICEOBJECTDATA { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; + UINT_PTR uAppData; +} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; +typedef const DIDEVICEOBJECTDATA *LPCDIDEVICEOBJECTDATA; + +typedef struct _DIOBJECTDATAFORMAT { + const GUID *pguid; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; +} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; +typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; + +typedef struct _DIDATAFORMAT { + DWORD dwSize; + DWORD dwObjSize; + DWORD dwFlags; + DWORD dwDataSize; + DWORD dwNumObjs; + LPDIOBJECTDATAFORMAT rgodf; +} DIDATAFORMAT, *LPDIDATAFORMAT; +typedef const DIDATAFORMAT *LPCDIDATAFORMAT; + +#define DIDOI_FFACTUATOR 0x00000001 +#define DIDOI_FFEFFECTTRIGGER 0x00000002 +#define DIDOI_POLLED 0x00008000 +#define DIDOI_ASPECTPOSITION 0x00000100 +#define DIDOI_ASPECTVELOCITY 0x00000200 +#define DIDOI_ASPECTACCEL 0x00000300 +#define DIDOI_ASPECTFORCE 0x00000400 +#define DIDOI_ASPECTMASK 0x00000F00 +#define DIDOI_GUIDISUSAGE 0x00010000 + +typedef struct DIPROPHEADER { + DWORD dwSize; + DWORD dwHeaderSize; + DWORD dwObj; + DWORD dwHow; +} DIPROPHEADER,*LPDIPROPHEADER; +typedef const DIPROPHEADER *LPCDIPROPHEADER; + +#define DIPH_DEVICE 0 +#define DIPH_BYOFFSET 1 +#define DIPH_BYID 2 +#define DIPH_BYUSAGE 3 + +#define DIMAKEUSAGEDWORD(UsagePage, Usage) (DWORD)MAKELONG(Usage, UsagePage) + +typedef struct DIPROPDWORD { + DIPROPHEADER diph; + DWORD dwData; +} DIPROPDWORD, *LPDIPROPDWORD; +typedef const DIPROPDWORD *LPCDIPROPDWORD; + +typedef struct DIPROPRANGE { + DIPROPHEADER diph; + LONG lMin; + LONG lMax; +} DIPROPRANGE, *LPDIPROPRANGE; +typedef const DIPROPRANGE *LPCDIPROPRANGE; + +#define DIPROPRANGE_NOMIN ((LONG)0x80000000) +#define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) + +typedef struct DIPROPCAL { + DIPROPHEADER diph; + LONG lMin; + LONG lCenter; + LONG lMax; +} DIPROPCAL, *LPDIPROPCAL; +typedef const DIPROPCAL *LPCDIPROPCAL; + +typedef struct DIPROPGUIDANDPATH { + DIPROPHEADER diph; + GUID guidClass; + WCHAR wszPath[MAX_PATH]; +} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH; +typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH; + +/* special property GUIDs */ +#ifdef __cplusplus +#define MAKEDIPROP(prop) (*(const GUID *)(prop)) +#else +#define MAKEDIPROP(prop) ((REFGUID)(prop)) +#endif +#define DIPROP_BUFFERSIZE MAKEDIPROP(1) +#define DIPROP_AXISMODE MAKEDIPROP(2) + +#define DIPROPAXISMODE_ABS 0 +#define DIPROPAXISMODE_REL 1 + +#define DIPROP_GRANULARITY MAKEDIPROP(3) +#define DIPROP_RANGE MAKEDIPROP(4) +#define DIPROP_DEADZONE MAKEDIPROP(5) +#define DIPROP_SATURATION MAKEDIPROP(6) +#define DIPROP_FFGAIN MAKEDIPROP(7) +#define DIPROP_FFLOAD MAKEDIPROP(8) +#define DIPROP_AUTOCENTER MAKEDIPROP(9) + +#define DIPROPAUTOCENTER_OFF 0 +#define DIPROPAUTOCENTER_ON 1 + +#define DIPROP_CALIBRATIONMODE MAKEDIPROP(10) + +#define DIPROPCALIBRATIONMODE_COOKED 0 +#define DIPROPCALIBRATIONMODE_RAW 1 + +#define DIPROP_CALIBRATION MAKEDIPROP(11) +#define DIPROP_GUIDANDPATH MAKEDIPROP(12) + +typedef struct DIDEVCAPS_DX3 { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +} DIDEVCAPS_DX3, *LPDIDEVCAPS_DX3; + +typedef struct DIDEVCAPS { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVCAPS,*LPDIDEVCAPS; + +#define DIDC_ATTACHED 0x00000001 +#define DIDC_POLLEDDEVICE 0x00000002 +#define DIDC_EMULATED 0x00000004 +#define DIDC_POLLEDDATAFORMAT 0x00000008 +#define DIDC_FORCEFEEDBACK 0x00000100 +#define DIDC_FFATTACK 0x00000200 +#define DIDC_FFFADE 0x00000400 +#define DIDC_SATURATION 0x00000800 +#define DIDC_POSNEGCOEFFICIENTS 0x00001000 +#define DIDC_POSNEGSATURATION 0x00002000 +#define DIDC_DEADBAND 0x00004000 +#define DIDC_STARTDELAY 0x00008000 +#define DIDC_ALIAS 0x00010000 +#define DIDC_PHANTOM 0x00020000 +#define DIDC_HIDDEN 0x00040000 + + +/* SetCooperativeLevel dwFlags */ +#define DISCL_EXCLUSIVE 0x00000001 +#define DISCL_NONEXCLUSIVE 0x00000002 +#define DISCL_FOREGROUND 0x00000004 +#define DISCL_BACKGROUND 0x00000008 + + +#define DIEFT_ALL 0x00000000 + +#define DIEFT_CONSTANTFORCE 0x00000001 +#define DIEFT_RAMPFORCE 0x00000002 +#define DIEFT_PERIODIC 0x00000003 +#define DIEFT_CONDITION 0x00000004 +#define DIEFT_CUSTOMFORCE 0x00000005 +#define DIEFT_HARDWARE 0x000000FF +#define DIEFT_FFATTACK 0x00000200 +#define DIEFT_FFFADE 0x00000400 +#define DIEFT_SATURATION 0x00000800 +#define DIEFT_POSNEGCOEFFICIENTS 0x00001000 +#define DIEFT_POSNEGSATURATION 0x00002000 +#define DIEFT_DEADBAND 0x00004000 +#define DIEFT_STARTDELAY 0x00008000 +#define DIEFT_GETTYPE(n) LOBYTE(n) + +#define DI_DEGREES 100 +#define DI_FFNOMINALMAX 10000 +#define DI_SECONDS 1000000 + +typedef struct DICONSTANTFORCE { + LONG lMagnitude; +} DICONSTANTFORCE, *LPDICONSTANTFORCE; +typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE; + +typedef struct DIRAMPFORCE { + LONG lStart; + LONG lEnd; +} DIRAMPFORCE, *LPDIRAMPFORCE; +typedef const DIRAMPFORCE *LPCDIRAMPFORCE; + +typedef struct DIPERIODIC { + DWORD dwMagnitude; + LONG lOffset; + DWORD dwPhase; + DWORD dwPeriod; +} DIPERIODIC, *LPDIPERIODIC; +typedef const DIPERIODIC *LPCDIPERIODIC; + +typedef struct DICONDITION { + LONG lOffset; + LONG lPositiveCoefficient; + LONG lNegativeCoefficient; + DWORD dwPositiveSaturation; + DWORD dwNegativeSaturation; + LONG lDeadBand; +} DICONDITION, *LPDICONDITION; +typedef const DICONDITION *LPCDICONDITION; + +typedef struct DICUSTOMFORCE { + DWORD cChannels; + DWORD dwSamplePeriod; + DWORD cSamples; + LPLONG rglForceData; +} DICUSTOMFORCE, *LPDICUSTOMFORCE; +typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE; + +typedef struct DIENVELOPE { + DWORD dwSize; + DWORD dwAttackLevel; + DWORD dwAttackTime; + DWORD dwFadeLevel; + DWORD dwFadeTime; +} DIENVELOPE, *LPDIENVELOPE; +typedef const DIENVELOPE *LPCDIENVELOPE; + +typedef struct DIEFFECT_DX5 { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDuration; + DWORD dwSamplePeriod; + DWORD dwGain; + DWORD dwTriggerButton; + DWORD dwTriggerRepeatInterval; + DWORD cAxes; + LPDWORD rgdwAxes; + LPLONG rglDirection; + LPDIENVELOPE lpEnvelope; + DWORD cbTypeSpecificParams; + LPVOID lpvTypeSpecificParams; +} DIEFFECT_DX5, *LPDIEFFECT_DX5; +typedef const DIEFFECT_DX5 *LPCDIEFFECT_DX5; + +typedef struct DIEFFECT { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDuration; + DWORD dwSamplePeriod; + DWORD dwGain; + DWORD dwTriggerButton; + DWORD dwTriggerRepeatInterval; + DWORD cAxes; + LPDWORD rgdwAxes; + LPLONG rglDirection; + LPDIENVELOPE lpEnvelope; + DWORD cbTypeSpecificParams; + LPVOID lpvTypeSpecificParams; + DWORD dwStartDelay; +} DIEFFECT, *LPDIEFFECT; +typedef const DIEFFECT *LPCDIEFFECT; +typedef DIEFFECT DIEFFECT_DX6; +typedef LPDIEFFECT LPDIEFFECT_DX6; + +typedef struct DIEFFECTINFOA { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + CHAR tszName[MAX_PATH]; +} DIEFFECTINFOA, *LPDIEFFECTINFOA; +typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA; + +typedef struct DIEFFECTINFOW { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + WCHAR tszName[MAX_PATH]; +} DIEFFECTINFOW, *LPDIEFFECTINFOW; +typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW; + +DECL_WINELIB_TYPE_AW(DIEFFECTINFO) +DECL_WINELIB_TYPE_AW(LPDIEFFECTINFO) +DECL_WINELIB_TYPE_AW(LPCDIEFFECTINFO) + +typedef BOOL (CALLBACK *LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID); +typedef BOOL (CALLBACK *LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID); + +typedef struct DIEFFESCAPE { + DWORD dwSize; + DWORD dwCommand; + LPVOID lpvInBuffer; + DWORD cbInBuffer; + LPVOID lpvOutBuffer; + DWORD cbOutBuffer; +} DIEFFESCAPE, *LPDIEFFESCAPE; + +typedef struct DIJOYSTATE { + LONG lX; + LONG lY; + LONG lZ; + LONG lRx; + LONG lRy; + LONG lRz; + LONG rglSlider[2]; + DWORD rgdwPOV[4]; + BYTE rgbButtons[32]; +} DIJOYSTATE, *LPDIJOYSTATE; + +typedef struct DIJOYSTATE2 { + LONG lX; + LONG lY; + LONG lZ; + LONG lRx; + LONG lRy; + LONG lRz; + LONG rglSlider[2]; + DWORD rgdwPOV[4]; + BYTE rgbButtons[128]; + LONG lVX; /* 'v' as in velocity */ + LONG lVY; + LONG lVZ; + LONG lVRx; + LONG lVRy; + LONG lVRz; + LONG rglVSlider[2]; + LONG lAX; /* 'a' as in acceleration */ + LONG lAY; + LONG lAZ; + LONG lARx; + LONG lARy; + LONG lARz; + LONG rglASlider[2]; + LONG lFX; /* 'f' as in force */ + LONG lFY; + LONG lFZ; + LONG lFRx; /* 'fr' as in rotational force aka torque */ + LONG lFRy; + LONG lFRz; + LONG rglFSlider[2]; +} DIJOYSTATE2, *LPDIJOYSTATE2; + +#define DIJOFS_X FIELD_OFFSET(DIJOYSTATE, lX) +#define DIJOFS_Y FIELD_OFFSET(DIJOYSTATE, lY) +#define DIJOFS_Z FIELD_OFFSET(DIJOYSTATE, lZ) +#define DIJOFS_RX FIELD_OFFSET(DIJOYSTATE, lRx) +#define DIJOFS_RY FIELD_OFFSET(DIJOYSTATE, lRy) +#define DIJOFS_RZ FIELD_OFFSET(DIJOYSTATE, lRz) +#define DIJOFS_SLIDER(n) (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \ + (n) * sizeof(LONG)) +#define DIJOFS_POV(n) (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \ + (n) * sizeof(DWORD)) +#define DIJOFS_BUTTON(n) (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n)) +#define DIJOFS_BUTTON0 DIJOFS_BUTTON(0) +#define DIJOFS_BUTTON1 DIJOFS_BUTTON(1) +#define DIJOFS_BUTTON2 DIJOFS_BUTTON(2) +#define DIJOFS_BUTTON3 DIJOFS_BUTTON(3) +#define DIJOFS_BUTTON4 DIJOFS_BUTTON(4) +#define DIJOFS_BUTTON5 DIJOFS_BUTTON(5) +#define DIJOFS_BUTTON6 DIJOFS_BUTTON(6) +#define DIJOFS_BUTTON7 DIJOFS_BUTTON(7) +#define DIJOFS_BUTTON8 DIJOFS_BUTTON(8) +#define DIJOFS_BUTTON9 DIJOFS_BUTTON(9) +#define DIJOFS_BUTTON10 DIJOFS_BUTTON(10) +#define DIJOFS_BUTTON11 DIJOFS_BUTTON(11) +#define DIJOFS_BUTTON12 DIJOFS_BUTTON(12) +#define DIJOFS_BUTTON13 DIJOFS_BUTTON(13) +#define DIJOFS_BUTTON14 DIJOFS_BUTTON(14) +#define DIJOFS_BUTTON15 DIJOFS_BUTTON(15) +#define DIJOFS_BUTTON16 DIJOFS_BUTTON(16) +#define DIJOFS_BUTTON17 DIJOFS_BUTTON(17) +#define DIJOFS_BUTTON18 DIJOFS_BUTTON(18) +#define DIJOFS_BUTTON19 DIJOFS_BUTTON(19) +#define DIJOFS_BUTTON20 DIJOFS_BUTTON(20) +#define DIJOFS_BUTTON21 DIJOFS_BUTTON(21) +#define DIJOFS_BUTTON22 DIJOFS_BUTTON(22) +#define DIJOFS_BUTTON23 DIJOFS_BUTTON(23) +#define DIJOFS_BUTTON24 DIJOFS_BUTTON(24) +#define DIJOFS_BUTTON25 DIJOFS_BUTTON(25) +#define DIJOFS_BUTTON26 DIJOFS_BUTTON(26) +#define DIJOFS_BUTTON27 DIJOFS_BUTTON(27) +#define DIJOFS_BUTTON28 DIJOFS_BUTTON(28) +#define DIJOFS_BUTTON29 DIJOFS_BUTTON(29) +#define DIJOFS_BUTTON30 DIJOFS_BUTTON(30) +#define DIJOFS_BUTTON31 DIJOFS_BUTTON(31) + +/* DInput 7 structures, types */ +typedef struct DIFILEEFFECT { + DWORD dwSize; + GUID GuidEffect; + LPCDIEFFECT lpDiEffect; + CHAR szFriendlyName[MAX_PATH]; +} DIFILEEFFECT, *LPDIFILEEFFECT; + +typedef const DIFILEEFFECT *LPCDIFILEEFFECT; +typedef BOOL (CALLBACK *LPDIENUMEFFECTSINFILECALLBACK)(LPCDIFILEEFFECT , LPVOID); + +/* DInput 8 structures and types */ +#if DIRECTINPUT_VERSION >= 0x0800 +typedef struct _DIACTIONA { + UINT_PTR uAppData; + DWORD dwSemantics; + DWORD dwFlags; + union { + LPCSTR lptszActionName; + UINT uResIdString; + } DUMMYUNIONNAME; + GUID guidInstance; + DWORD dwObjID; + DWORD dwHow; +} DIACTIONA, *LPDIACTIONA; +typedef const DIACTIONA *LPCDIACTIONA; + +typedef struct _DIACTIONW { + UINT_PTR uAppData; + DWORD dwSemantics; + DWORD dwFlags; + union { + LPCWSTR lptszActionName; + UINT uResIdString; + } DUMMYUNIONNAME; + GUID guidInstance; + DWORD dwObjID; + DWORD dwHow; +} DIACTIONW, *LPDIACTIONW; +typedef const DIACTIONW *LPCDIACTIONW; + +DECL_WINELIB_TYPE_AW(DIACTION) +DECL_WINELIB_TYPE_AW(LPDIACTION) +DECL_WINELIB_TYPE_AW(LPCDIACTION) + +#define DIA_FORCEFEEDBACK 0x00000001 +#define DIA_APPMAPPED 0x00000002 +#define DIA_APPNOMAP 0x00000004 +#define DIA_NORANGE 0x00000008 +#define DIA_APPFIXED 0x00000010 + +#define DIAH_UNMAPPED 0x00000000 +#define DIAH_USERCONFIG 0x00000001 +#define DIAH_APPREQUESTED 0x00000002 +#define DIAH_HWAPP 0x00000004 +#define DIAH_HWDEFAULT 0x00000008 +#define DIAH_DEFAULT 0x00000020 +#define DIAH_ERROR 0x80000000 + +typedef struct _DIACTIONFORMATA { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONA rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + LONG lAxisMin; + LONG lAxisMax; + HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + CHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATA, *LPDIACTIONFORMATA; +typedef const DIACTIONFORMATA *LPCDIACTIONFORMATA; + +typedef struct _DIACTIONFORMATW { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONW rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + LONG lAxisMin; + LONG lAxisMax; + HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + WCHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATW, *LPDIACTIONFORMATW; +typedef const DIACTIONFORMATW *LPCDIACTIONFORMATW; + +DECL_WINELIB_TYPE_AW(DIACTIONFORMAT) +DECL_WINELIB_TYPE_AW(LPDIACTIONFORMAT) +DECL_WINELIB_TYPE_AW(LPCDIACTIONFORMAT) + +#define DIAFTS_NEWDEVICELOW 0xFFFFFFFF +#define DIAFTS_NEWDEVICEHIGH 0xFFFFFFFF +#define DIAFTS_UNUSEDDEVICELOW 0x00000000 +#define DIAFTS_UNUSEDDEVICEHIGH 0x00000000 + +#define DIDBAM_DEFAULT 0x00000000 +#define DIDBAM_PRESERVE 0x00000001 +#define DIDBAM_INITIALIZE 0x00000002 +#define DIDBAM_HWDEFAULTS 0x00000004 + +#define DIDSAM_DEFAULT 0x00000000 +#define DIDSAM_NOUSER 0x00000001 +#define DIDSAM_FORCESAVE 0x00000002 + +#define DICD_DEFAULT 0x00000000 +#define DICD_EDIT 0x00000001 + +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +typedef struct _DICOLORSET { + DWORD dwSize; + D3DCOLOR cTextFore; + D3DCOLOR cTextHighlight; + D3DCOLOR cCalloutLine; + D3DCOLOR cCalloutHighlight; + D3DCOLOR cBorder; + D3DCOLOR cControlFill; + D3DCOLOR cHighlightFill; + D3DCOLOR cAreaFill; +} DICOLORSET, *LPDICOLORSET; +typedef const DICOLORSET *LPCDICOLORSET; + +typedef struct _DICONFIGUREDEVICESPARAMSA { + DWORD dwSize; + DWORD dwcUsers; + LPSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATA lprgFormats; + HWND hwnd; + DICOLORSET dics; + LPUNKNOWN lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSA, *LPDICONFIGUREDEVICESPARAMSA; +typedef const DICONFIGUREDEVICESPARAMSA *LPCDICONFIGUREDEVICESPARAMSA; + +typedef struct _DICONFIGUREDEVICESPARAMSW { + DWORD dwSize; + DWORD dwcUsers; + LPWSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATW lprgFormats; + HWND hwnd; + DICOLORSET dics; + LPUNKNOWN lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSW, *LPDICONFIGUREDEVICESPARAMSW; +typedef const DICONFIGUREDEVICESPARAMSW *LPCDICONFIGUREDEVICESPARAMSW; + +DECL_WINELIB_TYPE_AW(DICONFIGUREDEVICESPARAMS) +DECL_WINELIB_TYPE_AW(LPDICONFIGUREDEVICESPARAMS) +DECL_WINELIB_TYPE_AW(LPCDICONFIGUREDEVICESPARAMS) + +#define DIDIFT_CONFIGURATION 0x00000001 +#define DIDIFT_OVERLAY 0x00000002 + +#define DIDAL_CENTERED 0x00000000 +#define DIDAL_LEFTALIGNED 0x00000001 +#define DIDAL_RIGHTALIGNED 0x00000002 +#define DIDAL_MIDDLE 0x00000000 +#define DIDAL_TOPALIGNED 0x00000004 +#define DIDAL_BOTTOMALIGNED 0x00000008 + +typedef struct _DIDEVICEIMAGEINFOA { + CHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOA, *LPDIDEVICEIMAGEINFOA; +typedef const DIDEVICEIMAGEINFOA *LPCDIDEVICEIMAGEINFOA; + +typedef struct _DIDEVICEIMAGEINFOW { + WCHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOW, *LPDIDEVICEIMAGEINFOW; +typedef const DIDEVICEIMAGEINFOW *LPCDIDEVICEIMAGEINFOW; + +DECL_WINELIB_TYPE_AW(DIDEVICEIMAGEINFO) +DECL_WINELIB_TYPE_AW(LPDIDEVICEIMAGEINFO) +DECL_WINELIB_TYPE_AW(LPCDIDEVICEIMAGEINFO) + +typedef struct _DIDEVICEIMAGEINFOHEADERA { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOA lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERA, *LPDIDEVICEIMAGEINFOHEADERA; +typedef const DIDEVICEIMAGEINFOHEADERA *LPCDIDEVICEIMAGEINFOHEADERA; + +typedef struct _DIDEVICEIMAGEINFOHEADERW { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOW lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERW, *LPDIDEVICEIMAGEINFOHEADERW; +typedef const DIDEVICEIMAGEINFOHEADERW *LPCDIDEVICEIMAGEINFOHEADERW; + +DECL_WINELIB_TYPE_AW(DIDEVICEIMAGEINFOHEADER) +DECL_WINELIB_TYPE_AW(LPDIDEVICEIMAGEINFOHEADER) +DECL_WINELIB_TYPE_AW(LPCDIDEVICEIMAGEINFOHEADER) + +#endif /* DI8 */ + + +/***************************************************************************** + * IDirectInputEffect interface + */ + +#define INTERFACE IDirectInputEffect +DECLARE_INTERFACE_(IDirectInputEffect,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputEffect methods ***/ + STDMETHOD(Initialize)(THIS_ HINSTANCE, DWORD, REFGUID) PURE; + STDMETHOD(GetEffectGuid)(THIS_ LPGUID) PURE; + STDMETHOD(GetParameters)(THIS_ LPDIEFFECT, DWORD) PURE; + STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT, DWORD) PURE; + STDMETHOD(Start)(THIS_ DWORD, DWORD) PURE; + STDMETHOD(Stop)(THIS) PURE; + STDMETHOD(GetEffectStatus)(THIS_ LPDWORD) PURE; + STDMETHOD(Download)(THIS) PURE; + STDMETHOD(Unload)(THIS) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffect_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInputEffect methods ***/ +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->lpVtbl->GetEffectGuid(p,a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->lpVtbl->GetParameters(p,a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->lpVtbl->Start(p,a,b) +#define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectInputEffect_GetEffectStatus(p,a,b) (p)->lpVtbl->GetEffectStatus(p,a) +#define IDirectInputEffect_Download(p) (p)->lpVtbl->Download(p) +#define IDirectInputEffect_Unload(p) (p)->lpVtbl->Unload(p) +#define IDirectInputEffect_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#else +/*** IUnknown methods ***/ +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffect_AddRef(p) (p)->AddRef() +#define IDirectInputEffect_Release(p) (p)->Release() +/*** IDirectInputEffect methods ***/ +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->GetEffectGuid(a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->GetParameters(a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->SetParameters(a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->Start(a,b) +#define IDirectInputEffect_Stop(p) (p)->Stop() +#define IDirectInputEffect_GetEffectStatus(p,a,b) (p)->GetEffectStatus(a) +#define IDirectInputEffect_Download(p) (p)->Download() +#define IDirectInputEffect_Unload(p) (p)->Unload() +#define IDirectInputEffect_Escape(p,a) (p)->Escape(a) +#endif + + +/***************************************************************************** + * IDirectInputDeviceA interface + */ +#define INTERFACE IDirectInputDeviceA +DECLARE_INTERFACE_(IDirectInputDeviceA,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInputDeviceW interface + */ +#define INTERFACE IDirectInputDeviceW +DECLARE_INTERFACE_(IDirectInputDeviceW,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice_AddRef(p) (p)->AddRef() +#define IDirectInputDevice_Release(p) (p)->Release() +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice_Acquire(p) (p)->Acquire() +#define IDirectInputDevice_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#endif + + +/***************************************************************************** + * IDirectInputDevice2A interface + */ +#define INTERFACE IDirectInputDevice2A +DECLARE_INTERFACE_(IDirectInputDevice2A,IDirectInputDeviceA) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwEffType) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA pdei, REFGUID rguid) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD pdwOut) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE pesc) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInputDevice2W interface + */ +#define INTERFACE IDirectInputDevice2W +DECLARE_INTERFACE_(IDirectInputDevice2W,IDirectInputDeviceW) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwEffType) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW pdei, REFGUID rguid) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD pdwOut) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE pesc) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice2_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice2_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +/*** IDirectInputDevice2 methods ***/ +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice2_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#else +/*** IUnknown methods ***/ +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice2_AddRef(p) (p)->AddRef() +#define IDirectInputDevice2_Release(p) (p)->Release() +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice2_Acquire(p) (p)->Acquire() +#define IDirectInputDevice2_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +/*** IDirectInputDevice2 methods ***/ +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice2_Poll(p) (p)->Poll() +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#endif + +#if DIRECTINPUT_VERSION >= 0x0700 +/***************************************************************************** + * IDirectInputDevice7A interface + */ +#define INTERFACE IDirectInputDevice7A +DECLARE_INTERFACE_(IDirectInputDevice7A,IDirectInputDevice2A) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwEffType) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA pdei, REFGUID rguid) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD pdwOut) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE pesc) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) PURE; + /*** IDirectInputDevice7A methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR lpszFileName,LPDIENUMEFFECTSINFILECALLBACK pec,LPVOID pvRef,DWORD dwFlags) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR lpszFileName,DWORD dwEntries,LPDIFILEEFFECT rgDiFileEft,DWORD dwFlags) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInputDevice7W interface + */ +#define INTERFACE IDirectInputDevice7W +DECLARE_INTERFACE_(IDirectInputDevice7W,IDirectInputDevice2W) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwEffType) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW pdei, REFGUID rguid) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD pdwOut) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE pesc) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) PURE; + /*** IDirectInputDevice7W methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR lpszFileName,LPDIENUMEFFECTSINFILECALLBACK pec,LPVOID pvRef,DWORD dwFlags) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR lpszFileName,DWORD dwEntries,LPDIFILEEFFECT rgDiFileEft,DWORD dwFlags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice7_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice7_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice7_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +/*** IDirectInputDevice2 methods ***/ +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice7_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +/*** IDirectInputDevice7 methods ***/ +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#else +/*** IUnknown methods ***/ +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice7_AddRef(p) (p)->AddRef() +#define IDirectInputDevice7_Release(p) (p)->Release() +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice7_Acquire(p) (p)->Acquire() +#define IDirectInputDevice7_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +/*** IDirectInputDevice2 methods ***/ +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice7_Poll(p) (p)->Poll() +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +/*** IDirectInputDevice7 methods ***/ +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#endif + +#endif /* DI7 */ + +#if DIRECTINPUT_VERSION >= 0x0800 +/***************************************************************************** + * IDirectInputDevice8A interface + */ +#define INTERFACE IDirectInputDevice8A +DECLARE_INTERFACE_(IDirectInputDevice8A,IDirectInputDevice7A) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwEffType) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA pdei, REFGUID rguid) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD pdwOut) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE pesc) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) PURE; + /*** IDirectInputDevice7A methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR lpszFileName,LPDIENUMEFFECTSINFILECALLBACK pec,LPVOID pvRef,DWORD dwFlags) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR lpszFileName,DWORD dwEntries,LPDIFILEEFFECT rgDiFileEft,DWORD dwFlags) PURE; + /*** IDirectInputDevice8A methods ***/ + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInputDevice8W interface + */ +#define INTERFACE IDirectInputDevice8W +DECLARE_INTERFACE_(IDirectInputDevice8W,IDirectInputDevice7W) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW pdidi) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE; + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwEffType) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW pdei, REFGUID rguid) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD pdwOut) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE pesc) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) PURE; + /*** IDirectInputDevice7W methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR lpszFileName,LPDIENUMEFFECTSINFILECALLBACK pec,LPVOID pvRef,DWORD dwFlags) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR lpszFileName,DWORD dwEntries,LPDIFILEEFFECT rgDiFileEft,DWORD dwFlags) PURE; + /*** IDirectInputDevice8W methods ***/ + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice8_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +/*** IDirectInputDevice2 methods ***/ +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice8_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +/*** IDirectInputDevice7 methods ***/ +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +/*** IDirectInputDevice8 methods ***/ +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->lpVtbl->BuildActionMap(p,a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->lpVtbl->SetActionMap(p,a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->lpVtbl->GetImageInfo(p,a) +#else +/*** IUnknown methods ***/ +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice8_AddRef(p) (p)->AddRef() +#define IDirectInputDevice8_Release(p) (p)->Release() +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice8_Acquire(p) (p)->Acquire() +#define IDirectInputDevice8_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +/*** IDirectInputDevice2 methods ***/ +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice8_Poll(p) (p)->Poll() +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +/*** IDirectInputDevice7 methods ***/ +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +/*** IDirectInputDevice8 methods ***/ +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->BuildActionMap(a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->SetActionMap(a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->GetImageInfo(a) +#endif + +#endif /* DI8 */ + +/* "Standard" Mouse report... */ +typedef struct DIMOUSESTATE { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[4]; +} DIMOUSESTATE; + +/* "Standard" Mouse report for DInput 7... */ +typedef struct DIMOUSESTATE2 { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[8]; +} DIMOUSESTATE2; + +#define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) +#define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) +#define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) +#define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) +#define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) +#define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) +#define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) +#define DIMOFS_BUTTON4 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 4) +#define DIMOFS_BUTTON5 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 5) +#define DIMOFS_BUTTON6 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 6) +#define DIMOFS_BUTTON7 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 7) + +#ifdef __cplusplus +extern "C" { +#endif +extern const DIDATAFORMAT c_dfDIMouse; +extern const DIDATAFORMAT c_dfDIMouse2; /* DX 7 */ +extern const DIDATAFORMAT c_dfDIKeyboard; +extern const DIDATAFORMAT c_dfDIJoystick; +extern const DIDATAFORMAT c_dfDIJoystick2; +#ifdef __cplusplus +}; +#endif + +/***************************************************************************** + * IDirectInputA interface + */ +#define INTERFACE IDirectInputA +DECLARE_INTERFACE_(IDirectInputA,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInputW interface + */ +#define INTERFACE IDirectInputW +DECLARE_INTERFACE_(IDirectInputW,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInput methods ***/ +#define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirectInput_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput_AddRef(p) (p)->AddRef() +#define IDirectInput_Release(p) (p)->Release() +/*** IDirectInput methods ***/ +#define IDirectInput_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput_Initialize(p,a,b) (p)->Initialize(a,b) +#endif + +/***************************************************************************** + * IDirectInput2A interface + */ +#define INTERFACE IDirectInput2A +DECLARE_INTERFACE_(IDirectInput2A,IDirectInputA) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; + /*** IDirectInput2A methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInput2W interface + */ +#define INTERFACE IDirectInput2W +DECLARE_INTERFACE_(IDirectInput2W,IDirectInputW) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; + /*** IDirectInput2W methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInput2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInput methods ***/ +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +/*** IDirectInput2 methods ***/ +#define IDirectInput2_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirectInput2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput2_AddRef(p) (p)->AddRef() +#define IDirectInput2_Release(p) (p)->Release() +/*** IDirectInput methods ***/ +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->Initialize(a,b) +/*** IDirectInput2 methods ***/ +#define IDirectInput2_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#endif + +#if DIRECTINPUT_VERSION >= 0x0700 +/***************************************************************************** + * IDirectInput7A interface + */ +#define INTERFACE IDirectInput7A +DECLARE_INTERFACE_(IDirectInput7A,IDirectInput2A) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; + /*** IDirectInput2A methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance) PURE; + /*** IDirectInput7A methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInput7W interface + */ +#define INTERFACE IDirectInput7W +DECLARE_INTERFACE_(IDirectInput7W,IDirectInput2W) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; + /*** IDirectInput2W methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance) PURE; + /*** IDirectInput7W methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInput7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput7_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInput methods ***/ +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +/*** IDirectInput2 methods ***/ +#define IDirectInput7_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +/*** IDirectInput7 methods ***/ +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d) +#else +/*** IUnknown methods ***/ +#define IDirectInput7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput7_AddRef(p) (p)->AddRef() +#define IDirectInput7_Release(p) (p)->Release() +/*** IDirectInput methods ***/ +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->Initialize(a,b) +/*** IDirectInput2 methods ***/ +#define IDirectInput7_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +/*** IDirectInput7 methods ***/ +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->CreateDeviceEx(a,b,c,d) +#endif + +#endif /* DI7 */ + +#if DIRECTINPUT_VERSION >= 0x0800 +/***************************************************************************** + * IDirectInput8A interface + */ +#define INTERFACE IDirectInput8A +DECLARE_INTERFACE_(IDirectInput8A,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInput8A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICE8A *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBA lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) PURE; +}; +#undef INTERFACE + +/***************************************************************************** + * IDirectInput8W interface + */ +#define INTERFACE IDirectInput8W +DECLARE_INTERFACE_(IDirectInput8W,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInput8W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICE8W *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirectInput8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput8_Release(p) (p)->lpVtbl->Release(p) +/*** IDirectInput8 methods ***/ +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->lpVtbl->EnumDevicesBySemantics(p,a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->lpVtbl->ConfigureDevices(p,a,b,c,d) +#else +/*** IUnknown methods ***/ +#define IDirectInput8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput8_AddRef(p) (p)->AddRef() +#define IDirectInput8_Release(p) (p)->Release() +/*** IDirectInput8 methods ***/ +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->EnumDevicesBySemantics(a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->ConfigureDevices(a,b,c,d) +#endif + +#endif /* DI8 */ + +/* Export functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if DIRECTINPUT_VERSION >= 0x0800 +HRESULT WINAPI DirectInput8Create(HINSTANCE,DWORD,REFIID,LPVOID *,LPUNKNOWN); +#endif + +HRESULT WINAPI DirectInputCreateA(HINSTANCE,DWORD,LPDIRECTINPUTA *,LPUNKNOWN); +HRESULT WINAPI DirectInputCreateW(HINSTANCE,DWORD,LPDIRECTINPUTW *,LPUNKNOWN); +#define DirectInputCreate WINELIB_NAME_AW(DirectInputCreate) + +HRESULT WINAPI DirectInputCreateEx(HINSTANCE,DWORD,REFIID,LPVOID *,LPUNKNOWN); + +#ifdef __cplusplus +}; +#endif + +#endif /* __WINE_DINPUT_H */ + diff --git a/reactos/lib/dinput/Makefile b/reactos/lib/dinput/Makefile new file mode 100644 index 00000000000..4d146faa189 --- /dev/null +++ b/reactos/lib/dinput/Makefile @@ -0,0 +1,9 @@ +# $Id: Makefile,v 1.4 2004/11/29 00:13:49 greatlrd Exp $ + +PATH_TO_TOP = ../.. + +TARGET_TYPE = winedll + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/lib/dinput/Makefile.in b/reactos/lib/dinput/Makefile.in new file mode 100644 index 00000000000..4a47fdc3245 --- /dev/null +++ b/reactos/lib/dinput/Makefile.in @@ -0,0 +1,23 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = dinput.dll +IMPORTS = ole32 user32 advapi32 kernel32 +EXTRALIBS = -ldxguid -luuid + +C_SRCS = \ + data_formats.c \ + device.c \ + dinput_main.c \ + joystick_linux.c \ + joystick_linuxinput.c \ + keyboard.c \ + mouse.c \ + regsvr.c + +RC_SRCS = version.rc + +@MAKE_DLL_RULES@ + +### Dependencies: diff --git a/reactos/lib/dinput/Makefile.ros b/reactos/lib/dinput/Makefile.ros new file mode 100644 index 00000000000..c3d9ec9ec96 --- /dev/null +++ b/reactos/lib/dinput/Makefile.ros @@ -0,0 +1,28 @@ +# $Id: Makefile.ros,v 1.1 2004/11/29 00:13:49 greatlrd Exp $ + +TARGET_NAME = dinput + +TARGET_OBJECTS = data_formats.o device.o dinput_main.o joystick_linux.o joystick_linuxinput.o keyboard.o mouse.o regsvr.o + +TARGET_CFLAGS = -D__REACTOS__ + +TARGET_SDKLIBS = libwine.a ole32.a user32.a advapi32.a kernel32.a ole32.a wine_uuid.a ntdll.a winmm.a dxguid.a + + + +TARGET_RC_SRCS = version.rc +TARGET_RC_BINSRC = +TARGET_RC_BINARIES = + +default: all + +authors.c: +ifeq ($(HOST),mingw32-linux) + echo 'const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 };' > authors.c +else + echo const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 }; > authors.c +endif + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(TOOLS_PATH)/depend.mk diff --git a/reactos/lib/dinput/Makefile.ros-template b/reactos/lib/dinput/Makefile.ros-template new file mode 100644 index 00000000000..d41e1e09c5f --- /dev/null +++ b/reactos/lib/dinput/Makefile.ros-template @@ -0,0 +1,28 @@ +# $Id: Makefile.ros-template,v 1.1 2004/11/29 00:13:49 greatlrd Exp $ + +TARGET_NAME = dinput + +TARGET_OBJECTS = @C_SRCS@ + +TARGET_CFLAGS = @EXTRADEFS@ -D__REACTOS__ + +TARGET_SDKLIBS = libwine.a @IMPORTS@ ole32.a wine_uuid.a ntdll.a winmm.a dxguid.a + + + +TARGET_RC_SRCS = @RC_SRCS@ +TARGET_RC_BINSRC = @RC_BINSRC@ +TARGET_RC_BINARIES = @RC_BINARIES@ + +default: all + +authors.c: +ifeq ($(HOST),mingw32-linux) + echo 'const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 };' > authors.c +else + echo const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 }; > authors.c +endif + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(TOOLS_PATH)/depend.mk diff --git a/reactos/lib/dinput/data_formats.c b/reactos/lib/dinput/data_formats.c new file mode 100644 index 00000000000..e2c831581ed --- /dev/null +++ b/reactos/lib/dinput/data_formats.c @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2004 Robert Reif + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* TODO: + * add keyboard + */ + +#include + +#include "windef.h" +#include "dinput.h" + +#define numObjects(x) (sizeof(x) / sizeof(x[0])) + +DIOBJECTDATAFORMAT dfDIJoystick[] = { + { &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RxAxis,DIJOFS_RX,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RyAxis,DIJOFS_RY,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RzAxis,DIJOFS_RZ,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(0),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(1),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(2),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(3),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(0),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(1),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(2),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(3),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(4),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(5),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(6),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(7),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(8),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(9),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(10),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(11),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(12),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(13),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(14),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(15),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(16),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(17),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(18),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(19),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(20),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(21),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(22),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(23),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(24),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(25),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(26),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(27),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(28),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(29),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(30),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(31),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, +}; + +const DIDATAFORMAT c_dfDIJoystick = { + sizeof(DIDATAFORMAT), + sizeof(DIOBJECTDATAFORMAT), + DIDF_ABSAXIS, + sizeof(DIJOYSTATE2), + numObjects(dfDIJoystick), + dfDIJoystick +}; + +DIOBJECTDATAFORMAT dfDIJoystick2[] = { + { &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RxAxis,DIJOFS_RX,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RyAxis,DIJOFS_RY,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RzAxis,DIJOFS_RZ,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(0),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(1),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(2),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { &GUID_POV,DIJOFS_POV(3),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(0),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(1),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(2),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(3),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(4),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(5),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(6),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(7),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(8),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(9),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(10),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(11),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(12),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(13),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(14),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(15),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(16),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(17),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(18),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(19),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(20),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(21),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(22),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(23),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(24),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(25),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(26),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(27),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(28),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(29),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(30),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(31),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(32),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(33),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(34),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(35),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(36),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(37),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(38),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(39),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(40),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(41),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(42),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(43),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(44),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(45),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(46),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(47),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(48),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(49),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(50),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(51),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(52),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(53),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(54),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(55),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(56),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(57),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(58),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(59),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(60),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(61),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(62),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(63),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(64),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(65),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(66),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(67),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(68),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(69),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(70),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(71),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(72),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(73),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(74),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(75),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(76),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(77),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(78),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(79),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(80),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(81),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(82),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(83),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(84),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(85),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(86),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(87),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(88),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(89),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(90),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(91),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(92),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(93),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(94),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(95),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(96),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(97),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(98),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(99),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(100),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(101),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(102),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(103),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(104),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(105),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(106),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(107),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(108),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(109),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(110),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(111),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(112),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(113),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(114),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(115),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(116),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(117),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(118),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(119),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(120),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(121),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(122),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(123),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(124),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(125),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(126),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { NULL,DIJOFS_BUTTON(127),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, + { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lVX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lVY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lVZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lVRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lVRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lVRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lAX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lAY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lAZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lARx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lARy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lARz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lFX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lFY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lFZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lFRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lFRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lFRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, + { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, +}; + +const DIDATAFORMAT c_dfDIJoystick2 = { + sizeof(DIDATAFORMAT), + sizeof(DIOBJECTDATAFORMAT), + DIDF_ABSAXIS, + sizeof(DIJOYSTATE2), + numObjects(dfDIJoystick2), + dfDIJoystick2 +}; + +DIOBJECTDATAFORMAT dfDIMouse[] = { + { &GUID_XAxis, DIMOFS_X, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, + { &GUID_YAxis, DIMOFS_Y, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, + { &GUID_ZAxis, DIMOFS_Z, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, + { &GUID_Button, DIMOFS_BUTTON0, DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON1, DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON2, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON3, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 } +}; + +const DIDATAFORMAT c_dfDIMouse = { + sizeof(DIDATAFORMAT), + sizeof(DIOBJECTDATAFORMAT), + DIDF_RELAXIS, + sizeof(DIMOUSESTATE), + numObjects(dfDIMouse), + dfDIMouse +}; + +DIOBJECTDATAFORMAT dfDIMouse2[] = { + { &GUID_XAxis, DIMOFS_X, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, + { &GUID_YAxis, DIMOFS_Y, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, + { &GUID_ZAxis, DIMOFS_Z, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, + { &GUID_Button, DIMOFS_BUTTON0, DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON1, DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON2, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON3, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON4, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON5, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON6, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 }, + { &GUID_Button, DIMOFS_BUTTON7, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_BUTTON, 0 } +}; + +const DIDATAFORMAT c_dfDIMouse2 = { + sizeof(DIDATAFORMAT), + sizeof(DIOBJECTDATAFORMAT), + DIDF_RELAXIS, + sizeof(DIMOUSESTATE2), + numObjects(dfDIMouse2), + dfDIMouse2 +}; diff --git a/reactos/lib/dinput/device.c b/reactos/lib/dinput/device.c new file mode 100644 index 00000000000..9a2ec320b1a --- /dev/null +++ b/reactos/lib/dinput/device.c @@ -0,0 +1,884 @@ +/* DirectInput Device + * + * Copyright 1998 Marcus Meissner + * Copyright 1998,1999 Lionel Ulmer + * + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* This file contains all the Device specific functions that can be used as stubs + by real device implementations. + + It also contains all the helper functions. +*/ +#include "config.h" + +#include +#include +#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "dinput.h" +#include "device_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); + +/****************************************************************************** + * Various debugging tools + */ +void _dump_cooperativelevel_DI(DWORD dwFlags) { + if (TRACE_ON(dinput)) { + unsigned int i; + static const struct { + DWORD mask; + const char *name; + } flags[] = { +#define FE(x) { x, #x} + FE(DISCL_BACKGROUND), + FE(DISCL_EXCLUSIVE), + FE(DISCL_FOREGROUND), + FE(DISCL_NONEXCLUSIVE) +#undef FE + }; + for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) + if (flags[i].mask & dwFlags) + DPRINTF("%s ",flags[i].name); + DPRINTF("\n"); + } +} + +void _dump_EnumObjects_flags(DWORD dwFlags) { + if (TRACE_ON(dinput)) { + unsigned int i; + DWORD type, instance; + static const struct { + DWORD mask; + const char *name; + } flags[] = { +#define FE(x) { x, #x} + FE(DIDFT_RELAXIS), + FE(DIDFT_ABSAXIS), + FE(DIDFT_PSHBUTTON), + FE(DIDFT_TGLBUTTON), + FE(DIDFT_POV), + FE(DIDFT_COLLECTION), + FE(DIDFT_NODATA), + FE(DIDFT_FFACTUATOR), + FE(DIDFT_FFEFFECTTRIGGER), + FE(DIDFT_OUTPUT) +#undef FE + }; + type = (dwFlags & 0xFF0000FF); + instance = ((dwFlags >> 8) & 0xFFFF); + DPRINTF("Type:"); + if (type == DIDFT_ALL) { + DPRINTF(" DIDFT_ALL"); + } else { + for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) { + if (flags[i].mask & type) { + type &= ~flags[i].mask; + DPRINTF(" %s",flags[i].name); + } + } + if (type) { + DPRINTF(" (unhandled: %08lx)", type); + } + } + DPRINTF(" / Instance: "); + if (instance == ((DIDFT_ANYINSTANCE >> 8) & 0xFFFF)) { + DPRINTF("DIDFT_ANYINSTANCE"); + } else { + DPRINTF("%3ld", instance); + } + } +} + +void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) { + if (TRACE_ON(dinput)) { + DPRINTF(" - dwObj = 0x%08lx\n", diph->dwObj); + DPRINTF(" - dwHow = %s\n", + ((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" : + ((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" : + ((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown"))); + } +} + +void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) { + if (TRACE_ON(dinput)) { + DPRINTF(" - enumerating : %s ('%s') - %2ld - 0x%08lx - %s\n", + debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName); + } +} + +void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) { + if (TRACE_ON(dinput)) { + DPRINTF(" - enumerating : %s ('%s'), - %2ld - 0x%08lx - %s\n", + debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName)); + } +} + +/* This function is a helper to convert a GUID into any possible DInput GUID out there */ +const char *_dump_dinput_GUID(const GUID *guid) { + unsigned int i; + static const struct { + const GUID *guid; + const char *name; + } guids[] = { +#define FE(x) { &x, #x} + FE(GUID_XAxis), + FE(GUID_YAxis), + FE(GUID_ZAxis), + FE(GUID_RxAxis), + FE(GUID_RyAxis), + FE(GUID_RzAxis), + FE(GUID_Slider), + FE(GUID_Button), + FE(GUID_Key), + FE(GUID_POV), + FE(GUID_Unknown), + FE(GUID_SysMouse), + FE(GUID_SysKeyboard), + FE(GUID_Joystick), + FE(GUID_ConstantForce), + FE(GUID_RampForce), + FE(GUID_Square), + FE(GUID_Sine), + FE(GUID_Triangle), + FE(GUID_SawtoothUp), + FE(GUID_SawtoothDown), + FE(GUID_Spring), + FE(GUID_Damper), + FE(GUID_Inertia), + FE(GUID_Friction), + FE(GUID_CustomForce) +#undef FE + }; + if (guid == NULL) + return "null GUID"; + for (i = 0; i < (sizeof(guids) / sizeof(guids[0])); i++) { + if (IsEqualGUID(guids[i].guid, guid)) { + return guids[i].name; + } + } + return "Unknown GUID"; +} + +void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) { + unsigned int i; + + TRACE("Dumping DIDATAFORMAT structure:\n"); + TRACE(" - dwSize: %ld\n", df->dwSize); + if (df->dwSize != sizeof(DIDATAFORMAT)) { + WARN("Non-standard DIDATAFORMAT structure size (%ld instead of %d).\n", df->dwSize, sizeof(DIDATAFORMAT)); + } + TRACE(" - dwObjsize: %ld\n", df->dwObjSize); + if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) { + WARN("Non-standard DIOBJECTDATAFORMAT structure size (%ld instead of %d).\n", df->dwObjSize, sizeof(DIOBJECTDATAFORMAT)); + } + TRACE(" - dwFlags: 0x%08lx (", df->dwFlags); + switch (df->dwFlags) { + case DIDF_ABSAXIS: TRACE("DIDF_ABSAXIS"); break; + case DIDF_RELAXIS: TRACE("DIDF_RELAXIS"); break; + default: TRACE("unknown"); break; + } + TRACE(")\n"); + TRACE(" - dwDataSize: %ld\n", df->dwDataSize); + TRACE(" - dwNumObjs: %ld\n", df->dwNumObjs); + + for (i = 0; i < df->dwNumObjs; i++) { + TRACE(" - Object %d:\n", i); + TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df->rgodf[i].pguid), _dump_dinput_GUID(df->rgodf[i].pguid)); + TRACE(" * dwOfs: %ld\n", df->rgodf[i].dwOfs); + TRACE(" * dwType: 0x%08lx\n", df->rgodf[i].dwType); + TRACE(" "); _dump_EnumObjects_flags(df->rgodf[i].dwType); TRACE("\n"); + TRACE(" * dwFlags: 0x%08lx\n", df->rgodf[i].dwFlags); + } +} + +/* Conversion between internal data buffer and external data buffer */ +void fill_DataFormat(void *out, const void *in, DataFormat *df) { + int i; + char *in_c = (char *) in; + char *out_c = (char *) out; + + if (df->dt == NULL) { + /* This means that the app uses Wine's internal data format */ + memcpy(out, in, df->internal_format_size); + } else { + for (i = 0; i < df->size; i++) { + if (df->dt[i].offset_in >= 0) { + switch (df->dt[i].size) { + case 1: + TRACE("Copying (c) to %d from %d (value %d)\n", + df->dt[i].offset_out, df->dt[i].offset_in, *((char *) (in_c + df->dt[i].offset_in))); + *((char *) (out_c + df->dt[i].offset_out)) = *((char *) (in_c + df->dt[i].offset_in)); + break; + + case 2: + TRACE("Copying (s) to %d from %d (value %d)\n", + df->dt[i].offset_out, df->dt[i].offset_in, *((short *) (in_c + df->dt[i].offset_in))); + *((short *) (out_c + df->dt[i].offset_out)) = *((short *) (in_c + df->dt[i].offset_in)); + break; + + case 4: + TRACE("Copying (i) to %d from %d (value %d)\n", + df->dt[i].offset_out, df->dt[i].offset_in, *((int *) (in_c + df->dt[i].offset_in))); + *((int *) (out_c + df->dt[i].offset_out)) = *((int *) (in_c + df->dt[i].offset_in)); + break; + + default: + memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size); + break; + } + } else { + switch (df->dt[i].size) { + case 1: + TRACE("Copying (c) to %d default value %d\n", + df->dt[i].offset_out, df->dt[i].value); + *((char *) (out_c + df->dt[i].offset_out)) = (char) df->dt[i].value; + break; + + case 2: + TRACE("Copying (s) to %d default value %d\n", + df->dt[i].offset_out, df->dt[i].value); + *((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value; + break; + + case 4: + TRACE("Copying (i) to %d default value %d\n", + df->dt[i].offset_out, df->dt[i].value); + *((int *) (out_c + df->dt[i].offset_out)) = (int) df->dt[i].value; + break; + + default: + memset((out_c + df->dt[i].offset_out), df->dt[i].size, 0); + break; + } + } + } + } +} + +void release_DataFormat(DataFormat * format) +{ + TRACE("Deleting DataTransform : \n"); + + HeapFree(GetProcessHeap(), 0, format->dt); +} + +DataFormat *create_DataFormat(const DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) { + DataFormat *ret; + DataTransform *dt; + unsigned int i, j; + int same = 1; + int *done; + int index = 0; + DWORD next = 0; + + ret = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat)); + + done = (int *) HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs); + memset(done, 0, sizeof(int) * asked_format->dwNumObjs); + + dt = (DataTransform *) HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform)); + + TRACE("Creating DataTransform : \n"); + + for (i = 0; i < wine_format->dwNumObjs; i++) { + offset[i] = -1; + + for (j = 0; j < asked_format->dwNumObjs; j++) { + if (done[j] == 1) + continue; + + if (/* Check if the application either requests any GUID and if not, it if matches + * the GUID of the Wine object. + */ + ((asked_format->rgodf[j].pguid == NULL) || + (IsEqualGUID(wine_format->rgodf[i].pguid, asked_format->rgodf[j].pguid))) + && + (/* Then check if it accepts any instance id, and if not, if it matches Wine's + * instance id. + */ + ((asked_format->rgodf[j].dwType & 0x00FFFF00) == DIDFT_ANYINSTANCE) || + (DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType) == DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType)))) { + + done[j] = 1; + + TRACE("Matching : \n"); + TRACE(" - Asked (%d) :\n", j); + TRACE(" * GUID: %s ('%s')\n", + debugstr_guid(asked_format->rgodf[j].pguid), + _dump_dinput_GUID(asked_format->rgodf[j].pguid)); + TRACE(" * Offset: %3ld\n", asked_format->rgodf[j].dwOfs); + TRACE(" * dwType: %08lx\n", asked_format->rgodf[j].dwType); + TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n"); + + TRACE(" - Wine (%d) :\n", j); + TRACE(" * GUID: %s ('%s')\n", + debugstr_guid(wine_format->rgodf[j].pguid), + _dump_dinput_GUID(wine_format->rgodf[j].pguid)); + TRACE(" * Offset: %3ld\n", wine_format->rgodf[j].dwOfs); + TRACE(" * dwType: %08lx\n", wine_format->rgodf[j].dwType); + TRACE(" "); _dump_EnumObjects_flags(wine_format->rgodf[j].dwType); TRACE("\n"); + + if (wine_format->rgodf[i].dwType & DIDFT_BUTTON) + dt[index].size = sizeof(BYTE); + else + dt[index].size = sizeof(DWORD); + dt[index].offset_in = wine_format ->rgodf[i].dwOfs; + if (asked_format->rgodf[j].dwOfs < next) { + WARN("bad format: dwOfs=%ld, changing to %ld\n", asked_format->rgodf[j].dwOfs, next); + dt[index].offset_out = next; + offset[i] = next; + } else { + dt[index].offset_out = asked_format->rgodf[j].dwOfs; + offset[i] = asked_format->rgodf[j].dwOfs; + } + dt[index].value = 0; + next = next + dt[index].size; + + if (wine_format->rgodf[i].dwOfs != dt[index].offset_out) + same = 0; + + index++; + break; + } + } + + if (j == asked_format->dwNumObjs) + same = 0; + } + + TRACE("Setting to default value :\n"); + for (j = 0; j < asked_format->dwNumObjs; j++) { + if (done[j] == 0) { + TRACE(" - Asked (%d) :\n", j); + TRACE(" * GUID: %s ('%s')\n", + debugstr_guid(asked_format->rgodf[j].pguid), + _dump_dinput_GUID(asked_format->rgodf[j].pguid)); + TRACE(" * Offset: %3ld\n", asked_format->rgodf[j].dwOfs); + TRACE(" * dwType: %08lx\n", asked_format->rgodf[j].dwType); + TRACE(" "); _dump_EnumObjects_flags(asked_format->rgodf[j].dwType); TRACE("\n"); + + if (asked_format->rgodf[j].dwType & DIDFT_BUTTON) + dt[index].size = sizeof(BYTE); + else + dt[index].size = sizeof(DWORD); + dt[index].offset_in = -1; + dt[index].offset_out = asked_format->rgodf[j].dwOfs; + dt[index].value = 0; + index++; + + same = 0; + } + } + + ret->internal_format_size = wine_format->dwDataSize; + ret->size = index; + if (same) { + ret->dt = NULL; + HeapFree(GetProcessHeap(), 0, dt); + } else { + ret->dt = dt; + } + + HeapFree(GetProcessHeap(), 0, done); + + return ret; +} + +BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA lpddi, LPVOID lpvRef) { + DIDEVICEOBJECTINSTANCEW ddtmp; + device_enumobjects_AtoWcb_data* data; + + data = (device_enumobjects_AtoWcb_data*) lpvRef; + + memset(&ddtmp, 0, sizeof(DIDEVICEINSTANCEW)); + + ddtmp.dwSize = sizeof(DIDEVICEINSTANCEW); + ddtmp.guidType = lpddi->guidType; + ddtmp.dwOfs = lpddi->dwOfs; + ddtmp.dwType = lpddi->dwType; + ddtmp.dwFlags = lpddi->dwFlags; + MultiByteToWideChar(CP_ACP, 0, lpddi->tszName, -1, ddtmp.tszName, MAX_PATH); + + if (lpddi->dwSize == sizeof(DIDEVICEINSTANCEA)) { + /** + * if dwSize < sizeof(DIDEVICEINSTANCEA of DInput version >= 5) + * force feedback and other newer datas aren't available + */ + ddtmp.dwFFMaxForce = lpddi->dwFFMaxForce; + ddtmp.dwFFForceResolution = lpddi->dwFFForceResolution; + ddtmp.wCollectionNumber = lpddi->wCollectionNumber; + ddtmp.wDesignatorIndex = lpddi->wDesignatorIndex; + ddtmp.wUsagePage = lpddi->wUsagePage; + ddtmp.wUsage = lpddi->wUsage; + ddtmp.dwDimension = lpddi->dwDimension; + ddtmp.wExponent = lpddi->wExponent; + ddtmp.wReserved = lpddi->wReserved; + } + return data->lpCallBack(&ddtmp, data->lpvRef); +} + +/****************************************************************************** + * IDirectInputDeviceA + */ + +HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat( + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df +) { + IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface; + + TRACE("(this=%p,%p)\n",This,df); + + _dump_DIDATAFORMAT(df); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel( + LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags +) { + IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface; + TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags); + if (TRACE_ON(dinput)) { + TRACE(" cooperative level : "); + _dump_cooperativelevel_DI(dwflags); + } + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification( + LPDIRECTINPUTDEVICE8A iface,HANDLE hnd +) { + IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface; + FIXME("(this=%p,0x%08lx): stub\n",This,(DWORD)hnd); + return DI_OK; +} + +ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) +{ + IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface; + ULONG ref; + ref = InterlockedDecrement(&(This->ref)); + if (ref == 0) + HeapFree(GetProcessHeap(),0,This); + return ref; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface( + LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj +) +{ + IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if (IsEqualGUID(&IID_IUnknown,riid)) { + IDirectInputDevice2_AddRef(iface); + *ppobj = This; + return DI_OK; + } + if (IsEqualGUID(&IID_IDirectInputDeviceA,riid)) { + IDirectInputDevice2_AddRef(iface); + *ppobj = This; + return DI_OK; + } + if (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) { + IDirectInputDevice2_AddRef(iface); + *ppobj = This; + return DI_OK; + } + if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) { + IDirectInputDevice7_AddRef(iface); + *ppobj = This; + return DI_OK; + } + TRACE("Unsupported interface !\n"); + return E_FAIL; +} + +HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( + LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj +) +{ + IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if (IsEqualGUID(&IID_IUnknown,riid)) { + IDirectInputDevice2_AddRef(iface); + *ppobj = This; + return DI_OK; + } + if (IsEqualGUID(&IID_IDirectInputDeviceW,riid)) { + IDirectInputDevice2_AddRef(iface); + *ppobj = This; + return DI_OK; + } + if (IsEqualGUID(&IID_IDirectInputDevice2W,riid)) { + IDirectInputDevice2_AddRef(iface); + *ppobj = This; + return DI_OK; + } + if (IsEqualGUID(&IID_IDirectInputDevice7W,riid)) { + IDirectInputDevice7_AddRef(iface); + *ppobj = This; + return DI_OK; + } + TRACE("Unsupported interface !\n"); + return E_FAIL; +} + +ULONG WINAPI IDirectInputDevice2AImpl_AddRef( + LPDIRECTINPUTDEVICE8A iface) +{ + IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface; + return InterlockedIncrement(&(This->ref)); +} + +HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags); + if (TRACE_ON(dinput)) { + DPRINTF(" - flags = "); + _dump_EnumObjects_flags(dwFlags); + DPRINTF("\n"); + } + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( + LPDIRECTINPUTDEVICE8W iface, + LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags); + if (TRACE_ON(dinput)) { + DPRINTF(" - flags = "); + _dump_EnumObjects_flags(dwFlags); + DPRINTF("\n"); + } + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty( + LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPDIPROPHEADER pdiph) +{ + FIXME("(this=%p,%s,%p): stub!\n", + iface, debugstr_guid(rguid), pdiph); + + if (TRACE_ON(dinput)) + _dump_DIPROPHEADER(pdiph); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEOBJECTINSTANCEA pdidoi, + DWORD dwObj, + DWORD dwHow) +{ + FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n", + iface, pdidoi, dwObj, dwHow); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo( + LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEOBJECTINSTANCEW pdidoi, + DWORD dwObj, + DWORD dwHow) +{ + FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n", + iface, pdidoi, dwObj, dwHow); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEINSTANCEA pdidi) +{ + FIXME("(this=%p,%p): stub!\n", + iface, pdidi); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEINSTANCEW pdidi) +{ + FIXME("(this=%p,%p): stub!\n", + iface, pdidi); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel( + LPDIRECTINPUTDEVICE8A iface, + HWND hwndOwner, + DWORD dwFlags) +{ + FIXME("(this=%p,%p,0x%08lx): stub!\n", + iface, hwndOwner, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_Initialize( + LPDIRECTINPUTDEVICE8A iface, + HINSTANCE hinst, + DWORD dwVersion, + REFGUID rguid) +{ + FIXME("(this=%p,%p,%ld,%s): stub!\n", + iface, hinst, dwVersion, debugstr_guid(rguid)); + return DI_OK; +} + +/****************************************************************************** + * IDirectInputDevice2A + */ + +HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect( + LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPCDIEFFECT lpeff, + LPDIRECTINPUTEFFECT *ppdef, + LPUNKNOWN pUnkOuter) +{ + FIXME("(this=%p,%s,%p,%p,%p): stub!\n", + iface, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter); + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMEFFECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME("(this=%p,%p,%p,0x%08lx): stub!\n", + iface, lpCallback, lpvRef, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( + LPDIRECTINPUTDEVICE8W iface, + LPDIENUMEFFECTSCALLBACKW lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME("(this=%p,%p,%p,0x%08lx): stub!\n", + iface, lpCallback, lpvRef, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIEFFECTINFOA lpdei, + REFGUID rguid) +{ + FIXME("(this=%p,%p,%s): stub!\n", + iface, lpdei, debugstr_guid(rguid)); + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( + LPDIRECTINPUTDEVICE8W iface, + LPDIEFFECTINFOW lpdei, + REFGUID rguid) +{ + FIXME("(this=%p,%p,%s): stub!\n", + iface, lpdei, debugstr_guid(rguid)); + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState( + LPDIRECTINPUTDEVICE8A iface, + LPDWORD pdwOut) +{ + FIXME("(this=%p,%p): stub!\n", + iface, pdwOut); + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand( + LPDIRECTINPUTDEVICE8A iface, + DWORD dwFlags) +{ + FIXME("(this=%p,0x%08lx): stub!\n", + iface, dwFlags); + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME("(this=%p,%p,%p,0x%08lx): stub!\n", + iface, lpCallback, lpvRef, dwFlags); + if (lpCallback) + lpCallback(NULL, lpvRef); + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_Escape( + LPDIRECTINPUTDEVICE8A iface, + LPDIEFFESCAPE lpDIEEsc) +{ + FIXME("(this=%p,%p): stub!\n", + iface, lpDIEEsc); + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_Poll( + LPDIRECTINPUTDEVICE8A iface) +{ + /* Because wine devices do not need to be polled, just return DI_NOEFFECT */ + return DI_NOEFFECT; +} + +HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData( + LPDIRECTINPUTDEVICE8A iface, + DWORD cbObjectData, + LPCDIDEVICEOBJECTDATA rgdod, + LPDWORD pdwInOut, + DWORD dwFlags) +{ + FIXME("(this=%p,0x%08lx,%p,%p,0x%08lx): stub!\n", + iface, cbObjectData, rgdod, pdwInOut, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface, + LPCSTR lpszFileName, + LPDIENUMEFFECTSINFILECALLBACK pec, + LPVOID pvRef, + DWORD dwFlags) +{ + FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, lpszFileName, pec, pvRef, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface, + LPCWSTR lpszFileName, + LPDIENUMEFFECTSINFILECALLBACK pec, + LPVOID pvRef, + DWORD dwFlags) +{ + FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), pec, pvRef, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface, + LPCSTR lpszFileName, + DWORD dwEntries, + LPDIFILEEFFECT rgDiFileEft, + DWORD dwFlags) +{ + FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface, + LPCWSTR lpszFileName, + DWORD dwEntries, + LPDIFILEEFFECT rgDiFileEft, + DWORD dwFlags) +{ + FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, + LPDIACTIONFORMATA lpdiaf, + LPCSTR lpszUserName, + DWORD dwFlags) +{ + FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, + LPDIACTIONFORMATW lpdiaf, + LPCWSTR lpszUserName, + DWORD dwFlags) +{ + FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, + LPDIACTIONFORMATA lpdiaf, + LPCSTR lpszUserName, + DWORD dwFlags) +{ + FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, lpszUserName, dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, + LPDIACTIONFORMATW lpdiaf, + LPCWSTR lpszUserName, + DWORD dwFlags) +{ + FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) +{ + FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader); + + return DI_OK; +} + +HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) +{ + FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader); + + return DI_OK; +} diff --git a/reactos/lib/dinput/device_private.h b/reactos/lib/dinput/device_private.h new file mode 100644 index 00000000000..e7a32096efa --- /dev/null +++ b/reactos/lib/dinput/device_private.h @@ -0,0 +1,236 @@ +/* + * Copyright 2000 Lionel Ulmer + * Copyright 2000-2001 TransGaming Technologies Inc. + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H +#define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H + +#include + +#include "windef.h" +#include "winbase.h" +#include "dinput.h" + +/* Device implementation */ +typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl; +struct IDirectInputDevice2AImpl +{ + IDirectInputDevice2AVtbl *lpVtbl; + DWORD ref; + GUID guid; +}; + +/* Routines to do DataFormat / WineFormat conversions */ +typedef struct { + int size; + int offset_in; + int offset_out; + int value; +} DataTransform; + +typedef struct { + int size; + int internal_format_size; + DataTransform *dt; +} DataFormat; +extern void fill_DataFormat(void *out, const void *in, DataFormat *df) ; +extern DataFormat *create_DataFormat(const DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) ; +extern void release_DataFormat(DataFormat *df) ; + +/* Used to fill events in the queue */ +#define GEN_EVENT(offset,data,xtime,seq) \ +{ \ + /* If queue_len > 0, queuing is requested -> TRACE the event queued */ \ + if (This->queue_len > 0) { \ + int nq; \ + TRACE(" queueing %d at offset %d (queue head %d / size %d)\n", \ + (int) (data), (int) (offset), \ + (int) (This->queue_head), (int) (This->queue_len)); \ + \ + nq = This->queue_head+1; \ + while (nq >= This->queue_len) nq -= This->queue_len; \ + if ((offset >= 0) && (nq != This->queue_tail)) { \ + This->data_queue[This->queue_head].dwOfs = offset; \ + This->data_queue[This->queue_head].dwData = data; \ + This->data_queue[This->queue_head].dwTimeStamp = xtime; \ + This->data_queue[This->queue_head].dwSequence = seq; \ + This->queue_head = nq; \ + } else \ + This->overflow = TRUE; \ + } \ +} + +/** + * Callback Data used by specific callback + * for EnumObject on 'W' interfaces + */ +typedef struct { + LPDIENUMDEVICEOBJECTSCALLBACKW lpCallBack; + LPVOID lpvRef; +} device_enumobjects_AtoWcb_data; + +extern BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); + + +/* Various debug tools */ +extern void _dump_cooperativelevel_DI(DWORD dwFlags) ; +extern void _dump_EnumObjects_flags(DWORD dwFlags) ; +extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) ; +extern void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) ; +extern void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) ; +extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) ; +extern const char *_dump_dinput_GUID(const GUID *guid) ; + +/* And the stubs */ +extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat( + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel( + LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification( + LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ; +extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj); +extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj); +extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef( + LPDIRECTINPUTDEVICE8A iface) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( + LPDIRECTINPUTDEVICE8W iface, + LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, + LPVOID lpvRef, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty( + LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPDIPROPHEADER pdiph) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEOBJECTINSTANCEA pdidoi, + DWORD dwObj, + DWORD dwHow) ; +extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEOBJECTINSTANCEW pdidoi, + DWORD dwObj, + DWORD dwHow); +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEINSTANCEA pdidi) ; +extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEINSTANCEW pdidi) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel( + LPDIRECTINPUTDEVICE8A iface, + HWND hwndOwner, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize( + LPDIRECTINPUTDEVICE8A iface, + HINSTANCE hinst, + DWORD dwVersion, + REFGUID rguid) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect( + LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPCDIEFFECT lpeff, + LPDIRECTINPUTEFFECT *ppdef, + LPUNKNOWN pUnkOuter) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMEFFECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( + LPDIRECTINPUTDEVICE8W iface, + LPDIENUMEFFECTSCALLBACKW lpCallback, + LPVOID lpvRef, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIEFFECTINFOA lpdei, + REFGUID rguid) ; +extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( + LPDIRECTINPUTDEVICE8W iface, + LPDIEFFECTINFOW lpdei, + REFGUID rguid) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState( + LPDIRECTINPUTDEVICE8A iface, + LPDWORD pdwOut) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand( + LPDIRECTINPUTDEVICE8A iface, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, + LPVOID lpvRef, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape( + LPDIRECTINPUTDEVICE8A iface, + LPDIEFFESCAPE lpDIEEsc) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll( + LPDIRECTINPUTDEVICE8A iface) ; +extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData( + LPDIRECTINPUTDEVICE8A iface, + DWORD cbObjectData, + LPCDIDEVICEOBJECTDATA rgdod, + LPDWORD pdwInOut, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface, + LPCSTR lpszFileName, + LPDIENUMEFFECTSINFILECALLBACK pec, + LPVOID pvRef, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface, + LPCWSTR lpszFileName, + LPDIENUMEFFECTSINFILECALLBACK pec, + LPVOID pvRef, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface, + LPCSTR lpszFileName, + DWORD dwEntries, + LPDIFILEEFFECT rgDiFileEft, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface, + LPCWSTR lpszFileName, + DWORD dwEntries, + LPDIFILEEFFECT rgDiFileEft, + DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, + LPDIACTIONFORMATA lpdiaf, + LPCSTR lpszUserName, + DWORD dwFlags); +extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, + LPDIACTIONFORMATW lpdiaf, + LPCWSTR lpszUserName, + DWORD dwFlags); +extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, + LPDIACTIONFORMATA lpdiaf, + LPCSTR lpszUserName, + DWORD dwFlags); +extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, + LPDIACTIONFORMATW lpdiaf, + LPCWSTR lpszUserName, + DWORD dwFlags); +extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader); +extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader); + +#endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */ diff --git a/reactos/lib/dinput/dinput.stubs.c b/reactos/lib/dinput/dinput.stubs.c new file mode 100644 index 00000000000..4b95f2b790a --- /dev/null +++ b/reactos/lib/dinput/dinput.stubs.c @@ -0,0 +1,3 @@ +/* File generated automatically from dinput.spec; do not edit! */ +/* This file can be copied, modified and distributed without restriction. */ + diff --git a/reactos/lib/dinput/dinput_main.c b/reactos/lib/dinput/dinput_main.c new file mode 100644 index 00000000000..7a812547690 --- /dev/null +++ b/reactos/lib/dinput/dinput_main.c @@ -0,0 +1,756 @@ +/* DirectInput + * + * Copyright 1998 Marcus Meissner + * Copyright 1998,1999 Lionel Ulmer + * Copyright 2000-2002 TransGaming Technologies Inc. + * + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* Status: + * + * - Tomb Raider 2 Demo: + * Playable using keyboard only. + * - WingCommander Prophecy Demo: + * Doesn't get Input Focus. + * + * - Fallout : works great in X and DGA mode + */ + +#include "config.h" +#include "wine/port.h" + +#include +#include +#include + +#define COBJMACROS + +#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winerror.h" +#include "dinput_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); + +static IDirectInput7AVtbl ddi7avt; +static IDirectInput7WVtbl ddi7wvt; +static IDirectInput8AVtbl ddi8avt; +static IDirectInput8WVtbl ddi8wvt; + +/* This array will be filled a dinput.so loading */ +#define MAX_WINE_DINPUT_DEVICES 4 +static dinput_device * dinput_devices[MAX_WINE_DINPUT_DEVICES]; +static int nrof_dinput_devices = 0; + +HINSTANCE DINPUT_instance = NULL; + +BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserv) +{ + switch(reason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(inst); + DINPUT_instance = inst; + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +/* register a direct draw driver. We better not use malloc for we are in + * the ELF startup initialisation at this point. + */ +void dinput_register_device(dinput_device *device) { + int i; + + /* insert according to priority */ + for (i=0;ipref <= device->pref) { + memcpy(dinput_devices+i+1,dinput_devices+i,sizeof(dinput_devices[0])*(nrof_dinput_devices-i)); + dinput_devices[i] = device; + break; + } + } + if (i==nrof_dinput_devices) /* not found, or too low priority */ + dinput_devices[nrof_dinput_devices] = device; + + nrof_dinput_devices++; + + /* increase MAX_DDRAW_DRIVERS if the line below triggers */ + assert(nrof_dinput_devices <= MAX_WINE_DINPUT_DEVICES); +} + +/****************************************************************************** + * DirectInputCreateEx (DINPUT.@) + */ +HRESULT WINAPI DirectInputCreateEx( + HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, + LPUNKNOWN punkOuter) +{ + IDirectInputImpl* This; + + TRACE("(0x%08lx,%04lx,%s,%p,%p)\n", (DWORD)hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter); + + if (IsEqualGUID(&IID_IDirectInputA,riid) || + IsEqualGUID(&IID_IDirectInput2A,riid) || + IsEqualGUID(&IID_IDirectInput7A,riid)) { + This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This->lpVtbl = &ddi7avt; + This->ref = 1; + This->version = 1; + *ppDI = This; + + return DI_OK; + } + + if (IsEqualGUID(&IID_IDirectInputW,riid) || + IsEqualGUID(&IID_IDirectInput2W,riid) || + IsEqualGUID(&IID_IDirectInput7W,riid)) { + This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This->lpVtbl = &ddi7wvt; + This->ref = 1; + This->version = 1; + *ppDI = This; + + return DI_OK; + } + + if (IsEqualGUID(&IID_IDirectInput8A,riid)) { + This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This->lpVtbl = &ddi8avt; + This->ref = 1; + This->version = 8; + *ppDI = This; + + return DI_OK; + } + + if (IsEqualGUID(&IID_IDirectInput8W,riid)) { + This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This->lpVtbl = &ddi8wvt; + This->ref = 1; + This->version = 8; + *ppDI = This; + + return DI_OK; + } + + return DIERR_OLDDIRECTINPUTVERSION; +} + +/****************************************************************************** + * DirectInputCreateA (DINPUT.@) + */ +HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter) +{ + IDirectInputImpl* This; + TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter); + + //trace:dinput:DirectInputCreateA (0x00400000,0500,0x42bafc54,(nil)) + This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This->lpVtbl = &ddi7avt; + This->ref = 1; + if (dwVersion > 0x0700) { + This->version = 8; + } else { + /* We do not differientiate between version 1, 2 and 7 */ + This->version = 1; + } + *ppDI = (IDirectInputA*)This; + return 0; + +} + +/****************************************************************************** + * DirectInputCreateW (DINPUT.@) + */ +HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter) +{ + IDirectInputImpl* This; + TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter); + This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This->lpVtbl = &ddi7wvt; + This->ref = 1; + if (dwVersion >= 0x0800) { + This->version = 8; + } else { + /* We do not differientiate between version 1, 2 and 7 */ + This->version = 1; + } + *ppDI = (IDirectInputW*)This; + return 0; +} + +static char *_dump_DIDEVTYPE_value(DWORD dwDevType) { + switch (dwDevType) { + case 0: return "All devices"; + case DIDEVTYPE_MOUSE: return "DIDEVTYPE_MOUSE"; + case DIDEVTYPE_KEYBOARD: return "DIDEVTYPE_KEYBOARD"; + case DIDEVTYPE_JOYSTICK: return "DIDEVTYPE_JOYSTICK"; + case DIDEVTYPE_DEVICE: return "DIDEVTYPE_DEVICE"; + default: return "Unkown"; + } +} + +static void _dump_EnumDevices_dwFlags(DWORD dwFlags) { + if (TRACE_ON(dinput)) { + unsigned int i; + static const struct { + DWORD mask; + const char *name; + } flags[] = { +#define FE(x) { x, #x} + FE(DIEDFL_ALLDEVICES), + FE(DIEDFL_ATTACHEDONLY), + FE(DIEDFL_FORCEFEEDBACK), + FE(DIEDFL_INCLUDEALIASES), + FE(DIEDFL_INCLUDEPHANTOMS) +#undef FE + }; + if (dwFlags == 0) { + DPRINTF("DIEDFL_ALLDEVICES"); + return; + } + for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) + if (flags[i].mask & dwFlags) + DPRINTF("%s ",flags[i].name); + } +} + +/****************************************************************************** + * IDirectInputA_EnumDevices + */ +static HRESULT WINAPI IDirectInputAImpl_EnumDevices( + LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, + LPVOID pvRef, DWORD dwFlags) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + DIDEVICEINSTANCEA devInstance; + int i, j, r; + + TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n", + This, dwDevType, _dump_DIDEVTYPE_value(dwDevType), + lpCallback, pvRef, dwFlags); + + if (nrof_dinput_devices==0){ + scan_mouse(); + scan_keyboard(); + } + + TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n"); + + + for (i = 0; i < nrof_dinput_devices; i++) { + for (j = 0, r = -1; r != 0; j++) { + devInstance.dwSize = sizeof(devInstance); + TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name); + + + if ((r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->version, j))) { + if (lpCallback(&devInstance,pvRef) == DIENUM_STOP) + return 0; + } + } + } + + return 0; +} +/****************************************************************************** + * IDirectInputW_EnumDevices + */ +static HRESULT WINAPI IDirectInputWImpl_EnumDevices( + LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, + LPVOID pvRef, DWORD dwFlags) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + DIDEVICEINSTANCEW devInstance; + int i, j, r; + + if (nrof_dinput_devices==0){ + scan_mouse(); + scan_keyboard(); + } + + TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n", + This, dwDevType, _dump_DIDEVTYPE_value(dwDevType), + lpCallback, pvRef, dwFlags); + TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n"); + + + for (i = 0; i < nrof_dinput_devices; i++) { + for (j = 0, r = -1; r != 0; j++) { + devInstance.dwSize = sizeof(devInstance); + TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name); + if ((r = dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->version, j))) { + if (lpCallback(&devInstance,pvRef) == DIENUM_STOP) + return 0; + } + } + } + + return 0; +} + +static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + return InterlockedIncrement((&This->ref)); +} + +static ULONG WINAPI IDirectInputAImpl_Release(LPDIRECTINPUT7A iface) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + ULONG ref; + ref = InterlockedDecrement(&(This->ref)); + if (ref == 0) + HeapFree(GetProcessHeap(),0,This); + return ref; +} + +static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, REFIID riid, LPVOID *ppobj) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if (IsEqualGUID(&IID_IUnknown,riid) || + IsEqualGUID(&IID_IDirectInputA,riid) || + IsEqualGUID(&IID_IDirectInput2A,riid) || + IsEqualGUID(&IID_IDirectInput7A,riid)) { + IDirectInputAImpl_AddRef(iface); + *ppobj = This; + return 0; + } + TRACE("Unsupported interface !\n"); + return E_FAIL; +} + +static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, REFIID riid, LPVOID *ppobj) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if (IsEqualGUID(&IID_IUnknown,riid) || + IsEqualGUID(&IID_IDirectInputW,riid) || + IsEqualGUID(&IID_IDirectInput2W,riid) || + IsEqualGUID(&IID_IDirectInput7W,riid)) { + IDirectInputAImpl_AddRef((LPDIRECTINPUT7A) iface); + *ppobj = This; + return 0; + } + TRACE("Unsupported interface !\n"); + return E_FAIL; +} + +static HRESULT WINAPI IDirectInputAImpl_CreateDevice( + LPDIRECTINPUT7A iface,REFGUID rguid,LPDIRECTINPUTDEVICEA* pdev, + LPUNKNOWN punk +) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + HRESULT ret_value = DIERR_DEVICENOTREG; + int i; + + TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk); + + if (nrof_dinput_devices==0){ + scan_mouse(); + scan_keyboard(); + } + + /* Loop on all the devices to see if anyone matches the given GUID */ + for (i = 0; i < nrof_dinput_devices; i++) { + HRESULT ret; + if ((ret = dinput_devices[i]->create_deviceA(This, rguid, NULL, pdev)) == DI_OK) + return DI_OK; + + if (ret == DIERR_NOINTERFACE) + ret_value = DIERR_NOINTERFACE; + } + + return ret_value; +} + +static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7A iface, + REFGUID rguid, LPDIRECTINPUTDEVICEW* pdev, LPUNKNOWN punk) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + HRESULT ret_value = DIERR_DEVICENOTREG; + int i; + + TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk); + + if (nrof_dinput_devices==0){ + scan_mouse(); + scan_keyboard(); + } + + /* Loop on all the devices to see if anyone matches the given GUID */ + for (i = 0; i < nrof_dinput_devices; i++) { + HRESULT ret; + if ((ret = dinput_devices[i]->create_deviceW(This, rguid, NULL, pdev)) == DI_OK) + return DI_OK; + + if (ret == DIERR_NOINTERFACE) + ret_value = DIERR_NOINTERFACE; + } + + return ret_value; +} + +static HRESULT WINAPI IDirectInputAImpl_Initialize(LPDIRECTINPUT7A iface, HINSTANCE hinst, DWORD x) { + return DIERR_ALREADYINITIALIZED; +} + +static HRESULT WINAPI IDirectInputAImpl_GetDeviceStatus(LPDIRECTINPUT7A iface, + REFGUID rguid) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + FIXME("(%p)->(%s): stub\n",This,debugstr_guid(rguid)); + + return DI_OK; +} + +static HRESULT WINAPI IDirectInputAImpl_RunControlPanel(LPDIRECTINPUT7A iface, + HWND hwndOwner, + DWORD dwFlags) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + FIXME("(%p)->(%08lx,%08lx): stub\n",This, (DWORD) hwndOwner, dwFlags); + + return DI_OK; +} + +static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT7A iface, REFGUID rguid, + LPCSTR pszName, LPGUID pguidInstance) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), pszName, pguidInstance); + + return DI_OK; +} + +static HRESULT WINAPI IDirectInput2WImpl_FindDevice(LPDIRECTINPUT7W iface, REFGUID rguid, + LPCWSTR pszName, LPGUID pguidInstance) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), debugstr_w(pszName), pguidInstance); + + return DI_OK; +} + +static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, REFGUID rguid, + REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + HRESULT ret_value = DIERR_DEVICENOTREG; + int i; + + TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter); + + if (nrof_dinput_devices==0){ + scan_mouse(); + scan_keyboard(); + } + + /* Loop on all the devices to see if anyone matches the given GUID */ + for (i = 0; i < nrof_dinput_devices; i++) { + HRESULT ret; + if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK) + return DI_OK; + + if (ret == DIERR_NOINTERFACE) + ret_value = DIERR_NOINTERFACE; + } + + return ret_value; +} + +static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, REFGUID rguid, + REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + HRESULT ret_value = DIERR_DEVICENOTREG; + int i; + + TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter); + + if (nrof_dinput_devices==0){ + scan_mouse(); + scan_keyboard(); + } + + + + /* Loop on all the devices to see if anyone matches the given GUID */ + for (i = 0; i < nrof_dinput_devices; i++) { + HRESULT ret; + if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK) + return DI_OK; + + if (ret == DIERR_NOINTERFACE) + ret_value = DIERR_NOINTERFACE; + } + + return ret_value; +} + +static HRESULT WINAPI IDirectInput8AImpl_QueryInterface(LPDIRECTINPUT8A iface, REFIID riid, LPVOID *ppobj) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if (IsEqualGUID(&IID_IUnknown,riid) || + IsEqualGUID(&IID_IDirectInput8A,riid)) { + IDirectInputAImpl_AddRef((LPDIRECTINPUT7A) iface); + *ppobj = This; + return 0; + } + TRACE("Unsupported interface !\n"); + return E_NOINTERFACE; +} + +static HRESULT WINAPI IDirectInput8WImpl_QueryInterface(LPDIRECTINPUT8W iface, REFIID riid, LPVOID *ppobj) { + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if (IsEqualGUID(&IID_IUnknown,riid) || + IsEqualGUID(&IID_IDirectInput8W,riid)) { + IDirectInputAImpl_AddRef((LPDIRECTINPUT7A) iface); + *ppobj = This; + return 0; + } + TRACE("Unsupported interface !\n"); + return E_NOINTERFACE; +} + +static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics( + LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat, + LPDIENUMDEVICESBYSEMANTICSCBA lpCallback, + LPVOID pvRef, DWORD dwFlags +) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, ptszUserName, lpdiActionFormat, + lpCallback, pvRef, dwFlags); + return 0; +} + +static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( + LPDIRECTINPUT8W iface, LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat, + LPDIENUMDEVICESBYSEMANTICSCBW lpCallback, + LPVOID pvRef, DWORD dwFlags +) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, debugstr_w(ptszUserName), lpdiActionFormat, + lpCallback, pvRef, dwFlags); + return 0; +} + +static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices( + LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, + LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData +) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + FIXME("(this=%p,%p,%p,%04lx,%p): stub\n", This, lpdiCallback, lpdiCDParams, + dwFlags, pvRefData); + return 0; +} + +static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices( + LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, + LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData +) +{ + IDirectInputImpl *This = (IDirectInputImpl *)iface; + + FIXME("(this=%p,%p,%p,%04lx,%p): stub\n", This, lpdiCallback, lpdiCDParams, + dwFlags, pvRefData); + return 0; +} + +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(ddi7avt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static IDirectInput7AVtbl ddi7avt = { + XCAST(QueryInterface)IDirectInputAImpl_QueryInterface, + XCAST(AddRef)IDirectInputAImpl_AddRef, + XCAST(Release)IDirectInputAImpl_Release, + XCAST(CreateDevice)IDirectInputAImpl_CreateDevice, + XCAST(EnumDevices)IDirectInputAImpl_EnumDevices, + XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus, + XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel, + XCAST(Initialize)IDirectInputAImpl_Initialize, + XCAST(FindDevice)IDirectInput2AImpl_FindDevice, + XCAST(CreateDeviceEx)IDirectInput7AImpl_CreateDeviceEx +}; + +#undef XCAST +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(ddi7wvt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static IDirectInput7WVtbl ddi7wvt = { + XCAST(QueryInterface)IDirectInputWImpl_QueryInterface, + XCAST(AddRef)IDirectInputAImpl_AddRef, + XCAST(Release)IDirectInputAImpl_Release, + XCAST(CreateDevice)IDirectInputWImpl_CreateDevice, + XCAST(EnumDevices)IDirectInputWImpl_EnumDevices, + XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus, + XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel, + XCAST(Initialize)IDirectInputAImpl_Initialize, + XCAST(FindDevice)IDirectInput2WImpl_FindDevice, + XCAST(CreateDeviceEx)IDirectInput7WImpl_CreateDeviceEx +}; +#undef XCAST + +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(ddi8avt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static IDirectInput8AVtbl ddi8avt = { + XCAST(QueryInterface)IDirectInput8AImpl_QueryInterface, + XCAST(AddRef)IDirectInputAImpl_AddRef, + XCAST(Release)IDirectInputAImpl_Release, + XCAST(CreateDevice)IDirectInputAImpl_CreateDevice, + XCAST(EnumDevices)IDirectInputAImpl_EnumDevices, + XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus, + XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel, + XCAST(Initialize)IDirectInputAImpl_Initialize, + XCAST(FindDevice)IDirectInput2AImpl_FindDevice, + XCAST(EnumDevicesBySemantics)IDirectInput8AImpl_EnumDevicesBySemantics, + XCAST(ConfigureDevices)IDirectInput8AImpl_ConfigureDevices +}; +#undef XCAST + +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(ddi8wvt.fun)) +#else +# define XCAST(fun) (void*) +#endif +static IDirectInput8WVtbl ddi8wvt = { + XCAST(QueryInterface)IDirectInput8WImpl_QueryInterface, + XCAST(AddRef)IDirectInputAImpl_AddRef, + XCAST(Release)IDirectInputAImpl_Release, + XCAST(CreateDevice)IDirectInputWImpl_CreateDevice, + XCAST(EnumDevices)IDirectInputWImpl_EnumDevices, + XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus, + XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel, + XCAST(Initialize)IDirectInputAImpl_Initialize, + XCAST(FindDevice)IDirectInput2WImpl_FindDevice, + XCAST(EnumDevicesBySemantics)IDirectInput8WImpl_EnumDevicesBySemantics, + XCAST(ConfigureDevices)IDirectInput8WImpl_ConfigureDevices +}; +#undef XCAST + +/******************************************************************************* + * DirectInput ClassFactory + */ +typedef struct +{ + /* IUnknown fields */ + IClassFactoryVtbl *lpVtbl; + DWORD ref; +} IClassFactoryImpl; + +static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + + FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + return InterlockedIncrement(&(This->ref)); +} + +static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + /* static class, won't be freed */ + return InterlockedDecrement(&(This->ref)); +} + +static HRESULT WINAPI DICF_CreateInstance( + LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj +) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + + TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj); + if ( IsEqualGUID( &IID_IDirectInputA, riid ) || + IsEqualGUID( &IID_IDirectInputW, riid ) || + IsEqualGUID( &IID_IDirectInput2A, riid ) || + IsEqualGUID( &IID_IDirectInput2W, riid ) || + IsEqualGUID( &IID_IDirectInput7A, riid ) || + IsEqualGUID( &IID_IDirectInput7W, riid ) || + IsEqualGUID( &IID_IDirectInput8A, riid ) || + IsEqualGUID( &IID_IDirectInput8W, riid ) ) { + /* FIXME: reuse already created dinput if present? */ + return DirectInputCreateEx(0,0,riid,ppobj,pOuter); + } + + FIXME("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + FIXME("(%p)->(%d),stub!\n",This,dolock); + return S_OK; +} + +static IClassFactoryVtbl DICF_Vtbl = { + DICF_QueryInterface, + DICF_AddRef, + DICF_Release, + DICF_CreateInstance, + DICF_LockServer +}; +static IClassFactoryImpl DINPUT_CF = {&DICF_Vtbl, 1 }; + +/*********************************************************************** + * DllCanUnloadNow (DINPUT.@) + */ +HRESULT WINAPI DINPUT_DllCanUnloadNow(void) +{ + FIXME("(void): stub\n"); + + return S_FALSE; +} + +/*********************************************************************** + * DllGetClassObject (DINPUT.@) + */ +HRESULT WINAPI DINPUT_DllGetClassObject(REFCLSID rclsid, REFIID riid, + LPVOID *ppv) +{ + TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) { + *ppv = (LPVOID)&DINPUT_CF; + IClassFactory_AddRef((IClassFactory*)*ppv); + return S_OK; + } + + FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/reactos/lib/dinput/dinput_private.h b/reactos/lib/dinput/dinput_private.h new file mode 100644 index 00000000000..e1e8cd8e92d --- /dev/null +++ b/reactos/lib/dinput/dinput_private.h @@ -0,0 +1,58 @@ +/* + * Copyright 2000 Lionel Ulmer + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H +#define __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H + +#include + +#include "windef.h" +#include "winbase.h" +#include "dinput.h" + +/* Implementation specification */ +typedef struct IDirectInputImpl IDirectInputImpl; +struct IDirectInputImpl +{ + LPVOID lpVtbl; + DWORD ref; + + /* Used to have an unique sequence number for all the events */ + DWORD evsequence; + + int version; +}; + +/* Function called by all devices that Wine supports */ +typedef struct dinput_device { + INT pref; + const char *name; + BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id); + BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id); + HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev); + HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev); +} dinput_device; + +extern void dinput_register_device(dinput_device *device); + +extern HINSTANCE DINPUT_instance; + +void scan_keyboard(); +void scan_mouse(); + +#endif /* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */ diff --git a/reactos/lib/dinput/joystick_linux.c b/reactos/lib/dinput/joystick_linux.c new file mode 100644 index 00000000000..5e19d3b5467 --- /dev/null +++ b/reactos/lib/dinput/joystick_linux.c @@ -0,0 +1,1715 @@ +/* DirectInput Joystick device + * + * Copyright 1998 Marcus Meissner + * Copyright 1998,1999 Lionel Ulmer + * Copyright 2000-2001 TransGaming Technologies Inc. + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * To Do: + * dead zone + * force feedback + */ + +#include "config.h" +#include "wine/port.h" + +#ifdef HAVE_LINUX_22_JOYSTICK_API + +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#include +#ifdef HAVE_SYS_ERRNO_H +# include +#endif +#ifdef HAVE_LINUX_IOCTL_H +# include +#endif +#ifdef HAVE_LINUX_JOYSTICK_H +# include +#endif +#define JOYDEV "/dev/js" + +#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winreg.h" +#include "dinput.h" + +#include "dinput_private.h" +#include "device_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); + +typedef struct { + LONG lMin; + LONG lMax; + LONG lDeadZone; + LONG lSaturation; +} ObjProps; + +typedef struct { + LONG lX; + LONG lY; +} POV; + +typedef struct JoystickImpl JoystickImpl; +static IDirectInputDevice8AVtbl JoystickAvt; +static IDirectInputDevice8WVtbl JoystickWvt; +struct JoystickImpl +{ + LPVOID lpVtbl; + DWORD ref; + GUID guid; + char dev[32]; + + /* The 'parent' DInput */ + IDirectInputImpl *dinput; + + /* joystick private */ + int joyfd; + DIJOYSTATE2 js; /* wine data */ + LPDIDATAFORMAT user_df; /* user defined format */ + DataFormat *transform; /* wine to user format converter */ + int *offsets; /* object offsets */ + ObjProps *props; + HANDLE hEvent; + LPDIDEVICEOBJECTDATA data_queue; + int queue_head, queue_tail, queue_len; + BOOL acquired; + char *name; + DIDEVCAPS devcaps; + LONG deadzone; + int *axis_map; + int axes; + int buttons; + POV povs[4]; + CRITICAL_SECTION crit; + BOOL overflow; +}; + +static GUID DInput_Wine_Joystick_GUID = { /* 9e573ed9-7734-11d2-8d4a-23903fb6bdf7 */ + 0x9e573ed9, + 0x7734, + 0x11d2, + {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7} +}; + +static void _dump_DIDEVCAPS(LPDIDEVCAPS lpDIDevCaps) +{ + TRACE("dwSize: %ld\n", lpDIDevCaps->dwSize); + TRACE("dwFlags: %08lx\n",lpDIDevCaps->dwFlags); + TRACE("dwDevType: %08lx %s\n", lpDIDevCaps->dwDevType, + lpDIDevCaps->dwDevType == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : + lpDIDevCaps->dwDevType == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : + lpDIDevCaps->dwDevType == DIDEVTYPE_MOUSE ? "DIDEVTYPE_MOUSE" : + lpDIDevCaps->dwDevType == DIDEVTYPE_KEYBOARD ? "DIDEVTYPE_KEYBOARD" : + lpDIDevCaps->dwDevType == DIDEVTYPE_JOYSTICK ? "DIDEVTYPE_JOYSTICK" : + lpDIDevCaps->dwDevType == DIDEVTYPE_HID ? "DIDEVTYPE_HID" : "UNKNOWN"); + TRACE("dwAxes: %ld\n",lpDIDevCaps->dwAxes); + TRACE("dwButtons: %ld\n",lpDIDevCaps->dwButtons); + TRACE("dwPOVs: %ld\n",lpDIDevCaps->dwPOVs); + if (lpDIDevCaps->dwSize > sizeof(DIDEVCAPS_DX3)) { + TRACE("dwFFSamplePeriod: %ld\n",lpDIDevCaps->dwFFSamplePeriod); + TRACE("dwFFMinTimeResolution: %ld\n",lpDIDevCaps->dwFFMinTimeResolution); + TRACE("dwFirmwareRevision: %ld\n",lpDIDevCaps->dwFirmwareRevision); + TRACE("dwHardwareRevision: %ld\n",lpDIDevCaps->dwHardwareRevision); + TRACE("dwFFDriverVersion: %ld\n",lpDIDevCaps->dwFFDriverVersion); + } +} + +static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id) +{ + int fd = -1; + char dev[32]; + + if (dwFlags & DIEDFL_FORCEFEEDBACK) { + WARN("force feedback not supported\n"); + return FALSE; + } + + if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) { + /* check whether we have a joystick */ + sprintf(dev, "%s%d", JOYDEV, id); + if ((fd = open(dev,O_RDONLY)) < 0) { + WARN("open(%s,O_RDONLY) failed: %s\n", dev, strerror(errno)); + return FALSE; + } + + /* Return joystick */ + lpddi->guidInstance = DInput_Wine_Joystick_GUID; + lpddi->guidInstance.Data3 = id; + lpddi->guidProduct = DInput_Wine_Joystick_GUID; + /* we only support traditional joysticks for now */ + if (version >= 8) + lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + sprintf(lpddi->tszInstanceName, "Joystick %d", id); +#if defined(JSIOCGNAME) + if (ioctl(fd,JSIOCGNAME(sizeof(lpddi->tszProductName)),lpddi->tszProductName) < 0) { + WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", dev, strerror(errno)); + strcpy(lpddi->tszProductName, "Wine Joystick"); + } +#else + strcpy(lpddi->tszProductName, "Wine Joystick"); +#endif + + lpddi->guidFFDriver = GUID_NULL; + close(fd); + TRACE("Enumerating the linux Joystick device: %s (%s)\n", dev, lpddi->tszProductName); + return TRUE; + } + + return FALSE; +} + +static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id) +{ + int fd = -1; + char name[MAX_PATH]; + char dev[32]; + char friendly[32]; + + if (dwFlags & DIEDFL_FORCEFEEDBACK) { + WARN("force feedback not supported\n"); + return FALSE; + } + + if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) { + /* check whether we have a joystick */ + sprintf(dev, "%s%d", JOYDEV, id); + if ((fd = open(dev,O_RDONLY)) < 0) { + WARN("open(%s,O_RDONLY) failed: %s\n", dev, strerror(errno)); + return FALSE; + } + + /* Return joystick */ + lpddi->guidInstance = DInput_Wine_Joystick_GUID; + lpddi->guidInstance.Data3 = id; + lpddi->guidProduct = DInput_Wine_Joystick_GUID; + /* we only support traditional joysticks for now */ + if (version >= 8) + lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + sprintf(friendly, "Joystick %d", id); + MultiByteToWideChar(CP_ACP, 0, friendly, -1, lpddi->tszInstanceName, MAX_PATH); +#if defined(JSIOCGNAME) + if (ioctl(fd,JSIOCGNAME(sizeof(name)),name) < 0) { + WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", dev, strerror(errno)); + strcpy(name, "Wine Joystick"); + } +#else + strcpy(name, "Wine Joystick"); +#endif + MultiByteToWideChar(CP_ACP, 0, name, -1, lpddi->tszProductName, MAX_PATH); + lpddi->guidFFDriver = GUID_NULL; + close(fd); + TRACE("Enumerating the linux Joystick device: %s (%s)\n",dev,name); + return TRUE; + } + + return FALSE; +} + +/* + * Get a config key from either the app-specific or the default config + */ + +inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name, + char *buffer, DWORD size ) +{ + if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, buffer, &size )) + return 0; + + if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, buffer, &size )) + return 0; + + return ERROR_FILE_NOT_FOUND; +} + +/* + * Setup the dinput options. + */ + +static HRESULT setup_dinput_options(JoystickImpl * device) +{ + char buffer[MAX_PATH+1]; + HKEY hkey, appkey = 0; + DWORD len; + + buffer[MAX_PATH]='\0'; + + if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\dinput", &hkey)) hkey = 0; + + len = GetModuleFileNameA( 0, buffer, MAX_PATH ); + if (len && len < MAX_PATH) { + HKEY tmpkey; + + if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\AppDefaults", &tmpkey )) { + char appname[MAX_PATH+16]; + char *p = strrchr( buffer, '\\' ); + if (p!=NULL) { + strcpy(appname,p+1); + strcat(appname,"\\dinput"); + TRACE("appname = [%s] \n",appname); + if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0; + } + RegCloseKey( tmpkey ); + } + } + + /* get options */ + + if (!get_config_key( hkey, appkey, "DefaultDeadZone", buffer, MAX_PATH )) { + device->deadzone = atoi(buffer); + TRACE("setting default deadzone to: \"%s\" %ld\n", buffer, device->deadzone); + } + + if (!get_config_key( hkey, appkey, device->name, buffer, MAX_PATH )) { + int tokens = 0; + int axis = 0; + int pov = 0; + char *delim = ","; + char * ptr; + TRACE("\"%s\" = \"%s\"\n", device->name, buffer); + + device->axis_map = HeapAlloc(GetProcessHeap(), 0, device->axes * sizeof(int)); + if (device->axis_map == 0) + return DIERR_OUTOFMEMORY; + + if ((ptr = strtok(buffer, delim)) != NULL) { + do { + if (strcmp(ptr, "X") == 0) { + device->axis_map[tokens] = 0; + axis++; + } else if (strcmp(ptr, "Y") == 0) { + device->axis_map[tokens] = 1; + axis++; + } else if (strcmp(ptr, "Z") == 0) { + device->axis_map[tokens] = 2; + axis++; + } else if (strcmp(ptr, "Rx") == 0) { + device->axis_map[tokens] = 3; + axis++; + } else if (strcmp(ptr, "Ry") == 0) { + device->axis_map[tokens] = 4; + axis++; + } else if (strcmp(ptr, "Rz") == 0) { + device->axis_map[tokens] = 5; + axis++; + } else if (strcmp(ptr, "Slider1") == 0) { + device->axis_map[tokens] = 6; + axis++; + } else if (strcmp(ptr, "Slider2") == 0) { + device->axis_map[tokens] = 7; + axis++; + } else if (strcmp(ptr, "POV1") == 0) { + device->axis_map[tokens++] = 8; + device->axis_map[tokens] = 8; + pov++; + } else if (strcmp(ptr, "POV2") == 0) { + device->axis_map[tokens++] = 9; + device->axis_map[tokens] = 9; + pov++; + } else if (strcmp(ptr, "POV3") == 0) { + device->axis_map[tokens++] = 10; + device->axis_map[tokens] = 10; + pov++; + } else if (strcmp(ptr, "POV4") == 0) { + device->axis_map[tokens++] = 11; + device->axis_map[tokens] = 11; + pov++; + } else { + ERR("invalid joystick axis type: %s\n", ptr); + device->axis_map[tokens] = tokens; + axis++; + } + + tokens++; + } while ((ptr = strtok(NULL, delim)) != NULL); + + if (tokens != device->devcaps.dwAxes) { + ERR("not all joystick axes mapped: %d axes(%d,%d), %d arguments\n", device->axes, axis, pov,tokens); + while (tokens < device->axes) { + device->axis_map[tokens] = tokens; + tokens++; + } + } + } + + device->devcaps.dwAxes = axis; + device->devcaps.dwPOVs = pov; + } + + if (appkey) + RegCloseKey( appkey ); + + if (hkey) + RegCloseKey( hkey ); + + return DI_OK; +} + +void calculate_ids(JoystickImpl* device) +{ + int i; + int axis = 0; + int button = 0; + int pov = 0; + int axis_base; + int pov_base; + int button_base; + + /* Make two passes over the format. The first counts the number + * for each type and the second sets the id */ + for (i = 0; i < device->user_df->dwNumObjs; i++) { + if (DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) & DIDFT_AXIS) + axis++; + else if (DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) & DIDFT_POV) + pov++; + else if (DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) & DIDFT_BUTTON) + button++; + } + + axis_base = 0; + pov_base = axis; + button_base = axis + pov; + + axis = 0; + button = 0; + pov = 0; + + for (i = 0; i < device->user_df->dwNumObjs; i++) { + DWORD type = 0; + if (DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) & DIDFT_AXIS) { + axis++; + type = DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) | + DIDFT_MAKEINSTANCE(axis + axis_base); + TRACE("axis type = 0x%08lx\n", type); + } else if (DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) & DIDFT_POV) { + pov++; + type = DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) | + DIDFT_MAKEINSTANCE(pov + pov_base); + TRACE("POV type = 0x%08lx\n", type); + } else if (DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) & DIDFT_BUTTON) { + button++; + type = DIDFT_GETTYPE(device->user_df->rgodf[i].dwType) | + DIDFT_MAKEINSTANCE(button + button_base); + TRACE("button type = 0x%08lx\n", type); + } + device->user_df->rgodf[i].dwType = type; + } +} + +static HRESULT alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputImpl *dinput, LPDIRECTINPUTDEVICEA* pdev) +{ + DWORD i; + JoystickImpl* newDevice; + char name[MAX_PATH]; + HRESULT hr; + + newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickImpl)); + if (newDevice == 0) { + WARN("out of memory\n"); + *pdev = 0; + return DIERR_OUTOFMEMORY; + } + + sprintf(newDevice->dev, "%s%d", JOYDEV, rguid->Data3); + + if ((newDevice->joyfd = open(newDevice->dev,O_RDONLY)) < 0) { + WARN("open(%s,O_RDONLY) failed: %s\n", newDevice->dev, strerror(errno)); + HeapFree(GetProcessHeap(), 0, newDevice); + return DIERR_DEVICENOTREG; + } + + /* get the device name */ +#if defined(JSIOCGNAME) + if (ioctl(newDevice->joyfd,JSIOCGNAME(MAX_PATH),name) < 0) { + WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", newDevice->dev, strerror(errno)); + strcpy(name, "Wine Joystick"); + } +#else + strcpy(name, "Wine Joystick"); +#endif + + /* copy the device name */ + newDevice->name = HeapAlloc(GetProcessHeap(),0,strlen(name) + 1); + strcpy(newDevice->name, name); + +#ifdef JSIOCGAXES + if (ioctl(newDevice->joyfd,JSIOCGAXES,&newDevice->axes) < 0) { + WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", newDevice->dev, strerror(errno)); + newDevice->axes = 2; + } +#endif +#ifdef JSIOCGBUTTONS + if (ioctl(newDevice->joyfd,JSIOCGBUTTONS,&newDevice->buttons) < 0) { + WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", newDevice->dev, strerror(errno)); + newDevice->buttons = 2; + } +#endif + + newDevice->lpVtbl = jvt; + newDevice->ref = 1; + newDevice->dinput = dinput; + newDevice->acquired = FALSE; + newDevice->overflow = FALSE; + CopyMemory(&(newDevice->guid),rguid,sizeof(*rguid)); + + /* setup_dinput_options may change these */ + newDevice->deadzone = 5000; + newDevice->devcaps.dwButtons = newDevice->buttons; + newDevice->devcaps.dwAxes = newDevice->axes; + newDevice->devcaps.dwPOVs = 0; + + /* do any user specified configuration */ + hr = setup_dinput_options(newDevice); + if (hr != DI_OK) + goto FAILED1; + + if (newDevice->axis_map == 0) { + newDevice->axis_map = HeapAlloc(GetProcessHeap(), 0, newDevice->axes * sizeof(int)); + if (newDevice->axis_map == 0) + goto FAILED; + + for (i = 0; i < newDevice->axes; i++) + newDevice->axis_map[i] = i; + } + + /* wine uses DIJOYSTATE2 as it's internal format so copy + * the already defined format c_dfDIJoystick2 */ + newDevice->user_df = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwSize); + if (newDevice->user_df == 0) + goto FAILED; + + CopyMemory(newDevice->user_df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize); + + /* copy default objects */ + newDevice->user_df->rgodf = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize); + if (newDevice->user_df->rgodf == 0) + goto FAILED; + + CopyMemory(newDevice->user_df->rgodf,c_dfDIJoystick2.rgodf,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize); + + /* create default properties */ + newDevice->props = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*sizeof(ObjProps)); + if (newDevice->props == 0) + goto FAILED; + + /* initialize default properties */ + for (i = 0; i < c_dfDIJoystick2.dwNumObjs; i++) { + newDevice->props[i].lMin = 0; + newDevice->props[i].lMax = 0xffff; + newDevice->props[i].lDeadZone = newDevice->deadzone; /* % * 1000 */ + newDevice->props[i].lSaturation = 0; + } + + /* create an offsets array */ + newDevice->offsets = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,c_dfDIJoystick2.dwNumObjs*sizeof(int)); + if (newDevice->offsets == 0) + goto FAILED; + + /* create the default transform filter */ + newDevice->transform = create_DataFormat(&c_dfDIJoystick2, newDevice->user_df, newDevice->offsets); + + calculate_ids(newDevice); + + IDirectInputDevice_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->dinput); + InitializeCriticalSection(&(newDevice->crit)); + newDevice->crit.DebugInfo->Spare[1] = (DWORD)"DINPUT_Mouse"; + + newDevice->devcaps.dwSize = sizeof(newDevice->devcaps); + newDevice->devcaps.dwFlags = DIDC_ATTACHED; + newDevice->devcaps.dwDevType = DIDEVTYPE_JOYSTICK; + newDevice->devcaps.dwFFSamplePeriod = 0; + newDevice->devcaps.dwFFMinTimeResolution = 0; + newDevice->devcaps.dwFirmwareRevision = 0; + newDevice->devcaps.dwHardwareRevision = 0; + newDevice->devcaps.dwFFDriverVersion = 0; + + if (TRACE_ON(dinput)) { + _dump_DIDATAFORMAT(newDevice->user_df); + for (i = 0; i < (newDevice->axes); i++) + TRACE("axis_map[%ld] = %d\n", i, newDevice->axis_map[i]); + _dump_DIDEVCAPS(&newDevice->devcaps); + } + + *pdev = (LPDIRECTINPUTDEVICEA)newDevice; + + return DI_OK; + +FAILED: + hr = DIERR_OUTOFMEMORY; +FAILED1: + if (newDevice->axis_map) + HeapFree(GetProcessHeap(),0,newDevice->axis_map); + if (newDevice->name) + HeapFree(GetProcessHeap(),0,newDevice->name); + if (newDevice->props) + HeapFree(GetProcessHeap(),0,newDevice->props); + if (newDevice->user_df->rgodf) + HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf); + if (newDevice->user_df) + HeapFree(GetProcessHeap(),0,newDevice->user_df); + if (newDevice) + HeapFree(GetProcessHeap(),0,newDevice); + *pdev = 0; + + return hr; +} + +static BOOL IsJoystickGUID(REFGUID guid) +{ + GUID wine_joystick = DInput_Wine_Joystick_GUID; + GUID dev_guid = *guid; + + wine_joystick.Data3 = 0; + dev_guid.Data3 = 0; + + return IsEqualGUID(&wine_joystick, &dev_guid); +} + +static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev) +{ + if ((IsEqualGUID(&GUID_Joystick,rguid)) || + (IsJoystickGUID(rguid))) { + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceA,riid) || + IsEqualGUID(&IID_IDirectInputDevice2A,riid) || + IsEqualGUID(&IID_IDirectInputDevice7A,riid) || + IsEqualGUID(&IID_IDirectInputDevice8A,riid)) { + return alloc_device(rguid, &JoystickAvt, dinput, pdev); + } else { + WARN("no interface\n"); + *pdev = 0; + return DIERR_NOINTERFACE; + } + } + + WARN("invalid device GUID\n"); + *pdev = 0; + return DIERR_DEVICENOTREG; +} + +static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev) +{ + if ((IsEqualGUID(&GUID_Joystick,rguid)) || + (IsJoystickGUID(rguid))) { + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceW,riid) || + IsEqualGUID(&IID_IDirectInputDevice2W,riid) || + IsEqualGUID(&IID_IDirectInputDevice7W,riid) || + IsEqualGUID(&IID_IDirectInputDevice8W,riid)) { + return alloc_device(rguid, &JoystickWvt, dinput, (LPDIRECTINPUTDEVICEA *)pdev); + } else { + WARN("no interface\n"); + *pdev = 0; + return DIERR_NOINTERFACE; + } + } + + WARN("invalid device GUID\n"); + *pdev = 0; + return DIERR_DEVICENOTREG; +} + +static dinput_device joydev = { + 10, + "Wine Linux joystick driver", + joydev_enum_deviceA, + joydev_enum_deviceW, + joydev_create_deviceA, + joydev_create_deviceW +}; + +DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); } + + + +/****************************************************************************** + * Joystick + */ +static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface) +{ + JoystickImpl *This = (JoystickImpl *)iface; + ULONG ref; + + ref = InterlockedDecrement((&This->ref)); + if (ref) + return ref; + + /* Free the device name */ + if (This->name) + HeapFree(GetProcessHeap(),0,This->name); + + /* Free the axis map */ + if (This->axis_map) + HeapFree(GetProcessHeap(),0,This->axis_map); + + /* Free the data queue */ + if (This->data_queue != NULL) + HeapFree(GetProcessHeap(),0,This->data_queue); + + /* Free the DataFormat */ + HeapFree(GetProcessHeap(), 0, This->user_df->rgodf); + HeapFree(GetProcessHeap(), 0, This->user_df); + + /* Free the properties */ + HeapFree(GetProcessHeap(), 0, This->props); + + /* Free the offsets array */ + HeapFree(GetProcessHeap(),0,This->offsets); + + /* release the data transform filter */ + release_DataFormat(This->transform); + + This->crit.DebugInfo->Spare[1] = 0; + DeleteCriticalSection(&(This->crit)); + IDirectInputDevice_Release((LPDIRECTINPUTDEVICE8A)This->dinput); + + HeapFree(GetProcessHeap(),0,This); + return 0; +} + +/****************************************************************************** + * SetDataFormat : the application can choose the format of the data + * the device driver sends back with GetDeviceState. + */ +static HRESULT WINAPI JoystickAImpl_SetDataFormat( + LPDIRECTINPUTDEVICE8A iface, + LPCDIDATAFORMAT df) +{ + JoystickImpl *This = (JoystickImpl *)iface; + unsigned int i; + LPDIDATAFORMAT new_df = 0; + LPDIOBJECTDATAFORMAT new_rgodf = 0; + ObjProps * new_props = 0; + + TRACE("(%p,%p)\n",This,df); + + if (This->acquired) { + WARN("acquired\n"); + return DIERR_ACQUIRED; + } + + if (TRACE_ON(dinput)) + _dump_DIDATAFORMAT(df); + + /* Store the new data format */ + new_df = HeapAlloc(GetProcessHeap(),0,df->dwSize); + if (new_df == 0) + goto FAILED; + + new_rgodf = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*df->dwObjSize); + if (new_rgodf == 0) + goto FAILED; + + new_props = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*sizeof(ObjProps)); + if (new_props == 0) + goto FAILED; + + HeapFree(GetProcessHeap(),0,This->user_df); + HeapFree(GetProcessHeap(),0,This->user_df->rgodf); + HeapFree(GetProcessHeap(),0,This->props); + release_DataFormat(This->transform); + + This->user_df = new_df; + CopyMemory(This->user_df, df, df->dwSize); + This->user_df->rgodf = new_rgodf; + CopyMemory(This->user_df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize); + This->props = new_props; + for (i = 0; i < df->dwNumObjs; i++) { + This->props[i].lMin = 0; + This->props[i].lMax = 0xffff; + This->props[i].lDeadZone = 1000; + This->props[i].lSaturation = 0; + } + This->transform = create_DataFormat(&c_dfDIJoystick2, This->user_df, This->offsets); + + calculate_ids(This); + + return DI_OK; + +FAILED: + WARN("out of memory\n"); + if (new_props) + HeapFree(GetProcessHeap(),0,new_props); + if (new_rgodf) + HeapFree(GetProcessHeap(),0,new_rgodf); + if (new_df) + HeapFree(GetProcessHeap(),0,new_df); + return DIERR_OUTOFMEMORY; +} + +/****************************************************************************** + * Acquire : gets exclusive control of the joystick + */ +static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(%p)\n",This); + + if (This->acquired) { + WARN("already acquired\n"); + return S_FALSE; + } + + /* open the joystick device */ + if (This->joyfd==-1) { + TRACE("opening joystick device %s\n", This->dev); + + This->joyfd=open(This->dev,O_RDONLY); + if (This->joyfd==-1) { + ERR("open(%s) failed: %s\n", This->dev, strerror(errno)); + return DIERR_NOTFOUND; + } + } + + This->acquired = TRUE; + + return DI_OK; +} + +/****************************************************************************** + * Unacquire : frees the joystick + */ +static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(%p)\n",This); + + if (!This->acquired) { + WARN("not acquired\n"); + return DIERR_NOTACQUIRED; + } + + if (This->joyfd!=-1) { + TRACE("closing joystick device\n"); + close(This->joyfd); + This->joyfd = -1; + This->acquired = FALSE; + return DI_OK; + } + + This->acquired = FALSE; + + return DI_NOEFFECT; +} + +LONG map_axis(JoystickImpl * This, short val, short index) +{ + double fval = val; + double fmin = This->props[index].lMin; + double fmax = This->props[index].lMax; + double fret; + + fret = (((fval + 32767.0) * (fmax - fmin)) / (32767.0*2.0)) + fmin; + + if (fret >= 0.0) + fret += 0.5; + else + fret -= 0.5; + + return fret; +} + +/* convert wine format offset to user format object index */ +int offset_to_object(JoystickImpl *This, int offset) +{ + int i; + + for (i = 0; i < This->user_df->dwNumObjs; i++) { + if (This->user_df->rgodf[i].dwOfs == offset) + return i; + } + + return -1; +} + +static LONG calculate_pov(JoystickImpl *This, int index) +{ + if (This->povs[index].lX < 16384) { + if (This->povs[index].lY < 16384) + This->js.rgdwPOV[index] = 31500; + else if (This->povs[index].lY > 49150) + This->js.rgdwPOV[index] = 22500; + else + This->js.rgdwPOV[index] = 27000; + } else if (This->povs[index].lX > 49150) { + if (This->povs[index].lY < 16384) + This->js.rgdwPOV[index] = 4500; + else if (This->povs[index].lY > 49150) + This->js.rgdwPOV[index] = 13500; + else + This->js.rgdwPOV[index] = 9000; + } else { + if (This->povs[index].lY < 16384) + This->js.rgdwPOV[index] = 0; + else if (This->povs[index].lY > 49150) + This->js.rgdwPOV[index] = 18000; + else + This->js.rgdwPOV[index] = -1; + } + + return This->js.rgdwPOV[index]; +} + +static void joy_polldev(JoystickImpl *This) { + struct timeval tv; + fd_set readfds; + struct js_event jse; + TRACE("(%p)\n", This); + + if (This->joyfd==-1) { + WARN("no device\n"); + return; + } + while (1) { + memset(&tv,0,sizeof(tv)); + FD_ZERO(&readfds);FD_SET(This->joyfd,&readfds); + if (1>select(This->joyfd+1,&readfds,NULL,NULL,&tv)) + return; + /* we have one event, so we can read */ + if (sizeof(jse)!=read(This->joyfd,&jse,sizeof(jse))) { + return; + } + TRACE("js_event: type 0x%x, number %d, value %d\n", + jse.type,jse.number,jse.value); + if (jse.type & JS_EVENT_BUTTON) { + int offset = This->offsets[jse.number + 12]; + int value = jse.value?0x80:0x00; + + This->js.rgbButtons[jse.number] = value; + GEN_EVENT(offset,value,jse.time,(This->dinput->evsequence)++); + } else if (jse.type & JS_EVENT_AXIS) { + int number = This->axis_map[jse.number]; /* wine format object index */ + if (number < 12) { + int offset = This->offsets[number]; + int index = offset_to_object(This, offset); + LONG value = map_axis(This, jse.value, index); + + /* FIXME do deadzone and saturation here */ + + TRACE("changing axis %d => %d\n", jse.number, number); + switch (number) { + case 0: + This->js.lX = value; + break; + case 1: + This->js.lY = value; + break; + case 2: + This->js.lZ = value; + break; + case 3: + This->js.lRx = value; + break; + case 4: + This->js.lRy = value; + break; + case 5: + This->js.lRz = value; + break; + case 6: + This->js.rglSlider[0] = value; + break; + case 7: + This->js.rglSlider[1] = value; + break; + case 8: + /* FIXME don't go off array */ + if (This->axis_map[jse.number + 1] == number) + This->povs[0].lX = value; + else if (This->axis_map[jse.number - 1] == number) + This->povs[0].lY = value; + value = calculate_pov(This, 0); + break; + case 9: + if (This->axis_map[jse.number + 1] == number) + This->povs[1].lX = value; + else if (This->axis_map[jse.number - 1] == number) + This->povs[1].lY = value; + value = calculate_pov(This, 1); + break; + case 10: + if (This->axis_map[jse.number + 1] == number) + This->povs[2].lX = value; + else if (This->axis_map[jse.number - 1] == number) + This->povs[2].lY = value; + value = calculate_pov(This, 2); + break; + case 11: + if (This->axis_map[jse.number + 1] == number) + This->povs[3].lX = value; + else if (This->axis_map[jse.number - 1] == number) + This->povs[3].lY = value; + value = calculate_pov(This, 3); + break; + } + + GEN_EVENT(offset,value,jse.time,(This->dinput->evsequence)++); + } else + WARN("axis %d not supported\n", number); + } + } +} + +/****************************************************************************** + * GetDeviceState : returns the "state" of the joystick. + * + */ +static HRESULT WINAPI JoystickAImpl_GetDeviceState( + LPDIRECTINPUTDEVICE8A iface, + DWORD len, + LPVOID ptr) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(%p,0x%08lx,%p)\n",This,len,ptr); + + if (!This->acquired) { + WARN("not acquired\n"); + return DIERR_NOTACQUIRED; + } + + /* update joystick state */ + joy_polldev(This); + + /* convert and copy data to user supplied buffer */ + fill_DataFormat(ptr, &This->js, This->transform); + + return DI_OK; +} + +/****************************************************************************** + * GetDeviceData : gets buffered input data. + */ +static HRESULT WINAPI JoystickAImpl_GetDeviceData( + LPDIRECTINPUTDEVICE8A iface, + DWORD dodsize, + LPDIDEVICEOBJECTDATA dod, + LPDWORD entries, + DWORD flags) +{ + JoystickImpl *This = (JoystickImpl *)iface; + DWORD len; + int nqtail; + HRESULT hr = DI_OK; + + TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags); + + if (!This->acquired) { + WARN("not acquired\n"); + return DIERR_NOTACQUIRED; + } + + EnterCriticalSection(&(This->crit)); + + joy_polldev(This); + + len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0) + + (This->queue_head - This->queue_tail); + if (len > *entries) + len = *entries; + + if (dod == NULL) { + if (len) + TRACE("Application discarding %ld event(s).\n", len); + + *entries = len; + nqtail = This->queue_tail + len; + while (nqtail >= This->queue_len) + nqtail -= This->queue_len; + } else { + if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3)) { + ERR("Wrong structure size !\n"); + LeaveCriticalSection(&(This->crit)); + return DIERR_INVALIDPARAM; + } + + if (len) + TRACE("Application retrieving %ld event(s).\n", len); + + *entries = 0; + nqtail = This->queue_tail; + while (len) { + DWORD span = ((This->queue_head < nqtail) ? This->queue_len : This->queue_head) - nqtail; + if (span > len) + span = len; + + /* Copy the buffered data into the application queue */ + memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize); + /* Advance position */ + nqtail += span; + if (nqtail >= This->queue_len) + nqtail -= This->queue_len; + *entries += span; + len -= span; + } + } + + if (This->overflow) { + hr = DI_BUFFEROVERFLOW; + if (!(flags & DIGDD_PEEK)) { + This->overflow = FALSE; + } + } + + if (!(flags & DIGDD_PEEK)) + This->queue_tail = nqtail; + + LeaveCriticalSection(&(This->crit)); + + return hr; +} + +int find_property(JoystickImpl * This, LPCDIPROPHEADER ph) +{ + int i; + if (ph->dwHow == DIPH_BYOFFSET) { + return offset_to_object(This, ph->dwObj); + } else if (ph->dwHow == DIPH_BYID) { + for (i = 0; i < This->user_df->dwNumObjs; i++) { + if ((This->user_df->rgodf[i].dwType & 0x00ffffff) == (ph->dwObj & 0x00ffffff)) { + return i; + } + } + } + + return -1; +} + +/****************************************************************************** + * SetProperty : change input device properties + */ +static HRESULT WINAPI JoystickAImpl_SetProperty( + LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPCDIPROPHEADER ph) +{ + JoystickImpl *This = (JoystickImpl *)iface; + int i; + + TRACE("(%p,%s,%p)\n",This,debugstr_guid(rguid),ph); + + if (TRACE_ON(dinput)) + _dump_DIPROPHEADER(ph); + + if (!HIWORD(rguid)) { + switch ((DWORD)rguid) { + case (DWORD) DIPROP_BUFFERSIZE: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + TRACE("buffersize = %ld\n",pd->dwData); + if (This->data_queue) + This->data_queue = HeapReAlloc(GetProcessHeap(),0, This->data_queue, pd->dwData * sizeof(DIDEVICEOBJECTDATA)); + else + This->data_queue = HeapAlloc(GetProcessHeap(),0, pd->dwData * sizeof(DIDEVICEOBJECTDATA)); + This->queue_head = 0; + This->queue_tail = 0; + This->queue_len = pd->dwData; + break; + } + case (DWORD)DIPROP_RANGE: { + LPCDIPROPRANGE pr = (LPCDIPROPRANGE)ph; + if (ph->dwHow == DIPH_DEVICE) { + TRACE("proprange(%ld,%ld) all\n",pr->lMin,pr->lMax); + for (i = 0; i < This->user_df->dwNumObjs; i++) { + This->props[i].lMin = pr->lMin; + This->props[i].lMax = pr->lMax; + } + } else { + int obj = find_property(This, ph); + TRACE("proprange(%ld,%ld) obj=%d\n",pr->lMin,pr->lMax,obj); + if (obj >= 0) { + This->props[obj].lMin = pr->lMin; + This->props[obj].lMax = pr->lMax; + return DI_OK; + } + } + break; + } + case (DWORD)DIPROP_DEADZONE: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + if (ph->dwHow == DIPH_DEVICE) { + TRACE("deadzone(%ld) all\n",pd->dwData); + for (i = 0; i < This->user_df->dwNumObjs; i++) + This->props[i].lDeadZone = pd->dwData; + } else { + int obj = find_property(This, ph); + TRACE("deadzone(%ld) obj=%d\n",pd->dwData,obj); + if (obj >= 0) { + This->props[obj].lDeadZone = pd->dwData; + return DI_OK; + } + } + break; + } + case (DWORD)DIPROP_SATURATION: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + if (ph->dwHow == DIPH_DEVICE) { + TRACE("saturation(%ld) all\n",pd->dwData); + for (i = 0; i < This->user_df->dwNumObjs; i++) + This->props[i].lSaturation = pd->dwData; + } else { + int obj = find_property(This, ph); + TRACE("saturation(%ld) obj=%d\n",pd->dwData,obj); + if (obj >= 0) { + This->props[obj].lSaturation = pd->dwData; + return DI_OK; + } + } + break; + } + default: + FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid)); + break; + } + } + + return DI_OK; +} + +/****************************************************************************** + * SetEventNotification : specifies event to be sent on state change + */ +static HRESULT WINAPI JoystickAImpl_SetEventNotification( + LPDIRECTINPUTDEVICE8A iface, HANDLE hnd +) { + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd); + This->hEvent = hnd; + return DI_OK; +} + +static HRESULT WINAPI JoystickAImpl_GetCapabilities( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVCAPS lpDIDevCaps) +{ + JoystickImpl *This = (JoystickImpl *)iface; + int size; + + TRACE("%p->(%p)\n",iface,lpDIDevCaps); + + if (lpDIDevCaps == NULL) { + WARN("invalid parameter: lpDIDevCaps = NULL\n"); + return DIERR_INVALIDPARAM; + } + + size = lpDIDevCaps->dwSize; + CopyMemory(lpDIDevCaps, &This->devcaps, size); + lpDIDevCaps->dwSize = size; + + if (TRACE_ON(dinput)) + _dump_DIDEVCAPS(lpDIDevCaps); + + return DI_OK; +} + +static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(%p)\n",This); + + if (!This->acquired) { + WARN("not acquired\n"); + return DIERR_NOTACQUIRED; + } + + joy_polldev(This); + return DI_OK; +} + +/****************************************************************************** + * EnumObjects : enumerate the different buttons and axis... + */ +static HRESULT WINAPI JoystickAImpl_EnumObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + JoystickImpl *This = (JoystickImpl *)iface; + DIDEVICEOBJECTINSTANCEA ddoi; + BYTE i; + int user_offset; + int user_object; + + TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags); + if (TRACE_ON(dinput)) { + TRACE(" - flags = "); + _dump_EnumObjects_flags(dwFlags); + TRACE("\n"); + } + + /* Only the fields till dwFFMaxForce are relevant */ + ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); + + /* For the joystick, do as is done in the GetCapabilities function */ + if ((dwFlags == DIDFT_ALL) || + (dwFlags & DIDFT_AXIS) || + (dwFlags & DIDFT_POV)) { + int pov[4] = { 0, 0, 0, 0 }; + int axes = 0; + int povs = 0; + + for (i = 0; i < This->axes; i++) { + int wine_obj = This->axis_map[i]; + BOOL skip = FALSE; + + switch (wine_obj) { + case 0: + ddoi.guidType = GUID_XAxis; + break; + case 1: + ddoi.guidType = GUID_YAxis; + break; + case 2: + ddoi.guidType = GUID_ZAxis; + break; + case 3: + ddoi.guidType = GUID_RxAxis; + break; + case 4: + ddoi.guidType = GUID_RyAxis; + break; + case 5: + ddoi.guidType = GUID_RzAxis; + break; + case 6: + ddoi.guidType = GUID_Slider; + break; + case 7: + ddoi.guidType = GUID_Slider; + break; + case 8: + pov[0]++; + ddoi.guidType = GUID_POV; + break; + case 9: + pov[1]++; + ddoi.guidType = GUID_POV; + break; + case 10: + pov[2]++; + ddoi.guidType = GUID_POV; + break; + case 11: + pov[3]++; + ddoi.guidType = GUID_POV; + break; + default: + ddoi.guidType = GUID_Unknown; + } + if (wine_obj < 8) { + user_offset = This->offsets[wine_obj]; /* get user offset from wine index */ + user_object = offset_to_object(This, user_offset); + + ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff; + ddoi.dwOfs = This->user_df->rgodf[user_object].dwOfs; + sprintf(ddoi.tszName, "Axis %d", axes); + axes++; + } else { + if (pov[wine_obj - 8] < 2) { + user_offset = This->offsets[wine_obj]; /* get user offset from wine index */ + user_object = offset_to_object(This, user_offset); + + ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff; + ddoi.dwOfs = This->user_df->rgodf[user_object].dwOfs; + sprintf(ddoi.tszName, "POV %d", povs); + povs++; + } else + skip = TRUE; + } + if (!skip) { + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) + return DI_OK; + } + } + } + + if ((dwFlags == DIDFT_ALL) || + (dwFlags & DIDFT_BUTTON)) { + + /* The DInput SDK says that GUID_Button is only for mouse buttons but well... */ + ddoi.guidType = GUID_Button; + + for (i = 0; i < This->buttons; i++) { + user_offset = This->offsets[i + 12]; /* get user offset from wine index */ + user_object = offset_to_object(This, user_offset); + ddoi.guidType = GUID_Button; + ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff; + ddoi.dwOfs = This->user_df->rgodf[user_object].dwOfs; + sprintf(ddoi.tszName, "Button %d", i); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + } + } + + return DI_OK; +} + +/****************************************************************************** + * EnumObjects : enumerate the different buttons and axis... + */ +static HRESULT WINAPI JoystickWImpl_EnumObjects( + LPDIRECTINPUTDEVICE8W iface, + LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + device_enumobjects_AtoWcb_data data; + + data.lpCallBack = lpCallback; + data.lpvRef = lpvRef; + + return JoystickAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags); +} + +/****************************************************************************** + * GetProperty : get input device properties + */ +static HRESULT WINAPI JoystickAImpl_GetProperty( + LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPDIPROPHEADER pdiph) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(rguid), pdiph); + + if (TRACE_ON(dinput)) + _dump_DIPROPHEADER(pdiph); + + if (!HIWORD(rguid)) { + switch ((DWORD)rguid) { + case (DWORD) DIPROP_BUFFERSIZE: { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + TRACE(" return buffersize = %d\n",This->queue_len); + pd->dwData = This->queue_len; + break; + } + case (DWORD) DIPROP_RANGE: { + LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph; + int obj = find_property(This, pdiph); + /* The app is querying the current range of the axis + * return the lMin and lMax values */ + if (obj >= 0) { + pr->lMin = This->props[obj].lMin; + pr->lMax = This->props[obj].lMax; + TRACE("range(%ld, %ld) obj=%d\n", pr->lMin, pr->lMax, obj); + return DI_OK; + } + break; + } + case (DWORD) DIPROP_DEADZONE: { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + int obj = find_property(This, pdiph); + if (obj >= 0) { + pd->dwData = This->props[obj].lDeadZone; + TRACE("deadzone(%ld) obj=%d\n", pd->dwData, obj); + return DI_OK; + } + break; + } + case (DWORD) DIPROP_SATURATION: { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + int obj = find_property(This, pdiph); + if (obj >= 0) { + pd->dwData = This->props[obj].lSaturation; + TRACE("saturation(%ld) obj=%d\n", pd->dwData, obj); + return DI_OK; + } + break; + } + default: + FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid)); + break; + } + } + + return DI_OK; +} + +/****************************************************************************** + * GetObjectInfo : get object info + */ +HRESULT WINAPI JoystickAImpl_GetObjectInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEOBJECTINSTANCEA pdidoi, + DWORD dwObj, + DWORD dwHow) +{ + JoystickImpl *This = (JoystickImpl *)iface; + DIDEVICEOBJECTINSTANCEA didoiA; + unsigned int i; + + TRACE("(%p,%p,%ld,0x%08lx(%s))\n", + iface, pdidoi, dwObj, dwHow, + dwHow == DIPH_BYOFFSET ? "DIPH_BYOFFSET" : + dwHow == DIPH_BYID ? "DIPH_BYID" : + dwHow == DIPH_BYUSAGE ? "DIPH_BYUSAGE" : + "UNKNOWN"); + + if (pdidoi == NULL) { + WARN("invalid parameter: pdidoi = NULL\n"); + return DIERR_INVALIDPARAM; + } + + if ((pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA)) && + (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A))) { + WARN("invalid parameter: pdidoi->dwSize = %ld != %d or %d\n", + pdidoi->dwSize, sizeof(DIDEVICEOBJECTINSTANCEA), + sizeof(DIDEVICEOBJECTINSTANCE_DX3A)); + return DIERR_INVALIDPARAM; + } + + ZeroMemory(&didoiA, sizeof(didoiA)); + didoiA.dwSize = pdidoi->dwSize; + + switch (dwHow) { + case DIPH_BYOFFSET: { + int axis = 0; + int pov = 0; + int button = 0; + for (i = 0; i < This->user_df->dwNumObjs; i++) { + if (This->user_df->rgodf[i].dwOfs == dwObj) { + if (This->user_df->rgodf[i].pguid) + didoiA.guidType = *This->user_df->rgodf[i].pguid; + else + didoiA.guidType = GUID_NULL; + + didoiA.dwOfs = dwObj; + didoiA.dwType = This->user_df->rgodf[i].dwType; + didoiA.dwFlags = This->user_df->rgodf[i].dwFlags; + + if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_AXIS) + sprintf(didoiA.tszName, "Axis %d", axis); + else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_POV) + sprintf(didoiA.tszName, "POV %d", pov); + else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_BUTTON) + sprintf(didoiA.tszName, "Button %d", button); + + CopyMemory(pdidoi, &didoiA, pdidoi->dwSize); + return DI_OK; + } + + if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_AXIS) + axis++; + else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_POV) + pov++; + else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_BUTTON) + button++; + } + break; + } + case DIPH_BYID: + FIXME("dwHow = DIPH_BYID not implemented\n"); + break; + case DIPH_BYUSAGE: + FIXME("dwHow = DIPH_BYUSAGE not implemented\n"); + break; + default: + WARN("invalid parameter: dwHow = %08lx\n", dwHow); + return DIERR_INVALIDPARAM; + } + + CopyMemory(pdidoi, &didoiA, pdidoi->dwSize); + + return DI_OK; +} + +/****************************************************************************** + * GetDeviceInfo : get information about a device's identity + */ +HRESULT WINAPI JoystickAImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEINSTANCEA pdidi) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(%p,%p)\n", iface, pdidi); + + if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) && + (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA))) { + WARN("invalid parameter: pdidi->dwSize = %ld != %d or %d\n", + pdidi->dwSize, sizeof(DIDEVICEINSTANCE_DX3A), + sizeof(DIDEVICEINSTANCEA)); + return DIERR_INVALIDPARAM; + } + + /* Return joystick */ + pdidi->guidInstance = GUID_Joystick; + pdidi->guidProduct = DInput_Wine_Joystick_GUID; + /* we only support traditional joysticks for now */ + if (This->dinput->version >= 8) + pdidi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + pdidi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + strcpy(pdidi->tszInstanceName, "Joystick"); + strcpy(pdidi->tszProductName, This->name); + if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3A)) { + pdidi->guidFFDriver = GUID_NULL; + pdidi->wUsagePage = 0; + pdidi->wUsage = 0; + } + + return DI_OK; +} + +/****************************************************************************** + * GetDeviceInfo : get information about a device's identity + */ +HRESULT WINAPI JoystickWImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEINSTANCEW pdidi) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(%p,%p)\n", iface, pdidi); + + if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3W)) && + (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW))) { + WARN("invalid parameter: pdidi->dwSize = %ld != %d or %d\n", + pdidi->dwSize, sizeof(DIDEVICEINSTANCE_DX3W), + sizeof(DIDEVICEINSTANCEW)); + return DIERR_INVALIDPARAM; + } + + /* Return joystick */ + pdidi->guidInstance = GUID_Joystick; + pdidi->guidProduct = DInput_Wine_Joystick_GUID; + /* we only support traditional joysticks for now */ + if (This->dinput->version >= 8) + pdidi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + pdidi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, pdidi->tszInstanceName, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, This->name, -1, pdidi->tszProductName, MAX_PATH); + if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3W)) { + pdidi->guidFFDriver = GUID_NULL; + pdidi->wUsagePage = 0; + pdidi->wUsage = 0; + } + + return DI_OK; +} + +static IDirectInputDevice8AVtbl JoystickAvt = +{ + IDirectInputDevice2AImpl_QueryInterface, + IDirectInputDevice2AImpl_AddRef, + JoystickAImpl_Release, + JoystickAImpl_GetCapabilities, + JoystickAImpl_EnumObjects, + JoystickAImpl_GetProperty, + JoystickAImpl_SetProperty, + JoystickAImpl_Acquire, + JoystickAImpl_Unacquire, + JoystickAImpl_GetDeviceState, + JoystickAImpl_GetDeviceData, + JoystickAImpl_SetDataFormat, + JoystickAImpl_SetEventNotification, + IDirectInputDevice2AImpl_SetCooperativeLevel, + JoystickAImpl_GetObjectInfo, + JoystickAImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_RunControlPanel, + IDirectInputDevice2AImpl_Initialize, + IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2AImpl_EnumEffects, + IDirectInputDevice2AImpl_GetEffectInfo, + IDirectInputDevice2AImpl_GetForceFeedbackState, + IDirectInputDevice2AImpl_SendForceFeedbackCommand, + IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + IDirectInputDevice2AImpl_Escape, + JoystickAImpl_Poll, + IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7AImpl_EnumEffectsInFile, + IDirectInputDevice7AImpl_WriteEffectToFile, + IDirectInputDevice8AImpl_BuildActionMap, + IDirectInputDevice8AImpl_SetActionMap, + IDirectInputDevice8AImpl_GetImageInfo +}; + +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(SysJoystickWvt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static IDirectInputDevice8WVtbl SysJoystickWvt = +{ + IDirectInputDevice2WImpl_QueryInterface, + XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, + XCAST(Release)JoystickAImpl_Release, + XCAST(GetCapabilities)JoystickAImpl_GetCapabilities, + JoystickWImpl_EnumObjects, + XCAST(GetProperty)JoystickAImpl_GetProperty, + XCAST(SetProperty)JoystickAImpl_SetProperty, + XCAST(Acquire)JoystickAImpl_Acquire, + XCAST(Unacquire)JoystickAImpl_Unacquire, + XCAST(GetDeviceState)JoystickAImpl_GetDeviceState, + XCAST(GetDeviceData)JoystickAImpl_GetDeviceData, + XCAST(SetDataFormat)JoystickAImpl_SetDataFormat, + XCAST(SetEventNotification)JoystickAImpl_SetEventNotification, + XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel, + IDirectInputDevice2WImpl_GetObjectInfo, + JoystickWImpl_GetDeviceInfo, + XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, + XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, + XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2WImpl_EnumEffects, + IDirectInputDevice2WImpl_GetEffectInfo, + XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState, + XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand, + XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + XCAST(Escape)IDirectInputDevice2AImpl_Escape, + XCAST(Poll)JoystickAImpl_Poll, + XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7WImpl_EnumEffectsInFile, + IDirectInputDevice7WImpl_WriteEffectToFile, + IDirectInputDevice8WImpl_BuildActionMap, + IDirectInputDevice8WImpl_SetActionMap, + IDirectInputDevice8WImpl_GetImageInfo +}; +#undef XCAST + +#endif /* HAVE_LINUX_22_JOYSTICK_API */ diff --git a/reactos/lib/dinput/joystick_linuxinput.c b/reactos/lib/dinput/joystick_linuxinput.c new file mode 100644 index 00000000000..b58522630e2 --- /dev/null +++ b/reactos/lib/dinput/joystick_linuxinput.c @@ -0,0 +1,1090 @@ +/* DirectInput Joystick device + * + * Copyright 1998,2000 Marcus Meissner + * Copyright 1998,1999 Lionel Ulmer + * Copyright 2000-2001 TransGaming Technologies Inc. + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#ifdef HAVE_LINUX_INPUT_H + +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#include +#ifdef HAVE_SYS_ERRNO_H +# include +#endif + +#ifdef HAVE_CORRECT_LINUXINPUT_H + +#ifdef HAVE_LINUX_INPUT_H +# include +#endif + + +#define EVDEVPREFIX "/dev/input/event" + +#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "dinput.h" + +#include "dinput_private.h" +#include "device_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); + +/* Wine joystick driver object instances */ +#define WINE_JOYSTICK_AXIS_BASE 0 +#define WINE_JOYSTICK_BUTTON_BASE 8 + +typedef struct JoystickImpl JoystickImpl; +static IDirectInputDevice8AVtbl JoystickAvt; +static IDirectInputDevice8WVtbl JoystickWvt; +struct JoystickImpl +{ + LPVOID lpVtbl; + DWORD ref; + GUID guid; + + + /* The 'parent' DInput */ + IDirectInputImpl *dinput; + + /* joystick private */ + /* what range and deadzone the game wants */ + LONG wantmin[ABS_MAX]; + LONG wantmax[ABS_MAX]; + LONG deadz[ABS_MAX]; + + /* autodetecting ranges per axe by following movement */ + LONG havemax[ABS_MAX]; + LONG havemin[ABS_MAX]; + + int joyfd; + + LPDIDATAFORMAT df; + HANDLE hEvent; + LPDIDEVICEOBJECTDATA data_queue; + int queue_head, queue_tail, queue_len; + BOOL overflow; + DIJOYSTATE2 js; + + /* data returned by the EVIOCGABS() ioctl */ + int axes[ABS_MAX+1][5]; + +#define AXE_ABS 0 +#define AXE_ABSMIN 1 +#define AXE_ABSMAX 2 +#define AXE_ABSFUZZ 3 +#define AXE_ABSFLAT 4 + + + /* data returned by EVIOCGBIT for EV_ABS and EV_KEY */ + BYTE absbits[(ABS_MAX+7)/8]; + BYTE keybits[(KEY_MAX+7)/8]; +}; + +/* This GUID is slightly different from the linux joystick one. Take note. */ +static GUID DInput_Wine_Joystick_GUID = { /* 9e573eda-7734-11d2-8d4a-23903fb6bdf7 */ + 0x9e573eda, + 0x7734, + 0x11d2, + {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7} +}; + +static void fake_current_js_state(JoystickImpl *ji); + +#define test_bit(arr,bit) (((BYTE*)arr)[bit>>3]&(1<<(bit&7))) + +static int joydev_have(void) +{ + int i, fd; + int havejoy = 0; + + for (i=0;i<64;i++) { + char buf[200]; + BYTE absbits[(ABS_MAX+7)/8],keybits[(KEY_MAX+7)/8]; + + sprintf(buf,EVDEVPREFIX"%d",i); + if (-1!=(fd=open(buf,O_RDONLY))) { + if (-1==ioctl(fd,EVIOCGBIT(EV_ABS,sizeof(absbits)),absbits)) { + perror("EVIOCGBIT EV_ABS"); + close(fd); + continue; + } + if (-1==ioctl(fd,EVIOCGBIT(EV_KEY,sizeof(keybits)),keybits)) { + perror("EVIOCGBIT EV_KEY"); + close(fd); + continue; + } + /* A true joystick has at least axis X and Y, and at least 1 + * button. copied from linux/drivers/input/joydev.c */ + if (test_bit(absbits,ABS_X) && test_bit(absbits,ABS_Y) && + ( test_bit(keybits,BTN_TRIGGER) || + test_bit(keybits,BTN_A) || + test_bit(keybits,BTN_1) + ) + ) { + FIXME("found a joystick at %s!\n",buf); + havejoy = 1; + } + close(fd); + } + if (havejoy || (errno==ENODEV)) + break; + } + return havejoy; +} + +static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id) +{ + int havejoy = 0; + + if (id != 0) + return FALSE; + + if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK)) + return FALSE; + + if (dwFlags & DIEDFL_FORCEFEEDBACK) + return FALSE; + + havejoy = joydev_have(); + + if (!havejoy) + return FALSE; + + TRACE("Enumerating the linuxinput Joystick device\n"); + + /* Return joystick */ + lpddi->guidInstance = GUID_Joystick; + lpddi->guidProduct = DInput_Wine_Joystick_GUID; + + lpddi->guidFFDriver = GUID_NULL; + if (version >= 8) + lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + + strcpy(lpddi->tszInstanceName, "Joystick"); + /* ioctl JSIOCGNAME(len) */ + strcpy(lpddi->tszProductName, "Wine Joystick"); + return TRUE; +} + +static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id) +{ + int havejoy = 0; + + if (id != 0) + return FALSE; + + if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK)) + return FALSE; + + if (dwFlags & DIEDFL_FORCEFEEDBACK) + return FALSE; + + havejoy = joydev_have(); + + if (!havejoy) + return FALSE; + + TRACE("Enumerating the linuxinput Joystick device\n"); + + /* Return joystick */ + lpddi->guidInstance = GUID_Joystick; + lpddi->guidProduct = DInput_Wine_Joystick_GUID; + + lpddi->guidFFDriver = GUID_NULL; + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL<<8); + + MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, lpddi->tszInstanceName, MAX_PATH); + /* ioctl JSIOCGNAME(len) */ + MultiByteToWideChar(CP_ACP, 0, "Wine Joystick", -1, lpddi->tszProductName, MAX_PATH); + return TRUE; +} + +static JoystickImpl *alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputImpl *dinput) +{ + JoystickImpl* newDevice; + int i; + + newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickImpl)); + newDevice->lpVtbl = jvt; + newDevice->ref = 1; + newDevice->joyfd = -1; + newDevice->dinput = dinput; + memcpy(&(newDevice->guid),rguid,sizeof(*rguid)); + for (i=0;iwantmin[i] = -32768; + newDevice->wantmax[i] = 32767; + /* TODO: + * direct input defines a default for the deadzone somewhere; but as long + * as in map_axis the code for the dead zone is commented out its no + * problem + */ + newDevice->deadz[i] = 0; + } + fake_current_js_state(newDevice); + return newDevice; +} + +static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev) +{ + int havejoy = 0; + + havejoy = joydev_have(); + + if (!havejoy) + return DIERR_DEVICENOTREG; + + if ((IsEqualGUID(&GUID_Joystick,rguid)) || + (IsEqualGUID(&DInput_Wine_Joystick_GUID,rguid))) { + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceA,riid) || + IsEqualGUID(&IID_IDirectInputDevice2A,riid) || + IsEqualGUID(&IID_IDirectInputDevice7A,riid) || + IsEqualGUID(&IID_IDirectInputDevice8A,riid)) { + *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &JoystickAvt, dinput); + TRACE("Creating a Joystick device (%p)\n", *pdev); + return DI_OK; + } else + return DIERR_NOINTERFACE; + } + + return DIERR_DEVICENOTREG; +} + + +static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev) +{ + int havejoy = 0; + + havejoy = joydev_have(); + + if (!havejoy) + return DIERR_DEVICENOTREG; + + if ((IsEqualGUID(&GUID_Joystick,rguid)) || + (IsEqualGUID(&DInput_Wine_Joystick_GUID,rguid))) { + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceW,riid) || + IsEqualGUID(&IID_IDirectInputDevice2W,riid) || + IsEqualGUID(&IID_IDirectInputDevice7W,riid) || + IsEqualGUID(&IID_IDirectInputDevice8W,riid)) { + *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &JoystickWvt, dinput); + TRACE("Creating a Joystick device (%p)\n", *pdev); + return DI_OK; + } else + return DIERR_NOINTERFACE; + } + + return DIERR_DEVICENOTREG; +} + +static dinput_device joydev = { + 20, + "Wine Linux-input joystick driver", + joydev_enum_deviceA, + joydev_enum_deviceW, + joydev_create_deviceA, + joydev_create_deviceW +}; + +DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); } + +/****************************************************************************** + * Joystick + */ +static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface) +{ + JoystickImpl *This = (JoystickImpl *)iface; + ULONG ref; + + ref = InterlockedDecrement(&(This->ref)); + if (ref) + return ref; + + /* Free the data queue */ + if (This->data_queue != NULL) + HeapFree(GetProcessHeap(),0,This->data_queue); + + /* Free the DataFormat */ + HeapFree(GetProcessHeap(), 0, This->df); + + HeapFree(GetProcessHeap(),0,This); + return 0; +} + +/****************************************************************************** + * SetDataFormat : the application can choose the format of the data + * the device driver sends back with GetDeviceState. + */ +static HRESULT WINAPI JoystickAImpl_SetDataFormat( + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df +) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(this=%p,%p)\n",This,df); + + _dump_DIDATAFORMAT(df); + + /* Store the new data format */ + This->df = HeapAlloc(GetProcessHeap(),0,df->dwSize); + memcpy(This->df, df, df->dwSize); + This->df->rgodf = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*df->dwObjSize); + memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize); + + return 0; +} + +/****************************************************************************** + * Acquire : gets exclusive control of the joystick + */ +static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) +{ + int i; + JoystickImpl *This = (JoystickImpl *)iface; + char buf[200]; + + TRACE("(this=%p)\n",This); + if (This->joyfd!=-1) + return 0; + for (i=0;i<64;i++) { + sprintf(buf,EVDEVPREFIX"%d",i); + if (-1==(This->joyfd=open(buf,O_RDONLY))) { + if (errno==ENODEV) + return DIERR_NOTFOUND; + perror(buf); + continue; + } + if ((-1!=ioctl(This->joyfd,EVIOCGBIT(EV_ABS,sizeof(This->absbits)),This->absbits)) && + (-1!=ioctl(This->joyfd,EVIOCGBIT(EV_KEY,sizeof(This->keybits)),This->keybits)) && + (test_bit(This->absbits,ABS_X) && test_bit(This->absbits,ABS_Y) && + (test_bit(This->keybits,BTN_TRIGGER)|| + test_bit(This->keybits,BTN_A) || + test_bit(This->keybits,BTN_1) + ) + ) + ) + break; + close(This->joyfd); + This->joyfd = -1; + } + if (This->joyfd==-1) + return DIERR_NOTFOUND; + + for (i=0;iabsbits,i)) { + if (-1==ioctl(This->joyfd,EVIOCGABS(i),&(This->axes[i]))) + continue; + FIXME("axe %d: cur=%d, min=%d, max=%d, fuzz=%d, flat=%d\n", + i, + This->axes[i][AXE_ABS], + This->axes[i][AXE_ABSMIN], + This->axes[i][AXE_ABSMAX], + This->axes[i][AXE_ABSFUZZ], + This->axes[i][AXE_ABSFLAT] + ); + This->havemin[i] = This->axes[i][AXE_ABSMIN]; + This->havemax[i] = This->axes[i][AXE_ABSMAX]; + } + } + MESSAGE("\n"); + + fake_current_js_state(This); + + return 0; +} + +/****************************************************************************** + * Unacquire : frees the joystick + */ +static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(this=%p)\n",This); + if (This->joyfd!=-1) { + close(This->joyfd); + This->joyfd = -1; + return DI_OK; + } + else + return DI_NOEFFECT; +} + +/* + * This maps the read value (from the input event) to a value in the + * 'wanted' range. It also autodetects the possible range of the axe and + * adapts values accordingly. + */ +static int +map_axis(JoystickImpl* This, int axis, int val) { + int xmin = This->axes[axis][AXE_ABSMIN]; + int xmax = This->axes[axis][AXE_ABSMAX]; + int hmax = This->havemax[axis]; + int hmin = This->havemin[axis]; + int wmin = This->wantmin[axis]; + int wmax = This->wantmax[axis]; + int ret; + + if (val > hmax) This->havemax[axis] = hmax = val; + if (val < hmin) This->havemin[axis] = hmin = val; + + if (xmin == xmax) return val; + + /* map the value from the hmin-hmax range into the wmin-wmax range */ + ret = (val * (wmax-wmin)) / (hmax-hmin) + wmin; + +#if 0 + /* deadzone doesn't work comfortably enough right now. needs more testing*/ + if ((ret > -deadz/2 ) && (ret < deadz/2)) { + FIXME("%d in deadzone, return mid.\n",val); + return (wmax-wmin)/2+wmin; + } +#endif + return ret; +} + +/* + * set the current state of the js device as it would be with the middle + * values on the axes + */ +static void fake_current_js_state(JoystickImpl *ji) +{ + ji->js.lX = map_axis(ji, ABS_X, ji->axes[ABS_X ][AXE_ABS]); + ji->js.lY = map_axis(ji, ABS_Y, ji->axes[ABS_Y ][AXE_ABS]); + ji->js.lZ = map_axis(ji, ABS_Z, ji->axes[ABS_Z ][AXE_ABS]); + ji->js.lRx = map_axis(ji, ABS_RX, ji->axes[ABS_RX][AXE_ABS]); + ji->js.lRy = map_axis(ji, ABS_RY, ji->axes[ABS_RY][AXE_ABS]); + ji->js.lRz = map_axis(ji, ABS_RZ, ji->axes[ABS_RZ][AXE_ABS]); +} + +static void joy_polldev(JoystickImpl *This) { + struct timeval tv; + fd_set readfds; + struct input_event ie; + + if (This->joyfd==-1) + return; + + while (1) { + memset(&tv,0,sizeof(tv)); + FD_ZERO(&readfds); + FD_SET(This->joyfd,&readfds); + + if (1>select(This->joyfd+1,&readfds,NULL,NULL,&tv)) + return; + + /* we have one event, so we can read */ + if (sizeof(ie)!=read(This->joyfd,&ie,sizeof(ie))) + return; + + TRACE("input_event: type %d, code %d, value %d\n",ie.type,ie.code,ie.value); + switch (ie.type) { + case EV_KEY: /* button */ + switch (ie.code) { + case BTN_TRIGGER: /* normal flight stick */ + case BTN_A: /* gamepad */ + case BTN_1: /* generic */ + This->js.rgbButtons[0] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(0),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_THUMB: + case BTN_B: + case BTN_2: + This->js.rgbButtons[1] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(1),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_THUMB2: + case BTN_C: + case BTN_3: + This->js.rgbButtons[2] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(2),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_TOP: + case BTN_X: + case BTN_4: + This->js.rgbButtons[3] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(3),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_TOP2: + case BTN_Y: + case BTN_5: + This->js.rgbButtons[4] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(4),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_PINKIE: + case BTN_Z: + case BTN_6: + This->js.rgbButtons[5] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(5),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_BASE: + case BTN_TL: + case BTN_7: + This->js.rgbButtons[6] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(6),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_BASE2: + case BTN_TR: + case BTN_8: + This->js.rgbButtons[7] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(7),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_BASE3: + case BTN_TL2: + case BTN_9: + This->js.rgbButtons[8] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(8),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_BASE4: + case BTN_TR2: + This->js.rgbButtons[9] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(9),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case BTN_BASE5: + case BTN_SELECT: + This->js.rgbButtons[10] = ie.value?0x80:0x00; + GEN_EVENT(DIJOFS_BUTTON(10),ie.value?0x80:0x0,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + default: + FIXME("unhandled joystick button %x, value %d\n",ie.code,ie.value); + break; + } + break; + case EV_ABS: + switch (ie.code) { + case ABS_X: + This->js.lX = map_axis(This,ABS_X,ie.value); + GEN_EVENT(DIJOFS_X,This->js.lX,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case ABS_Y: + This->js.lY = map_axis(This,ABS_Y,ie.value); + GEN_EVENT(DIJOFS_Y,This->js.lY,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case ABS_Z: + This->js.lZ = map_axis(This,ABS_Z,ie.value); + GEN_EVENT(DIJOFS_Z,This->js.lZ,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case ABS_RX: + This->js.lRx = map_axis(This,ABS_RX,ie.value); + GEN_EVENT(DIJOFS_RX,This->js.lRx,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case ABS_RY: + This->js.lRy = map_axis(This,ABS_RY,ie.value); + GEN_EVENT(DIJOFS_RY,This->js.lRy,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + case ABS_RZ: + This->js.lRz = map_axis(This,ABS_RZ,ie.value); + GEN_EVENT(DIJOFS_RZ,This->js.lRz,ie.time.tv_usec,(This->dinput->evsequence)++); + break; + default: + FIXME("unhandled joystick axe event (code %d, value %d)\n",ie.code,ie.value); + break; + } + break; + default: + FIXME("joystick cannot handle type %d event (code %d)\n",ie.type,ie.code); + break; + } + } +} + +/****************************************************************************** + * GetDeviceState : returns the "state" of the joystick. + * + */ +static HRESULT WINAPI JoystickAImpl_GetDeviceState( + LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr +) { + JoystickImpl *This = (JoystickImpl *)iface; + + joy_polldev(This); + + TRACE("(this=%p,0x%08lx,%p)\n",This,len,ptr); + if ((len != sizeof(DIJOYSTATE)) && (len != sizeof(DIJOYSTATE2))) { + FIXME("len %ld is not sizeof(DIJOYSTATE) or DIJOYSTATE2, unsupported format.\n",len); + return E_FAIL; + } + memcpy(ptr,&(This->js),len); + This->queue_head = 0; + This->queue_tail = 0; + return 0; +} + +/****************************************************************************** + * GetDeviceData : gets buffered input data. + */ +static HRESULT WINAPI JoystickAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, + DWORD dodsize, + LPDIDEVICEOBJECTDATA dod, + LPDWORD entries, + DWORD flags +) { + JoystickImpl *This = (JoystickImpl *)iface; + + FIXME("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx),STUB!\n",This,dodsize,*entries,flags); + + joy_polldev(This); + if (flags & DIGDD_PEEK) + FIXME("DIGDD_PEEK\n"); + + if (dod == NULL) { + } else { + } + return 0; +} + +/****************************************************************************** + * SetProperty : change input device properties + */ +static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPCDIPROPHEADER ph) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + FIXME("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph); + FIXME("ph.dwSize = %ld, ph.dwHeaderSize =%ld, ph.dwObj = %ld, ph.dwHow= %ld\n",ph->dwSize, ph->dwHeaderSize,ph->dwObj,ph->dwHow); + + if (!HIWORD(rguid)) { + switch ((DWORD)rguid) { + case (DWORD) DIPROP_BUFFERSIZE: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + + FIXME("buffersize = %ld\n",pd->dwData); + break; + } + case (DWORD)DIPROP_RANGE: { + LPCDIPROPRANGE pr = (LPCDIPROPRANGE)ph; + + FIXME("proprange(%ld,%ld)\n",pr->lMin,pr->lMax); + switch (ph->dwObj) { + case 0: /* X */ + case 4: /* Y */ + case 8: /* Z */ + case 12: /* Rx */ + case 16: /* Ry */ + case 20: /* Rz */ + This->wantmin[ph->dwObj/4] = pr->lMin; + This->wantmax[ph->dwObj/4] = pr->lMax; + break; + default: + FIXME("setting proprange %ld - %ld for dwObj %ld\n",pr->lMin,pr->lMax,ph->dwObj); + } + break; + } + case (DWORD)DIPROP_DEADZONE: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + + FIXME("setting deadzone(%ld)\n",pd->dwData); + This->deadz[ph->dwObj/4] = pd->dwData; + break; + } + default: + FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid)); + break; + } + } + fake_current_js_state(This); + return 0; +} + +/****************************************************************************** + * SetEventNotification : specifies event to be sent on state change + */ +static HRESULT WINAPI JoystickAImpl_SetEventNotification( + LPDIRECTINPUTDEVICE8A iface, HANDLE hnd +) { + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd); + This->hEvent = hnd; + return DI_OK; +} + +static HRESULT WINAPI JoystickAImpl_GetCapabilities( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVCAPS lpDIDevCaps) +{ + JoystickImpl *This = (JoystickImpl *)iface; + int xfd = This->joyfd; + int i,axes,buttons; + int wasacquired = 1; + + TRACE("%p->(%p)\n",iface,lpDIDevCaps); + if (xfd==-1) { + /* yes, games assume we return something, even if unacquired */ + JoystickAImpl_Acquire(iface); + xfd = This->joyfd; + wasacquired = 0; + } + lpDIDevCaps->dwFlags = DIDC_ATTACHED; + lpDIDevCaps->dwDevType = DIDEVTYPE_JOYSTICK; + + axes=0; + for (i=0;iabsbits,i)) axes++; + buttons=0; + for (i=0;ikeybits,i)) buttons++; + + lpDIDevCaps->dwAxes = axes; + lpDIDevCaps->dwButtons = buttons; + + if (!wasacquired) + JoystickAImpl_Unacquire(iface); + + return DI_OK; +} + +static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface) { + JoystickImpl *This = (JoystickImpl *)iface; + TRACE("(),stub!\n"); + + joy_polldev(This); + return DI_OK; +} + +/****************************************************************************** + * EnumObjects : enumerate the different buttons and axis... + */ +static HRESULT WINAPI JoystickAImpl_EnumObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + JoystickImpl *This = (JoystickImpl *)iface; + DIDEVICEOBJECTINSTANCEA ddoi; + int xfd = This->joyfd; + + + TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags); + if (TRACE_ON(dinput)) { + TRACE(" - flags = "); + _dump_EnumObjects_flags(dwFlags); + TRACE("\n"); + } + + if (xfd == -1) return DIERR_NOTACQUIRED; + + /* Only the fields till dwFFMaxForce are relevant */ + ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); + + /* For the joystick, do as is done in the GetCapabilities function */ + /* FIXME: needs more items */ + if ((dwFlags == DIDFT_ALL) || + (dwFlags & DIDFT_AXIS)) { + BYTE i; + + for (i = 0; i < ABS_MAX; i++) { + if (!test_bit(This->absbits,i)) continue; + + switch (i) { + case ABS_X: + ddoi.guidType = GUID_XAxis; + ddoi.dwOfs = DIJOFS_X; + break; + case ABS_Y: + ddoi.guidType = GUID_YAxis; + ddoi.dwOfs = DIJOFS_Y; + break; + case ABS_Z: + ddoi.guidType = GUID_ZAxis; + ddoi.dwOfs = DIJOFS_Z; + break; + case ABS_RX: + ddoi.guidType = GUID_RxAxis; + ddoi.dwOfs = DIJOFS_RX; + break; + case ABS_RY: + ddoi.guidType = GUID_RyAxis; + ddoi.dwOfs = DIJOFS_RY; + break; + case ABS_RZ: + ddoi.guidType = GUID_RzAxis; + ddoi.dwOfs = DIJOFS_RZ; + break; + case ABS_THROTTLE: + ddoi.guidType = GUID_Slider; + ddoi.dwOfs = DIJOFS_SLIDER(0); + break; + default: + FIXME("unhandled abs axis %d, ignoring!\n",i); + } + ddoi.dwType = DIDFT_MAKEINSTANCE((1<keybits,i)) continue; + + switch (i) { + case BTN_TRIGGER: + case BTN_A: + case BTN_1: + ddoi.dwOfs = DIJOFS_BUTTON(0); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 0) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_THUMB: + case BTN_B: + case BTN_2: + ddoi.dwOfs = DIJOFS_BUTTON(1); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 1) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_THUMB2: + case BTN_C: + case BTN_3: + ddoi.dwOfs = DIJOFS_BUTTON(2); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 2) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_TOP: + case BTN_X: + case BTN_4: + ddoi.dwOfs = DIJOFS_BUTTON(3); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 3) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_TOP2: + case BTN_Y: + case BTN_5: + ddoi.dwOfs = DIJOFS_BUTTON(4); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 4) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_PINKIE: + case BTN_Z: + case BTN_6: + ddoi.dwOfs = DIJOFS_BUTTON(5); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 5) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_BASE: + case BTN_TL: + case BTN_7: + ddoi.dwOfs = DIJOFS_BUTTON(6); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 6) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_BASE2: + case BTN_TR: + case BTN_8: + ddoi.dwOfs = DIJOFS_BUTTON(7); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 7) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_BASE3: + case BTN_TL2: + case BTN_9: + ddoi.dwOfs = DIJOFS_BUTTON(8); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 8) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_BASE4: + case BTN_TR2: + ddoi.dwOfs = DIJOFS_BUTTON(9); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 9) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + case BTN_BASE5: + case BTN_SELECT: + ddoi.dwOfs = DIJOFS_BUTTON(10); + ddoi.dwType = DIDFT_MAKEINSTANCE((0x0001 << 10) << WINE_JOYSTICK_BUTTON_BASE) | DIDFT_PSHBUTTON; + break; + } + sprintf(ddoi.tszName, "%d-Button", i); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) + return DI_OK; + } + } + + if (xfd!=This->joyfd) + close(xfd); + + return DI_OK; +} + +static HRESULT WINAPI JoystickWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, + LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + device_enumobjects_AtoWcb_data data; + + data.lpCallBack = lpCallback; + data.lpvRef = lpvRef; + + return JoystickAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags); +} + +/****************************************************************************** + * GetProperty : get input device properties + */ +static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPDIPROPHEADER pdiph) +{ + JoystickImpl *This = (JoystickImpl *)iface; + + TRACE("(this=%p,%s,%p): stub!\n", + iface, debugstr_guid(rguid), pdiph); + + if (TRACE_ON(dinput)) + _dump_DIPROPHEADER(pdiph); + + if (!HIWORD(rguid)) { + switch ((DWORD)rguid) { + case (DWORD) DIPROP_BUFFERSIZE: { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + + TRACE(" return buffersize = %d\n",This->queue_len); + pd->dwData = This->queue_len; + break; + } + + case (DWORD) DIPROP_RANGE: { + /* LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph; */ + if ((pdiph->dwHow == DIPH_BYID) && + (pdiph->dwObj & DIDFT_ABSAXIS)) { + /* The app is querying the current range of the axis : return the lMin and lMax values */ + FIXME("unimplemented axis range query.\n"); + } + + break; + } + + default: + FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid)); + break; + } + } + + + return DI_OK; +} + +static IDirectInputDevice8AVtbl JoystickAvt = +{ + IDirectInputDevice2AImpl_QueryInterface, + IDirectInputDevice2AImpl_AddRef, + JoystickAImpl_Release, + JoystickAImpl_GetCapabilities, + JoystickAImpl_EnumObjects, + JoystickAImpl_GetProperty, + JoystickAImpl_SetProperty, + JoystickAImpl_Acquire, + JoystickAImpl_Unacquire, + JoystickAImpl_GetDeviceState, + JoystickAImpl_GetDeviceData, + JoystickAImpl_SetDataFormat, + JoystickAImpl_SetEventNotification, + IDirectInputDevice2AImpl_SetCooperativeLevel, + IDirectInputDevice2AImpl_GetObjectInfo, + IDirectInputDevice2AImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_RunControlPanel, + IDirectInputDevice2AImpl_Initialize, + IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2AImpl_EnumEffects, + IDirectInputDevice2AImpl_GetEffectInfo, + IDirectInputDevice2AImpl_GetForceFeedbackState, + IDirectInputDevice2AImpl_SendForceFeedbackCommand, + IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + IDirectInputDevice2AImpl_Escape, + JoystickAImpl_Poll, + IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7AImpl_EnumEffectsInFile, + IDirectInputDevice7AImpl_WriteEffectToFile, + IDirectInputDevice8AImpl_BuildActionMap, + IDirectInputDevice8AImpl_SetActionMap, + IDirectInputDevice8AImpl_GetImageInfo +}; + +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(JoystickWvt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static IDirectInputDevice8WVtbl JoystickWvt = +{ + IDirectInputDevice2WImpl_QueryInterface, + XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, + XCAST(Release)JoystickAImpl_Release, + XCAST(GetCapabilities)JoystickAImpl_GetCapabilities, + JoystickWImpl_EnumObjects, + XCAST(GetProperty)JoystickAImpl_GetProperty, + XCAST(SetProperty)JoystickAImpl_SetProperty, + XCAST(Acquire)JoystickAImpl_Acquire, + XCAST(Unacquire)JoystickAImpl_Unacquire, + XCAST(GetDeviceState)JoystickAImpl_GetDeviceState, + XCAST(GetDeviceData)JoystickAImpl_GetDeviceData, + XCAST(SetDataFormat)JoystickAImpl_SetDataFormat, + XCAST(SetEventNotification)JoystickAImpl_SetEventNotification, + XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel, + IDirectInputDevice2WImpl_GetObjectInfo, + IDirectInputDevice2WImpl_GetDeviceInfo, + XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, + XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, + XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2WImpl_EnumEffects, + IDirectInputDevice2WImpl_GetEffectInfo, + XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState, + XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand, + XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + XCAST(Escape)IDirectInputDevice2AImpl_Escape, + XCAST(Poll)JoystickAImpl_Poll, + XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7WImpl_EnumEffectsInFile, + IDirectInputDevice7WImpl_WriteEffectToFile, + IDirectInputDevice8WImpl_BuildActionMap, + IDirectInputDevice8WImpl_SetActionMap, + IDirectInputDevice8WImpl_GetImageInfo +}; +#undef XCAST + +#endif /* HAVE_LINUX_INPUT_H */ + +#endif diff --git a/reactos/lib/dinput/keyboard.c b/reactos/lib/dinput/keyboard.c new file mode 100644 index 00000000000..b16b7191ad5 --- /dev/null +++ b/reactos/lib/dinput/keyboard.c @@ -0,0 +1,868 @@ +/* DirectInput Keyboard device + * + * Copyright 1998 Marcus Meissner + * Copyright 1998,1999 Lionel Ulmer + * Copyright 2000-2001 TransGaming Technologies Inc. + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#include +#include +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winerror.h" +#include "dinput.h" + +#include "dinput_private.h" +#include "device_private.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); + +//fast fix misning from mingw headers +#ifdef __REACTOS__ +#define LLKHF_EXTENDED (KF_EXTENDED >> 8) +#define LLKHF_INJECTED 0x00000010 +//#define LLKHF_ALTDOWN (KF_ALTDOWN >> 8) +#define LLKHF_UP (KF_UP >> 8) +#endif + +static IDirectInputDevice8AVtbl SysKeyboardAvt; +static IDirectInputDevice8WVtbl SysKeyboardWvt; + +typedef struct SysKeyboardImpl SysKeyboardImpl; +struct SysKeyboardImpl +{ + LPVOID lpVtbl; + DWORD ref; + GUID guid; + + IDirectInputImpl* dinput; + + HANDLE hEvent; + /* SysKeyboardAImpl */ + int acquired; + int buffersize; /* set in 'SetProperty' */ + LPDIDEVICEOBJECTDATA buffer; /* buffer for 'GetDeviceData'. + Alloc at 'Acquire', Free at + 'Unacquire' */ + int count; /* number of objects in use in + 'buffer' */ + int start; /* 'buffer' rotates. This is the + first in use (if count > 0) */ + BOOL overflow; /* return DI_BUFFEROVERFLOW in + 'GetDeviceData' */ + CRITICAL_SECTION crit; +}; + +SysKeyboardImpl *current; /* Today's acquired device +FIXME: currently this can be only one. +Maybe this should be a linked list or st. +I don't know what the rules are for multiple acquired keyboards, +but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason. +*/ + +static BYTE DInputKeyState[256]; /* array for 'GetDeviceState' */ + +static CRITICAL_SECTION keyboard_crit; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &keyboard_crit, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { 0, (DWORD)(__FILE__ ": keyboard_crit") } +}; +static CRITICAL_SECTION keyboard_crit = { &critsect_debug, -1, 0, 0, 0, 0 }; + +static DWORD keyboard_users; + +#ifndef __REACTOS__ +static HHOOK keyboard_hook; +#endif + +#ifdef __REACTOS__ +void reactos_input_keyboard(); + +void reactos_input_keyboard() +{ + MSG msg; + BOOL fDone; + int disk_code = -1; + BOOL down; + BYTE oldDInputKeyState[256]; + int t; + + memcpy(&oldDInputKeyState,&DInputKeyState,256); + GetKeyboardState(DInputKeyState); + + for( t=0;t<255;t++) + { + if (oldDInputKeyState[t]!=DInputKeyState[t]) disk_code=t; + } + + + if (disk_code!=-1) { + if (current->buffer != NULL) + { + int n; + n = (current->start + current->count) % current->buffersize; + + current->buffer[n].dwOfs = (BYTE) disk_code; + current->buffer[n].dwData = DInputKeyState[disk_code]; + current->buffer[n].dwTimeStamp = 10; + current->buffer[n].dwSequence = current->dinput->evsequence++; + + + if (current->count == current->buffersize) + { + current->start = ++current->start % current->buffersize; + current->overflow = TRUE; + } + else + current->count++; + + } + } + + +} +#endif +#ifndef __REACTOS__ +LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam ) +{ + TRACE("(%d,%d,%ld)\n", code, wparam, lparam); + + if (code == HC_ACTION) + { + BYTE dik_code; + BOOL down; + DWORD timestamp; + + { + KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam; + dik_code = hook->scanCode; + if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80; + down = !(hook->flags & LLKHF_UP); + timestamp = hook->time; + } + + DInputKeyState[dik_code] = (down ? 0x80 : 0); + TRACE(" setting %02X to %02X\n", dik_code, DInputKeyState[dik_code]); + + if (current != NULL) + { + if (current->hEvent) + SetEvent(current->hEvent); + + if (current->buffer != NULL) + { + int n; + + EnterCriticalSection(&(current->crit)); + + n = (current->start + current->count) % current->buffersize; + + current->buffer[n].dwOfs = dik_code; + current->buffer[n].dwData = down ? 0x80 : 0; + current->buffer[n].dwTimeStamp = timestamp; + current->buffer[n].dwSequence = current->dinput->evsequence++; + + TRACE("Adding event at offset %d : %ld - %ld - %ld - %ld\n", n, + current->buffer[n].dwOfs, current->buffer[n].dwData, current->buffer[n].dwTimeStamp, current->buffer[n].dwSequence); + + if (current->count == current->buffersize) + { + current->start = ++current->start % current->buffersize; + current->overflow = TRUE; + } + else + current->count++; + + LeaveCriticalSection(&(current->crit)); + } + } + } + + return CallNextHookEx(keyboard_hook, code, wparam, lparam); +} +#endif + +static GUID DInput_Wine_Keyboard_GUID = { /* 0ab8648a-7735-11d2-8c73-71df54a96441 */ + 0x0ab8648a, + 0x7735, + 0x11d2, + {0x8c, 0x73, 0x71, 0xdf, 0x54, 0xa9, 0x64, 0x41} +}; + +static void fill_keyboard_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, int version) { + DWORD dwSize; + DIDEVICEINSTANCEA ddi; + + dwSize = lpddi->dwSize; + + TRACE("%ld %p\n", dwSize, lpddi); + + memset(lpddi, 0, dwSize); + memset(&ddi, 0, sizeof(ddi)); + + ddi.dwSize = dwSize; + ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */ + ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */ + if (version >= 8) + ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8); + else + ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); + strcpy(ddi.tszInstanceName, "Keyboard"); + strcpy(ddi.tszProductName, "Wine Keyboard"); + + memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi))); +} + +static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, int version) { + DWORD dwSize; + DIDEVICEINSTANCEW ddi; + + dwSize = lpddi->dwSize; + + TRACE("%ld %p\n", dwSize, lpddi); + + memset(lpddi, 0, dwSize); + memset(&ddi, 0, sizeof(ddi)); + + ddi.dwSize = dwSize; + ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */ + ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */ + if (version >= 8) + ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8); + else + ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); + MultiByteToWideChar(CP_ACP, 0, "Keyboard", -1, ddi.tszInstanceName, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, "Wine Keyboard", -1, ddi.tszProductName, MAX_PATH); + + memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi))); +} + +static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id) +{ + if (id != 0) + return FALSE; + + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) || + ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) { + TRACE("Enumerating the Keyboard device\n"); + + fill_keyboard_dideviceinstanceA(lpddi, version); + + return TRUE; + } + + return FALSE; +} + +static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id) +{ + if (id != 0) + return FALSE; + + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) || + ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) { + TRACE("Enumerating the Keyboard device\n"); + + fill_keyboard_dideviceinstanceW(lpddi, version); + + return TRUE; + } + + return FALSE; +} + +static SysKeyboardImpl *alloc_device_keyboard(REFGUID rguid, LPVOID kvt, IDirectInputImpl *dinput) +{ + SysKeyboardImpl* newDevice; + newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl)); + newDevice->lpVtbl = kvt; + newDevice->ref = 1; + memcpy(&(newDevice->guid),rguid,sizeof(*rguid)); + newDevice->dinput = dinput; + +#ifndef __REACTOS__ + EnterCriticalSection(&keyboard_crit); + + if (!keyboard_users++) + keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 ); + + LeaveCriticalSection(&keyboard_crit); +#endif + return newDevice; +} + + +static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev) +{ + if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */ + (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */ + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceA,riid) || + IsEqualGUID(&IID_IDirectInputDevice2A,riid) || + IsEqualGUID(&IID_IDirectInputDevice7A,riid) || + IsEqualGUID(&IID_IDirectInputDevice8A,riid)) { + *pdev = (IDirectInputDeviceA*) alloc_device_keyboard(rguid, &SysKeyboardAvt, dinput); + TRACE("Creating a Keyboard device (%p)\n", *pdev); + return DI_OK; + } else + return DIERR_NOINTERFACE; + } + return DIERR_DEVICENOTREG; +} + +static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev) +{ + if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */ + (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */ + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceW,riid) || + IsEqualGUID(&IID_IDirectInputDevice2W,riid) || + IsEqualGUID(&IID_IDirectInputDevice7W,riid) || + IsEqualGUID(&IID_IDirectInputDevice8W,riid)) { + *pdev = (IDirectInputDeviceW*) alloc_device_keyboard(rguid, &SysKeyboardWvt, dinput); + TRACE("Creating a Keyboard device (%p)\n", *pdev); + return DI_OK; + } else + return DIERR_NOINTERFACE; + } + return DIERR_DEVICENOTREG; +} + +dinput_device keyboarddev = { + 100, + "Wine keyboard driver", + keyboarddev_enum_deviceA, + keyboarddev_enum_deviceW, + keyboarddev_create_deviceA, + keyboarddev_create_deviceW +}; + +void scan_keyboard() +{ + dinput_register_device(&keyboarddev); +} + +DECL_GLOBAL_CONSTRUCTOR(keyboarddev_register) { dinput_register_device(&keyboarddev); } + +static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + ULONG ref; + + ref = InterlockedDecrement(&(This->ref)); + if (ref) + return ref; + +#ifndef __REACTOS__ + EnterCriticalSection(&keyboard_crit); + if (!--keyboard_users) { + UnhookWindowsHookEx( keyboard_hook ); + keyboard_hook = 0; + } + LeaveCriticalSection(&keyboard_crit); +#endif + + /* Free the data queue */ + if (This->buffer != NULL) + HeapFree(GetProcessHeap(),0,This->buffer); + + DeleteCriticalSection(&(This->crit)); + + HeapFree(GetProcessHeap(),0,This); + return DI_OK; +} + +static HRESULT WINAPI SysKeyboardAImpl_SetProperty( + LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPCDIPROPHEADER ph +) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph); + TRACE("(size=%ld,headersize=%ld,obj=%ld,how=%ld\n", + ph->dwSize,ph->dwHeaderSize,ph->dwObj,ph->dwHow); + if (!HIWORD(rguid)) { + switch ((DWORD)rguid) { + case (DWORD) DIPROP_BUFFERSIZE: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + + TRACE("(buffersize=%ld)\n",pd->dwData); + + if (This->acquired) + return DIERR_INVALIDPARAM; + + This->buffersize = pd->dwData; + + break; + } + default: + WARN("Unknown type %ld\n",(DWORD)rguid); + break; + } + } + return DI_OK; +} + + +static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState( + LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr +) +{ + TRACE("(%p)->(%ld,%p)\n", iface, len, ptr); + +#ifdef __REACTOS__ + reactos_input_keyboard(); +#endif + + /* Note: device does not need to be acquired */ + if (len != 256) + return DIERR_INVALIDPARAM; + + MsgWaitForMultipleObjectsEx(0, NULL, 0, 0, 0); + + if (TRACE_ON(dinput)) { + int i; + for (i = 0; i < 256; i++) { + if (DInputKeyState[i] != 0x00) { + TRACE(" - %02X: %02x\n", i, DInputKeyState[i]); + } + } + } + + memcpy(ptr, DInputKeyState, 256); + return DI_OK; +} + +static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData( + LPDIRECTINPUTDEVICE8A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod, + LPDWORD entries,DWORD flags +) +{ + + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + int ret = DI_OK, i = 0; +#ifdef __REACTOS__ + reactos_input_keyboard(); +#endif + + TRACE("(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n", + This,dodsize,dod,entries,entries?*entries:0,flags); + + if (This->acquired == 0) + return DIERR_NOTACQUIRED; + + if (This->buffer == NULL) + return DIERR_NOTBUFFERED; + + if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3)) + return DIERR_INVALIDPARAM; + + MsgWaitForMultipleObjectsEx(0, NULL, 0, 0, 0); + + EnterCriticalSection(&(This->crit)); + + /* Copy item at a time for the case dodsize > sizeof(buffer[n]) */ + while ((i < *entries || *entries == INFINITE) && i < This->count) + { + if (dod != NULL) + { + int n = (This->start + i) % This->buffersize; + LPDIDEVICEOBJECTDATA pd + = (LPDIDEVICEOBJECTDATA)((BYTE *)dod + dodsize * i); + pd->dwOfs = This->buffer[n].dwOfs; + pd->dwData = This->buffer[n].dwData; + pd->dwTimeStamp = This->buffer[n].dwTimeStamp; + pd->dwSequence = This->buffer[n].dwSequence; + } + i++; + } + + *entries = i; + + if (This->overflow) + ret = DI_BUFFEROVERFLOW; + + if (!(flags & DIGDD_PEEK)) + { + /* Empty buffer */ + This->count -= i; + This->start = (This->start + i) % This->buffersize; + This->overflow = FALSE; + } + + LeaveCriticalSection(&(This->crit)); + + TRACE("Returning %ld events queued\n", *entries); + + return ret; +} + +static HRESULT WINAPI SysKeyboardAImpl_EnumObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + DIDEVICEOBJECTINSTANCEA ddoi; + int i; + + TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags); + if (TRACE_ON(dinput)) { + TRACE(" - flags = "); + _dump_EnumObjects_flags(dwFlags); + TRACE("\n"); + } + + /* Only the fields till dwFFMaxForce are relevant */ + memset(&ddoi, 0, sizeof(ddoi)); + ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); + + for (i = 0; i < 256; i++) { + /* Report 255 keys :-) */ + ddoi.guidType = GUID_Key; + ddoi.dwOfs = i; + ddoi.dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_BUTTON; + GetKeyNameTextA(((i & 0x7f) << 16) | ((i & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName)); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + } + + return DI_OK; +} + +static HRESULT WINAPI SysKeyboardWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, + LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + + device_enumobjects_AtoWcb_data data; + + data.lpCallBack = lpCallback; + data.lpvRef = lpvRef; + + return SysKeyboardAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags); +} + +static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface); + +static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + + TRACE("(this=%p)\n",This); + + if (This->acquired) + return S_FALSE; + + This->acquired = 1; + + if (current != NULL) + { + FIXME("Not more than one keyboard can be acquired at the same time.\n"); + SysKeyboardAImpl_Unacquire(iface); + } + + current = This; + + if (This->buffersize > 0) + { + This->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + This->buffersize * sizeof(*(This->buffer))); + This->start = 0; + This->count = 0; + This->overflow = FALSE; + InitializeCriticalSection(&(This->crit)); + } + else + This->buffer = NULL; + + + return DI_OK; +} + +static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + TRACE("(this=%p)\n",This); + + if (This->acquired == 0) + return DI_NOEFFECT; + + if (current == This) + current = NULL; + else + ERR("this != current\n"); + + This->acquired = 0; + + if (This->buffersize >= 0) + { + HeapFree(GetProcessHeap(), 0, This->buffer); + This->buffer = NULL; + DeleteCriticalSection(&(This->crit)); + } + + return DI_OK; +} + +static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, + HANDLE hnd) { + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + + TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd); + + This->hEvent = hnd; + return DI_OK; +} + +/****************************************************************************** + * GetCapabilities : get the device capablitites + */ +static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVCAPS lpDIDevCaps) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + + TRACE("(this=%p,%p)\n",This,lpDIDevCaps); + + if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) { + lpDIDevCaps->dwFlags = DIDC_ATTACHED; + if (This->dinput->version >= 8) + lpDIDevCaps->dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8); + else + lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); + lpDIDevCaps->dwAxes = 0; + lpDIDevCaps->dwButtons = 256; + lpDIDevCaps->dwPOVs = 0; + lpDIDevCaps->dwFFSamplePeriod = 0; + lpDIDevCaps->dwFFMinTimeResolution = 0; + lpDIDevCaps->dwFirmwareRevision = 100; + lpDIDevCaps->dwHardwareRevision = 100; + lpDIDevCaps->dwFFDriverVersion = 0; + } else if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS_DX3)) { + lpDIDevCaps->dwFlags = DIDC_ATTACHED; + lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); + lpDIDevCaps->dwAxes = 0; + lpDIDevCaps->dwButtons = 256; + lpDIDevCaps->dwPOVs = 0; + } else { + WARN("invalid parameter\n"); + return DIERR_INVALIDPARAM; + } + + return DI_OK; +} + +/****************************************************************************** + * GetObjectInfo : get information about a device object such as a button + * or axis + */ +static HRESULT WINAPI +SysKeyboardAImpl_GetObjectInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEOBJECTINSTANCEA pdidoi, + DWORD dwObj, + DWORD dwHow) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + DIDEVICEOBJECTINSTANCEA ddoi; + DWORD dwSize = pdidoi->dwSize; + + TRACE("(this=%p,%p,%ld,0x%08lx)\n", This, pdidoi, dwObj, dwHow); + + if (dwHow == DIPH_BYID) { + WARN(" querying by id not supported yet...\n"); + return DI_OK; + } + + memset(pdidoi, 0, dwSize); + memset(&ddoi, 0, sizeof(ddoi)); + + ddoi.dwSize = dwSize; + ddoi.guidType = GUID_Key; + ddoi.dwOfs = dwObj; + ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON; + GetKeyNameTextA(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName)); + + /* And return our just filled device object instance structure */ + memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi))); + + _dump_OBJECTINSTANCEA(pdidoi); + + return DI_OK; +} + +static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, + LPDIDEVICEOBJECTINSTANCEW pdidoi, + DWORD dwObj, + DWORD dwHow) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + DIDEVICEOBJECTINSTANCEW ddoi; + DWORD dwSize = pdidoi->dwSize; + + TRACE("(this=%p,%p,%ld,0x%08lx)\n", This, pdidoi, dwObj, dwHow); + + if (dwHow == DIPH_BYID) { + WARN(" querying by id not supported yet...\n"); + return DI_OK; + } + + memset(pdidoi, 0, dwSize); + memset(&ddoi, 0, sizeof(ddoi)); + + ddoi.dwSize = dwSize; + ddoi.guidType = GUID_Key; + ddoi.dwOfs = dwObj; + ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON; + GetKeyNameTextW(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName)); + + /* And return our just filled device object instance structure */ + memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi))); + + _dump_OBJECTINSTANCEW(pdidoi); + + return DI_OK; +} + +/****************************************************************************** + * GetDeviceInfo : get information about a device's identity + */ +static HRESULT WINAPI SysKeyboardAImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEINSTANCEA pdidi) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + TRACE("(this=%p,%p)\n", This, pdidi); + + if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) { + WARN(" dinput3 not supporte yet...\n"); + return DI_OK; + } + + fill_keyboard_dideviceinstanceA(pdidi, This->dinput->version); + + return DI_OK; +} + +static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) +{ + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + TRACE("(this=%p,%p)\n", This, pdidi); + + if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) { + WARN(" dinput3 not supporte yet...\n"); + return DI_OK; + } + + fill_keyboard_dideviceinstanceW(pdidi, This->dinput->version); + + return DI_OK; +} + +static IDirectInputDevice8AVtbl SysKeyboardAvt = +{ + IDirectInputDevice2AImpl_QueryInterface, + IDirectInputDevice2AImpl_AddRef, + SysKeyboardAImpl_Release, + SysKeyboardAImpl_GetCapabilities, + SysKeyboardAImpl_EnumObjects, + IDirectInputDevice2AImpl_GetProperty, + SysKeyboardAImpl_SetProperty, + SysKeyboardAImpl_Acquire, + SysKeyboardAImpl_Unacquire, + SysKeyboardAImpl_GetDeviceState, + SysKeyboardAImpl_GetDeviceData, + IDirectInputDevice2AImpl_SetDataFormat, + SysKeyboardAImpl_SetEventNotification, + IDirectInputDevice2AImpl_SetCooperativeLevel, + SysKeyboardAImpl_GetObjectInfo, + SysKeyboardAImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_RunControlPanel, + IDirectInputDevice2AImpl_Initialize, + IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2AImpl_EnumEffects, + IDirectInputDevice2AImpl_GetEffectInfo, + IDirectInputDevice2AImpl_GetForceFeedbackState, + IDirectInputDevice2AImpl_SendForceFeedbackCommand, + IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + IDirectInputDevice2AImpl_Escape, + IDirectInputDevice2AImpl_Poll, + IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7AImpl_EnumEffectsInFile, + IDirectInputDevice7AImpl_WriteEffectToFile, + IDirectInputDevice8AImpl_BuildActionMap, + IDirectInputDevice8AImpl_SetActionMap, + IDirectInputDevice8AImpl_GetImageInfo +}; + +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(SysKeyboardWvt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static IDirectInputDevice8WVtbl SysKeyboardWvt = +{ + IDirectInputDevice2WImpl_QueryInterface, + XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, + XCAST(Release)SysKeyboardAImpl_Release, + XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities, + SysKeyboardWImpl_EnumObjects, + XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty, + XCAST(SetProperty)SysKeyboardAImpl_SetProperty, + XCAST(Acquire)SysKeyboardAImpl_Acquire, + XCAST(Unacquire)SysKeyboardAImpl_Unacquire, + XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState, + XCAST(GetDeviceData)SysKeyboardAImpl_GetDeviceData, + XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat, + XCAST(SetEventNotification)SysKeyboardAImpl_SetEventNotification, + XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel, + SysKeyboardWImpl_GetObjectInfo, + SysKeyboardWImpl_GetDeviceInfo, + XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, + XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, + XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2WImpl_EnumEffects, + IDirectInputDevice2WImpl_GetEffectInfo, + XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState, + XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand, + XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + XCAST(Escape)IDirectInputDevice2AImpl_Escape, + XCAST(Poll)IDirectInputDevice2AImpl_Poll, + XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7WImpl_EnumEffectsInFile, + IDirectInputDevice7WImpl_WriteEffectToFile, + IDirectInputDevice8WImpl_BuildActionMap, + IDirectInputDevice8WImpl_SetActionMap, + IDirectInputDevice8WImpl_GetImageInfo +}; +#undef XCAST diff --git a/reactos/lib/dinput/mouse.c b/reactos/lib/dinput/mouse.c new file mode 100644 index 00000000000..c6da6033f37 --- /dev/null +++ b/reactos/lib/dinput/mouse.c @@ -0,0 +1,1253 @@ +/* DirectInput Mouse device + * + * Copyright 1998 Marcus Meissner + * Copyright 1998,1999 Lionel Ulmer + * Copyright 2000-2001 TransGaming Technologies Inc. + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "dinput.h" + +#include "dinput_private.h" +#include "device_private.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +#define MOUSE_HACK + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); +typedef struct { + POINT pt; + DWORD mouseData; + DWORD flags; + DWORD time; + ULONG_PTR dwExtraInfo; +} MSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT; + +/* Wine mouse driver object instances */ +#define WINE_MOUSE_X_AXIS_INSTANCE 0 +#define WINE_MOUSE_Y_AXIS_INSTANCE 1 +#define WINE_MOUSE_Z_AXIS_INSTANCE 2 +#define WINE_MOUSE_L_BUTTON_INSTANCE 0 +#define WINE_MOUSE_R_BUTTON_INSTANCE 1 +#define WINE_MOUSE_M_BUTTON_INSTANCE 2 +#define WINE_MOUSE_D_BUTTON_INSTANCE 3 + +/* ------------------------------- */ +/* Wine mouse internal data format */ +/* ------------------------------- */ + +/* Constants used to access the offset array */ +#define WINE_MOUSE_X_POSITION 0 +#define WINE_MOUSE_Y_POSITION 1 +#define WINE_MOUSE_Z_POSITION 2 +#define WINE_MOUSE_L_POSITION 3 +#define WINE_MOUSE_R_POSITION 4 +#define WINE_MOUSE_M_POSITION 5 + +typedef struct { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[4]; +} Wine_InternalMouseData; + +#define WINE_INTERNALMOUSE_NUM_OBJS 6 + +static const DIOBJECTDATAFORMAT Wine_InternalMouseObjectFormat[WINE_INTERNALMOUSE_NUM_OBJS] = { + { &GUID_XAxis, FIELD_OFFSET(Wine_InternalMouseData, lX), + DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 }, + { &GUID_YAxis, FIELD_OFFSET(Wine_InternalMouseData, lY), + DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 }, + { &GUID_ZAxis, FIELD_OFFSET(Wine_InternalMouseData, lZ), + DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS, 0 }, + { &GUID_Button, (FIELD_OFFSET(Wine_InternalMouseData, rgbButtons)) + 0, + DIDFT_MAKEINSTANCE(WINE_MOUSE_L_BUTTON_INSTANCE) | DIDFT_PSHBUTTON, 0 }, + { &GUID_Button, (FIELD_OFFSET(Wine_InternalMouseData, rgbButtons)) + 1, + DIDFT_MAKEINSTANCE(WINE_MOUSE_R_BUTTON_INSTANCE) | DIDFT_PSHBUTTON, 0 }, + { &GUID_Button, (FIELD_OFFSET(Wine_InternalMouseData, rgbButtons)) + 2, + DIDFT_MAKEINSTANCE(WINE_MOUSE_M_BUTTON_INSTANCE) | DIDFT_PSHBUTTON, 0 } +}; + +static const DIDATAFORMAT Wine_InternalMouseFormat = { + 0, /* dwSize - unused */ + 0, /* dwObjsize - unused */ + 0, /* dwFlags - unused */ + sizeof(Wine_InternalMouseData), + WINE_INTERNALMOUSE_NUM_OBJS, /* dwNumObjs */ + (LPDIOBJECTDATAFORMAT) Wine_InternalMouseObjectFormat +}; + +static IDirectInputDevice8AVtbl SysMouseAvt; +static IDirectInputDevice8WVtbl SysMouseWvt; + +typedef struct SysMouseImpl SysMouseImpl; + +typedef enum { + WARP_DONE, /* Warping has been done */ + WARP_NEEDED, /* Warping is needed */ + WARP_STARTED /* Warping has been done, waiting for the warp event */ +} WARP_STATUS; + +struct SysMouseImpl +{ + LPVOID lpVtbl; + DWORD ref; + GUID guid; + + IDirectInputImpl *dinput; + + /* The current data format and the conversion between internal + and external data formats */ + DIDATAFORMAT *df; + DataFormat *wine_df; + int offset_array[WINE_INTERNALMOUSE_NUM_OBJS]; + + /* SysMouseAImpl */ + BYTE absolute; + /* Previous position for relative moves */ + LONG prevX, prevY; + /* These are used in case of relative -> absolute transitions */ + POINT org_coords; + HHOOK hook; + HWND win; + DWORD dwCoopLevel; + POINT mapped_center; + DWORD win_centerX, win_centerY; + LPDIDEVICEOBJECTDATA data_queue; + int queue_head, queue_tail, queue_len; + BOOL overflow; + /* warping: whether we need to move mouse back to middle once we + * reach window borders (for e.g. shooters, "surface movement" games) */ + WARP_STATUS need_warp; + int acquired; + HANDLE hEvent; + CRITICAL_SECTION crit; + + /* This is for mouse reporting. */ + Wine_InternalMouseData m_state; +}; + +/* FIXME: This is ugly and not thread safe :/ */ +static IDirectInputDevice8A* current_lock = NULL; + +/* FIXME: This is ugly but needed on Windows */ +static int mouse_set = 0; + +static GUID DInput_Wine_Mouse_GUID = { /* 9e573ed8-7734-11d2-8d4a-23903fb6bdf7 */ + 0x9e573ed8, + 0x7734, + 0x11d2, + {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7} +}; + +static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, int version) { + DWORD dwSize; + DIDEVICEINSTANCEA ddi; + + dwSize = lpddi->dwSize; + + TRACE("%ld %p\n", dwSize, lpddi); + + memset(lpddi, 0, dwSize); + memset(&ddi, 0, sizeof(ddi)); + + ddi.dwSize = dwSize; + ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */ + ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */ + if (version >= 8) + ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8); + else + ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); + strcpy(ddi.tszInstanceName, "Mouse"); + strcpy(ddi.tszProductName, "Wine Mouse"); + + memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi))); +} + +static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, int version) { + DWORD dwSize; + DIDEVICEINSTANCEW ddi; + + dwSize = lpddi->dwSize; + + TRACE("%ld %p\n", dwSize, lpddi); + + memset(lpddi, 0, dwSize); + memset(&ddi, 0, sizeof(ddi)); + + ddi.dwSize = dwSize; + ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */ + ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */ + if (version >= 8) + ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8); + else + ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); + MultiByteToWideChar(CP_ACP, 0, "Mouse", -1, ddi.tszInstanceName, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, "Wine Mouse", -1, ddi.tszProductName, MAX_PATH); + + memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi))); +} + +static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id) +{ + if (id != 0) + return FALSE; + + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) || + ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) { + TRACE("Enumerating the mouse device\n"); + + fill_mouse_dideviceinstanceA(lpddi, version); + + return TRUE; + } + + return FALSE; +} + +static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id) +{ + if (id != 0) + return FALSE; + + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) || + ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) { + TRACE("Enumerating the mouse device\n"); + + fill_mouse_dideviceinstanceW(lpddi, version); + + return TRUE; + } + + return FALSE; +} + +static SysMouseImpl *alloc_device_mouse(REFGUID rguid, LPVOID mvt, IDirectInputImpl *dinput) +{ + int offset_array[WINE_INTERNALMOUSE_NUM_OBJS] = { + FIELD_OFFSET(Wine_InternalMouseData, lX), + FIELD_OFFSET(Wine_InternalMouseData, lY), + FIELD_OFFSET(Wine_InternalMouseData, lZ), + FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 0, + FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 1, + FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 2 + }; + SysMouseImpl* newDevice; + newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl)); + newDevice->ref = 1; + newDevice->lpVtbl = mvt; +#ifndef __REACTOS__ + InitializeCriticalSection(&(newDevice->crit)); +#endif + memcpy(&(newDevice->guid),rguid,sizeof(*rguid)); + + /* Per default, Wine uses its internal data format */ + newDevice->df = (DIDATAFORMAT *) &Wine_InternalMouseFormat; + memcpy(newDevice->offset_array, offset_array, WINE_INTERNALMOUSE_NUM_OBJS * sizeof(int)); + newDevice->wine_df = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat)); + newDevice->wine_df->size = 0; + newDevice->wine_df->internal_format_size = Wine_InternalMouseFormat.dwDataSize; + newDevice->wine_df->dt = NULL; + newDevice->dinput = dinput; + + return newDevice; +} + +static HRESULT mousedev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev) +{ + if ((IsEqualGUID(&GUID_SysMouse,rguid)) || /* Generic Mouse */ + (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */ + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceA,riid) || + IsEqualGUID(&IID_IDirectInputDevice2A,riid) || + IsEqualGUID(&IID_IDirectInputDevice7A,riid) || + IsEqualGUID(&IID_IDirectInputDevice8A,riid)) { + *pdev = (IDirectInputDeviceA*) alloc_device_mouse(rguid, &SysMouseAvt, dinput); + TRACE("Creating a Mouse device (%p)\n", *pdev); + return DI_OK; + } else + return DIERR_NOINTERFACE; + } + + return DIERR_DEVICENOTREG; +} + +static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev) +{ + if ((IsEqualGUID(&GUID_SysMouse,rguid)) || /* Generic Mouse */ + (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */ + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceW,riid) || + IsEqualGUID(&IID_IDirectInputDevice2W,riid) || + IsEqualGUID(&IID_IDirectInputDevice7W,riid) || + IsEqualGUID(&IID_IDirectInputDevice8W,riid)) { + *pdev = (IDirectInputDeviceW*) alloc_device_mouse(rguid, &SysMouseWvt, dinput); + TRACE("Creating a Mouse device (%p)\n", *pdev); + return DI_OK; + } else + return DIERR_NOINTERFACE; + } + + return DIERR_DEVICENOTREG; +} + +static dinput_device mousedev = { + 100, + "Wine mouse driver", + mousedev_enum_deviceA, + mousedev_enum_deviceW, + mousedev_create_deviceA, + mousedev_create_deviceW +}; + +void scan_mouse() +{ + dinput_register_device(&mousedev); +} + +DECL_GLOBAL_CONSTRUCTOR(mousedev_register) { dinput_register_device(&mousedev); } + +/****************************************************************************** + * SysMouseA (DInput Mouse support) + */ + +/****************************************************************************** + * Release : release the mouse buffer. + */ +static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + ULONG ref; + + ref = InterlockedDecrement(&(This->ref)); + if (ref) + return ref; + + /* Free the data queue */ + if (This->data_queue != NULL) + HeapFree(GetProcessHeap(),0,This->data_queue); + +#ifndef __REACTOS__ + if (This->hook) { + UnhookWindowsHookEx( This->hook ); + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(TRUE); /* show cursor */ + } + DeleteCriticalSection(&(This->crit)); +#endif + +#ifdef __REACTOS__ +if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(TRUE); /* show cursor */ + +#endif + /* Free the DataFormat */ + if (This->df != &(Wine_InternalMouseFormat)) { + HeapFree(GetProcessHeap(), 0, This->df->rgodf); + HeapFree(GetProcessHeap(), 0, This->df); + } + + HeapFree(GetProcessHeap(),0,This); + return 0; +} + + +/****************************************************************************** + * SetCooperativeLevel : store the window in which we will do our + * grabbing. + */ +static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel( + LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags +) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + + TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags); + + if (TRACE_ON(dinput)) { + TRACE(" cooperative level : "); + _dump_cooperativelevel_DI(dwflags); + } + + /* Store the window which asks for the mouse */ + if (!hwnd) + hwnd = GetDesktopWindow(); + This->win = hwnd; + This->dwCoopLevel = dwflags; + + return DI_OK; +} + + +/****************************************************************************** + * SetDataFormat : the application can choose the format of the data + * the device driver sends back with GetDeviceState. + * + * For the moment, only the "standard" configuration (c_dfDIMouse) is supported + * in absolute and relative mode. + */ +static HRESULT WINAPI SysMouseAImpl_SetDataFormat( + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df +) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + + TRACE("(this=%p,%p)\n",This,df); + + _dump_DIDATAFORMAT(df); + + /* Tests under windows show that a call to SetDataFormat always sets the mouse + in relative mode whatever the dwFlags value (DIDF_ABSAXIS/DIDF_RELAXIS). + To switch in absolute mode, SetProperty must be used. */ + This->absolute = 0; + + /* Store the new data format */ + This->df = HeapAlloc(GetProcessHeap(),0,df->dwSize); + memcpy(This->df, df, df->dwSize); + This->df->rgodf = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*df->dwObjSize); + memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize); + + /* Prepare all the data-conversion filters */ + This->wine_df = create_DataFormat(&(Wine_InternalMouseFormat), df, This->offset_array); + + return DI_OK; +} + +/* low-level mouse hook */ +static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lparam ) +{ + LRESULT ret; + MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam; + SysMouseImpl* This = (SysMouseImpl*) current_lock; + DWORD dwCoop; + static long last_event = 0; + int wdata; + + if (code != HC_ACTION) return CallNextHookEx( This->hook, code, wparam, lparam ); + + EnterCriticalSection(&(This->crit)); + dwCoop = This->dwCoopLevel; + + /* Only allow mouse events every 10 ms. + * This is to allow the cursor to start acceleration before + * the warps happen. But if it involves a mouse button event we + * allow it since we don't want to loose the clicks. + */ + if (((GetCurrentTime() - last_event) < 10) + && wparam == WM_MOUSEMOVE) + goto end; + else last_event = GetCurrentTime(); + + /* Mouse moved -> send event if asked */ + if (This->hEvent) + SetEvent(This->hEvent); + + if (wparam == WM_MOUSEMOVE) { + if (This->absolute) { + if (hook->pt.x != This->prevX) + GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x, hook->time, 0); + if (hook->pt.y != This->prevY) + GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y, hook->time, 0); + } else { + /* Now, warp handling */ + if ((This->need_warp == WARP_STARTED) && + (hook->pt.x == This->mapped_center.x) && (hook->pt.y == This->mapped_center.y)) { + /* Warp has been done... */ + This->need_warp = WARP_DONE; + goto end; + } + + /* Relative mouse input with absolute mouse event : the real fun starts here... */ + if ((This->need_warp == WARP_NEEDED) || + (This->need_warp == WARP_STARTED)) { + if (hook->pt.x != This->prevX) + GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x - This->prevX, + hook->time, (This->dinput->evsequence)++); + if (hook->pt.y != This->prevY) + GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->prevY, + hook->time, (This->dinput->evsequence)++); + } else { + /* This is the first time the event handler has been called after a + GetDeviceData or GetDeviceState. */ + if (hook->pt.x != This->mapped_center.x) { + GEN_EVENT(This->offset_array[WINE_MOUSE_X_POSITION], hook->pt.x - This->mapped_center.x, + hook->time, (This->dinput->evsequence)++); + This->need_warp = WARP_NEEDED; + } + + if (hook->pt.y != This->mapped_center.y) { + GEN_EVENT(This->offset_array[WINE_MOUSE_Y_POSITION], hook->pt.y - This->mapped_center.y, + hook->time, (This->dinput->evsequence)++); + This->need_warp = WARP_NEEDED; + } + } + } + + This->prevX = hook->pt.x; + This->prevY = hook->pt.y; + + if (This->absolute) { + This->m_state.lX = hook->pt.x; + This->m_state.lY = hook->pt.y; + } else { + This->m_state.lX = hook->pt.x - This->mapped_center.x; + This->m_state.lY = hook->pt.y - This->mapped_center.y; + } + } + + TRACE(" msg %x pt %ld %ld (W=%d)\n", + wparam, hook->pt.x, hook->pt.y, (!This->absolute) && This->need_warp ); + + switch(wparam) { + case WM_LBUTTONDOWN: + GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0xFF, + hook->time, This->dinput->evsequence++); + This->m_state.rgbButtons[0] = 0xFF; + break; + case WM_LBUTTONUP: + GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x00, + hook->time, This->dinput->evsequence++); + This->m_state.rgbButtons[0] = 0x00; + break; + case WM_RBUTTONDOWN: + GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0xFF, + hook->time, This->dinput->evsequence++); + This->m_state.rgbButtons[1] = 0xFF; + break; + case WM_RBUTTONUP: + GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x00, + hook->time, This->dinput->evsequence++); + This->m_state.rgbButtons[1] = 0x00; + break; + case WM_MBUTTONDOWN: + GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0xFF, + hook->time, This->dinput->evsequence++); + This->m_state.rgbButtons[2] = 0xFF; + break; + case WM_MBUTTONUP: + GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x00, + hook->time, This->dinput->evsequence++); + This->m_state.rgbButtons[2] = 0x00; + break; + case WM_MOUSEWHEEL: + wdata = (short)HIWORD(hook->mouseData); + GEN_EVENT(This->offset_array[WINE_MOUSE_Z_POSITION], wdata, + hook->time, This->dinput->evsequence++); + This->m_state.lZ += wdata; + break; + } + + TRACE("(X: %ld - Y: %ld L: %02x M: %02x R: %02x)\n", + This->m_state.lX, This->m_state.lY, + This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]); + + end: + LeaveCriticalSection(&(This->crit)); + + if (dwCoop & DISCL_NONEXCLUSIVE) { + /* Pass the events down to previous handlers (e.g. win32 input) */ + ret = CallNextHookEx( This->hook, code, wparam, lparam ); + } else { + /* Ignore message */ + ret = 1; + } + return ret; +} + + +static void dinput_window_check(SysMouseImpl* This) { + RECT rect; + DWORD centerX, centerY; + + /* make sure the window hasn't moved */ + GetWindowRect(This->win, &rect); + centerX = (rect.right - rect.left) / 2; + centerY = (rect.bottom - rect.top ) / 2; + if (This->win_centerX != centerX || This->win_centerY != centerY) { + This->win_centerX = centerX; + This->win_centerY = centerY; + } + This->mapped_center.x = This->win_centerX; + This->mapped_center.y = This->win_centerY; + MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1); +} + + +/****************************************************************************** + * Acquire : gets exclusive control of the mouse + */ +static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + RECT rect; + + TRACE("(this=%p)\n",This); + + if (This->acquired == 0) { + POINT point; + + /* Store (in a global variable) the current lock */ + current_lock = (IDirectInputDevice8A*)This; + + /* Init the mouse state */ + GetCursorPos( &point ); + if (This->absolute) { + This->m_state.lX = point.x; + This->m_state.lY = point.y; + This->prevX = point.x; + This->prevY = point.y; + } else { + This->m_state.lX = 0; + This->m_state.lY = 0; + This->org_coords = point; + } + This->m_state.lZ = 0; + This->m_state.rgbButtons[0] = ((GetKeyState(VK_LBUTTON) & 0x80) ? 0xFF : 0x00); + This->m_state.rgbButtons[1] = ((GetKeyState(VK_RBUTTON) & 0x80) ? 0xFF : 0x00); + This->m_state.rgbButtons[2] = ((GetKeyState(VK_MBUTTON) & 0x80) ? 0xFF : 0x00); + + /* Install our mouse hook */ + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(FALSE); /* hide cursor */ +#ifndef __REACTOS__ + This->hook = SetWindowsHookExA( WH_MOUSE_LL, dinput_mouse_hook, DINPUT_instance, 0 ); +#endif + /* Get the window dimension and find the center */ + GetWindowRect(This->win, &rect); + This->win_centerX = (rect.right - rect.left) / 2; + This->win_centerY = (rect.bottom - rect.top ) / 2; + + /* Warp the mouse to the center of the window */ + if (This->absolute == 0) { + This->mapped_center.x = This->win_centerX; + This->mapped_center.y = This->win_centerY; + MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1); + TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); + SetCursorPos( This->mapped_center.x, This->mapped_center.y ); +#ifdef MOUSE_HACK + This->need_warp = WARP_DONE; +#else + This->need_warp = WARP_STARTED; +#endif + } + + This->acquired = 1; + return DI_OK; + } + return S_FALSE; +} + +/****************************************************************************** + * Unacquire : frees the mouse + */ +static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + + TRACE("(this=%p)\n",This); + + if (This->acquired) { + /* Reinstall previous mouse event handler */ + +#ifndef __REACTOS__ + if (This->hook) { + UnhookWindowsHookEx( This->hook ); + This->hook = 0; + + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(TRUE); /* show cursor */ + } +#endif +#ifdef __REACTOS__ + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(TRUE); /* show cursor */ +#endif + + /* No more locks */ + current_lock = NULL; + + /* Unacquire device */ + This->acquired = 0; + + /* And put the mouse cursor back where it was at acquire time */ + if (This->absolute == 0) { + TRACE(" warping mouse back to (%ld , %ld)\n", This->org_coords.x, This->org_coords.y); + SetCursorPos(This->org_coords.x, This->org_coords.y); + } + } else { + return DI_NOEFFECT; + } + + return DI_OK; +} + +// if you call poll then to getdevicestate +// it did not send back right value in windows +int poll_mouse=0; +static HRESULT WINAPI SysMouseAImpl_Poll(LPDIRECTINPUTDEVICE8A iface) +{ + int retValue = DI_OK; + +SysMouseImpl *This = (SysMouseImpl *)iface; + if (poll_mouse==0) { + retValue=SysMouseAImpl_Acquire(iface); + poll_mouse=1; + if (retValue!=DI_OK) retValue=DIERR_NOTACQUIRED; + else retValue = DI_OK; + } + + return retValue; +} + + +/****************************************************************************** + * GetDeviceState : returns the "state" of the mouse. + * + * For the moment, only the "standard" return structure (DIMOUSESTATE) is + * supported. + */ +static HRESULT WINAPI SysMouseAImpl_GetDeviceState( + LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr +) { + SysMouseImpl *This = (SysMouseImpl *)iface; + POINT point; + +#ifndef __REACTOS__ + EnterCriticalSection(&(This->crit)); +#endif + TRACE("(this=%p,0x%08lx,%p): \n",This,len,ptr); + + /* Copy the current mouse state */ + fill_DataFormat(ptr, &(This->m_state), This->wine_df); + + + // this fix windows bugs when + // some program calling on mouse poll + if (poll_mouse==1) poll_mouse=0; + else { + if (This->absolute == 0) { + This->m_state.lX = 0; + This->m_state.lY = 0; + This->m_state.lZ = 0; + } + } + + + /* Check if we need to do a mouse warping */ + if (This->need_warp == WARP_NEEDED) { + dinput_window_check(This); + TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); + if (mouse_set==0){ + SetCursorPos( This->mapped_center.x, This->mapped_center.y ); + mouse_set++; + } + +#ifdef MOUSE_HACK + This->need_warp = WARP_DONE; +#else + This->need_warp = WARP_STARTED; +#endif + } + +#ifndef __REACTOS__ + LeaveCriticalSection(&(This->crit)); +#endif + + TRACE("(X: %ld - Y: %ld - Z: %ld L: %02x M: %02x R: %02x)\n", + This->m_state.lX, This->m_state.lY, This->m_state.lZ, + This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]); + + return DI_OK; +} + +/****************************************************************************** + * GetDeviceState : gets buffered input data. + */ + +static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, + DWORD dodsize, + LPDIDEVICEOBJECTDATA dod, + LPDWORD entries, + DWORD flags +) { + SysMouseImpl *This = (SysMouseImpl *)iface; + DWORD len; + int nqtail; + + + TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags); + + + // windows does not get any data if + // we do not call manual to mouse Acquire + // this is only need if some apps calling on getdevice data direcly + // in windows GetdeviceData does always update first the data + // then return it. + SysMouseAImpl_Acquire(iface); + + + if (This->acquired == 0) { + WARN(" application tries to get data from an unacquired device !\n"); + return DIERR_NOTACQUIRED; + } + + +#ifndef __REACTOS__ + EnterCriticalSection(&(This->crit)); +#endif + + // FIXME mouse are bit choppy here. + + len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0) + + (This->queue_head - This->queue_tail); + if (len > *entries) len = *entries; + + if (dod == NULL) { + if (len) + TRACE("Application discarding %ld event(s).\n", len); + + *entries = len; + nqtail = This->queue_tail + len; + while (nqtail >= This->queue_len) nqtail -= This->queue_len; + } else { + if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3)) { + ERR("Wrong structure size !\n"); +#ifndef __REACTOS__ + LeaveCriticalSection(&(This->crit)); +#endif + return DIERR_INVALIDPARAM; + } + + if (len) + TRACE("Application retrieving %ld event(s).\n", len); + + *entries = 0; + nqtail = This->queue_tail; + while (len) { + DWORD span = ((This->queue_head < nqtail) ? This->queue_len : This->queue_head) - nqtail; + if (span > len) + span = len; + + /* Copy the buffered data into the application queue */ + memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize); + + /* Advance position */ + nqtail += span; + if (nqtail >= This->queue_len) nqtail -= This->queue_len; + *entries += span; + len -= span; + } + } + if (!(flags & DIGDD_PEEK)) + This->queue_tail = nqtail; +#ifndef __REACTOS__ + LeaveCriticalSection(&(This->crit)); +#endif + /* Check if we need to do a mouse warping */ + + + if (This->need_warp == WARP_NEEDED) { + dinput_window_check(This); + TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); + if (mouse_set==0){ + SetCursorPos( This->mapped_center.x, This->mapped_center.y ); + mouse_set++; + } + +#ifdef MOUSE_HACK + This->need_warp = WARP_DONE; +#else + This->need_warp = WARP_STARTED; +#endif + } + return DI_OK; +} + +/****************************************************************************** + * SetProperty : change input device properties + */ +static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPCDIPROPHEADER ph) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph); + + if (!HIWORD(rguid)) { + switch ((DWORD)rguid) { + case (DWORD) DIPROP_BUFFERSIZE: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + + TRACE("buffersize = %ld\n",pd->dwData); + + This->data_queue = (LPDIDEVICEOBJECTDATA)HeapAlloc(GetProcessHeap(),0, + pd->dwData * sizeof(DIDEVICEOBJECTDATA)); + This->queue_head = 0; + This->queue_tail = 0; + This->queue_len = pd->dwData; + break; + } + case (DWORD) DIPROP_AXISMODE: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + This->absolute = !(pd->dwData); + TRACE("Using %s coordinates mode now\n", This->absolute ? "absolute" : "relative"); + break; + } + default: + FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid)); + break; + } + } + + return DI_OK; +} + +/****************************************************************************** + * GetProperty : get input device properties + */ +static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, + REFGUID rguid, + LPDIPROPHEADER pdiph) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + + TRACE("(this=%p,%s,%p): stub!\n", + iface, debugstr_guid(rguid), pdiph); + + if (TRACE_ON(dinput)) + _dump_DIPROPHEADER(pdiph); + + if (!HIWORD(rguid)) { + switch ((DWORD)rguid) { + case (DWORD) DIPROP_BUFFERSIZE: { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + + TRACE(" return buffersize = %d\n",This->queue_len); + pd->dwData = This->queue_len; + break; + } + + case (DWORD) DIPROP_GRANULARITY: { + LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph; + + /* We'll just assume that the app asks about the Z axis */ + pr->dwData = WHEEL_DELTA; + + break; + } + + case (DWORD) DIPROP_RANGE: { + LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph; + + if ((pdiph->dwHow == DIPH_BYID) && + ((pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS)) || + (pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS)))) { + /* Querying the range of either the X or the Y axis. As I do + not know the range, do as if the range were + unrestricted...*/ + pr->lMin = DIPROPRANGE_NOMIN; + pr->lMax = DIPROPRANGE_NOMAX; + } + + break; + } + + default: + FIXME("Unknown type %ld (%s)\n",(DWORD)rguid,debugstr_guid(rguid)); + break; + } + } + + return DI_OK; +} + + + +/****************************************************************************** + * SetEventNotification : specifies event to be sent on state change + */ +static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, + HANDLE hnd) { + SysMouseImpl *This = (SysMouseImpl *)iface; + + TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd); + + This->hEvent = hnd; + + return DI_OK; +} + +/****************************************************************************** + * GetCapabilities : get the device capablitites + */ +static HRESULT WINAPI SysMouseAImpl_GetCapabilities( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVCAPS lpDIDevCaps) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + + TRACE("(this=%p,%p)\n",This,lpDIDevCaps); + + if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) { + lpDIDevCaps->dwFlags = DIDC_ATTACHED; + if (This->dinput->version >= 8) + lpDIDevCaps->dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8); + else + lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); + lpDIDevCaps->dwAxes = 3; + lpDIDevCaps->dwButtons = 3; + lpDIDevCaps->dwPOVs = 0; + lpDIDevCaps->dwFFSamplePeriod = 0; + lpDIDevCaps->dwFFMinTimeResolution = 0; + lpDIDevCaps->dwFirmwareRevision = 100; + lpDIDevCaps->dwHardwareRevision = 100; + lpDIDevCaps->dwFFDriverVersion = 0; + } else if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS_DX3)) { + lpDIDevCaps->dwFlags = DIDC_ATTACHED; + lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); + lpDIDevCaps->dwAxes = 3; + lpDIDevCaps->dwButtons = 3; + lpDIDevCaps->dwPOVs = 0; + } else { + WARN("invalid parameter\n"); + return DIERR_INVALIDPARAM; + } + + return DI_OK; +} + + +/****************************************************************************** + * EnumObjects : enumerate the different buttons and axis... + */ +static HRESULT WINAPI SysMouseAImpl_EnumObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + DIDEVICEOBJECTINSTANCEA ddoi; + + TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags); + if (TRACE_ON(dinput)) { + TRACE(" - flags = "); + _dump_EnumObjects_flags(dwFlags); + TRACE("\n"); + } + + /* Only the fields till dwFFMaxForce are relevant */ + memset(&ddoi, 0, sizeof(ddoi)); + ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); + + /* In a mouse, we have : two relative axis and three buttons */ + if ((dwFlags == DIDFT_ALL) || + (dwFlags & DIDFT_AXIS)) { + /* X axis */ + ddoi.guidType = GUID_XAxis; + ddoi.dwOfs = This->offset_array[WINE_MOUSE_X_POSITION]; + ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS; + strcpy(ddoi.tszName, "X-Axis"); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + + /* Y axis */ + ddoi.guidType = GUID_YAxis; + ddoi.dwOfs = This->offset_array[WINE_MOUSE_Y_POSITION]; + ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS; + strcpy(ddoi.tszName, "Y-Axis"); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + + /* Z axis */ + ddoi.guidType = GUID_ZAxis; + ddoi.dwOfs = This->offset_array[WINE_MOUSE_Z_POSITION]; + ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS; + strcpy(ddoi.tszName, "Z-Axis"); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + } + + if ((dwFlags == DIDFT_ALL) || + (dwFlags & DIDFT_BUTTON)) { + ddoi.guidType = GUID_Button; + + /* Left button */ + ddoi.dwOfs = This->offset_array[WINE_MOUSE_L_POSITION]; + ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_L_BUTTON_INSTANCE) | DIDFT_PSHBUTTON; + strcpy(ddoi.tszName, "Left-Button"); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + + /* Right button */ + ddoi.dwOfs = This->offset_array[WINE_MOUSE_R_POSITION]; + ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_R_BUTTON_INSTANCE) | DIDFT_PSHBUTTON; + strcpy(ddoi.tszName, "Right-Button"); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + + /* Middle button */ + ddoi.dwOfs = This->offset_array[WINE_MOUSE_M_POSITION]; + ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_M_BUTTON_INSTANCE) | DIDFT_PSHBUTTON; + strcpy(ddoi.tszName, "Middle-Button"); + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + } + + return DI_OK; +} + +static HRESULT WINAPI SysMouseWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID lpvRef,DWORD dwFlags) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + + device_enumobjects_AtoWcb_data data; + + data.lpCallBack = lpCallback; + data.lpvRef = lpvRef; + + return SysMouseAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags); +} + +/****************************************************************************** + * GetDeviceInfo : get information about a device's identity + */ +static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo( + LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEINSTANCEA pdidi) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + TRACE("(this=%p,%p)\n", This, pdidi); + + if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) { + WARN(" dinput3 not supporte yet...\n"); + return DI_OK; + } + + fill_mouse_dideviceinstanceA(pdidi, This->dinput->version); + + return DI_OK; +} + +static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) +{ + SysMouseImpl *This = (SysMouseImpl *)iface; + TRACE("(this=%p,%p)\n", This, pdidi); + + if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) { + WARN(" dinput3 not supporte yet...\n"); + return DI_OK; + } + + fill_mouse_dideviceinstanceW(pdidi, This->dinput->version); + + return DI_OK; +} + + +static IDirectInputDevice8AVtbl SysMouseAvt = +{ + IDirectInputDevice2AImpl_QueryInterface, + IDirectInputDevice2AImpl_AddRef, + SysMouseAImpl_Release, + SysMouseAImpl_GetCapabilities, + SysMouseAImpl_EnumObjects, + SysMouseAImpl_GetProperty, + SysMouseAImpl_SetProperty, + SysMouseAImpl_Acquire, + SysMouseAImpl_Unacquire, + SysMouseAImpl_GetDeviceState, + SysMouseAImpl_GetDeviceData, + SysMouseAImpl_SetDataFormat, + SysMouseAImpl_SetEventNotification, + SysMouseAImpl_SetCooperativeLevel, + IDirectInputDevice2AImpl_GetObjectInfo, + SysMouseAImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_RunControlPanel, + IDirectInputDevice2AImpl_Initialize, + IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2AImpl_EnumEffects, + IDirectInputDevice2AImpl_GetEffectInfo, + IDirectInputDevice2AImpl_GetForceFeedbackState, + IDirectInputDevice2AImpl_SendForceFeedbackCommand, + IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + IDirectInputDevice2AImpl_Escape, + SysMouseAImpl_Poll, + IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7AImpl_EnumEffectsInFile, + IDirectInputDevice7AImpl_WriteEffectToFile, + IDirectInputDevice8AImpl_BuildActionMap, + IDirectInputDevice8AImpl_SetActionMap, + IDirectInputDevice8AImpl_GetImageInfo +}; + +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(SysMouseWvt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static IDirectInputDevice8WVtbl SysMouseWvt = +{ + IDirectInputDevice2WImpl_QueryInterface, + XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, + XCAST(Release)SysMouseAImpl_Release, + XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities, + SysMouseWImpl_EnumObjects, + XCAST(GetProperty)SysMouseAImpl_GetProperty, + XCAST(SetProperty)SysMouseAImpl_SetProperty, + XCAST(Acquire)SysMouseAImpl_Acquire, + XCAST(Unacquire)SysMouseAImpl_Unacquire, + XCAST(GetDeviceState)SysMouseAImpl_GetDeviceState, + XCAST(GetDeviceData)SysMouseAImpl_GetDeviceData, + XCAST(SetDataFormat)SysMouseAImpl_SetDataFormat, + XCAST(SetEventNotification)SysMouseAImpl_SetEventNotification, + XCAST(SetCooperativeLevel)SysMouseAImpl_SetCooperativeLevel, + IDirectInputDevice2WImpl_GetObjectInfo, + SysMouseWImpl_GetDeviceInfo, + XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, + XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, + XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, + IDirectInputDevice2WImpl_EnumEffects, + IDirectInputDevice2WImpl_GetEffectInfo, + XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState, + XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand, + XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects, + XCAST(Escape)IDirectInputDevice2AImpl_Escape, + XCAST(Poll)SysMouseAImpl_Poll, + XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7WImpl_EnumEffectsInFile, + IDirectInputDevice7WImpl_WriteEffectToFile, + IDirectInputDevice8WImpl_BuildActionMap, + IDirectInputDevice8WImpl_SetActionMap, + IDirectInputDevice8WImpl_GetImageInfo +}; +#undef XCAST diff --git a/reactos/lib/dinput/regsvr.c b/reactos/lib/dinput/regsvr.c new file mode 100644 index 00000000000..6bdd46a0e3c --- /dev/null +++ b/reactos/lib/dinput/regsvr.c @@ -0,0 +1,558 @@ +/* + * self-registerable dll functions for dinput.dll + * + * Copyright (C) 2003 John K. Hohm + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "winerror.h" + +#include "dinput.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); + +/* + * Near the bottom of this file are the exported DllRegisterServer and + * DllUnregisterServer, which make all this worthwhile. + */ + +/*********************************************************************** + * interface for self-registering + */ +struct regsvr_interface +{ + IID const *iid; /* NULL for end of list */ + LPCSTR name; /* can be NULL to omit */ + IID const *base_iid; /* can be NULL to omit */ + int num_methods; /* can be <0 to omit */ + CLSID const *ps_clsid; /* can be NULL to omit */ + CLSID const *ps_clsid32; /* can be NULL to omit */ +}; + +static HRESULT register_interfaces(struct regsvr_interface const *list); +static HRESULT unregister_interfaces(struct regsvr_interface const *list); + +struct regsvr_coclass +{ + CLSID const *clsid; /* NULL for end of list */ + LPCSTR name; /* can be NULL to omit */ + LPCSTR ips; /* can be NULL to omit */ + LPCSTR ips32; /* can be NULL to omit */ + LPCSTR ips32_tmodel; /* can be NULL to omit */ + LPCSTR progid; /* can be NULL to omit */ + LPCSTR viprogid; /* can be NULL to omit */ + LPCSTR progid_extra; /* can be NULL to omit */ +}; + +static HRESULT register_coclasses(struct regsvr_coclass const *list); +static HRESULT unregister_coclasses(struct regsvr_coclass const *list); + +/*********************************************************************** + * static string constants + */ +static WCHAR const interface_keyname[10] = { + 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 }; +static WCHAR const base_ifa_keyname[14] = { + 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', + 'e', 0 }; +static WCHAR const num_methods_keyname[11] = { + 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 }; +static WCHAR const ps_clsid_keyname[15] = { + 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', + 'i', 'd', 0 }; +static WCHAR const ps_clsid32_keyname[17] = { + 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', + 'i', 'd', '3', '2', 0 }; +static WCHAR const clsid_keyname[6] = { + 'C', 'L', 'S', 'I', 'D', 0 }; +static WCHAR const curver_keyname[7] = { + 'C', 'u', 'r', 'V', 'e', 'r', 0 }; +static WCHAR const ips_keyname[13] = { + 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', + 0 }; +static WCHAR const ips32_keyname[15] = { + 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', + '3', '2', 0 }; +static WCHAR const progid_keyname[7] = { + 'P', 'r', 'o', 'g', 'I', 'D', 0 }; +static WCHAR const viprogid_keyname[25] = { + 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p', + 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D', + 0 }; +static char const tmodel_valuename[] = "ThreadingModel"; + +/*********************************************************************** + * static helper functions + */ +static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid); +static LONG register_key_defvalueW(HKEY base, WCHAR const *name, + WCHAR const *value); +static LONG register_key_defvalueA(HKEY base, WCHAR const *name, + char const *value); +static LONG register_progid(WCHAR const *clsid, + char const *progid, char const *curver_progid, + char const *name, char const *extra); +static LONG recursive_delete_key(HKEY key); +static LONG recursive_delete_keyA(HKEY base, char const *name); +static LONG recursive_delete_keyW(HKEY base, WCHAR const *name); + +/*********************************************************************** + * register_interfaces + */ +static HRESULT register_interfaces(struct regsvr_interface const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY interface_key; + + res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &interface_key, NULL); + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->iid; ++list) { + WCHAR buf[39]; + HKEY iid_key; + + StringFromGUID2(list->iid, buf, 39); + res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &iid_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_interface_key; + + if (list->name) { + res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, + (CONST BYTE*)(list->name), + strlen(list->name) + 1); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (list->base_iid) { + register_key_guid(iid_key, base_ifa_keyname, list->base_iid); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (0 <= list->num_methods) { + static WCHAR const fmt[3] = { '%', 'd', 0 }; + HKEY key; + + res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + + wsprintfW(buf, fmt, list->num_methods); + res = RegSetValueExW(key, NULL, 0, REG_SZ, + (CONST BYTE*)buf, + (lstrlenW(buf) + 1) * sizeof(WCHAR)); + RegCloseKey(key); + + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (list->ps_clsid) { + register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + if (list->ps_clsid32) { + register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32); + if (res != ERROR_SUCCESS) goto error_close_iid_key; + } + + error_close_iid_key: + RegCloseKey(iid_key); + } + +error_close_interface_key: + RegCloseKey(interface_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * unregister_interfaces + */ +static HRESULT unregister_interfaces(struct regsvr_interface const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY interface_key; + + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, + KEY_READ | KEY_WRITE, &interface_key); + if (res == ERROR_FILE_NOT_FOUND) return S_OK; + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->iid; ++list) { + WCHAR buf[39]; + + StringFromGUID2(list->iid, buf, 39); + res = recursive_delete_keyW(interface_key, buf); + } + + RegCloseKey(interface_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * register_coclasses + */ +static HRESULT register_coclasses(struct regsvr_coclass const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + + res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + WCHAR buf[39]; + HKEY clsid_key; + + StringFromGUID2(list->clsid, buf, 39); + res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + + if (list->name) { + res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, + (CONST BYTE*)(list->name), + strlen(list->name) + 1); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->ips) { + res = register_key_defvalueA(clsid_key, ips_keyname, list->ips); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->ips32) { + HKEY ips32_key; + + res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, + &ips32_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, + (CONST BYTE*)list->ips32, + lstrlenA(list->ips32) + 1); + if (res == ERROR_SUCCESS && list->ips32_tmodel) + res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, + (CONST BYTE*)list->ips32_tmodel, + strlen(list->ips32_tmodel) + 1); + RegCloseKey(ips32_key); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->progid) { + res = register_key_defvalueA(clsid_key, progid_keyname, + list->progid); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + res = register_progid(buf, list->progid, NULL, + list->name, list->progid_extra); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->viprogid) { + res = register_key_defvalueA(clsid_key, viprogid_keyname, + list->viprogid); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + res = register_progid(buf, list->viprogid, list->progid, + list->name, list->progid_extra); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + error_close_clsid_key: + RegCloseKey(clsid_key); + } + +error_close_coclass_key: + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * unregister_coclasses + */ +static HRESULT unregister_coclasses(struct regsvr_coclass const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, + KEY_READ | KEY_WRITE, &coclass_key); + if (res == ERROR_FILE_NOT_FOUND) return S_OK; + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + WCHAR buf[39]; + + StringFromGUID2(list->clsid, buf, 39); + res = recursive_delete_keyW(coclass_key, buf); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + + if (list->progid) { + res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + + if (list->viprogid) { + res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->viprogid); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + } + +error_close_coclass_key: + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * regsvr_key_guid + */ +static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) +{ + WCHAR buf[39]; + + StringFromGUID2(guid, buf, 39); + return register_key_defvalueW(base, name, buf); +} + +/*********************************************************************** + * regsvr_key_defvalueW + */ +static LONG register_key_defvalueW( + HKEY base, + WCHAR const *name, + WCHAR const *value) +{ + LONG res; + HKEY key; + + res = RegCreateKeyExW(base, name, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) return res; + res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, + (lstrlenW(value) + 1) * sizeof(WCHAR)); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * regsvr_key_defvalueA + */ +static LONG register_key_defvalueA( + HKEY base, + WCHAR const *name, + char const *value) +{ + LONG res; + HKEY key; + + res = RegCreateKeyExW(base, name, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) return res; + res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, + lstrlenA(value) + 1); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * regsvr_progid + */ +static LONG register_progid( + WCHAR const *clsid, + char const *progid, + char const *curver_progid, + char const *name, + char const *extra) +{ + LONG res; + HKEY progid_key; + + res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0, + NULL, 0, KEY_READ | KEY_WRITE, NULL, + &progid_key, NULL); + if (res != ERROR_SUCCESS) return res; + + if (name) { + res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, + (CONST BYTE*)name, strlen(name) + 1); + if (res != ERROR_SUCCESS) goto error_close_progid_key; + } + + if (clsid) { + res = register_key_defvalueW(progid_key, clsid_keyname, clsid); + if (res != ERROR_SUCCESS) goto error_close_progid_key; + } + + if (curver_progid) { + res = register_key_defvalueA(progid_key, curver_keyname, + curver_progid); + if (res != ERROR_SUCCESS) goto error_close_progid_key; + } + + if (extra) { + HKEY extra_key; + + res = RegCreateKeyExA(progid_key, extra, 0, + NULL, 0, KEY_READ | KEY_WRITE, NULL, + &extra_key, NULL); + if (res == ERROR_SUCCESS) + RegCloseKey(extra_key); + } + +error_close_progid_key: + RegCloseKey(progid_key); + return res; +} + +/*********************************************************************** + * recursive_delete_key + */ +static LONG recursive_delete_key(HKEY key) +{ + LONG res; + WCHAR subkey_name[MAX_PATH]; + DWORD cName; + HKEY subkey; + + for (;;) { + cName = sizeof(subkey_name) / sizeof(WCHAR); + res = RegEnumKeyExW(key, 0, subkey_name, &cName, + NULL, NULL, NULL, NULL); + if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) { + res = ERROR_SUCCESS; /* presumably we're done enumerating */ + break; + } + res = RegOpenKeyExW(key, subkey_name, 0, + KEY_READ | KEY_WRITE, &subkey); + if (res == ERROR_FILE_NOT_FOUND) continue; + if (res != ERROR_SUCCESS) break; + + res = recursive_delete_key(subkey); + RegCloseKey(subkey); + if (res != ERROR_SUCCESS) break; + } + + if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0); + return res; +} + +/*********************************************************************** + * recursive_delete_keyA + */ +static LONG recursive_delete_keyA(HKEY base, char const *name) +{ + LONG res; + HKEY key; + + res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key); + if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS; + if (res != ERROR_SUCCESS) return res; + res = recursive_delete_key(key); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * recursive_delete_keyW + */ +static LONG recursive_delete_keyW(HKEY base, WCHAR const *name) +{ + LONG res; + HKEY key; + + res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key); + if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS; + if (res != ERROR_SUCCESS) return res; + res = recursive_delete_key(key); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * coclass list + */ +static struct regsvr_coclass const coclass_list[] = { + { + &CLSID_DirectInput, + "DirectInput Object", + NULL, + "dinput.dll", + "Both" + }, + { + &CLSID_DirectInputDevice, + "DirectInputDevice Object", + NULL, + "dinput.dll", + "Both" + }, + { NULL } /* list terminator */ +}; + +/*********************************************************************** + * interface list + */ + +static struct regsvr_interface const interface_list[] = { + { NULL } /* list terminator */ +}; + +/*********************************************************************** + * DllRegisterServer (DINPUT.@) + */ +HRESULT WINAPI DINPUT_DllRegisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = register_coclasses(coclass_list); + if (SUCCEEDED(hr)) + hr = register_interfaces(interface_list); + return hr; +} + +/*********************************************************************** + * DllUnregisterServer (DINPUT.@) + */ +HRESULT WINAPI DINPUT_DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = unregister_coclasses(coclass_list); + if (SUCCEEDED(hr)) + hr = unregister_interfaces(interface_list); + return hr; +} diff --git a/reactos/lib/dinput/version.rc b/reactos/lib/dinput/version.rc new file mode 100644 index 00000000000..65dc50a1512 --- /dev/null +++ b/reactos/lib/dinput/version.rc @@ -0,0 +1,26 @@ +/* + * Copyright 2001 Ove Kaaven + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define WINE_FILEDESCRIPTION_STR "Wine DirectInput" +#define WINE_FILENAME_STR "dinput.dll" +#define WINE_FILEVERSION 5,1,2600,881 +#define WINE_FILEVERSION_STR "5.1.2600.881" +#define WINE_PRODUCTVERSION 5,1,2600,881 +#define WINE_PRODUCTVERSION_STR "5.1" + +#include "wine/wine_common_ver.rc" diff --git a/reactos/lib/dinput8/Makefile.in b/reactos/lib/dinput8/Makefile.in new file mode 100644 index 00000000000..8494fd6e74b --- /dev/null +++ b/reactos/lib/dinput8/Makefile.in @@ -0,0 +1,16 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = dinput8.dll +IMPORTS = dinput +EXTRALIBS = -luuid + +C_SRCS = \ + dinput8_main.c + +RC_SRCS = version.rc + +@MAKE_DLL_RULES@ + +### Dependencies: diff --git a/reactos/lib/dinput8/Makefile.ros b/reactos/lib/dinput8/Makefile.ros new file mode 100644 index 00000000000..c1fa839a4db --- /dev/null +++ b/reactos/lib/dinput8/Makefile.ros @@ -0,0 +1,28 @@ +# $Id: Makefile.ros,v 1.1 2004/11/29 00:14:14 greatlrd Exp $ + +TARGET_NAME = dinput8 + +TARGET_OBJECTS = dinput8_main.o + +TARGET_CFLAGS = -D__REACTOS__ + +TARGET_SDKLIBS = libwine.a dinput.a ole32.a wine_uuid.a ntdll.a winmm.a dxguid.a + + + +TARGET_RC_SRCS = version.rc +TARGET_RC_BINSRC = +TARGET_RC_BINARIES = + +default: all + +authors.c: +ifeq ($(HOST),mingw32-linux) + echo 'const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 };' > authors.c +else + echo const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 }; > authors.c +endif + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(TOOLS_PATH)/depend.mk diff --git a/reactos/lib/dinput8/Makefile.ros-template b/reactos/lib/dinput8/Makefile.ros-template new file mode 100644 index 00000000000..2a764154a8b --- /dev/null +++ b/reactos/lib/dinput8/Makefile.ros-template @@ -0,0 +1,28 @@ +# $Id: Makefile.ros-template,v 1.1 2004/11/29 00:14:14 greatlrd Exp $ + +TARGET_NAME = dinput8 + +TARGET_OBJECTS = @C_SRCS@ + +TARGET_CFLAGS = @EXTRADEFS@ -D__REACTOS__ + +TARGET_SDKLIBS = libwine.a @IMPORTS@ ole32.a wine_uuid.a ntdll.a winmm.a dxguid.a + + + +TARGET_RC_SRCS = @RC_SRCS@ +TARGET_RC_BINSRC = @RC_BINSRC@ +TARGET_RC_BINARIES = @RC_BINARIES@ + +default: all + +authors.c: +ifeq ($(HOST),mingw32-linux) + echo 'const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 };' > authors.c +else + echo const char * const SHELL_Authors[] = { "WINE team", "ReactOS team", 0 }; > authors.c +endif + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(TOOLS_PATH)/depend.mk diff --git a/reactos/lib/dinput8/dinput8_main.c b/reactos/lib/dinput8/dinput8_main.c new file mode 100644 index 00000000000..7de9b95079b --- /dev/null +++ b/reactos/lib/dinput8/dinput8_main.c @@ -0,0 +1,83 @@ +/* DirectInput 8 + * + * Copyright 2002 TransGaming Technologies Inc. + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include +#include +#include + +#include "wine/debug.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "dinput.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput); + +/****************************************************************************** + * DirectInput8Create (DINPUT8.@) + */ +HRESULT WINAPI DirectInput8Create( + HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, + LPUNKNOWN punkOuter +) { + return DirectInputCreateEx(hinst, dwVersion, riid, ppDI, punkOuter); +} + +/*********************************************************************** + * DllCanUnloadNow (DINPUT8.@) + */ +HRESULT WINAPI DINPUT8_DllCanUnloadNow(void) +{ + FIXME("(void): stub\n"); + + return S_FALSE; +} + +/*********************************************************************** + * DllGetClassObject (DINPUT8.@) + */ +HRESULT WINAPI DINPUT8_DllGetClassObject(REFCLSID rclsid, REFIID riid, + LPVOID *ppv) +{ + FIXME("(%p, %p, %p): stub\n", debugstr_guid(rclsid), + debugstr_guid(riid), ppv); + + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (DINPUT8.@) + */ +HRESULT WINAPI DINPUT8_DllRegisterServer(void) +{ + FIXME("(void): stub\n"); + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (DINPUT8.@) + */ +HRESULT WINAPI DINPUT8_DllUnregisterServer(void) +{ + FIXME("(void): stub\n"); + + return S_OK; +} diff --git a/reactos/lib/dinput8/makefile b/reactos/lib/dinput8/makefile new file mode 100644 index 00000000000..c9e7b2addd6 --- /dev/null +++ b/reactos/lib/dinput8/makefile @@ -0,0 +1,9 @@ +# $Id: makefile,v 1.1 2004/11/29 00:14:14 greatlrd Exp $ + +PATH_TO_TOP = ../.. + +TARGET_TYPE = winedll + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/lib/dinput8/version.rc b/reactos/lib/dinput8/version.rc new file mode 100644 index 00000000000..e69fa99701d --- /dev/null +++ b/reactos/lib/dinput8/version.rc @@ -0,0 +1,27 @@ +/* + * Copyright 2004 Tom Wickline + * + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define WINE_FILEDESCRIPTION_STR "Wine DirectInput 8" +#define WINE_FILENAME_STR "dinput8.dll" +#define WINE_FILEVERSION 5,1,2600,881 +#define WINE_FILEVERSION_STR "5.1.2600.881" +#define WINE_PRODUCTVERSION 5,1,2600,881 +#define WINE_PRODUCTVERSION_STR "5.1" +#define WINE_PRODUCTNAME_STR "DirectX" + +#include "wine/wine_common_ver.rc" diff --git a/reactos/lib/dxguid/dxguid-mingw.c b/reactos/lib/dxguid/dxguid-mingw.c new file mode 100644 index 00000000000..274904fe689 --- /dev/null +++ b/reactos/lib/dxguid/dxguid-mingw.c @@ -0,0 +1,617 @@ +/* + + dxguid.c - DirectX GUIDs + + Written by Filip Navara + + 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. + +*/ + +#if defined(__LCC__) || defined(__GNUC__) +#define INITGUID 1 +#include +#else +#include +#endif + +// wine own ? +//DEFINE_GUID(IID_IDsDriver, 0x8C4233C0l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +//DEFINE_GUID(IID_IDsDriverNotify, 0x00363EF44, 0x3B57, 0x11D3, 0xAC, 0x79, 0x00, 0x10, 0x5A, 0x01, 0x7f, 0xe1); +//DEFINE_GUID(IID_IDsDriverPropertySet, 0x0F6F2E8E0, 0xD842, 0x11D0, 0x8F, 0x75, 0x00, 0xC0, 0x4F, 0xC2, 0x8A, 0xCA); +//DEFINE_GUID(IID_IDsDriverBuffer, 0x8C4233C1l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +// this is wrong but it keep dinput happy + +// ok + +DEFINE_GUID(CLSID_CDirect3DRM,0x4516ec41,0x8f20,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMAnimation,0x4fa35698,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimationSet,0x4fa35699,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMClippedVisual,0x5434e72d,0x6d66,0x11d1,0xbb,0xb,0x0,0x0,0xf8,0x75,0x86,0x5a); +DEFINE_GUID(CLSID_CDirect3DRMDevice,0x4fa3568e,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFace,0x4fa35693,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFrame,0x4fa35690,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFrameInterpolator,0xde9eaa2,0x3b84,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMLight,0x4fa35694,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMLightInterpolator,0xde9eaa6,0x3b84,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMaterial,0x4fa35697,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMaterialInterpolator,0xde9eaa7,0x3b84,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMesh,0x4fa35691,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMeshBuilder,0x4fa35692,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMeshInterpolator,0xde9eaa3,0x3b84,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMProgressiveMesh,0x4516ec40,0x8f20,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMShadow,0x4fa3569b,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMTexture,0x4fa35695,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMTextureInterpolator,0xde9eaa8,0x3b84,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMUserVisual,0x4fa3569a,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewport,0x4fa3568f,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewportInterpolator,0xde9eaa1,0x3b84,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_CDirect3DRMWrap,0x4fa35696,0x623f,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(CLSID_CDirectXFile,0x4516ec43,0x8f20,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(CLSID_DirectDraw,0xd7b70ee0,0x4340,0x11cf,0xb0,0x63,0x0,0x20,0xaf,0xc2,0xcd,0x35); +DEFINE_GUID(CLSID_DirectDraw7,0x3c305196,0x50db,0x11d3,0x9c,0xfe,0x00,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(CLSID_DirectDrawClipper,0x593817a0,0x7db3,0x11cf,0xa2,0xde,0x0,0xaa,0x0,0xb9,0x33,0x56); +DEFINE_GUID(CLSID_DirectDrawFactory2,0xb9dc4790,0x4af1,0x11d1,0x8c,0x4c,0x0,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(CLSID_DirectInput,0x25e609e0,0xb259,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x0,0x0); +DEFINE_GUID(CLSID_DirectInput8,0x25e609e4,0xb259,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice,0x25e609e1,0xb259,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x0,0x0); +DEFINE_GUID(CLSID_DirectInputDevice8,0x25e609e5,0xb259,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectMusic,0x636b9f10,0xc7d,0x11d1,0x95,0xb2,0x0,0x20,0xaf,0xdc,0x74,0x21); +DEFINE_GUID(CLSID_DirectMusicAudioPathConfig,0xee0b9ca0,0xa81e,0x11d3,0x9b,0xd1,0x0,0x80,0xc7,0x15,0xa,0x74); +DEFINE_GUID(CLSID_DirectMusicBand,0x79ba9e00,0xb6ee,0x11d1,0x86,0xbe,0x0,0xc0,0x4f,0xbf,0x8f,0xef); +DEFINE_GUID(CLSID_DirectMusicBandTrack,0xd2ac2894,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicCollection,0x480ff4b0,0x28b2,0x11d1,0xbe,0xf7,0x0,0xc0,0x4f,0xbf,0x8f,0xef); +DEFINE_GUID(CLSID_DirectMusicCommandTrack,0xd2ac288c,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicComposer,0xd2ac2890,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicContainer,0x9301e380,0x1f22,0x11d3,0x82,0x26,0xd2,0xfa,0x76,0x25,0x5d,0x47); +DEFINE_GUID(CLSID_DirectMusicGraph,0xd2ac2884,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicChordMap,0xd2ac288f,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicChordMapTrack,0xd2ac2896,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicChordTrack,0xd2ac288b,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicLoader,0xd2ac2892,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicLyricsTrack,0x995c1cf5,0x54ff,0x11d3,0x8b,0xda,0x0,0x60,0x8,0x93,0xb1,0xb6); +DEFINE_GUID(CLSID_DirectMusicMarkerTrack,0x55a8fd00,0x4288,0x11d3,0x9b,0xd1,0x8a,0xd,0x61,0xc8,0x88,0x35); +DEFINE_GUID(CLSID_DirectMusicMelodyFormulationTrack,0xb0684266,0xb57f,0x11d2,0x97,0xf9,0x0,0xc0,0x4f,0xa3,0x6e,0x58); +DEFINE_GUID(CLSID_DirectMusicMotifTrack,0xd2ac288e,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicMuteTrack,0xd2ac2898,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicParamControlTrack,0x4be0537b,0x5c19,0x11d3,0x8b,0xdc,0x0,0x60,0x8,0x93,0xb1,0xb6); +DEFINE_GUID(CLSID_DirectMusicPatternTrack,0xd2ac2897,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicPerformance,0xd2ac2881,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicScript,0x810b5013,0xe88d,0x11d2,0x8b,0xc1,0x0,0x60,0x8,0x93,0xb1,0xb6); +DEFINE_GUID(CLSID_DirectMusicScriptTrack,0x4108fa85,0x3586,0x11d3,0x8b,0xd7,0x0,0x60,0x8,0x93,0xb1,0xb6); +DEFINE_GUID(CLSID_DirectMusicSegment,0xd2ac2882,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicSegmentState,0xd2ac2883,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicSegmentTriggerTrack,0xbae4d665,0x4ea1,0x11d3,0x8b,0xda,0x0,0x60,0x8,0x93,0xb1,0xb6); +DEFINE_GUID(CLSID_DirectMusicSeqTrack,0xd2ac2886,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicSignPostTrack,0xf17e8672,0xc3b4,0x11d1,0x87,0xb,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicSong,0xaed5f0a5,0xd972,0x483d,0xa3,0x84,0x64,0x9d,0xfe,0xb9,0xc1,0x81); +DEFINE_GUID(CLSID_DirectMusicStyle,0xd2ac288a,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicStyleTrack,0xd2ac288d,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicSynth,0x58c2b4d0,0x46e7,0x11d1,0x89,0xac,0x0,0xa0,0xc9,0x5,0x41,0x29); +DEFINE_GUID(CLSID_DirectMusicSysExTrack,0xd2ac2887,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicTempoTrack,0xd2ac2885,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicTimeSigTrack,0xd2ac2888,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(CLSID_DirectMusicWaveTrack,0xeed36461,0x9ea5,0x11d3,0x9b,0xd1,0x0,0x80,0xc7,0x15,0xa,0x74); +DEFINE_GUID(CLSID_DirectPlay,0xd1eb6d20,0x8923,0x11d0,0x9d,0x97,0x0,0xa0,0xc9,0xa,0x43,0xcb); +DEFINE_GUID(CLSID_DirectPlay8Address,0x934a9523,0xa3ca,0x4bc5,0xad,0xa0,0xd6,0xd9,0x5d,0x97,0x94,0x21); +DEFINE_GUID(CLSID_DirectPlay8Client,0x743f1dc6,0x5aba,0x429f,0x8b,0xdf,0xc5,0x4d,0x3,0x25,0x3d,0xc2); +DEFINE_GUID(CLSID_DirectPlay8LobbiedApplication,0x667955ad,0x6b3b,0x43ca,0xb9,0x49,0xbc,0x69,0xb5,0xba,0xff,0x7f); +DEFINE_GUID(CLSID_DirectPlay8LobbyClient,0x3b2b6775,0x70b6,0x45af,0x8d,0xea,0xa2,0x9,0xc6,0x95,0x59,0xf3); +DEFINE_GUID(CLSID_DirectPlay8ThreadPool,0xfc47060e,0x6153,0x4b34,0xb9,0x75,0x8e,0x41,0x21,0xeb,0x7f,0x3c); +DEFINE_GUID(CLSID_DirectPlay8NATResolver,0xe4c1d9a2,0xcbf7,0x48bd,0x9a,0x69,0x34,0xa5,0x5e,0xd,0x89,0x41); +DEFINE_GUID(CLSID_DirectPlay8Peer,0x286f484d,0x375e,0x4458,0xa2,0x72,0xb1,0x38,0xe2,0xf8,0xa,0x6a); +DEFINE_GUID(CLSID_DirectPlay8Server,0xda825e1b,0x6830,0x43d7,0x83,0x5d,0xb,0x5a,0xd8,0x29,0x56,0xa2); +DEFINE_GUID(CLSID_DirectPlayLobby,0x2fe8f810,0xb2a5,0x11d0,0xa7,0x87,0x0,0x0,0xf8,0x3,0xab,0xfc); +DEFINE_GUID(CLSID_DirectPlayVoiceClient,0xb9f3eb85,0xb781,0x4ac1,0x8d,0x90,0x93,0xa0,0x5e,0xe3,0x7d,0x7d); +DEFINE_GUID(CLSID_DirectPlayVoiceServer,0xd3f5b8e6,0x9b78,0x4a4c,0x94,0xea,0xca,0x23,0x97,0xb6,0x63,0xd3); +DEFINE_GUID(CLSID_DirectPlayVoiceTest,0xf0f094b,0xb01c,0x4091,0xa1,0x4d,0xdd,0xc,0xd8,0x7,0x71,0x1a); +DEFINE_GUID(CLSID_DirectSound,0x47d4d946,0x62e8,0x11cf,0x93,0xbc,0x44,0x45,0x53,0x54,0x0,0x0); +DEFINE_GUID(CLSID_DirectSound8,0x3901cc3f,0x84b5,0x4fa4,0xba,0x35,0xaa,0x81,0x72,0xb8,0xa0,0x9b); +DEFINE_GUID(CLSID_DirectSoundCapture,0xb0210780,0x89cd,0x11d0,0xaf,0x8,0x0,0xa0,0xc9,0x25,0xcd,0x16); +DEFINE_GUID(CLSID_DirectSoundCapture8,0xe4bcac13,0x7f99,0x4908,0x9a,0x8e,0x74,0xe3,0xbf,0x24,0xb6,0xe1); +DEFINE_GUID(CLSID_DirectSoundFullDuplex,0xfea4300c,0x7959,0x4147,0xb2,0x6a,0x23,0x77,0xb9,0xe7,0xa9,0x1d); +DEFINE_GUID(CLSID_DirectSoundWave,0x8a667154,0xf9cb,0x11d2,0xad,0x8a,0x0,0x60,0xb0,0x57,0x5a,0xbc); +// FIXME in wine include files +// DEFINE_GUID(CLSID_DirectSoundPrivate,0x11ab3ec0,0x25ec,0x11d1,0xa4,0xd8,0x00,0xc0,0x4f,0xc2,0x8a,0xca); +// DEFINE_GUID(DSPROPSETID_DirectSoundDevice,0x84624f82,0x25ec,0x11d1,0xa4,0xd8,0x00,0xc0,0x4f,0xc2,0x8a,0xca); +DEFINE_GUID(CLSID_DP8SP_IPX,0x53934290,0x628d,0x11d2,0xae,0xf,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(CLSID_DP8SP_MODEM,0x6d4a3650,0x628d,0x11d2,0xae,0xf,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(CLSID_DP8SP_SERIAL,0x743b5d60,0x628d,0x11d2,0xae,0xf,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(CLSID_DP8SP_TCPIP,0xebfe7ba0,0x628d,0x11d2,0xae,0xf,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(CLSID_DP8SP_BLUETOOTH,0x995513af,0x3027,0x4b9a,0x95,0x6e,0xc7,0x72,0xb3,0xf7,0x80,0x6); +DEFINE_GUID(DDVPTYPE_BROOKTREE,0x1352a560l,0xda61,0x11cf,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(DDVPTYPE_CCIR656,0xfca326a0l,0xda60,0x11cf,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(DDVPTYPE_E_HREFH_VREFH,0x54f39980l,0xda60,0x11cf,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(DDVPTYPE_E_HREFH_VREFL,0x92783220l,0xda60,0x11cf,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(DDVPTYPE_E_HREFL_VREFH,0xa07a02e0l,0xda60,0x11cf,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(DDVPTYPE_E_HREFL_VREFL,0xe09c77e0l,0xda60,0x11cf,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(DDVPTYPE_PHILIPS,0x332cf160l,0xda61,0x11cf,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(DPAID_ComPort,0xf2f0ce00,0xe0af,0x11cf,0x9c,0x4e,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_INet,0xc4a54da0,0xe0af,0x11cf,0x9c,0x4e,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_INetPort,0xe4524541,0x8ea5,0x11d1,0x8a,0x96,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(DPAID_INetW,0xe63232a0,0x9dbf,0x11d0,0x9c,0xc1,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_LobbyProvider,0x59b95640,0x9667,0x11d0,0xa7,0x7d,0x0,0x0,0xf8,0x3,0xab,0xfc); +DEFINE_GUID(DPAID_Modem,0xf6dcc200,0xa2fe,0x11d0,0x9c,0x4f,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_ModemW,0x1fd92e0,0xa2ff,0x11d0,0x9c,0x4f,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_Phone,0x78ec89a0,0xe0af,0x11cf,0x9c,0x4e,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_PhoneW,0xba5a7a70,0x9dbf,0x11d0,0x9c,0xc1,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_ServiceProvider,0x7d916c0,0xe0af,0x11cf,0x9c,0x4e,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPAID_TotalSize,0x1318f560,0x912c,0x11d0,0x9d,0xaa,0x0,0xa0,0xc9,0xa,0x43,0xcb); +DEFINE_GUID(DPLPROPERTY_LobbyGuid,0xf56920a0,0xd218,0x11d0,0xba,0x39,0x0,0xc0,0x4f,0xd7,0xed,0x67); +DEFINE_GUID(DPLPROPERTY_MessagesSupported,0x762ccda1,0xd916,0x11d0,0xba,0x39,0x0,0xc0,0x4f,0xd7,0xed,0x67); +DEFINE_GUID(DPLPROPERTY_PlayerGuid,0xb4319322,0xd20d,0x11d0,0xba,0x39,0x0,0xc0,0x4f,0xd7,0xed,0x67); +DEFINE_GUID(DPLPROPERTY_PlayerScore,0x48784000,0xd219,0x11d0,0xba,0x39,0x0,0xc0,0x4f,0xd7,0xed,0x67); +DEFINE_GUID(DPSPGUID_IPX,0x685bc400,0x9d2c,0x11cf,0xa9,0xcd,0x0,0xaa,0x0,0x68,0x86,0xe3); +DEFINE_GUID(DPSPGUID_TCPIP,0x36e95ee0,0x8577,0x11cf,0x96,0xc,0x0,0x80,0xc7,0x53,0x4e,0x82); +DEFINE_GUID(DPSPGUID_SERIAL,0xf1d6860,0x88d9,0x11cf,0x9c,0x4e,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPSPGUID_MODEM,0x44eaa760,0xcb68,0x11cf,0x9c,0x4e,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(DPVCTGUID_ADPCM,0x699b52c1,0xa885,0x46a8,0xa3,0x8,0x97,0x17,0x24,0x19,0xad,0xc7); +DEFINE_GUID(DPVCTGUID_GSM,0x24768c60,0x5a0d,0x11d3,0x9b,0xe4,0x52,0x54,0x0,0xd9,0x85,0xe7); +DEFINE_GUID(DPVCTGUID_NONE,0x8de12fd4,0x7cb3,0x48ce,0xa7,0xe8,0x9c,0x47,0xa2,0x2e,0x8a,0xc5); +DEFINE_GUID(DPVCTGUID_SC03,0x7d82a29b,0x2242,0x4f82,0x8f,0x39,0x5d,0x11,0x53,0xdf,0x3e,0x41); +DEFINE_GUID(DPVCTGUID_SC06,0x53def900,0x7168,0x4633,0xb4,0x7f,0xd1,0x43,0x91,0x6a,0x13,0xc7); +DEFINE_GUID(DPVCTGUID_TRUESPEECH,0xd7954361,0x5a0b,0x11d3,0x9b,0xe4,0x52,0x54,0x0,0xd9,0x85,0xe7); +DEFINE_GUID(DPVCTGUID_VR12,0xfe44a9fe,0x8ed4,0x48bf,0x9d,0x66,0x1b,0x1a,0xdf,0xf9,0xff,0x6d); +DEFINE_GUID(DS3DALG_HRTF_FULL,0xc2413340,0x1c1b,0x11d2,0x94,0xf5,0x0,0xc0,0x4f,0xc2,0x8a,0xca); +DEFINE_GUID(DS3DALG_HRTF_LIGHT,0xc2413342,0x1c1b,0x11d2,0x94,0xf5,0x0,0xc0,0x4f,0xc2,0x8a,0xca); +DEFINE_GUID(DS3DALG_NO_VIRTUALIZATION,0xc241333f,0x1c1b,0x11d2,0x94,0xf5,0x0,0xc0,0x4f,0xc2,0x8a,0xca); +DEFINE_GUID(DSDEVID_DefaultCapture,0xdef00001,0x9c6d,0x47ed,0xaa,0xf1,0x4d,0xda,0x8f,0x2b,0x5c,0x03); +DEFINE_GUID(DSDEVID_DefaultPlayback,0xdef00000,0x9c6d,0x47ed,0xaa,0xf1,0x4d,0xda,0x8f,0x2b,0x5c,0x03); +DEFINE_GUID(DSDEVID_DefaultVoiceCapture,0xdef00003,0x9c6d,0x47ed,0xaa,0xf1,0x4d,0xda,0x8f,0x2b,0x5c,0x03); +DEFINE_GUID(DSDEVID_DefaultVoicePlayback,0xdef00002,0x9c6d,0x47ed,0xaa,0xf1,0x4d,0xda,0x8f,0x2b,0x5c,0x03); +DEFINE_GUID(GUID_All_Objects,0xaa114de5,0xc262,0x4169,0xa1,0xc8,0x23,0xd6,0x98,0xcc,0x73,0xb5); +DEFINE_GUID(GUID_BandParam,0x2bb1938,0xcb8b,0x11d2,0x8b,0xb9,0x0,0x60,0x8,0x93,0xb1,0xb6); +DEFINE_GUID(GUID_Buffer_3D_Dry,0x186cc546,0xdb29,0x11d3,0x9b,0xd1,0x0,0x80,0xc7,0x15,0xa,0x74); +DEFINE_GUID(GUID_Buffer_EnvReverb,0x186cc542,0xdb29,0x11d3,0x9b,0xd1,0x0,0x80,0xc7,0x15,0xa,0x74); +DEFINE_GUID(GUID_Buffer_Mono,0x186cc547,0xdb29,0x11d3,0x9b,0xd1,0x0,0x80,0xc7,0x15,0xa,0x74); +DEFINE_GUID(GUID_Buffer_Reverb,0x186cc541,0xdb29,0x11d3,0x9b,0xd1,0x0,0x80,0xc7,0x15,0xa,0x74); +DEFINE_GUID(GUID_Buffer_Stereo,0x186cc545,0xdb29,0x11d3,0x9b,0xd1,0x0,0x80,0xc7,0x15,0xa,0x74); +DEFINE_GUID(GUID_Button,0xa36d02f0,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Clear_All_Bands,0xd2ac28ab,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_Clear_All_MelodyFragments,0x8509fee6,0xb617,0x11d2,0x97,0xfa,0x0,0xc0,0x4f,0xa3,0x6e,0x58); +DEFINE_GUID(GUID_ColorControlCallbacks,0xefd60cc2,0x49e7,0x11d0,0x88,0x9d,0x0,0xaa,0x0,0xbb,0xb7,0x6a); +DEFINE_GUID(GUID_CommandParam,0xd2ac289d,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_CommandParam2,0x28f97ef7,0x9538,0x11d2,0x97,0xa9,0x0,0xc0,0x4f,0xa3,0x6e,0x58); +DEFINE_GUID(GUID_CommandParamNext,0x472afe7a,0x281b,0x11d3,0x81,0x7d,0x0,0xc0,0x4f,0xa3,0x6e,0x58); +DEFINE_GUID(GUID_ConnectToDLSCollection,0x1db1ae6b,0xe92e,0x11d1,0xa8,0xc5,0x0,0xc0,0x4f,0xa3,0x72,0x6e); +DEFINE_GUID(GUID_ConstantForce,0x13541c20,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_CustomForce,0x13541c2b,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_D3DCallbacks2,0xba584e1,0x70b6,0x11d0,0x88,0x9d,0x0,0xaa,0x0,0xbb,0xb7,0x6a); +DEFINE_GUID(GUID_D3DCallbacks3,0xddf41230,0xec0a,0x11d0,0xa9,0xb6,0x0,0xaa,0x0,0xc0,0x99,0x3e); +DEFINE_GUID(GUID_D3DExtendedCaps,0x7de41f80,0x9d93,0x11d0,0x89,0xab,0x0,0xa0,0xc9,0x5,0x41,0x29); +DEFINE_GUID(GUID_D3DParseUnknownCommandCallback,0x2e04ffa0,0x98e4,0x11d1,0x8c,0xe1,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(GUID_Damper,0x13541c28,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_DDMoreCaps,0x880baf30,0xb030,0x11d0,0x8e,0xa7,0x0,0x60,0x97,0x97,0xea,0x5b); +DEFINE_GUID(GUID_DDMoreSurfaceCaps,0x3b8a0466,0xf269,0x11d1,0x88,0xb,0x0,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(GUID_DDStereoMode,0xf828169c,0xa8e8,0x11d2,0xa1,0xf2,0x0,0xa0,0xc9,0x83,0xea,0xf6); +DEFINE_GUID(GUID_DefaultGMCollection,0xf17e8673,0xc3b4,0x11d1,0x87,0xb,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_DirectDrawPaletteStream,0x730c7ffc,0x5347,0x11d1,0x8c,0x4d,0x0,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(GUID_DirectDrawSurfaceStream,0xe043bc46,0x5317,0x11d1,0x8c,0x4d,0x0,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(GUID_DirectMusicAllTypes,0xd2ac2893,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_Disable_Auto_Download,0xd2ac28aa,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_DisableTempo,0x45fc707d,0x1db4,0x11d2,0xbc,0xac,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(GUID_DisableTimeSig,0x45fc707b,0x1db4,0x11d2,0xbc,0xac,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(GUID_DMUS_PROP_DLS1,0x178f2f27,0xc364,0x11d1,0xa7,0x60,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_DMUS_PROP_DLS2,0xf14599e5,0x4689,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(GUID_DMUS_PROP_Effects,0xcda8d611,0x684a,0x11d2,0x87,0x1e,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_DMUS_PROP_GM_Hardware,0x178f2f24,0xc364,0x11d1,0xa7,0x60,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_DMUS_PROP_GS_Capable,0x6496aba2,0x61b0,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(GUID_DMUS_PROP_GS_Hardware,0x178f2f25,0xc364,0x11d1,0xa7,0x60,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_DMUS_PROP_INSTRUMENT2,0x865fd372,0x9f67,0x11d2,0x87,0x2a,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_DMUS_PROP_LegacyCaps,0xcfa7cdc2,0x00a1,0x11d2,0xaa,0xd5,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_DMUS_PROP_MemorySize,0x178f2f28,0xc364,0x11d1,0xa7,0x60,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_DMUS_PROP_SampleMemorySize,0x178f2f28,0xc364,0x11d1,0xa7,0x60,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_DMUS_PROP_SamplePlaybackRate,0x2a91f713,0xa4bf,0x11d2,0xbb,0xdf,0x0,0x60,0x8,0x33,0xdb,0xd8); +DEFINE_GUID(GUID_DMUS_PROP_SynthSink_DSOUND,0xaa97844,0xc877,0x11d1,0x87,0xc,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_DMUS_PROP_SynthSink_WAVE,0xaa97845,0xc877,0x11d1,0x87,0xc,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_DMUS_PROP_Volume,0xfedfae25l,0xe46e,0x11d1,0xaa,0xce,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_DMUS_PROP_WavesReverb,0x4cb5622,0x32e5,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(GUID_DMUS_PROP_WriteLatency,0x268a0fa0,0x60f2,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(GUID_DMUS_PROP_WritePeriod,0x268a0fa1,0x60f2,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(GUID_DMUS_PROP_XG_Capable,0x6496aba1,0x61b0,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(GUID_DMUS_PROP_XG_Hardware,0x178f2f26,0xc364,0x11d1,0xa7,0x60,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(GUID_Download,0xd2ac28a7,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_DownloadToAudioPath,0x9f2c0341,0xc5c4,0x11d3,0x9b,0xd1,0x44,0x45,0x53,0x54,0x0,0x0); +DEFINE_GUID(GUID_DSCFX_CLASS_AEC,0xbf963d80l,0xc559,0x11d0,0x8a,0x2b,0x00,0xa0,0xc9,0x25,0x5a,0xc1); +DEFINE_GUID(GUID_DSCFX_CLASS_NS,0xe07f903f,0x62fd,0x4e60,0x8c,0xdd,0xde,0xa7,0x23,0x66,0x65,0xb5); +DEFINE_GUID(GUID_DSCFX_MS_AEC,0xcdebb919,0x379a,0x488a,0x87,0x65,0xf5,0x3c,0xfd,0x36,0xde,0x40); +DEFINE_GUID(GUID_DSCFX_MS_NS,0x11c5c73b,0x66e9,0x4ba1,0xa0,0xba,0xe8,0x14,0xc6,0xee,0xd9,0x2d); +DEFINE_GUID(GUID_DSCFX_SYSTEM_AEC,0x1c22c56d,0x9879,0x4f5b,0xa3,0x89,0x27,0x99,0x6d,0xdc,0x28,0x10); +DEFINE_GUID(GUID_DSCFX_SYSTEM_NS,0x5ab0882e,0x7274,0x4516,0x87,0x7d,0x4e,0xee,0x99,0xba,0x4f,0xd0); +DEFINE_GUID(GUID_DSFX_STANDARD_COMPRESSOR,0xef011f79,0x4000,0x406d,0x87,0xaf,0xbf,0xfb,0x3f,0xc3,0x9d,0x57); +DEFINE_GUID(GUID_DSFX_STANDARD_DISTORTION,0xef114c90,0xcd1d,0x484e,0x96,0xe5,0x09,0xcf,0xaf,0x91,0x2a,0x21); +DEFINE_GUID(GUID_DSFX_STANDARD_ECHO,0xef3e932c,0xd40b,0x4f51,0x8c,0xcf,0x3f,0x98,0xf1,0xb2,0x9d,0x5d); +DEFINE_GUID(GUID_DSFX_STANDARD_FLANGER,0xefca3d92,0xdfd8,0x4672,0xa6,0x03,0x74,0x20,0x89,0x4b,0xad,0x98); +DEFINE_GUID(GUID_DSFX_STANDARD_GARGLE,0xdafd8210,0x5711,0x4b91,0x9f,0xe3,0xf7,0x5b,0x7a,0xe2,0x79,0xbf); +DEFINE_GUID(GUID_DSFX_STANDARD_CHORUS,0xefe6629c,0x81f7,0x4281,0xbd,0x91,0xc9,0xd6,0x04,0xa9,0x5a,0xf6); +DEFINE_GUID(GUID_DSFX_STANDARD_I3DL2REVERB,0xef985e71,0xd5c7,0x42d4,0xba,0x4d,0x2d,0x07,0x3e,0x2e,0x96,0xf4); +DEFINE_GUID(GUID_DSFX_STANDARD_PARAMEQ,0x120ced89,0x3bf4,0x4173,0xa1,0x32,0x3c,0xb4,0x06,0xcf,0x32,0x31); +DEFINE_GUID(GUID_DSFX_WAVES_REVERB,0x87fc0268,0x9a55,0x4360,0x95,0xaa,0x00,0x4a,0x1d,0x9d,0xe2,0x6c); +DEFINE_GUID(GUID_Enable_Auto_Download,0xd2ac28a9,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_EnableTempo,0x45fc707e,0x1db4,0x11d2,0xbc,0xac,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(GUID_EnableTimeSig,0x45fc707c,0x1db4,0x11d2,0xbc,0xac,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(GUID_Friction,0x13541c2a,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_HIDClass,0x745a17a0,0x74d3,0x11d0,0xb6,0xfe,0x00,0xa0,0xc9,0x0f,0x57,0xda); +DEFINE_GUID(GUID_ChordParam,0xd2ac289e,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_IDirectMusicBand,0xd2ac28ac,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_IDirectMusicChordMap,0xd2ac28ad,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_IDirectMusicStyle,0xd2ac28a1,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_Inertia,0x13541c29,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_Joystick,0x6f1d2b70,0xd5a0,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_KernelCallbacks,0x80863800,0x6b06,0x11d0,0x9b,0x6,0x0,0xa0,0xc9,0x3,0xa3,0xb8); +DEFINE_GUID(GUID_KernelCaps,0xffaa7540,0x7aa8,0x11d0,0x9b,0x6,0x0,0xa0,0xc9,0x3,0xa3,0xb8); +DEFINE_GUID(GUID_Key,0x55728220,0xd33c,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_KeyboardClass,0x4d36e96b,0xe325,0x11ce,0xbf,0xc1,0x08,0x00,0x2b,0xe1,0x03,0x18); +DEFINE_GUID(GUID_MediaClass,0x4d36e96c,0xe325,0x11ce,0xbf,0xc1,0x08,0x00,0x2b,0xe1,0x03,0x18); +DEFINE_GUID(GUID_MelodyFragment,0xb291c7f2,0xb616,0x11d2,0x97,0xfa,0x0,0xc0,0x4f,0xa3,0x6e,0x58); +DEFINE_GUID(GUID_Miscellaneous2Callbacks,0x406b2f00,0x3e5a,0x11d1,0xb6,0x40,0x0,0xaa,0x0,0xa1,0xf9,0x6a); +DEFINE_GUID(GUID_MiscellaneousCallbacks,0xefd60cc0,0x49e7,0x11d0,0x88,0x9d,0x0,0xaa,0x0,0xbb,0xb7,0x6a); +DEFINE_GUID(GUID_MotionCompCallbacks,0xb1122b40,0x5da5,0x11d1,0x8f,0xcf,0x0,0xc0,0x4f,0xc2,0x9b,0x4e); +DEFINE_GUID(GUID_MouseClass,0x4d36e96f,0xe325,0x11ce,0xbf,0xc1,0x08,0x00,0x2b,0xe1,0x03,0x18); +DEFINE_GUID(GUID_MuteParam,0xd2ac28af,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_NonLocalVidMemCaps,0x86c4fa80,0x8d84,0x11d0,0x94,0xe8,0x0,0xc0,0x4f,0xc3,0x41,0x37); +DEFINE_GUID(GUID_NOTIFICATION_COMMAND,0xd2ac289c,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_NOTIFICATION_CHORD,0xd2ac289b,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_NOTIFICATION_MEASUREANDBEAT,0xd2ac289a,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_NOTIFICATION_PERFORMANCE,0x81f75bc5,0x4e5d,0x11d2,0xbc,0xc7,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(GUID_NOTIFICATION_RECOMPOSE,0xd348372b,0x945b,0x45ae,0xa5,0x22,0x45,0xf,0x12,0x5b,0x84,0xa5); +DEFINE_GUID(GUID_NOTIFICATION_SEGMENT,0xd2ac2899,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_NTCallbacks,0x6fe9ecde,0xdf89,0x11d1,0x9d,0xb0,0,0x60,0x8,0x27,0x71,0xba); +DEFINE_GUID(GUID_OptSurfaceKmodeInfo,0xe05c8472,0x51d4,0x11d1,0x8c,0xce,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(GUID_OptSurfaceUmodeInfo,0x9d792804,0x5fa8,0x11d1,0x8c,0xd0,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(GUID_PerfAutoDownload,0xfb09565b,0x3631,0x11d2,0xbc,0xb8,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(GUID_PerfMasterGrooveLevel,0xd2ac28b2,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_PerfMasterTempo,0xd2ac28b0,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_PerfMasterVolume,0xd2ac28b1,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_Play_Marker,0xd8761a41,0x801a,0x11d3,0x9b,0xd1,0xda,0xf7,0xe1,0xc3,0xd8,0x34); +DEFINE_GUID(GUID_POV,0xa36d02f2,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RampForce,0x13541c21,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_RhythmParam,0xd2ac289f,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_RxAxis,0xa36d02f4,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RyAxis,0xa36d02f5,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RzAxis,0xa36d02e3,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SawtoothDown,0x13541c26,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_SawtoothUp,0x13541c25,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_SeedVariations,0x65b76fa5,0xff37,0x11d2,0x81,0x4e,0x0,0xc0,0x4f,0xa3,0x6e,0x58); +DEFINE_GUID(GUID_Sine,0x13541c23,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_Slider,0xa36d02e4,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Spring,0x13541c27,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_Square,0x13541c22,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_StandardMIDIFile,0x6621075,0xe92e,0x11d1,0xa8,0xc5,0x0,0xc0,0x4f,0xa3,0x72,0x6e); +DEFINE_GUID(GUID_Synth_Default,0x26bb9432,0x45fe,0x48d3,0xa3,0x75,0x24,0x72,0xc5,0xe3,0xe7,0x86); +DEFINE_GUID(GUID_SysKeyboard,0x6f1d2b61,0xd5a0,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm,0x6f1d2b82,0xd5a0,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm2,0x6f1d2b83,0xd5a0,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouse,0x6f1d2b60,0xd5a0,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm,0x6f1d2b80,0xd5a0,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm2,0x6f1d2b81,0xd5a0,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_TempoParam,0xd2ac28a5,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_TimeSignature,0xd2ac28a4,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_Triangle,0x13541c24,0x8e33,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(GUID_Unknown,0xa36d02f3,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Unload,0xd2ac28a8,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(GUID_UnloadFromAudioPath,0x9f2c0342,0xc5c4,0x11d3,0x9b,0xd1,0x44,0x45,0x53,0x54,0x0,0x0); +DEFINE_GUID(GUID_UserModeDriverInfo,0xf0b0e8e2,0x5f97,0x11d1,0x8c,0xd0,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(GUID_UserModeDriverPassword,0x97f861b6,0x60a1,0x11d1,0x8c,0xd0,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(GUID_Valid_Start_Time,0x7f6b1760,0x1fdb,0x11d3,0x82,0x26,0x44,0x45,0x53,0x54,0x0,0x0); +DEFINE_GUID(GUID_Variations,0x11f72cce,0x26e6,0x4ecd,0xaf,0x2e,0xd6,0x68,0xe6,0x67,0x7,0xd8); +DEFINE_GUID(GUID_VideoPortCallbacks,0xefd60cc1,0x49e7,0x11d0,0x88,0x9d,0x0,0xaa,0x0,0xbb,0xb7,0x6a); +DEFINE_GUID(GUID_VideoPortCaps,0xefd60cc3,0x49e7,0x11d0,0x88,0x9d,0x0,0xaa,0x0,0xbb,0xb7,0x6a); +DEFINE_GUID(GUID_XAxis,0xa36d02e0,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_YAxis,0xa36d02e1,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZAxis,0xa36d02e2,0xc9f3,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZPixelFormats,0x93869880,0x36cf,0x11d1,0x9b,0x1b,0x0,0xaa,0x0,0xbb,0xb8,0xae); +DEFINE_GUID(IID_ID3DXAnimationController,0x3a714d34,0xff61,0x421e,0x90,0x9f,0x63,0x9f,0x38,0x35,0x67,0x8); +DEFINE_GUID(IID_ID3DXAnimationMixer,0x5eec992b,0x1046,0x44f6,0x92,0x4b,0xd1,0x75,0x96,0xb0,0x48,0x3e); +DEFINE_GUID(IID_ID3DXAnimationSet,0x54b569ac,0xaef,0x473e,0x97,0x4,0x3f,0xef,0x31,0x7f,0x64,0xab); +DEFINE_GUID(IID_ID3DXBaseMesh,0x2a835771,0xbf4d,0x43f4,0x8e,0x14,0x82,0xa8,0x9,0xf1,0x7d,0x8a); +DEFINE_GUID(IID_ID3DXBuffer,0x932e6a7e,0xc68e,0x45dd,0xa7,0xbf,0x53,0xd1,0x9c,0x86,0xdb,0x1f); +DEFINE_GUID(IID_ID3DXEffect,0x648b1ceb,0x8d4e,0x4d66,0xb6,0xfa,0xe4,0x49,0x69,0xe8,0x2e,0x89); +DEFINE_GUID(IID_ID3DXEffectCompiler,0xf8ee90d3,0xfcc6,0x4f14,0x8a,0xe8,0x63,0x74,0xae,0x96,0x8e,0x33); +DEFINE_GUID(IID_ID3DXEffectPool,0x53ca7768,0xc0d0,0x4664,0x8e,0x79,0xd1,0x56,0xe4,0xf5,0xb7,0xe0); +DEFINE_GUID(IID_ID3DXInterpolator,0xade2c06d,0x3747,0x4b9f,0xa5,0x14,0x34,0x40,0xb8,0x28,0x49,0x80); +DEFINE_GUID(IID_ID3DXKeyFrameInterpolator,0x6caa71f8,0x972,0x4cdb,0xa5,0x5b,0x43,0xb9,0x68,0x99,0x75,0x15); +DEFINE_GUID(IID_ID3DXMatrixStack,0xe3357330,0xcc5e,0x11d2,0xa4,0x34,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(IID_ID3DXMesh,0xccae5c3b,0x4dd1,0x4d0f,0x99,0x7e,0x46,0x84,0xca,0x64,0x55,0x7f); +DEFINE_GUID(IID_ID3DXPMesh,0x19fbe386,0xc282,0x4659,0x97,0xbd,0xcb,0x86,0x9b,0x8,0x4a,0x6c); +DEFINE_GUID(IID_ID3DXSkinMesh,0x8db06ecc,0xebfc,0x408a,0x94,0x4,0x30,0x74,0xb4,0x77,0x35,0x15); +DEFINE_GUID(IID_ID3DXSPMesh,0x4e3ca05c,0xd4ff,0x4d11,0x8a,0x2,0x16,0x45,0x9e,0x8,0xf6,0xf4); +DEFINE_GUID(IID_ID3DXTechnique,0xa00f378d,0xaf79,0x4917,0x90,0x7e,0x4d,0x63,0x5e,0xe6,0x38,0x44); +DEFINE_GUID(IID_IDDVideoPortContainer,0x6c142760,0xa733,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirect3D,0x3bba0080,0x2421,0x11cf,0xa3,0x1a,0x00,0xaa,0x00,0xb9,0x33,0x56); +DEFINE_GUID(IID_IDirect3D2,0x6aae1ec1,0x662a,0x11d0,0x88,0x9d,0x00,0xaa,0x00,0xbb,0xb7,0x6a); +DEFINE_GUID(IID_IDirect3D3,0xbb223240,0xe72b,0x11d0,0xa9,0xb4,0x00,0xaa,0x00,0xc0,0x99,0x3e); +DEFINE_GUID(IID_IDirect3D7,0xf5049e77,0x4861,0x11d2,0xa4,0x7,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(IID_IDirect3D8,0x1dd9e8da,0x1c77,0x4d40,0xb0,0xcf,0x98,0xfe,0xfd,0xff,0x95,0x12); +DEFINE_GUID(IID_IDirect3D9, 0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c); +DEFINE_GUID(IID_IDirect3DBaseTexture8,0xb4211cfa,0x51b9,0x4a9f,0xab,0x78,0xdb,0x99,0xb2,0xbb,0x67,0x8e); +DEFINE_GUID(IID_IDirect3DBaseTexture9, 0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce); +DEFINE_GUID(IID_IDirect3DCubeTexture8,0x3ee5b968,0x2aca,0x4c34,0x8b,0xb5,0x7e,0x0c,0x3d,0x19,0xb7,0x50); +DEFINE_GUID(IID_IDirect3DCubeTexture9, 0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f); +DEFINE_GUID(IID_IDirect3DDevice,0x64108800,0x957d,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DDevice2,0x93281501,0x8cf8,0x11d0,0x89,0xab,0x0,0xa0,0xc9,0x5,0x41,0x29); +DEFINE_GUID(IID_IDirect3DDevice3,0xb0ab3b60,0x33d7,0x11d1,0xa9,0x81,0x0,0xc0,0x4f,0xd7,0xb1,0x74); +DEFINE_GUID(IID_IDirect3DDevice7,0xf5049e79,0x4861,0x11d2,0xa4,0x7,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(IID_IDirect3DDevice8,0x7385e5df,0x8fe8,0x41d5,0x86,0xb6,0xd7,0xb4,0x85,0x47,0xb6,0xcf); +DEFINE_GUID(IID_IDirect3DDevice9, 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb); +DEFINE_GUID(IID_IDirect3DExecuteBuffer,0x4417c145,0x33ad,0x11cf,0x81,0x6f,0x00,0x00,0xc0,0x20,0x15,0x6e); +DEFINE_GUID(IID_IDirect3DHALDevice,0x84e63de0,0x46aa,0x11cf,0x81,0x6f,0x00,0x00,0xc0,0x20,0x15,0x6e); +DEFINE_GUID(IID_IDirect3DIndexBuffer8,0x0e689c9a,0x053d,0x44a0,0x9d,0x92,0xdb,0x0e,0x3d,0x75,0x0f,0x86); +DEFINE_GUID(IID_IDirect3DIndexBuffer9, 0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35); +DEFINE_GUID(IID_IDirect3DLight,0x4417c142,0x33ad,0x11cf,0x81,0x6f,0x00,0x00,0xc0,0x20,0x15,0x6e); +DEFINE_GUID(IID_IDirect3DMaterial,0x4417c144,0x33ad,0x11cf,0x81,0x6f,0x00,0x00,0xc0,0x20,0x15,0x6e); +DEFINE_GUID(IID_IDirect3DMaterial2,0x93281503,0x8cf8,0x11d0,0x89,0xab,0x0,0xa0,0xc9,0x5,0x41,0x29); +DEFINE_GUID(IID_IDirect3DMaterial3,0xca9c46f4,0xd3c5,0x11d1,0xb7,0x5a,0x0,0x60,0x8,0x52,0xb3,0x12); +DEFINE_GUID(IID_IDirect3DMMXDevice,0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29); +DEFINE_GUID(IID_IDirect3DNullDevice,0x8767df22,0xbacc,0x11d1,0x89,0x69,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(IID_IDirect3DPixelShader9, 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89); +DEFINE_GUID(IID_IDirect3DQuery9, 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc); +DEFINE_GUID(IID_IDirect3DResource9, 0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4); +DEFINE_GUID(IID_IDirect3DRampDevice,0xf2086b20,0x259f,0x11cf,0xa3,0x1a,0x00,0xaa,0x00,0xb9,0x33,0x56); +DEFINE_GUID(IID_IDirect3DRefDevice,0x50936643,0x13e9,0x11d1,0x89,0xaa,0x0,0xa0,0xc9,0x5,0x41,0x29); +DEFINE_GUID(IID_IDirect3DResource8,0x1b36bb7b,0x9b7,0x410a,0xb4,0x45,0x7d,0x14,0x30,0xd7,0xb3,0x3f); +DEFINE_GUID(IID_IDirect3DRGBDevice,0xa4665c60,0x2673,0x11cf,0xa3,0x1a,0x00,0xaa,0x00,0xb9,0x33,0x56); +DEFINE_GUID(IID_IDirect3DRM,0x2bc49361,0x8327,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRM2,0x4516ecc8,0x8f20,0x11d0,0x9b,0x6d,0x00,0x00,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRM3,0x4516ec83,0x8f20,0x11d0,0x9b,0x6d,0x00,0x00,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMAnimation,0xeb16cb0d,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimation2,0xff6b7f77,0xa40e,0x11d1,0x91,0xf9,0x0,0x0,0xf8,0x75,0x8e,0x66); +DEFINE_GUID(IID_IDirect3DRMAnimationArray,0xd5f1cae0,0x4bd7,0x11d1,0xb9,0x74,0x0,0x60,0x8,0x3e,0x45,0xf3); +DEFINE_GUID(IID_IDirect3DRMAnimationSet,0xeb16cb0e,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationSet2,0xff6b7f79,0xa40e,0x11d1,0x91,0xf9,0x0,0x0,0xf8,0x75,0x8e,0x66); +DEFINE_GUID(IID_IDirect3DRMClippedVisual,0x5434e733,0x6d66,0x11d1,0xbb,0xb,0x0,0x0,0xf8,0x75,0x86,0x5a); +DEFINE_GUID(IID_IDirect3DRMDevice,0xe9e19280,0x6e05,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMDevice2,0x4516ec78,0x8f20,0x11d0,0x9b,0x6d,0x00,0x00,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMDevice3,0x549f498b,0xbfeb,0x11d1,0x8e,0xd8,0x0,0xa0,0xc9,0x67,0xa4,0x82); +DEFINE_GUID(IID_IDirect3DRMDeviceArray,0xeb16cb10,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMFace,0xeb16cb07,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMFace2,0x4516ec81,0x8f20,0x11d0,0x9b,0x6d,0x00,0x00,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMFaceArray,0xeb16cb17,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMFrame,0xeb16cb03,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMFrame2,0xc3dfbd60,0x3988,0x11d0,0x9e,0xc2,0x0,0x0,0xc0,0x29,0x1a,0xc3); +DEFINE_GUID(IID_IDirect3DRMFrame3,0xff6b7f70,0xa40e,0x11d1,0x91,0xf9,0x0,0x0,0xf8,0x75,0x8e,0x66); +DEFINE_GUID(IID_IDirect3DRMFrameArray,0xeb16cb12,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMInterpolator,0x242f6bc1,0x3849,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMLight,0xeb16cb08,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMLightArray,0xeb16cb14,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial,0xeb16cb0b,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial2,0xff6b7f75,0xa40e,0x11d1,0x91,0xf9,0x0,0x0,0xf8,0x75,0x8e,0x66); +DEFINE_GUID(IID_IDirect3DRMMesh,0xa3a80d01,0x6e12,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder,0xa3a80d02,0x6e12,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder2,0x4516ec77,0x8f20,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder3,0x4516ec82,0x8f20,0x11d0,0x9b,0x6d,0x00,0x00,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMObject,0xeb16cb00,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMObject2,0x4516ec7c,0x8f20,0x11d0,0x9b,0x6d,0x00,0x00,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMObjectArray,0x242f6bc2,0x3849,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMPicked2Array,0x4516ec7b,0x8f20,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMPickedArray,0xeb16cb16,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMProgressiveMesh,0x4516ec79,0x8f20,0x11d0,0x9b,0x6d,0x0,0x0,0xc0,0x78,0x1b,0xc3); +DEFINE_GUID(IID_IDirect3DRMShadow,0xaf359780,0x6ba3,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow2,0x86b44e25,0x9c82,0x11d1,0xbb,0xb,0x0,0xa0,0xc9,0x81,0xa0,0xa6); +DEFINE_GUID(IID_IDirect3DRMTexture,0xeb16cb09,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture2,0x120f30c0,0x1629,0x11d0,0x94,0x1c,0x0,0x80,0xc8,0xc,0xfa,0x7b); +DEFINE_GUID(IID_IDirect3DRMTexture3,0xff6b7f73,0xa40e,0x11d1,0x91,0xf9,0x0,0x0,0xf8,0x75,0x8e,0x66); +DEFINE_GUID(IID_IDirect3DRMUserVisual,0x59163de0,0x6d43,0x11cf,0xac,0x4a,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMViewport,0xeb16cb02,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMViewport2,0x4a1b1be6,0xbfed,0x11d1,0x8e,0xd8,0x0,0xa0,0xc9,0x67,0xa4,0x82); +DEFINE_GUID(IID_IDirect3DRMViewportArray,0xeb16cb11,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMVisual,0xeb16cb04,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMVisualArray,0xeb16cb13,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMWinDevice,0xc5016cc0,0xd273,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DRMWrap,0xeb16cb0a,0xd271,0x11ce,0xac,0x48,0x0,0x0,0xc0,0x38,0x25,0xa1); +DEFINE_GUID(IID_IDirect3DStateBlock9,0xb07c4fe5,0x310d,0x4ba8,0xa2,0x3c,0x4f,0xf,0x20,0x6f,0x21,0x8b); +DEFINE_GUID(IID_IDirect3DSurface8,0xb96eebca,0xb326,0x4ea5,0x88,0x2f,0x2f,0xf5,0xba,0xe0,0x21,0xdd); +DEFINE_GUID(IID_IDirect3DSurface9,0xcfbaf3a,0x9ff6,0x429a,0x99,0xb3,0xa2,0x79,0x6a,0xf8,0xb8,0x9b); +DEFINE_GUID(IID_IDirect3DSwapChain8,0x928c088b,0x76b9,0x4c6b,0xa5,0x36,0xa5,0x90,0x85,0x38,0x76,0xcd); +DEFINE_GUID(IID_IDirect3DSwapChain9,0x794950f2,0xadfc,0x458a,0x90,0x5e,0x10,0xa1,0xb,0xb,0x50,0x3b); +DEFINE_GUID(IID_IDirect3DTexture,0x2cdcd9e0,0x25a0,0x11cf,0xa3,0x1a,0x00,0xaa,0x00,0xb9,0x33,0x56); +DEFINE_GUID(IID_IDirect3DTexture2,0x93281502,0x8cf8,0x11d0,0x89,0xab,0x0,0xa0,0xc9,0x5,0x41,0x29); +DEFINE_GUID(IID_IDirect3DTexture8,0xe4cdd575,0x2866,0x4f01,0xb1,0x2e,0x7e,0xec,0xe1,0xec,0x93,0x58); +DEFINE_GUID(IID_IDirect3DTexture9,0x85c31227,0x3de5,0x4f00,0x9b,0x3a,0xf1,0x1a,0xc3,0x8c,0x18,0xb5); +DEFINE_GUID(IID_IDirect3DTnLHalDevice,0xf5049e78,0x4861,0x11d2,0xa4,0x7,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(IID_IDirect3DVertexBuffer,0x7a503555,0x4a83,0x11d1,0xa5,0xdb,0x0,0xa0,0xc9,0x3,0x67,0xf8); +DEFINE_GUID(IID_IDirect3DVertexBuffer7,0xf5049e7d,0x4861,0x11d2,0xa4,0x7,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(IID_IDirect3DVertexBuffer8,0x8aeeeac7,0x05f9,0x44d4,0xb5,0x91,0x00,0x0b,0x0d,0xf1,0xcb,0x95); +DEFINE_GUID(IID_IDirect3DVertexBuffer9,0xb64bb1b5,0xfd70,0x4df6,0xbf,0x91,0x19,0xd0,0xa1,0x24,0x55,0xe3); +DEFINE_GUID(IID_IDirect3DVertexDeclaration9,0xdd13c59c,0x36fa,0x4098,0xa8,0xfb,0xc7,0xed,0x39,0xdc,0x85,0x46); +DEFINE_GUID(IID_IDirect3DVertexShader9,0xefc5557e,0x6265,0x4613,0x8a,0x94,0x43,0x85,0x78,0x89,0xeb,0x36); +DEFINE_GUID(IID_IDirect3DViewport,0x4417c146,0x33ad,0x11cf,0x81,0x6f,0x00,0x00,0xc0,0x20,0x15,0x6e); +DEFINE_GUID(IID_IDirect3DViewport2,0x93281500,0x8cf8,0x11d0,0x89,0xab,0x0,0xa0,0xc9,0x5,0x41,0x29); +DEFINE_GUID(IID_IDirect3DViewport3,0xb0ab3b61,0x33d7,0x11d1,0xa9,0x81,0x0,0xc0,0x4f,0xd7,0xb1,0x74); +DEFINE_GUID(IID_IDirect3DVolume8,0xbd7349f5,0x14f1,0x42e4,0x9c,0x79,0x97,0x23,0x80,0xdb,0x40,0xc0); +DEFINE_GUID(IID_IDirect3DVolume9,0x24f416e6,0x1f67,0x4aa7,0xb8,0x8e,0xd3,0x3f,0x6f,0x31,0x28,0xa1); +DEFINE_GUID(IID_IDirect3DVolumeTexture8,0x4b8aaafa,0x140f,0x42ba,0x91,0x31,0x59,0x7e,0xaf,0xaa,0x2e,0xad); +DEFINE_GUID(IID_IDirect3DVolumeTexture9,0x2518526c,0xe789,0x4111,0xa7,0xb9,0x47,0xef,0x32,0x8d,0x13,0xe6); +DEFINE_GUID(IID_IDirectDraw,0x6c14db80,0xa733,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectDraw2,0xb3a6f3e0,0x2b43,0x11cf,0xa2,0xde,0x00,0xaa,0x00,0xb9,0x33,0x56); +DEFINE_GUID(IID_IDirectDraw4,0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(IID_IDirectDraw7,0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b); +DEFINE_GUID(IID_IDirectDrawClipper,0x6c14db85,0xa733,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectDrawColorControl,0x4b9f0ee0,0x0d7e,0x11d0,0x9b,0x06,0x00,0xa0,0xc9,0x03,0xa3,0xb8); +DEFINE_GUID(IID_IDirectDrawFactory2,0x89b2c488,0x4af4,0x11d1,0x8c,0x4c,0x0,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(IID_IDirectDrawGammaControl,0x69c11c3e,0xb46b,0x11d1,0xad,0x7a,0x00,0xc0,0x4f,0xc2,0x9b,0x4e); +DEFINE_GUID(IID_IDirectDrawOptSurface,0x51191f1e,0x4f2b,0x11d1,0x8c,0xc3,0x0,0xa0,0xc9,0x6,0x29,0xa8); +DEFINE_GUID(IID_IDirectDrawPalette,0x6c14db84,0xa733,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectDrawPalette2,0xc03c477e,0x6519,0x11d1,0x8c,0x52,0x0,0xc0,0x4f,0xd9,0x30,0xc5); +DEFINE_GUID(IID_IDirectDrawSurface,0x6c14db81,0xa733,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectDrawSurface2,0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27); +DEFINE_GUID(IID_IDirectDrawSurface3,0xda044e00,0x69b2,0x11d0,0xa1,0xd5,0x00,0xaa,0x00,0xb8,0xdf,0xbb); +DEFINE_GUID(IID_IDirectDrawSurface4,0x0b2b8630,0xad35,0x11d0,0x8e,0xa6,0x00,0x60,0x97,0x97,0xea,0x5b); +DEFINE_GUID(IID_IDirectDrawSurface7,0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b); +//IID_IDirectDrawSurfaceNew +DEFINE_GUID(IID_IDirectDrawVideoPort,0xb36d93e0,0x2b43,0x11cf,0xa2,0xde,0x00,0xaa,0x00,0xb9,0x33,0x56); +DEFINE_GUID(IID_IDirectDrawVideoPortNotify,0xa655fb94,0x0589,0x4e57,0xb3,0x33,0x56,0x7a,0x89,0x46,0x8c,0x88); +DEFINE_GUID(IID_IDirectInput2A,0x5944e662,0xaa8a,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2W,0x5944e663,0xaa8a,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput7A,0x9a4cb684,0x236d,0x11d3,0x8e,0x9d,0x00,0xc0,0x4f,0x68,0x44,0xae); +DEFINE_GUID(IID_IDirectInput7W,0x9a4cb685,0x236d,0x11d3,0x8e,0x9d,0x00,0xc0,0x4f,0x68,0x44,0xae); +DEFINE_GUID(IID_IDirectInput8A,0xbf798030,0x483a,0x4da2,0xaa,0x99,0x5d,0x64,0xed,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInput8W,0xbf798031,0x483a,0x4da2,0xaa,0x99,0x5d,0x64,0xed,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInputA,0x89521360,0xaa8a,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2A,0x5944e682,0xc92e,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2W,0x5944e683,0xc92e,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice7A,0x57d7c6bc,0x2356,0x11d3,0x8e,0x9d,0x00,0xc0,0x4f,0x68,0x44,0xae); +DEFINE_GUID(IID_IDirectInputDevice7W,0x57d7c6bd,0x2356,0x11d3,0x8e,0x9d,0x00,0xc0,0x4f,0x68,0x44,0xae); +DEFINE_GUID(IID_IDirectInputDevice8A,0x54d41080,0xdc15,0x4833,0xa4,0x1b,0x74,0x8f,0x73,0xa3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDevice8W,0x54d41081,0xdc15,0x4833,0xa4,0x1b,0x74,0x8f,0x73,0xa3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDeviceA,0x5944e680,0xc92e,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW,0x5944e681,0xc92e,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputEffect,0xe7e1f7c0,0x88d2,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(IID_IDirectInputEffectDriver,0x02538130,0x898f,0x11d0,0x9a,0xd0,0x00,0xa0,0xc9,0xa0,0x6e,0x35); +DEFINE_GUID(IID_IDirectInputJoyConfig,0x1de12ab1,0xc9f5,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputJoyConfig8,0xeb0d7dfa,0x1990,0x4f27,0xb4,0xd6,0xed,0xf2,0xee,0xc4,0xa4,0x4c); +DEFINE_GUID(IID_IDirectInputPIDDriver,0xeec6993a,0xb3fd,0x11d2,0xa9,0x16,0x00,0xc0,0x4f,0xb9,0x86,0x38); +DEFINE_GUID(IID_IDirectInputW,0x89521361,0xaa8a,0x11cf,0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectMusic,0x6536115a,0x7b2d,0x11d2,0xba,0x18,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(IID_IDirectMusic2,0x6fc2cae1, 0xbc78, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusic8,0x2d3629f7,0x813d,0x4939,0x85,0x08,0xf0,0x5c,0x6b,0x75,0xfd,0x97); +DEFINE_GUID(IID_IDirectMusicAudioPath,0xc87631f5, 0x23be, 0x4986, 0x88, 0x36, 0x5, 0x83, 0x2f, 0xcc, 0x48, 0xf9); +DEFINE_GUID(IID_IDirectMusicBand,0xd2ac28c0, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicBuffer,0xd2ac2878, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicCollection,0xd2ac287c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicComposer,0xd2ac28bf,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicContainer,0x9301e386,0x1f22,0x11d3,0x82,0x26,0xd2,0xfa,0x76,0x25,0x5d,0x47); +DEFINE_GUID(IID_IDirectMusicDownload,0xd2ac287b,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicDownloadedInstrument,0xd2ac287e,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicGetLoader,0x68a04844,0xd13d,0x11d1,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(IID_IDirectMusicGraph,0x2befc277,0x5497,0x11d2,0xbc,0xcb,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(IID_IDirectMusicChordMap,0xd2ac28be,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicInstrument,0xd2ac287d,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicLoader,0x2ffaaca2,0x5dca,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(IID_IDirectMusicLoader8,0x19e7c08c,0xa44,0x4e6a,0xa1,0x16,0x59,0x5a,0x7c,0xd5,0xde,0x8c); +DEFINE_GUID(IID_IDirectMusicObject,0xd2ac28b5,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicPatternTrack,0x51c22e10,0xb49f,0x46fc,0xbe,0xc2,0xe6,0x28,0x8f,0xb9,0xed,0xe6); +DEFINE_GUID(IID_IDirectMusicPerformance,0x7d43d03,0x6523,0x11d2,0x87,0x1d,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicPerformance2,0x6fc2cae0,0xbc78,0x11d2,0xaf,0xa6,0x0,0xaa,0x0,0x24,0xd8,0xb6); +DEFINE_GUID(IID_IDirectMusicPerformance8,0x679c4137,0xc62e,0x4147,0xb2,0xb4,0x9d,0x56,0x9a,0xcb,0x25,0x4c); +DEFINE_GUID(IID_IDirectMusicPort,0x08f2d8c9,0x37c2,0x11d2,0xb9,0xf9,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(IID_IDirectMusicPortDownload,0xd2ac287a,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicScript,0x2252373a,0x5814,0x489b,0x82,0x9,0x31,0xfe,0xde,0xba,0xf1,0x37);/*{2252373a-5814-489b-8209-31fedebaf137}*/ +DEFINE_GUID(IID_IDirectMusicSegment,0xf96029a2,0x4282,0x11d2,0x87,0x17,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicSegment2,0xd38894d1,0xc052,0x11d2,0x87,0x2f,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicSegment8,0xc6784488,0x41a3,0x418f,0xaa,0x15,0xb3,0x50,0x93,0xba,0x42,0xd4); +DEFINE_GUID(IID_IDirectMusicSegmentState,0xa3afdcc7,0xd3ee,0x11d1,0xbc,0x8d,0x0,0xa0,0xc9,0x22,0xe6,0xeb); +DEFINE_GUID(IID_IDirectMusicSegmentState8,0xa50e4730,0xae4,0x48a7,0x98,0x39,0xbc,0x4,0xbf,0xe0,0x77,0x72); +DEFINE_GUID(IID_IDirectMusicSong,0xa862b2ec,0x3676,0x4982,0x85,0xa,0x78,0x42,0x77,0x5e,0x1d,0x86); +DEFINE_GUID(IID_IDirectMusicStyle,0xd2ac28bd,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicStyle8,0xfd24ad8a,0xa260,0x453d,0xbf,0x50,0x6f,0x93,0x84,0xf7,0x9,0x85); +DEFINE_GUID(IID_IDirectMusicThru,0xced153e7,0x3606,0x11d2,0xb9,0xf9,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(IID_IDirectMusicTool,0xd2ac28ba,0xb39b,0x11d1,0x87,0x4,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicTrack,0xf96029a1,0x4282,0x11d2,0x87,0x17,0x0,0x60,0x8,0x93,0xb1,0xbd); +DEFINE_GUID(IID_IDirectMusicTool8,0xe674303,0x3b05,0x11d3,0x9b,0xd1,0xf9,0xe7,0xf0,0xa0,0x15,0x36); +DEFINE_GUID(IID_IDirectMusicTrack8,0xe674304,0x3b05,0x11d3,0x9b,0xd1,0xf9,0xe7,0xf0,0xa0,0x15,0x36); +DEFINE_GUID(IID_IDirectPlay,0x5454e9a0,0xdb65,0x11ce,0x92,0x1c,0x00,0xaa,0x00,0x6c,0x49,0x72); +DEFINE_GUID(IID_IDirectPlay2,0x2b74f7c0,0x9154,0x11cf,0xa9,0xcd,0x0,0xaa,0x0,0x68,0x86,0xe3); +DEFINE_GUID(IID_IDirectPlay2A,0x9d460580,0xa822,0x11cf,0x96,0xc,0x0,0x80,0xc7,0x53,0x4e,0x82); +DEFINE_GUID(IID_IDirectPlay3,0x133efe40,0x32dc,0x11d0,0x9c,0xfb,0x0,0xa0,0xc9,0xa,0x43,0xcb); +DEFINE_GUID(IID_IDirectPlay3A,0x133efe41,0x32dc,0x11d0,0x9c,0xfb,0x0,0xa0,0xc9,0xa,0x43,0xcb); +DEFINE_GUID(IID_IDirectPlay4,0xab1c530,0x4745,0x11d1,0xa7,0xa1,0x0,0x0,0xf8,0x3,0xab,0xfc); +DEFINE_GUID(IID_IDirectPlay4A,0xab1c531,0x4745,0x11d1,0xa7,0xa1,0x0,0x0,0xf8,0x3,0xab,0xfc); +DEFINE_GUID(IID_IDirectPlay8Address,0x83783300,0x4063,0x4c8a,0x9d,0xb3,0x82,0x83,0xa,0x7f,0xeb,0x31); +DEFINE_GUID(IID_IDirectPlay8AddressIP,0xe5a0e990,0x2bad,0x430b,0x87,0xda,0xa1,0x42,0xcf,0x75,0xde,0x58); +DEFINE_GUID(IID_IDirectPlay8Client,0x5102dacd,0x241b,0x11d3,0xae,0xa7,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(IID_IDirectPlay8LobbiedApplication,0x819074a3,0x16c,0x11d3,0xae,0x14,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(IID_IDirectPlay8LobbyClient,0x819074a2,0x16c,0x11d3,0xae,0x14,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(IID_IDirectPlay8NATResolver,0xa9e213f2,0x9a60,0x486f,0xbf,0x3b,0x53,0x40,0x8b,0x6d,0x1c,0xbb); +DEFINE_GUID(IID_IDirectPlay8Peer,0x5102dacf,0x241b,0x11d3,0xae,0xa7,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(IID_IDirectPlay8Server,0x5102dace,0x241b,0x11d3,0xae,0xa7,0x0,0x60,0x97,0xb0,0x14,0x11); +DEFINE_GUID(IID_IDirectPlay8ThreadPool,0xd22ee73,0x4a46,0x4a0d,0x89,0xb2,0x4,0x5b,0x4d,0x66,0x64,0x25); +DEFINE_GUID(IID_IDirectPlayLobby,0xaf465c71,0x9588,0x11cf,0xa0,0x20,0x0,0xaa,0x0,0x61,0x57,0xac); +DEFINE_GUID(IID_IDirectPlayLobby2,0x194c220,0xa303,0x11d0,0x9c,0x4f,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(IID_IDirectPlayLobby2A,0x1bb4af80,0xa303,0x11d0,0x9c,0x4f,0x0,0xa0,0xc9,0x5,0x42,0x5e); +DEFINE_GUID(IID_IDirectPlayLobby3,0x2db72490,0x652c,0x11d1,0xa7,0xa8,0x0,0x0,0xf8,0x3,0xab,0xfc); +DEFINE_GUID(IID_IDirectPlayLobby3A,0x2db72491,0x652c,0x11d1,0xa7,0xa8,0x0,0x0,0xf8,0x3,0xab,0xfc); +DEFINE_GUID(IID_IDirectPlayLobbyA,0x26c66a70,0xb367,0x11cf,0xa0,0x24,0x0,0xaa,0x0,0x61,0x57,0xac); +DEFINE_GUID(IID_IDirectPlayVoiceClient,0x1dfdc8ea,0xbcf7,0x41d6,0xb2,0x95,0xab,0x64,0xb3,0xb2,0x33,0x6); +DEFINE_GUID(IID_IDirectPlayVoiceServer,0xfaa1c173,0x468,0x43b6,0x8a,0x2a,0xea,0x8a,0x4f,0x20,0x76,0xc9); +DEFINE_GUID(IID_IDirectPlayVoiceTest,0xd26af734,0x208b,0x41da,0x82,0x24,0xe0,0xce,0x79,0x81,0xb,0xe1); +DEFINE_GUID(IID_IDirectSound,0x279afa83,0x4981,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectSound3DBuffer,0x279afa86,0x4981,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectSound3DListener,0x279afa84,0x4981,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectSound8,0xc50a7e93,0xf395,0x4834,0x9e,0xf6,0x7f,0xa9,0x9d,0xe5,0x09,0x66); +DEFINE_GUID(IID_IDirectSoundBuffer,0x279afa85,0x4981,0x11ce,0xa5,0x21,0x00,0x20,0xaf,0x0b,0xe5,0x60); +DEFINE_GUID(IID_IDirectSoundBuffer8,0x6825a449,0x7524,0x4d82,0x92,0x0f,0x50,0xe3,0x6a,0xb3,0xab,0x1e); +DEFINE_GUID(IID_IDirectSoundCapture,0xb0210781,0x89cd,0x11d0,0xaf,0x8,0x0,0xa0,0xc9,0x25,0xcd,0x16); +DEFINE_GUID(IID_IDirectSoundCaptureBuffer,0xb0210782,0x89cd,0x11d0,0xaf,0x8,0x0,0xa0,0xc9,0x25,0xcd,0x16); +DEFINE_GUID(IID_IDirectSoundCaptureBuffer8,0x990df4,0xdbb,0x4872,0x83,0x3e,0x6d,0x30,0x3e,0x80,0xae,0xb6); +DEFINE_GUID(IID_IDirectSoundCaptureFXAec,0xad74143d,0x903d,0x4ab7,0x80,0x66,0x28,0xd3,0x63,0x03,0x6d,0x65); +DEFINE_GUID(IID_IDirectSoundCaptureFXNoiseSuppress,0xed311e41,0xfbae,0x4175,0x96,0x25,0xcd,0x8,0x54,0xf6,0x93,0xca); +DEFINE_GUID(IID_IDirectSoundFullDuplex,0xedcb4c7a,0xdaab,0x4216,0xa4,0x2e,0x6c,0x50,0x59,0x6d,0xdc,0x1d); +DEFINE_GUID(IID_IDirectSoundFXCompressor,0x4bbd1154,0x62f6,0x4e2c,0xa1,0x5c,0xd3,0xb6,0xc4,0x17,0xf7,0xa0); +DEFINE_GUID(IID_IDirectSoundFXDistortion,0x8ecf4326,0x455f,0x4d8b,0xbd,0xa9,0x8d,0x5d,0x3e,0x9e,0x3e,0x0b); +DEFINE_GUID(IID_IDirectSoundFXEcho,0x8bd28edf,0x50db,0x4e92,0xa2,0xbd,0x44,0x54,0x88,0xd1,0xed,0x42); +DEFINE_GUID(IID_IDirectSoundFXFlanger,0x903e9878,0x2c92,0x4072,0x9b,0x2c,0xea,0x68,0xf5,0x39,0x67,0x83); +DEFINE_GUID(IID_IDirectSoundFXGargle,0xd616f352,0xd622,0x11ce,0xaa,0xc5,0x00,0x20,0xaf,0x0b,0x99,0xa3); +DEFINE_GUID(IID_IDirectSoundFXChorus,0x880842e3,0x145f,0x43e6,0xa9,0x34,0xa7,0x18,0x06,0xe5,0x05,0x47); +DEFINE_GUID(IID_IDirectSoundFXI3DL2Reverb,0x4b166a6a,0x0d66,0x43f3,0x80,0xe3,0xee,0x62,0x80,0xde,0xe1,0xa4); +DEFINE_GUID(IID_IDirectSoundFXParamEq,0xc03ca9fe,0xfe90,0x4204,0x80,0x78,0x82,0x33,0x4c,0xd1,0x77,0xda); +DEFINE_GUID(IID_IDirectSoundFXWavesReverb,0x46858c3a,0x0dc6,0x45e3,0xb7,0x60,0xd4,0xee,0xf1,0x6c,0xb3,0x25); +DEFINE_GUID(IID_IDirectSoundNotify,0xb0210783,0x89cd,0x11d0,0xaf,0x8,0x0,0xa0,0xc9,0x25,0xcd,0x16); +DEFINE_GUID(IID_IDirectXFile,0x3d82ab40,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(IID_IDirectXFileBinary,0x3d82ab46,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(IID_IDirectXFileData,0x3d82ab44,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(IID_IDirectXFileDataReference,0x3d82ab45,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(IID_IDirectXFileEnumObject,0x3d82ab41,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(IID_IDirectXFileObject,0x3d82ab43,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(IID_IDirectXFileSaveObject,0x3d82ab42,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(IID_IKsControl,0x28f54685l,0x06fd,0x11d2,0xb2,0x7a,0x00,0xa0,0xc9,0x22,0x31,0x96); +DEFINE_GUID(IID_IKsFastClock,0xc9902485,0xc180,0x11d2,0x84,0x73,0xd4,0x23,0x94,0x45,0x9e,0x5e); +DEFINE_GUID(IID_IKsPropertySet,0x31efac30,0x515c,0x11d0,0xa9,0xaa,0x00,0xaa,0x00,0x61,0xbe,0x93); +DEFINE_GUID(IID_IReferenceClock,0x56a86897,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(KSDATAFORMAT_SUBTYPE_DIRECTMUSIC,0x1a82f8bc,0x3f8b,0x11d2,0xb7,0x74,0x00,0x60,0x08,0x33,0x16,0xc1); +DEFINE_GUID(KSDATAFORMAT_SUBTYPE_MIDI,0x1d262760l,0xe957,0x11cf,0xa5,0xd6,0x28,0xdb,0x04,0xc1,0x00,0x00); +DEFINE_GUID(TID_D3DRMAnimation,0x3d82ab4f,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMAnimationKey,0x10dd46a8,0x775b,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMAnimationOptions,0xe2bf56c0,0x840f,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMAnimationSet,0x3d82ab50,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMAppData,0xe5745280,0xb24f,0x11cf,0x9d,0xd5,0x0,0xaa,0x0,0xa7,0x1a,0x2f); +DEFINE_GUID(TID_D3DRMBoolean,0x537da6a0,0xca37,0x11d0,0x94,0x1c,0x0,0x80,0xc8,0xc,0xfa,0x7b); +DEFINE_GUID(TID_D3DRMBoolean2d,0x4885ae63,0x78e8,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMCamera,0x3d82ab51,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMColorRGB,0xd3e16e81,0x7835,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMColorRGBA,0x35ff44e0,0x6c7c,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMCoords2d,0xf6f23f44,0x7686,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMExternalVisual,0x98116aa0,0xbdba,0x11d1,0x82,0xc0,0x00,0xa0,0xc9,0x69,0x72,0x71); +DEFINE_GUID(TID_D3DRMFloatKeys,0x10dd46a9,0x775b,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMFrame,0x3d82ab46,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMFramePosition,0xe2bf56c1,0x840f,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMFrameRotation,0xe2bf56c3,0x840f,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMFrameTransformMatrix,0xf6f23f41,0x7686,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMFrameVelocity,0xe2bf56c2,0x840f,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMGuid,0xa42790e0,0x7810,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMIndexedColor,0x1630b820,0x7842,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMInfo,0x2b957100,0x9e9a,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMInlineData,0x3a23eea0,0x94b1,0x11d0,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMLight,0x3d82ab4a,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMLightAttenuation,0xa8a98ba0,0xc5e5,0x11cf,0xb9,0x41,0x0,0x80,0xc8,0xc,0xfa,0x7b); +DEFINE_GUID(TID_D3DRMLightPenumbra,0xaed22741,0xb31f,0x11cf,0x9d,0xd5,0x0,0xaa,0x0,0xa7,0x1a,0x2f); +DEFINE_GUID(TID_D3DRMLightRange,0xaed22742,0xb31f,0x11cf,0x9d,0xd5,0x0,0xaa,0x0,0xa7,0x1a,0x2f); +DEFINE_GUID(TID_D3DRMLightUmbra,0xaed22740,0xb31f,0x11cf,0x9d,0xd5,0x0,0xaa,0x0,0xa7,0x1a,0x2f); +DEFINE_GUID(TID_D3DRMMaterial,0x3d82ab4d,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMMaterialAmbientColor,0x01411840,0x7786,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMaterialArray,0x35ff44e1,0x6c7c,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMaterialDiffuseColor,0x01411841,0x7786,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMaterialEmissiveColor,0xd3e16e80,0x7835,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMaterialPower,0x01411843,0x7786,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMaterialSpecularColor,0x01411842,0x7786,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMaterialWrap,0x4885ae60,0x78e8,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMatrix4x4,0xf6f23f45,0x7686,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMesh,0x3d82ab44,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMMeshFace,0x3d82ab5f,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMMeshFaceWraps,0xed1ec5c0,0xc0a8,0x11d0,0x94,0x1c,0x0,0x80,0xc8,0xc,0xfa,0x7b); +DEFINE_GUID(TID_D3DRMMeshMaterialList,0xf6f23f42,0x7686,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMeshNormals,0xf6f23f43,0x7686,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMeshTextureCoords,0xf6f23f40,0x7686,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMMeshVertexColors,0x1630b821,0x7842,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMProgressiveMesh,0x8a63c360,0x997d,0x11d0,0x94,0x1c,0x0,0x80,0xc8,0x0c,0xfa,0x7b); +DEFINE_GUID(TID_D3DRMPropertyBag,0x7f0f21e1,0xbfe1,0x11d1,0x82,0xc0,0x0,0xa0,0xc9,0x69,0x72,0x71); +DEFINE_GUID(TID_D3DRMRightHanded,0x7f5d5ea0,0xd53a,0x11d1,0x82,0xc0,0x0,0xa0,0xc9,0x69,0x72,0x71); +DEFINE_GUID(TID_D3DRMStringProperty,0x7f0f21e0,0xbfe1,0x11d1,0x82,0xc0,0x0,0xa0,0xc9,0x69,0x72,0x71); +DEFINE_GUID(TID_D3DRMTextureFilename,0xa42790e1,0x7810,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMTextureReference,0xa42790e2,0x7810,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMTimedFloatKeys,0xf406b180,0x7b3b,0x11cf,0x8f,0x52,0x0,0x40,0x33,0x35,0x94,0xa3); +DEFINE_GUID(TID_D3DRMUrl,0x3a23eea1,0x94b1,0x11d0,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_D3DRMVector,0x3d82ab5e,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); +DEFINE_GUID(TID_DXFILEHeader,0x3d82ab43,0x62da,0x11cf,0xab,0x39,0x0,0x20,0xaf,0x71,0xe4,0x33); diff --git a/reactos/lib/dxguid/makefile b/reactos/lib/dxguid/makefile new file mode 100644 index 00000000000..bf89c258e7e --- /dev/null +++ b/reactos/lib/dxguid/makefile @@ -0,0 +1,26 @@ +# $Id: makefile,v 1.1 2004/11/29 00:14:38 greatlrd Exp $ + +PATH_TO_TOP = ../.. + +TARGET_DEFONLY = yes + +TARGET_TYPE = library + +TARGET_NAME = dxguid + +TARGET_CFLAGS = -D__REACTOS__ + +# require os code to explicitly request A/W version of structs/functions +TARGET_CFLAGS += -D_DISABLE_TIDENTS -Werror -Wall + +TARGET_LFLAGS = -Wl + +TARGET_OBJECTS = \ + dxguid-mingw.o + + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# EOF \ No newline at end of file