From 6cd359bc934d2abb3a77ae7e0ae2725d6aa2af85 Mon Sep 17 00:00:00 2001 From: Robert Riggs Date: Thu, 10 Dec 1998 09:08:48 +0000 Subject: [PATCH] Stubs for IDirectInputEffect and IDirectInputDevice2A methods, as well as AddRef(), GetCapabilites(), EnumObjects(), GetProperty(), GetObjectInfo(), GetDeviceInfo(), Initialize(), and RunControlPanel() for IDirectInputDevice. --- include/dinput.h | 155 ++++++++++++++++++++++++++++++++- windows/dinput.c | 217 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 355 insertions(+), 17 deletions(-) diff --git a/include/dinput.h b/include/dinput.h index a29c2a5cbb6..03978e2f0da 100644 --- a/include/dinput.h +++ b/include/dinput.h @@ -58,6 +58,7 @@ DEFINE_GUID(GUID_CustomForce, 0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9, typedef struct IDirectInput32A IDirectInput32A,*LPDIRECTINPUT32A; typedef struct IDirectInputDevice32A IDirectInputDevice32A,*LPDIRECTINPUTDEVICE32A; +typedef struct IDirectInputEffect IDirectInputEffect,*LPDIRECTINPUTEFFECT; typedef struct SysKeyboard32A SysKeyboard32A,*LPSYSKEYBOARD32A; typedef struct SysMouse32A SysMouse32A,*LPSYSMOUSE32A; @@ -236,6 +237,8 @@ typedef BOOL32 (CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACK32A)(LPCDIDEVICEOBJECTIN typedef BOOL32 (CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACK32W)(LPCDIDEVICEOBJECTINSTANCE32W,LPVOID); DECL_WINELIB_TYPE_AW(LPDIENUMDEVICEOBJECTSCALLBACK) +typedef BOOL32 (CALLBACK * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID); + #define DIK_ESCAPE 0x01 #define DIK_1 0x02 #define DIK_2 0x03 @@ -529,6 +532,144 @@ typedef struct DIDEVCAPS { #define DISCL_FOREGROUND 0x00000004 #define DISCL_BACKGROUND 0x00000008 +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 { + 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, *LPDIEFFECT; + +typedef const DIEFFECT *LPCDIEFFECT; + +typedef struct DIEFFECTINFOA { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + CHAR tszName[MAX_PATH]; +} DIEFFECTINFOA, *LPDIEFFECTINFOA; + +typedef struct DIEFFECTINFOW { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + WCHAR tszName[MAX_PATH]; +} DIEFFECTINFOW, *LPDIEFFECTINFOW; + +#ifdef UNICODE +typedef DIEFFECTINFOW DIEFFECTINFO; +typedef LPDIEFFECTINFOW LPDIEFFECTINFO; +#else +typedef DIEFFECTINFOA DIEFFECTINFO; +typedef LPDIEFFECTINFOA LPDIEFFECTINFO; +#endif + +typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA; +typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW; +typedef const DIEFFECTINFO *LPCDIEFFECTINFO; + +typedef BOOL32 (CALLBACK * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID); +typedef BOOL32 (CALLBACK * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID); + +typedef struct DIEFFESCAPE { + DWORD dwSize; + DWORD dwCommand; + LPVOID lpvInBuffer; + DWORD cbInBuffer; + LPVOID lpvOutBuffer; + DWORD cbOutBuffer; +} DIEFFESCAPE, *LPDIEFFESCAPE; + +#define THIS LPDIRECTINPUTEFFECT this +typedef struct IDirectInputEffect_VTable { + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectInputEffect methods ***/ + STDMETHOD(Initialize)(THIS_ HINSTANCE32,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; +} IDirectInputEffect_VTable,*LPDIRECTINPUTEFFECT_VTABLE; +#undef THIS + +struct IDirectInputEffect { + LPDIRECTINPUTEFFECT_VTABLE lpvtbl; + DWORD ref; + GUID guid; +}; + #define THIS LPDIRECTINPUTDEVICE32A this typedef struct IDirectInputDeviceA_VTable { /*** IUnknown methods ***/ @@ -552,7 +693,19 @@ typedef struct IDirectInputDeviceA_VTable { STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCE32A) PURE; STDMETHOD(RunControlPanel)(THIS_ HWND32,DWORD) PURE; STDMETHOD(Initialize)(THIS_ HINSTANCE32,DWORD,REFGUID) PURE; -} IDirectInputDeviceA_VTable,*LPDIRECTINPUTDEVICEA_VTABLE; + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + +} IDirectInputDeviceA_VTable,*LPDIRECTINPUTDEVICEA_VTABLE, + IDirectInputDevice2A_VTable,*LPDIRECTINPUTDEVICE2A_VTABLE; struct IDirectInputDevice32A { LPDIRECTINPUTDEVICEA_VTABLE lpvtbl; diff --git a/windows/dinput.c b/windows/dinput.c index d2db6d0938b..1679ccb5057 100644 --- a/windows/dinput.c +++ b/windows/dinput.c @@ -418,9 +418,176 @@ static HRESULT WINAPI IDirectInputDeviceA_QueryInterface( *ppobj = this; return 0; } + if (!memcmp(&IID_IDirectInputDevice2A,riid,sizeof(*riid))) { + this->lpvtbl->fnAddRef(this); + *ppobj = this; + return 0; + } return E_FAIL; } +static ULONG WINAPI IDirectInputDeviceA_AddRef( + LPDIRECTINPUTDEVICE32A this) +{ + return ++this->ref; +} + +static HRESULT WINAPI IDirectInputDeviceA_GetCapabilities( + LPDIRECTINPUTDEVICE32A this, + LPDIDEVCAPS lpDIDevCaps) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDeviceA_EnumObjects( + LPDIRECTINPUTDEVICE32A this, + LPDIENUMDEVICEOBJECTSCALLBACK32A lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME(dinput, "stub!\n"); + if (lpCallback) + lpCallback(NULL, lpvRef); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDeviceA_GetProperty( + LPDIRECTINPUTDEVICE32A this, + REFGUID rguid, + LPDIPROPHEADER pdiph) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDeviceA_GetObjectInfo( + LPDIRECTINPUTDEVICE32A this, + LPDIDEVICEOBJECTINSTANCE32A pdidoi, + DWORD dwObj, + DWORD dwHow) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDeviceA_GetDeviceInfo( + LPDIRECTINPUTDEVICE32A this, + LPDIDEVICEINSTANCE32A pdidi) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDeviceA_RunControlPanel( + LPDIRECTINPUTDEVICE32A this, + HWND32 hwndOwner, + DWORD dwFlags) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDeviceA_Initialize( + LPDIRECTINPUTDEVICE32A this, + HINSTANCE32 hinst, + DWORD dwVersion, + REFGUID rguid) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +/****************************************************************************** + * IDirectInputDevice2A + */ + +static HRESULT WINAPI IDirectInputDevice2A_CreateEffect( + LPDIRECTINPUTDEVICE32A this, + REFGUID rguid, + LPCDIEFFECT lpeff, + LPDIRECTINPUTEFFECT *ppdef, + LPUNKNOWN pUnkOuter) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_EnumEffects( + LPDIRECTINPUTDEVICE32A this, + LPDIENUMEFFECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME(dinput, "stub!\n"); + if (lpCallback) + lpCallback(NULL, lpvRef); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_GetEffectInfo( + LPDIRECTINPUTDEVICE32A this, + LPDIEFFECTINFOA lpdei, + REFGUID rguid) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_GetForceFeedbackState( + LPDIRECTINPUTDEVICE32A this, + LPDWORD pdwOut) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_SendForceFeedbackCommand( + LPDIRECTINPUTDEVICE32A this, + DWORD dwFlags) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_EnumCreatedEffectObjects( + LPDIRECTINPUTDEVICE32A this, + LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + FIXME(dinput, "stub!\n"); + if (lpCallback) + lpCallback(NULL, lpvRef); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_Escape( + LPDIRECTINPUTDEVICE32A this, + LPDIEFFESCAPE lpDIEEsc) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_Poll( + LPDIRECTINPUTDEVICE32A this) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + +static HRESULT WINAPI IDirectInputDevice2A_SendDeviceData( + LPDIRECTINPUTDEVICE32A this, + DWORD cbObjectData, + LPDIDEVICEOBJECTDATA rgdod, + LPDWORD pdwInOut, + DWORD dwFlags) +{ + FIXME(dinput, "stub!\n"); + return DI_OK; +} + /****************************************************************************** * SysMouseA (DInput Mouse support) */ @@ -537,11 +704,11 @@ static HRESULT WINAPI SysMouseA_GetDeviceState( static IDirectInputDeviceA_VTable SysKeyboardAvt={ IDirectInputDeviceA_QueryInterface, - (void*)2, + IDirectInputDeviceA_AddRef, IDirectInputDeviceA_Release, - (void*)4, - (void*)5, - (void*)6, + IDirectInputDeviceA_GetCapabilities, + IDirectInputDeviceA_EnumObjects, + IDirectInputDeviceA_GetProperty, SysKeyboardA_SetProperty, SysKeyboardA_Acquire, SysKeyboardA_Unacquire, @@ -550,19 +717,28 @@ static IDirectInputDeviceA_VTable SysKeyboardAvt={ IDirectInputDeviceA_SetDataFormat, IDirectInputDeviceA_SetEventNotification, IDirectInputDeviceA_SetCooperativeLevel, - (void*)15, - (void*)16, - (void*)17, - (void*)18, + IDirectInputDeviceA_GetObjectInfo, + IDirectInputDeviceA_GetDeviceInfo, + IDirectInputDeviceA_RunControlPanel, + IDirectInputDeviceA_Initialize, + IDirectInputDevice2A_CreateEffect, + IDirectInputDevice2A_EnumEffects, + IDirectInputDevice2A_GetEffectInfo, + IDirectInputDevice2A_GetForceFeedbackState, + IDirectInputDevice2A_SendForceFeedbackCommand, + IDirectInputDevice2A_EnumCreatedEffectObjects, + IDirectInputDevice2A_Escape, + IDirectInputDevice2A_Poll, + IDirectInputDevice2A_SendDeviceData, }; static IDirectInputDeviceA_VTable SysMouseAvt={ IDirectInputDeviceA_QueryInterface, - (void*)2, + IDirectInputDeviceA_AddRef, IDirectInputDeviceA_Release, - (void*)4, - (void*)5, - (void*)6, + IDirectInputDeviceA_GetCapabilities, + IDirectInputDeviceA_EnumObjects, + IDirectInputDeviceA_GetProperty, IDirectInputDeviceA_SetProperty, IDirectInputDeviceA_Acquire, IDirectInputDeviceA_Unacquire, @@ -571,8 +747,17 @@ static IDirectInputDeviceA_VTable SysMouseAvt={ SysMouseA_SetDataFormat, IDirectInputDeviceA_SetEventNotification, IDirectInputDeviceA_SetCooperativeLevel, - (void*)15, - (void*)16, - (void*)17, - (void*)18, + IDirectInputDeviceA_GetObjectInfo, + IDirectInputDeviceA_GetDeviceInfo, + IDirectInputDeviceA_RunControlPanel, + IDirectInputDeviceA_Initialize, + IDirectInputDevice2A_CreateEffect, + IDirectInputDevice2A_EnumEffects, + IDirectInputDevice2A_GetEffectInfo, + IDirectInputDevice2A_GetForceFeedbackState, + IDirectInputDevice2A_SendForceFeedbackCommand, + IDirectInputDevice2A_EnumCreatedEffectObjects, + IDirectInputDevice2A_Escape, + IDirectInputDevice2A_Poll, + IDirectInputDevice2A_SendDeviceData, };