From d2d08f0c28ae09f0f0a3623d5fcc432306f341a9 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Fri, 14 Jun 2002 00:39:44 +0000 Subject: [PATCH] - support DirectInput 8 interfaces. - implemented mouse wheel support. --- configure | 3 +- configure.ac | 1 + dlls/Makefile.in | 7 + dlls/dinput/device.c | 76 ++++-- dlls/dinput/device_private.h | 59 +++-- dlls/dinput/dinput_main.c | 141 ++++++++---- dlls/dinput/dinput_private.h | 8 +- dlls/dinput/joystick/linux.c | 109 ++++----- dlls/dinput/joystick/linuxinput.c | 107 +++------ dlls/dinput/keyboard/main.c | 92 +++----- dlls/dinput/mouse/main.c | 224 ++++++++++-------- dlls/dinput8/.cvsignore | 3 + dlls/dinput8/Makefile.in | 18 ++ dlls/dinput8/dinput8.spec | 7 + dlls/dinput8/dinput8_main.c | 82 +++++++ include/d3dtypes.h | 3 + include/dinput.h | 370 +++++++++++++++++++++++++++++- 17 files changed, 894 insertions(+), 416 deletions(-) create mode 100644 dlls/dinput8/.cvsignore create mode 100644 dlls/dinput8/Makefile.in create mode 100644 dlls/dinput8/dinput8.spec create mode 100644 dlls/dinput8/dinput8_main.c diff --git a/configure b/configure index 7feef27a76f..04eb09b19df 100755 --- a/configure +++ b/configure @@ -13125,7 +13125,7 @@ MAKE_DLL_RULES=dlls/Makedll.rules MAKE_PROG_RULES=programs/Makeprog.rules -ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules programs/Makeprog.rules Makefile debugger/Makefile dlls/Makefile dlls/advapi32/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/gdi/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/netapi32/Makefile dlls/ntdll/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/user/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winspool/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile library/Makefile miscemu/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/regtest/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineconsole/Makefile programs/winefile/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wrc/Makefile tsx11/Makefile unicode/Makefile" +ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules programs/Makeprog.rules Makefile debugger/Makefile dlls/Makefile dlls/advapi32/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/gdi/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/netapi32/Makefile dlls/ntdll/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/user/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winspool/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile library/Makefile miscemu/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/regtest/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineconsole/Makefile programs/winefile/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wrc/Makefile tsx11/Makefile unicode/Makefile" cat >confcache <<\_ACEOF @@ -13620,6 +13620,7 @@ do "dlls/ddraw/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/ddraw/Makefile" ;; "dlls/devenum/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/devenum/Makefile" ;; "dlls/dinput/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dinput/Makefile" ;; + "dlls/dinput8/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dinput8/Makefile" ;; "dlls/dplay/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dplay/Makefile" ;; "dlls/dplayx/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dplayx/Makefile" ;; "dlls/dsound/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dsound/Makefile" ;; diff --git a/configure.ac b/configure.ac index 34e90e9a0dd..7bf712eeb1d 100644 --- a/configure.ac +++ b/configure.ac @@ -1247,6 +1247,7 @@ dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile +dlls/dinput8/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 29628764811..b3266026b81 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -26,6 +26,7 @@ BASEDIRS = \ dciman32 \ devenum \ dinput \ + dinput8 \ dplay \ dplayx \ dsound \ @@ -134,6 +135,7 @@ all: \ ddeml.dll$(DLLEXT) \ devenum.dll$(DLLEXT) \ dinput.dll$(DLLEXT) \ + dinput8.dll$(DLLEXT) \ dispdib.dll$(DLLEXT) \ display.dll$(DLLEXT) \ dplay.dll$(DLLEXT) \ @@ -289,6 +291,9 @@ devenum.dll$(DLLEXT): devenum/devenum.dll$(DLLEXT) dinput.dll$(DLLEXT): dinput/dinput.dll$(DLLEXT) $(RM) $@ && $(LN_S) dinput/dinput.dll$(DLLEXT) $@ +dinput8.dll$(DLLEXT): dinput8/dinput8.dll$(DLLEXT) + $(RM) $@ && $(LN_S) dinput8/dinput8.dll$(DLLEXT) $@ + dplay.dll$(DLLEXT): dplay/dplay.dll$(DLLEXT) $(RM) $@ && $(LN_S) dplay/dplay.dll$(DLLEXT) $@ @@ -546,6 +551,7 @@ dciman32/dciman32.dll$(DLLEXT): dciman32 ddraw/ddraw.dll$(DLLEXT): ddraw devenum/devenum.dll$(DLLEXT): devenum dinput/dinput.dll$(DLLEXT): dinput +dinput8/dinput8.dll$(DLLEXT): dinput8 dplay/dplay.dll$(DLLEXT): dplay dplayx/dplayx.dll$(DLLEXT): dplayx dsound/dsound.dll$(DLLEXT): dsound @@ -642,6 +648,7 @@ dciman32: kernel32.dll$(DLLEXT) ddraw: user32.dll$(DLLEXT) gdi32.dll$(DLLEXT) kernel32.dll$(DLLEXT) libuser32.dll.$(LIBEXT) \ libgdi32.dll.$(LIBEXT) libkernel32.dll.$(LIBEXT) devenum: kernel32.dll$(DLLEXT) +dinput8: dinput.dll$(DLLEXT) dinput: user32.dll$(DLLEXT) kernel32.dll$(DLLEXT) dplay: dplayx.dll$(DLLEXT) dplayx: winmm.dll$(DLLEXT) ole32.dll$(DLLEXT) user32.dll$(DLLEXT) advapi32.dll$(DLLEXT) \ diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 9354d84ee32..0dfc9297f11 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -272,7 +272,7 @@ DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_f */ HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat( - LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) { int i; ICOM_THIS(IDirectInputDevice2AImpl,iface); @@ -295,7 +295,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat( } HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel( - LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags + LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) { ICOM_THIS(IDirectInputDevice2AImpl,iface); TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags); @@ -305,14 +305,14 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel( } HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification( - LPDIRECTINPUTDEVICE2A iface,HANDLE hnd + LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) { ICOM_THIS(IDirectInputDevice2AImpl,iface); FIXME("(this=%p,0x%08lx): stub\n",This,(DWORD)hnd); return 0; } -ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE2A iface) +ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(IDirectInputDevice2AImpl,iface); This->ref--; @@ -323,7 +323,7 @@ ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE2A iface) } HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface( - LPDIRECTINPUTDEVICE2A iface,REFIID riid,LPVOID *ppobj + LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj ) { ICOM_THIS(IDirectInputDevice2AImpl,iface); @@ -349,14 +349,14 @@ HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface( } ULONG WINAPI IDirectInputDevice2AImpl_AddRef( - LPDIRECTINPUTDEVICE2A iface) + LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(IDirectInputDevice2AImpl,iface); return ++This->ref; } HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) @@ -372,7 +372,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects( } HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) { @@ -386,7 +386,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty( } HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) @@ -398,7 +398,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( } HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEINSTANCEA pdidi) { FIXME("(this=%p,%p): stub!\n", @@ -408,7 +408,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo( } HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags) { @@ -419,7 +419,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel( } HRESULT WINAPI IDirectInputDevice2AImpl_Initialize( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) @@ -434,7 +434,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Initialize( */ HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, @@ -446,7 +446,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect( } HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) @@ -460,7 +460,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects( } HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIEFFECTINFOA lpdei, REFGUID rguid) { @@ -470,7 +470,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo( } HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut) { FIXME("(this=%p,%p): stub!\n", @@ -479,7 +479,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState( } HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags) { FIXME("(this=%p,0x%08lx): stub!\n", @@ -488,7 +488,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand( } HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags) @@ -501,7 +501,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects( } HRESULT WINAPI IDirectInputDevice2AImpl_Escape( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc) { FIXME("(this=%p,%p): stub!\n", @@ -510,16 +510,16 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Escape( } HRESULT WINAPI IDirectInputDevice2AImpl_Poll( - LPDIRECTINPUTDEVICE2A iface) + LPDIRECTINPUTDEVICE8A iface) { /* Because wine devices do not need to be polled, just return DI_NOEFFECT */ return DI_NOEFFECT; } HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData, - LPDIDEVICEOBJECTDATA rgdod, + LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) { @@ -529,7 +529,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData( return DI_OK; } -HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE7A iface, +HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, @@ -540,7 +540,7 @@ HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE7A return DI_OK; } -HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE7A iface, +HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, @@ -550,3 +550,31 @@ HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE7A 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 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 IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) +{ + FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader); + + return DI_OK; +} diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index ee009686cef..ff59a8daf05 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -1,5 +1,6 @@ /* * 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 @@ -78,88 +79,98 @@ extern void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) ; /* And the stubs */ extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat( - LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df ) ; + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel( - LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags ) ; + LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification( - LPDIRECTINPUTDEVICE2A iface,HANDLE hnd ) ; -extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE2A iface) ; + LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ; +extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface( - LPDIRECTINPUTDEVICE2A iface,REFIID riid,LPVOID *ppobj ) ; + LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj ) ; extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef( - LPDIRECTINPUTDEVICE2A iface) ; + LPDIRECTINPUTDEVICE8A iface) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEINSTANCEA pdidi) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMEFFECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIEFFECTINFOA lpdei, REFGUID rguid) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll( - LPDIRECTINPUTDEVICE2A iface) ; + LPDIRECTINPUTDEVICE8A iface) ; extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData, - LPDIDEVICEOBJECTDATA rgdod, + LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) ; -extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE7A iface, +extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags) ; -extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE7A iface, +extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface, LPCSTR lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags) ; +extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, + LPDIACTIONFORMATA lpdiaf, + LPCSTR lpszUserName, + DWORD dwFlags); +extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, + LPDIACTIONFORMATA lpdiaf, + LPCSTR lpszUserName, + DWORD dwFlags); +extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, + LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader); #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */ diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index ef5bad01a03..61cb10278d2 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -2,6 +2,7 @@ * * 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 @@ -26,10 +27,6 @@ * Doesn't get Input Focus. * * - Fallout : works great in X and DGA mode - * - * FIXME: The keyboard handling needs to (and will) be merged into keyboard.c - * (The current implementation is currently only a proof of concept and - * an utter mess.) */ #include "config.h" @@ -45,8 +42,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); -static ICOM_VTABLE(IDirectInputA) ddiavt; static ICOM_VTABLE(IDirectInput7A) ddi7avt; +static ICOM_VTABLE(IDirectInput8A) ddi8avt; /* This array will be filled a dinput.so loading */ #define MAX_WINE_DINPUT_DEVICES 4 @@ -103,19 +100,22 @@ HRESULT WINAPI DirectInputCreateEx( TRACE("(0x%08lx,%04lx,%s,%p,%p)\n", (DWORD)hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter ); - if (IsEqualGUID(&IID_IDirectInputA,riid)) { + if (IsEqualGUID(&IID_IDirectInputA,riid) || + IsEqualGUID(&IID_IDirectInput2A,riid) || + IsEqualGUID(&IID_IDirectInput7A,riid)) { This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl)); + This->lpVtbl = &ddi7avt; This->ref = 1; - ICOM_VTBL(This) = &ddiavt; *ppDI = This; return DI_OK; } - if (IsEqualGUID(&IID_IDirectInput7A,riid)) { + + if (IsEqualGUID(&IID_IDirectInput8A,riid)) { This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl)); + This->lpVtbl = &ddi8avt; This->ref = 1; - ICOM_VTBL(This) = (ICOM_VTABLE(IDirectInputA) *) &ddi7avt; *ppDI = This; return DI_OK; @@ -134,10 +134,11 @@ HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU (DWORD)hinst,dwVersion,ppDI,punkOuter ); This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl)); + This->lpVtbl = &ddi7avt; This->ref = 1; - ICOM_VTBL(This) = &ddiavt; *ppDI=(IDirectInputA*)This; return 0; + } /****************************************************************************** * IDirectInputA_EnumDevices @@ -155,6 +156,7 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices( for (i = 0; i < nrof_dinput_devices; i++) { if (dinput_devices[i]->enum_device(dwDevType, dwFlags, &devInstance)) { + devInstance.dwSize = sizeof(devInstance); if (lpCallback(&devInstance,pvRef) == DIENUM_STOP) return 0; } @@ -163,6 +165,24 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices( return 0; } +static HRESULT WINAPI IDirectInputAImpl_QueryInterface( + LPDIRECTINPUT7A iface,REFIID riid,LPVOID *ppobj +) { + ICOM_THIS(IDirectInputAImpl,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)) { + IDirectInputA_AddRef(iface); + *ppobj = This; + return 0; + } + TRACE("Unsupported interface !\n"); + return E_FAIL; +} + static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface) { ICOM_THIS(IDirectInputAImpl,iface); @@ -202,26 +222,6 @@ static HRESULT WINAPI IDirectInputAImpl_CreateDevice( return ret_value; } -static HRESULT WINAPI IDirectInputAImpl_QueryInterface( - LPDIRECTINPUT7A iface,REFIID riid,LPVOID *ppobj -) { - ICOM_THIS(IDirectInputAImpl,iface); - - TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); - if (IsEqualGUID(&IID_IUnknown,riid)) { - IDirectInputA_AddRef(iface); - *ppobj = This; - return 0; - } - if (IsEqualGUID(&IID_IDirectInputA,riid)) { - IDirectInputA_AddRef(iface); - *ppobj = This; - return 0; - } - TRACE("Unsupported interface !\n"); - return E_FAIL; -} - static HRESULT WINAPI IDirectInputAImpl_Initialize( LPDIRECTINPUT7A iface,HINSTANCE hinst,DWORD x ) { @@ -246,7 +246,7 @@ static HRESULT WINAPI IDirectInputAImpl_RunControlPanel(LPDIRECTINPUT7A iface, return DI_OK; } -static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT2A iface, REFGUID rguid, +static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT7A iface, REFGUID rguid, LPCSTR pszName, LPGUID pguidInstance) { ICOM_THIS(IDirectInputAImpl,iface); FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), pszName, pguidInstance); @@ -276,28 +276,49 @@ static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, R return ret_value; } -#if !defined(__STRICT_ANSI__) && defined(__GNUC__) -# define XCAST(fun) (typeof(ddiavt.fun)) -#else -# define XCAST(fun) (void*) -#endif +static HRESULT WINAPI IDirectInput8AImpl_QueryInterface( + LPDIRECTINPUT8A iface,REFIID riid,LPVOID *ppobj +) { + ICOM_THIS(IDirectInputAImpl,iface); -static ICOM_VTABLE(IDirectInputA) ddiavt = + TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if (IsEqualGUID(&IID_IUnknown,riid) || + IsEqualGUID(&IID_IDirectInput8A,riid)) { + IDirectInputA_AddRef(iface); + *ppobj = This; + return 0; + } + TRACE("Unsupported interface !\n"); + return E_FAIL; +} + +static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics( + LPDIRECTINPUT8A iface, LPCSTR ptszUserName, LPDIACTIONFORMATA lpdiActionFormat, + LPDIENUMDEVICESBYSEMANTICSCBA lpCallback, + LPVOID pvRef, DWORD dwFlags +) { - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - 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 -}; -#undef XCAST + ICOM_THIS(IDirectInputAImpl,iface); + + FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, ptszUserName, lpdiActionFormat, + lpCallback, pvRef, dwFlags); + return 0; +} + +static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices( + LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, + LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData +) +{ + ICOM_THIS(IDirectInputAImpl,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)) +# define XCAST(fun) (typeof(ddi7avt.fun)) #else # define XCAST(fun) (void*) #endif @@ -317,6 +338,28 @@ static ICOM_VTABLE(IDirectInput7A) ddi7avt = { }; #undef XCAST +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(ddi8avt.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static ICOM_VTABLE(IDirectInput8A) ddi8avt = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + 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, + IDirectInput8AImpl_EnumDevicesBySemantics, + IDirectInput8AImpl_ConfigureDevices +}; +#undef XCAST + /*********************************************************************** * DllCanUnloadNow (DINPUT.@) */ diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 30d3c4ff6df..77f1eaf3146 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -26,11 +26,11 @@ typedef struct IDirectInputAImpl IDirectInputAImpl; struct IDirectInputAImpl { - ICOM_VFIELD(IDirectInputA); - DWORD ref; + LPVOID lpVtbl; + DWORD ref; - /* Used to have an unique sequence number for all the events */ - DWORD evsequence; + /* Used to have an unique sequence number for all the events */ + DWORD evsequence; }; /* Function called by all devices that Wine supports */ diff --git a/dlls/dinput/joystick/linux.c b/dlls/dinput/joystick/linux.c index 5f0bdcd492c..4bf7090c0d7 100644 --- a/dlls/dinput/joystick/linux.c +++ b/dlls/dinput/joystick/linux.c @@ -2,6 +2,7 @@ * * 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 @@ -56,12 +57,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); #define WINE_JOYSTICK_BUTTON_BASE 8 typedef struct JoystickAImpl JoystickAImpl; -static ICOM_VTABLE(IDirectInputDevice2A) JoystickAvt; -static ICOM_VTABLE(IDirectInputDevice7A) Joystick7Avt; +static ICOM_VTABLE(IDirectInputDevice8A) JoystickAvt; struct JoystickAImpl { - /* IDirectInputDevice2AImpl */ - ICOM_VFIELD(IDirectInputDevice2A); + LPVOID lpVtbl; DWORD ref; GUID guid; @@ -87,10 +86,15 @@ static GUID DInput_Wine_Joystick_GUID = { /* 9e573ed9-7734-11d2-8d4a-23903fb6bdf static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi) { + int fd = -1; + + if (dwFlags & DIEDFL_FORCEFEEDBACK) + return FALSE; + if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) { /* check whether we have a joystick */ - if ((access(JOYDEV,O_RDONLY) != -1) || (errno!=ENODEV && errno!=ENOENT)) { - TRACE("Enumerating the Joystick device\n"); + if ((fd = open(JOYDEV,O_RDONLY) != -1) || (errno!=ENODEV && errno!=ENOENT)) { + TRACE("Enumerating the linux Joystick device\n"); /* Return joystick */ lpddi->guidInstance = GUID_Joystick; @@ -102,6 +106,9 @@ static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANC /* ioctl JSIOCGNAME(len) */ strcpy(lpddi->tszProductName, "Wine Joystick"); + lpddi->guidFFDriver = GUID_NULL; + if (fd != -1) + close(fd); return TRUE; } } @@ -109,14 +116,14 @@ static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANC return FALSE; } -static JoystickAImpl *alloc_device(REFGUID rguid, ICOM_VTABLE(IDirectInputDevice2A) *jvt, IDirectInputAImpl *dinput) +static JoystickAImpl *alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputAImpl *dinput) { JoystickAImpl* newDevice; newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickAImpl)); - newDevice->ref = 1; - ICOM_VTBL(newDevice) = jvt; - newDevice->joyfd = -1; + newDevice->lpVtbl = jvt; + newDevice->ref = 1; + newDevice->joyfd = -1; newDevice->lMin = -32768; newDevice->lMax = +32767; newDevice->dinput = dinput; @@ -129,16 +136,15 @@ static HRESULT joydev_create_device(IDirectInputAImpl *dinput, REFGUID rguid, RE { if ((IsEqualGUID(&GUID_Joystick,rguid)) || (IsEqualGUID(&DInput_Wine_Joystick_GUID,rguid))) { - if ((riid == NULL) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid))) { + 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 if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) { - *pdev=(IDirectInputDeviceA*) alloc_device(rguid, (ICOM_VTABLE(IDirectInputDevice2A) *) &Joystick7Avt, dinput); - - TRACE("Creating a Joystick DInput7A device (%p)\n", *pdev); - return DI_OK; } else return DIERR_NOINTERFACE; } @@ -157,7 +163,7 @@ DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); } /****************************************************************************** * Joystick */ -static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE2A iface) +static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(JoystickAImpl,iface); @@ -181,7 +187,7 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE2A iface) * the device driver sends back with GetDeviceState. */ static HRESULT WINAPI JoystickAImpl_SetDataFormat( - LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) { ICOM_THIS(JoystickAImpl,iface); @@ -214,7 +220,7 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat( /****************************************************************************** * Acquire : gets exclusive control of the joystick */ -static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(JoystickAImpl,iface); @@ -230,7 +236,7 @@ static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) /****************************************************************************** * Unacquire : frees the joystick */ -static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(JoystickAImpl,iface); @@ -292,7 +298,7 @@ static void joy_polldev(JoystickAImpl *This) { * */ static HRESULT WINAPI JoystickAImpl_GetDeviceState( - LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr + LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr ) { ICOM_THIS(JoystickAImpl,iface); @@ -310,7 +316,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState( /****************************************************************************** * GetDeviceData : gets buffered input data. */ -static HRESULT WINAPI JoystickAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI JoystickAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, @@ -333,7 +339,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, /****************************************************************************** * SetProperty : change input device properties */ -static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER ph) { @@ -377,7 +383,7 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface, * SetEventNotification : specifies event to be sent on state change */ static HRESULT WINAPI JoystickAImpl_SetEventNotification( - LPDIRECTINPUTDEVICE2A iface, HANDLE hnd + LPDIRECTINPUTDEVICE8A iface, HANDLE hnd ) { ICOM_THIS(JoystickAImpl,iface); @@ -387,7 +393,7 @@ static HRESULT WINAPI JoystickAImpl_SetEventNotification( } static HRESULT WINAPI JoystickAImpl_GetCapabilities( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) { ICOM_THIS(JoystickAImpl,iface); @@ -413,7 +419,7 @@ static HRESULT WINAPI JoystickAImpl_GetCapabilities( close(xfd); return DI_OK; } -static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE2A iface) { +static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(JoystickAImpl,iface); TRACE("(),stub!\n"); @@ -425,7 +431,7 @@ static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE2A iface) { * EnumObjects : enumerate the different buttons and axis... */ static HRESULT WINAPI JoystickAImpl_EnumObjects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) @@ -509,7 +515,7 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects( /****************************************************************************** * GetProperty : get input device properties */ -static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) { @@ -554,7 +560,7 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface, return DI_OK; } -static ICOM_VTABLE(IDirectInputDevice2A) JoystickAvt = +static ICOM_VTABLE(IDirectInputDevice8A) JoystickAvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IDirectInputDevice2AImpl_QueryInterface, @@ -584,48 +590,11 @@ static ICOM_VTABLE(IDirectInputDevice2A) JoystickAvt = IDirectInputDevice2AImpl_Escape, JoystickAImpl_Poll, IDirectInputDevice2AImpl_SendDeviceData, -}; - -#if !defined(__STRICT_ANSI__) && defined(__GNUC__) -# define XCAST(fun) (typeof(Joystick7Avt.fun)) -#else -# define XCAST(fun) (void*) -#endif - -static ICOM_VTABLE(IDirectInputDevice7A) Joystick7Avt = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - XCAST(QueryInterface)IDirectInputDevice2AImpl_QueryInterface, - XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, - XCAST(Release)JoystickAImpl_Release, - XCAST(GetCapabilities)JoystickAImpl_GetCapabilities, - XCAST(EnumObjects)JoystickAImpl_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, - XCAST(GetObjectInfo)IDirectInputDevice2AImpl_GetObjectInfo, - XCAST(GetDeviceInfo)IDirectInputDevice2AImpl_GetDeviceInfo, - XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, - XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, - XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, - XCAST(EnumEffects)IDirectInputDevice2AImpl_EnumEffects, - XCAST(GetEffectInfo)IDirectInputDevice2AImpl_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, IDirectInputDevice7AImpl_EnumEffectsInFile, - IDirectInputDevice7AImpl_WriteEffectToFile + IDirectInputDevice7AImpl_WriteEffectToFile, + IDirectInputDevice8AImpl_BuildActionMap, + IDirectInputDevice8AImpl_SetActionMap, + IDirectInputDevice8AImpl_GetImageInfo }; -#undef XCAST - #endif /* HAVE_LINUX_22_JOYSTICK_API */ diff --git a/dlls/dinput/joystick/linuxinput.c b/dlls/dinput/joystick/linuxinput.c index 910aecbe283..2f3dbaa6db7 100644 --- a/dlls/dinput/joystick/linuxinput.c +++ b/dlls/dinput/joystick/linuxinput.c @@ -2,6 +2,7 @@ * * 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 @@ -62,12 +63,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); #define WINE_JOYSTICK_BUTTON_BASE 8 typedef struct JoystickAImpl JoystickAImpl; -static ICOM_VTABLE(IDirectInputDevice2A) JoystickAvt; -static ICOM_VTABLE(IDirectInputDevice7A) Joystick7Avt; +static ICOM_VTABLE(IDirectInputDevice8A) JoystickAvt; struct JoystickAImpl { - /* IDirectInputDevice2AImpl */ - ICOM_VFIELD(IDirectInputDevice2A); + LPVOID lpVtbl; DWORD ref; GUID guid; @@ -125,6 +124,9 @@ static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANC if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK)) return FALSE; + if (dwFlags & DIEDFL_FORCEFEEDBACK) + return FALSE; + for (i=0;i<64;i++) { char buf[200]; BYTE absbits[(ABS_MAX+7)/8],keybits[(KEY_MAX+7)/8]; @@ -161,12 +163,13 @@ static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANC if (!havejoy) return FALSE; - TRACE("Enumerating the Joystick device\n"); + 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); @@ -176,17 +179,16 @@ static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANC return TRUE; } -static JoystickAImpl *alloc_device(REFGUID rguid, ICOM_VTABLE(IDirectInputDevice2A) *jvt, IDirectInputAImpl *dinput) +static JoystickAImpl *alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputAImpl *dinput) { JoystickAImpl* newDevice; int i; newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickAImpl)); - newDevice->ref = 1; - ICOM_VTBL(newDevice) = jvt; - - newDevice->joyfd = -1; - newDevice->dinput = dinput; + newDevice->lpVtbl = jvt; + newDevice->ref = 1; + newDevice->joyfd = -1; + newDevice->dinput = dinput; memcpy(&(newDevice->guid),rguid,sizeof(*rguid)); for (i=0;iwantmin[i] = -32768; @@ -238,16 +240,14 @@ static HRESULT joydev_create_device(IDirectInputAImpl *dinput, REFGUID rguid, RE if ((IsEqualGUID(&GUID_Joystick,rguid)) || (IsEqualGUID(&DInput_Wine_Joystick_GUID,rguid))) { - if ((riid == NULL) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid))) { + 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 if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) { - *pdev=(IDirectInputDeviceA*) alloc_device(rguid, (ICOM_VTABLE(IDirectInputDevice2A) *) &Joystick7Avt, dinput); - - TRACE("Creating a Joystick DInput7A device (%p)\n", *pdev); - return DI_OK; } else return DIERR_NOINTERFACE; } @@ -266,7 +266,7 @@ DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); } /****************************************************************************** * Joystick */ -static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE2A iface) +static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(JoystickAImpl,iface); @@ -290,7 +290,7 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE2A iface) * the device driver sends back with GetDeviceState. */ static HRESULT WINAPI JoystickAImpl_SetDataFormat( - LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) { ICOM_THIS(JoystickAImpl,iface); @@ -323,7 +323,7 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat( /****************************************************************************** * Acquire : gets exclusive control of the joystick */ -static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) { int i; ICOM_THIS(JoystickAImpl,iface); @@ -380,7 +380,7 @@ static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) /****************************************************************************** * Unacquire : frees the joystick */ -static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(JoystickAImpl,iface); @@ -508,7 +508,7 @@ static void joy_polldev(JoystickAImpl *This) { * */ static HRESULT WINAPI JoystickAImpl_GetDeviceState( - LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr + LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr ) { ICOM_THIS(JoystickAImpl,iface); @@ -527,7 +527,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState( /****************************************************************************** * GetDeviceData : gets buffered input data. */ -static HRESULT WINAPI JoystickAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI JoystickAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, @@ -550,7 +550,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, /****************************************************************************** * SetProperty : change input device properties */ -static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER ph) { @@ -605,7 +605,7 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface, * SetEventNotification : specifies event to be sent on state change */ static HRESULT WINAPI JoystickAImpl_SetEventNotification( - LPDIRECTINPUTDEVICE2A iface, HANDLE hnd + LPDIRECTINPUTDEVICE8A iface, HANDLE hnd ) { ICOM_THIS(JoystickAImpl,iface); @@ -615,7 +615,7 @@ static HRESULT WINAPI JoystickAImpl_SetEventNotification( } static HRESULT WINAPI JoystickAImpl_GetCapabilities( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) { ICOM_THIS(JoystickAImpl,iface); @@ -647,7 +647,7 @@ static HRESULT WINAPI JoystickAImpl_GetCapabilities( return DI_OK; } -static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE2A iface) { +static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(JoystickAImpl,iface); TRACE("(),stub!\n"); @@ -659,7 +659,7 @@ static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE2A iface) { * EnumObjects : enumerate the different buttons and axis... */ static HRESULT WINAPI JoystickAImpl_EnumObjects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) @@ -823,7 +823,7 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects( /****************************************************************************** * GetProperty : get input device properties */ -static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) { @@ -866,7 +866,7 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface, return DI_OK; } -static ICOM_VTABLE(IDirectInputDevice2A) JoystickAvt = +static ICOM_VTABLE(IDirectInputDevice8A) JoystickAvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IDirectInputDevice2AImpl_QueryInterface, @@ -896,50 +896,13 @@ static ICOM_VTABLE(IDirectInputDevice2A) JoystickAvt = IDirectInputDevice2AImpl_Escape, JoystickAImpl_Poll, IDirectInputDevice2AImpl_SendDeviceData, -}; - -#if !defined(__STRICT_ANSI__) && defined(__GNUC__) -# define XCAST(fun) (typeof(Joystick7Avt.fun)) -#else -# define XCAST(fun) (void*) -#endif - -static ICOM_VTABLE(IDirectInputDevice7A) Joystick7Avt = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - XCAST(QueryInterface)IDirectInputDevice2AImpl_QueryInterface, - XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, - XCAST(Release)JoystickAImpl_Release, - XCAST(GetCapabilities)JoystickAImpl_GetCapabilities, - XCAST(EnumObjects)JoystickAImpl_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, - XCAST(GetObjectInfo)IDirectInputDevice2AImpl_GetObjectInfo, - XCAST(GetDeviceInfo)IDirectInputDevice2AImpl_GetDeviceInfo, - XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, - XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, - XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, - XCAST(EnumEffects)IDirectInputDevice2AImpl_EnumEffects, - XCAST(GetEffectInfo)IDirectInputDevice2AImpl_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, IDirectInputDevice7AImpl_EnumEffectsInFile, - IDirectInputDevice7AImpl_WriteEffectToFile + IDirectInputDevice7AImpl_WriteEffectToFile, + IDirectInputDevice8AImpl_BuildActionMap, + IDirectInputDevice8AImpl_SetActionMap, + IDirectInputDevice8AImpl_GetImageInfo }; -#undef XCAST - #endif /* HAVE_LINUX_INPUT_H */ #endif diff --git a/dlls/dinput/keyboard/main.c b/dlls/dinput/keyboard/main.c index c2f56eee16d..ce33d1ad708 100644 --- a/dlls/dinput/keyboard/main.c +++ b/dlls/dinput/keyboard/main.c @@ -2,6 +2,7 @@ * * 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 @@ -35,14 +36,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); -static ICOM_VTABLE(IDirectInputDevice2A) SysKeyboardAvt; -static ICOM_VTABLE(IDirectInputDevice7A) SysKeyboard7Avt; +static ICOM_VTABLE(IDirectInputDevice8A) SysKeyboardAvt; typedef struct SysKeyboardAImpl SysKeyboardAImpl; struct SysKeyboardAImpl { - /* IDirectInputDevice2AImpl */ - ICOM_VFIELD(IDirectInputDevice2A); + LPVOID lpVtbl; DWORD ref; GUID guid; @@ -151,12 +150,12 @@ static BOOL keyboarddev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEIN return FALSE; } -static SysKeyboardAImpl *alloc_device(REFGUID rguid, ICOM_VTABLE(IDirectInputDevice2A) *kvt, IDirectInputAImpl *dinput) +static SysKeyboardAImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputAImpl *dinput) { SysKeyboardAImpl* newDevice; newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardAImpl)); + newDevice->lpVtbl = kvt; newDevice->ref = 1; - ICOM_VTBL(newDevice) = kvt; memcpy(&(newDevice->guid),rguid,sizeof(*rguid)); newDevice->dinput = dinput; @@ -168,16 +167,14 @@ static HRESULT keyboarddev_create_device(IDirectInputAImpl *dinput, REFGUID rgui { if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */ (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */ - if ((riid == NULL) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid))) { + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceA,riid) || + IsEqualGUID(&IID_IDirectInputDevice2A,riid) || + IsEqualGUID(&IID_IDirectInputDevice7A,riid) || + IsEqualGUID(&IID_IDirectInputDevice8A,riid)) { *pdev=(IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput); - TRACE("Creating a Keyboard device (%p)\n", *pdev); return DI_OK; - } else if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) { - *pdev=(IDirectInputDeviceA*) alloc_device(rguid, (ICOM_VTABLE(IDirectInputDevice2A) *) &SysKeyboard7Avt, dinput); - - TRACE("Creating a Keyboard DInput7A device (%p)\n", *pdev); - return DI_OK; } else return DIERR_NOINTERFACE; } @@ -194,7 +191,7 @@ static dinput_device keyboarddev = { DECL_GLOBAL_CONSTRUCTOR(keyboarddev_register) { dinput_register_device(&keyboarddev); } static HRESULT WINAPI SysKeyboardAImpl_SetProperty( - LPDIRECTINPUTDEVICE2A iface,REFGUID rguid,LPCDIPROPHEADER ph + LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPCDIPROPHEADER ph ) { ICOM_THIS(SysKeyboardAImpl,iface); @@ -225,7 +222,7 @@ static HRESULT WINAPI SysKeyboardAImpl_SetProperty( } static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState( - LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr + LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr ) { /* Note: device does not need to be acquired */ @@ -237,7 +234,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState( } static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData( - LPDIRECTINPUTDEVICE2A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod, + LPDIRECTINPUTDEVICE8A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod, LPDWORD entries,DWORD flags ) { @@ -289,9 +286,9 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData( return ret; } -static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface); +static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface); -static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(SysKeyboardAImpl,iface); @@ -325,7 +322,7 @@ static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) return DI_OK; } -static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(SysKeyboardAImpl,iface); TRACE("(this=%p)\n",This); @@ -350,8 +347,8 @@ static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface) return DI_OK; } -static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE2A iface, - HANDLE hnd) { +static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, + HANDLE hnd) { ICOM_THIS(SysKeyboardAImpl,iface); TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd); @@ -364,7 +361,7 @@ static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE2 * GetCapabilities : get the device capablitites */ static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) { ICOM_THIS(SysKeyboardAImpl,iface); @@ -390,7 +387,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities( return DI_OK; } -static ICOM_VTABLE(IDirectInputDevice2A) SysKeyboardAvt = +static ICOM_VTABLE(IDirectInputDevice8A) SysKeyboardAvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IDirectInputDevice2AImpl_QueryInterface, @@ -419,47 +416,10 @@ static ICOM_VTABLE(IDirectInputDevice2A) SysKeyboardAvt = IDirectInputDevice2AImpl_EnumCreatedEffectObjects, IDirectInputDevice2AImpl_Escape, IDirectInputDevice2AImpl_Poll, - IDirectInputDevice2AImpl_SendDeviceData + IDirectInputDevice2AImpl_SendDeviceData, + IDirectInputDevice7AImpl_EnumEffectsInFile, + IDirectInputDevice7AImpl_WriteEffectToFile, + IDirectInputDevice8AImpl_BuildActionMap, + IDirectInputDevice8AImpl_SetActionMap, + IDirectInputDevice8AImpl_GetImageInfo }; - -#if !defined(__STRICT_ANSI__) && defined(__GNUC__) -# define XCAST(fun) (typeof(SysKeyboard7Avt.fun)) -#else -# define XCAST(fun) (void*) -#endif - -static ICOM_VTABLE(IDirectInputDevice7A) SysKeyboard7Avt = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - XCAST(QueryInterface)IDirectInputDevice2AImpl_QueryInterface, - XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, - XCAST(Release)IDirectInputDevice2AImpl_Release, - XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities, - XCAST(EnumObjects)IDirectInputDevice2AImpl_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, - XCAST(GetObjectInfo)IDirectInputDevice2AImpl_GetObjectInfo, - XCAST(GetDeviceInfo)IDirectInputDevice2AImpl_GetDeviceInfo, - XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, - XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, - XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, - XCAST(EnumEffects)IDirectInputDevice2AImpl_EnumEffects, - XCAST(GetEffectInfo)IDirectInputDevice2AImpl_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, - IDirectInputDevice7AImpl_EnumEffectsInFile, - IDirectInputDevice7AImpl_WriteEffectToFile -}; - -#undef XCAST diff --git a/dlls/dinput/mouse/main.c b/dlls/dinput/mouse/main.c index 38f0e160ce0..a596ad69372 100644 --- a/dlls/dinput/mouse/main.c +++ b/dlls/dinput/mouse/main.c @@ -2,6 +2,7 @@ * * 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 @@ -41,9 +42,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); /* Wine mouse driver object instances */ #define WINE_MOUSE_X_AXIS_INSTANCE 0x0001 #define WINE_MOUSE_Y_AXIS_INSTANCE 0x0002 -#define WINE_MOUSE_L_BUTTON_INSTANCE 0x0004 -#define WINE_MOUSE_R_BUTTON_INSTANCE 0x0008 -#define WINE_MOUSE_M_BUTTON_INSTANCE 0x0010 +#define WINE_MOUSE_Z_AXIS_INSTANCE 0x0004 +#define WINE_MOUSE_L_BUTTON_INSTANCE 0x0008 +#define WINE_MOUSE_R_BUTTON_INSTANCE 0x0010 +#define WINE_MOUSE_M_BUTTON_INSTANCE 0x0020 /* ------------------------------- */ /* Wine mouse internal data format */ @@ -52,23 +54,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); /* Constants used to access the offset array */ #define WINE_MOUSE_X_POSITION 0 #define WINE_MOUSE_Y_POSITION 1 -#define WINE_MOUSE_L_POSITION 2 -#define WINE_MOUSE_R_POSITION 3 -#define WINE_MOUSE_M_POSITION 4 +#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 5 +#define WINE_INTERNALMOUSE_NUM_OBJS 6 static 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, @@ -86,8 +92,7 @@ static DIDATAFORMAT Wine_InternalMouseFormat = { Wine_InternalMouseObjectFormat }; -static ICOM_VTABLE(IDirectInputDevice2A) SysMouseAvt; -static ICOM_VTABLE(IDirectInputDevice7A) SysMouse7Avt; +static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt; typedef struct SysMouseAImpl SysMouseAImpl; typedef enum { @@ -98,8 +103,7 @@ typedef enum { struct SysMouseAImpl { - /* IDirectInputDevice2AImpl */ - ICOM_VFIELD(IDirectInputDevice2A); + LPVOID lpVtbl; DWORD ref; GUID guid; @@ -109,7 +113,7 @@ struct SysMouseAImpl and external data formats */ LPDIDATAFORMAT df; DataFormat *wine_df; - int offset_array[5]; + int offset_array[WINE_INTERNALMOUSE_NUM_OBJS]; /* SysMouseAImpl */ BYTE absolute; @@ -141,7 +145,7 @@ static GUID DInput_Wine_Mouse_GUID = { /* 9e573ed8-7734-11d2-8d4a-23903fb6bdf7 * }; /* FIXME: This is ugly and not thread safe :/ */ -static IDirectInputDevice2A* current_lock = NULL; +static IDirectInputDevice8A* current_lock = NULL; static BOOL mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi) @@ -162,11 +166,12 @@ static BOOL mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTA return FALSE; } -static SysMouseAImpl *alloc_device(REFGUID rguid, ICOM_VTABLE(IDirectInputDevice2A) *mvt, IDirectInputAImpl *dinput) +static SysMouseAImpl *alloc_device(REFGUID rguid, LPVOID mvt, IDirectInputAImpl *dinput) { - int offset_array[5] = { + 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 @@ -174,13 +179,13 @@ static SysMouseAImpl *alloc_device(REFGUID rguid, ICOM_VTABLE(IDirectInputDevice SysMouseAImpl* newDevice; newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseAImpl)); newDevice->ref = 1; - ICOM_VTBL(newDevice) = mvt; + newDevice->lpVtbl = mvt; InitializeCriticalSection(&(newDevice->crit)); memcpy(&(newDevice->guid),rguid,sizeof(*rguid)); /* Per default, Wine uses its internal data format */ newDevice->df = &Wine_InternalMouseFormat; - memcpy(newDevice->offset_array, offset_array, 5 * sizeof(int)); + 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; @@ -194,16 +199,14 @@ static HRESULT mousedev_create_device(IDirectInputAImpl *dinput, REFGUID rguid, { if ((IsEqualGUID(&GUID_SysMouse,rguid)) || /* Generic Mouse */ (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */ - if ((riid == NULL) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) || (IsEqualGUID(&IID_IDirectInputDevice2A,riid))) { + if ((riid == NULL) || + IsEqualGUID(&IID_IDirectInputDeviceA,riid) || + IsEqualGUID(&IID_IDirectInputDevice2A,riid) || + IsEqualGUID(&IID_IDirectInputDevice7A,riid) || + IsEqualGUID(&IID_IDirectInputDevice8A,riid)) { *pdev=(IDirectInputDeviceA*) alloc_device(rguid, &SysMouseAvt, dinput); - TRACE("Creating a Mouse device (%p)\n", *pdev); return DI_OK; - }else if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) { - *pdev=(IDirectInputDeviceA*) alloc_device(rguid, (ICOM_VTABLE(IDirectInputDevice2A) *) &SysMouse7Avt, dinput); - - TRACE("Creating a Mouse DInput7A device (%p)\n", *pdev); - return DI_OK; } else return DIERR_NOINTERFACE; } @@ -226,7 +229,7 @@ DECL_GLOBAL_CONSTRUCTOR(mousedev_register) { dinput_register_device(&mousedev); /****************************************************************************** * Release : release the mouse buffer. */ -static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE2A iface) +static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(SysMouseAImpl,iface); @@ -238,7 +241,11 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE2A iface) if (This->data_queue != NULL) HeapFree(GetProcessHeap(),0,This->data_queue); - if (This->hook) UnhookWindowsHookEx( This->hook ); + if (This->hook) { + UnhookWindowsHookEx( This->hook ); + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(TRUE); /* show cursor */ + } DeleteCriticalSection(&(This->crit)); /* Free the DataFormat */ @@ -257,7 +264,7 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE2A iface) * grabbing. */ static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel( - LPDIRECTINPUTDEVICE2A iface,HWND hwnd,DWORD dwflags + LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) { ICOM_THIS(SysMouseAImpl,iface); @@ -285,7 +292,7 @@ static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel( * in absolute and relative mode. */ static HRESULT WINAPI SysMouseAImpl_SetDataFormat( - LPDIRECTINPUTDEVICE2A iface,LPCDIDATAFORMAT df + LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) { ICOM_THIS(SysMouseAImpl,iface); @@ -333,10 +340,25 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara LRESULT ret; MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam; SysMouseAImpl* This = (SysMouseAImpl*) 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 dont 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); @@ -425,6 +447,12 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara 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", @@ -432,20 +460,40 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]); end: - if (This->dwCoopLevel & DISCL_NONEXCLUSIVE) + 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 ret = 1; /* ignore message */ - LeaveCriticalSection(&(This->crit)); return ret; } +static void dinput_window_check(SysMouseAImpl* 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(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(SysMouseAImpl,iface); RECT rect; @@ -456,7 +504,7 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) POINT point; /* Store (in a global variable) the current lock */ - current_lock = (IDirectInputDevice2A*)This; + current_lock = (IDirectInputDevice8A*)This; /* Init the mouse state */ if (This->absolute) { @@ -469,11 +517,14 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) This->m_state.lX = 0; This->m_state.lY = 0; } + This->m_state.lZ = 0; This->m_state.rgbButtons[0] = (GetKeyState(VK_LBUTTON) ? 0xFF : 0x00); This->m_state.rgbButtons[1] = (GetKeyState(VK_MBUTTON) ? 0xFF : 0x00); This->m_state.rgbButtons[2] = (GetKeyState(VK_RBUTTON) ? 0xFF : 0x00); /* Install our mouse hook */ + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(FALSE); /* hide cursor */ This->hook = SetWindowsHookExW( WH_MOUSE_LL, dinput_mouse_hook, 0, 0 ); /* Get the window dimension and find the center */ @@ -496,14 +547,15 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface) } This->acquired = 1; + return DI_OK; } - return DI_OK; + return S_FALSE; } /****************************************************************************** * Unacquire : frees the mouse */ -static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface) +static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) { ICOM_THIS(SysMouseAImpl,iface); @@ -512,8 +564,12 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface) if (This->acquired) { /* Reinstall previous mouse event handler */ - if (This->hook) UnhookWindowsHookEx( This->hook ); - This->hook = 0; + if (This->hook) { + UnhookWindowsHookEx( This->hook ); + This->hook = 0; + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(TRUE); /* show cursor */ + } /* No more locks */ current_lock = NULL; @@ -534,7 +590,7 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE2A iface) * supported. */ static HRESULT WINAPI SysMouseAImpl_GetDeviceState( - LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr + LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr ) { ICOM_THIS(SysMouseAImpl,iface); @@ -548,13 +604,12 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState( 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) { - This->mapped_center.x = This->win_centerX; - This->mapped_center.y = This->win_centerY; - MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1); + dinput_window_check(This); TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); SetCursorPos( This->mapped_center.x, This->mapped_center.y ); @@ -577,7 +632,7 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState( /****************************************************************************** * GetDeviceState : gets buffered input data. */ -static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, @@ -594,11 +649,14 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, 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)) { + if (dodsize < sizeof(DIDEVICEOBJECTDATA)) { ERR("Wrong structure size !\n"); LeaveCriticalSection(&(This->crit)); return DIERR_INVALIDPARAM; @@ -629,9 +687,7 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, /* Check if we need to do a mouse warping */ if (This->need_warp == WARP_NEEDED) { - This->mapped_center.x = This->win_centerX; - This->mapped_center.y = This->win_centerY; - MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1); + dinput_window_check(This); TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); SetCursorPos( This->mapped_center.x, This->mapped_center.y ); @@ -647,7 +703,7 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface, /****************************************************************************** * SetProperty : change input device properties */ -static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER ph) { @@ -687,7 +743,7 @@ static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface, /****************************************************************************** * GetProperty : get input device properties */ -static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) { @@ -709,6 +765,15 @@ static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface, 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; @@ -740,7 +805,7 @@ static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE2A iface, /****************************************************************************** * SetEventNotification : specifies event to be sent on state change */ -static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE2A iface, +static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, HANDLE hnd) { ICOM_THIS(SysMouseAImpl,iface); @@ -755,7 +820,7 @@ static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE2A i * GetCapabilities : get the device capablitites */ static HRESULT WINAPI SysMouseAImpl_GetCapabilities( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) { ICOM_THIS(SysMouseAImpl,iface); @@ -765,7 +830,7 @@ static HRESULT WINAPI SysMouseAImpl_GetCapabilities( if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) { lpDIDevCaps->dwFlags = DIDC_ATTACHED; lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE; - lpDIDevCaps->dwAxes = 2; + lpDIDevCaps->dwAxes = 3; lpDIDevCaps->dwButtons = 3; lpDIDevCaps->dwPOVs = 0; lpDIDevCaps->dwFFSamplePeriod = 0; @@ -786,7 +851,7 @@ static HRESULT WINAPI SysMouseAImpl_GetCapabilities( * EnumObjects : enumerate the different buttons and axis... */ static HRESULT WINAPI SysMouseAImpl_EnumObjects( - LPDIRECTINPUTDEVICE2A iface, + LPDIRECTINPUTDEVICE8A iface, LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID lpvRef, DWORD dwFlags) @@ -822,6 +887,14 @@ static HRESULT WINAPI SysMouseAImpl_EnumObjects( 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) || @@ -854,7 +927,7 @@ static HRESULT WINAPI SysMouseAImpl_EnumObjects( } -static ICOM_VTABLE(IDirectInputDevice2A) SysMouseAvt = +static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt = { ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IDirectInputDevice2AImpl_QueryInterface, @@ -884,46 +957,9 @@ static ICOM_VTABLE(IDirectInputDevice2A) SysMouseAvt = 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(SysMouse7Avt.fun)) -#else -# define XCAST(fun) (void*) -#endif - -static ICOM_VTABLE(IDirectInputDevice7A) SysMouse7Avt = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - XCAST(QueryInterface)IDirectInputDevice2AImpl_QueryInterface, - XCAST(AddRef)IDirectInputDevice2AImpl_AddRef, - XCAST(Release)SysMouseAImpl_Release, - XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities, - XCAST(EnumObjects)SysMouseAImpl_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, - XCAST(GetObjectInfo)IDirectInputDevice2AImpl_GetObjectInfo, - XCAST(GetDeviceInfo)IDirectInputDevice2AImpl_GetDeviceInfo, - XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel, - XCAST(Initialize)IDirectInputDevice2AImpl_Initialize, - XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect, - XCAST(EnumEffects)IDirectInputDevice2AImpl_EnumEffects, - XCAST(GetEffectInfo)IDirectInputDevice2AImpl_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, - IDirectInputDevice7AImpl_EnumEffectsInFile, - IDirectInputDevice7AImpl_WriteEffectToFile -}; - -#undef XCAST diff --git a/dlls/dinput8/.cvsignore b/dlls/dinput8/.cvsignore new file mode 100644 index 00000000000..6dd7eeac007 --- /dev/null +++ b/dlls/dinput8/.cvsignore @@ -0,0 +1,3 @@ +Makefile +dinput8.dll.dbg.c +dinput8.spec.c diff --git a/dlls/dinput8/Makefile.in b/dlls/dinput8/Makefile.in new file mode 100644 index 00000000000..6d71c520936 --- /dev/null +++ b/dlls/dinput8/Makefile.in @@ -0,0 +1,18 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = dinput8.dll +IMPORTS = dinput +EXTRALIBS = $(LIBUUID) + +LDDLLFLAGS = @LDDLLFLAGS@ +SYMBOLFILE = $(MODULE).tmp.o + +C_SRCS = \ + dinput8_main.c + +@MAKE_DLL_RULES@ + +### Dependencies: + diff --git a/dlls/dinput8/dinput8.spec b/dlls/dinput8/dinput8.spec new file mode 100644 index 00000000000..774fa8a5069 --- /dev/null +++ b/dlls/dinput8/dinput8.spec @@ -0,0 +1,7 @@ +name dinput8 + +@ stdcall DirectInput8Create(long long ptr ptr ptr) DirectInput8Create +@ stdcall DllCanUnloadNow() DINPUT8_DllCanUnloadNow +@ stdcall DllGetClassObject(ptr ptr ptr) DINPUT8_DllGetClassObject +@ stdcall DllRegisterServer() DINPUT8_DllRegisterServer +@ stdcall DllUnregisterServer() DINPUT8_DllUnregisterServer diff --git a/dlls/dinput8/dinput8_main.c b/dlls/dinput8/dinput8_main.c new file mode 100644 index 00000000000..a63be97acb8 --- /dev/null +++ b/dlls/dinput8/dinput8_main.c @@ -0,0 +1,82 @@ +/* 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 "wine/debug.h" +#include "winbase.h" +#include "winerror.h" +#include "windef.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/include/d3dtypes.h b/include/d3dtypes.h index 908ff24599f..163cde0eb28 100644 --- a/include/d3dtypes.h +++ b/include/d3dtypes.h @@ -77,7 +77,10 @@ typedef HRESULT (CALLBACK *LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffs typedef HRESULT (CALLBACK *LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext); typedef HRESULT (CALLBACK *LPD3DENUMPIXELFORMATSCALLBACK)(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext); +#ifndef D3DCOLOR_DEFINED typedef DWORD D3DCOLOR, *LPD3DCOLOR; +#define D3DCOLOR_DEFINED +#endif typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE; typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE; diff --git a/include/dinput.h b/include/dinput.h index cf8660347fb..214e7b17d81 100644 --- a/include/dinput.h +++ b/include/dinput.h @@ -22,12 +22,17 @@ #include "windef.h" /* for MAX_PATH */ #include "unknwn.h" -#define DIRECTINPUT_VERSION 0x0500 +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0800 +#endif /* 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); @@ -35,12 +40,16 @@ DEFINE_GUID(IID_IDirectInput2A, 0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x 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 */ @@ -76,23 +85,39 @@ DEFINE_GUID(GUID_Friction, 0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA DEFINE_GUID(GUID_CustomForce, 0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); typedef struct IDirectInputA IDirectInputA,*LPDIRECTINPUTA; +typedef struct IDirectInputW IDirectInputW,*LPDIRECTINPUTW; typedef struct IDirectInput2A IDirectInput2A,*LPDIRECTINPUT2A; +typedef struct IDirectInput2W IDirectInput2W,*LPDIRECTINPUT2W; typedef struct IDirectInput7A IDirectInput7A,*LPDIRECTINPUT7A; +typedef struct IDirectInput7W IDirectInput7W,*LPDIRECTINPUT7W; +typedef struct IDirectInput8A IDirectInput8A,*LPDIRECTINPUT8A; +typedef struct IDirectInput8W IDirectInput8W,*LPDIRECTINPUT8W; typedef struct IDirectInputDeviceA IDirectInputDeviceA,*LPDIRECTINPUTDEVICEA; +typedef struct IDirectInputDeviceW IDirectInputDeviceW,*LPDIRECTINPUTDEVICEW; typedef struct IDirectInputDevice2A IDirectInputDevice2A,*LPDIRECTINPUTDEVICE2A; +typedef struct IDirectInputDevice2W IDirectInputDevice2W,*LPDIRECTINPUTDEVICE2W; typedef struct IDirectInputDevice7A IDirectInputDevice7A,*LPDIRECTINPUTDEVICE7A; +typedef struct IDirectInputDevice7W IDirectInputDevice7W,*LPDIRECTINPUTDEVICE7W; +typedef struct IDirectInputDevice8A IDirectInputDevice8A,*LPDIRECTINPUTDEVICE8A; +typedef struct IDirectInputDevice8W IDirectInputDevice8W,*LPDIRECTINPUTDEVICE8W; typedef struct IDirectInputEffect IDirectInputEffect,*LPDIRECTINPUTEFFECT; typedef struct SysKeyboardA SysKeyboardA,*LPSYSKEYBOARDA; typedef struct SysMouseA SysMouseA,*LPSYSMOUSEA; #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 @@ -158,6 +183,7 @@ DECL_WINELIB_TYPE_AW(LPDIRECTINPUTDEVICE2) #define DIEDFL_FORCEFEEDBACK 0x00000100 #define DIEDFL_INCLUDEALIASES 0x00010000 #define DIEDFL_INCLUDEPHANTOMS 0x00020000 +#define DIEDFL_INCLUDEHIDDEN 0x00040000 #define DIDEVTYPE_DEVICE 1 #define DIDEVTYPE_MOUSE 2 @@ -281,7 +307,15 @@ typedef BOOL (CALLBACK *LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA,LPVOID); typedef BOOL (CALLBACK *LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW,LPVOID); DECL_WINELIB_TYPE_AW(LPDIENUMDEVICESCALLBACK) -typedef BOOL (CALLBACK *LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); +#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) @@ -591,14 +625,12 @@ typedef struct DIDEVCAPS { 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 { @@ -607,7 +639,6 @@ typedef struct DIPERIODIC { DWORD dwPhase; DWORD dwPeriod; } DIPERIODIC, *LPDIPERIODIC; - typedef const DIPERIODIC *LPCDIPERIODIC; typedef struct DICONDITION { @@ -618,7 +649,6 @@ typedef struct DICONDITION { DWORD dwNegativeSaturation; LONG lDeadBand; } DICONDITION, *LPDICONDITION; - typedef const DICONDITION *LPCDICONDITION; typedef struct DICUSTOMFORCE { @@ -627,7 +657,6 @@ typedef struct DICUSTOMFORCE { DWORD cSamples; LPLONG rglForceData; } DICUSTOMFORCE, *LPDICUSTOMFORCE; - typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE; typedef struct DIENVELOPE { @@ -637,7 +666,6 @@ typedef struct DIENVELOPE { DWORD dwFadeLevel; DWORD dwFadeTime; } DIENVELOPE, *LPDIENVELOPE; - typedef const DIENVELOPE *LPCDIENVELOPE; typedef struct DIEFFECT { @@ -655,7 +683,6 @@ typedef struct DIEFFECT { DWORD cbTypeSpecificParams; LPVOID lpvTypeSpecificParams; } DIEFFECT, *LPDIEFFECT; - typedef const DIEFFECT *LPCDIEFFECT; typedef struct DIEFFECTINFOA { @@ -794,6 +821,229 @@ typedef struct DIFILEEFFECT { 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 @@ -894,7 +1144,7 @@ ICOM_DEFINE(IDirectInputDeviceA,IUnknown) ICOM_METHOD3(HRESULT,EnumCreatedEffectObjects, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,lpCallback, LPVOID,pvRef, DWORD,fl) \ ICOM_METHOD1(HRESULT,Escape, LPDIEFFESCAPE,pesc) \ ICOM_METHOD (HRESULT,Poll) \ - ICOM_METHOD4(HRESULT,SendDeviceData, DWORD,cbObjectData, LPDIDEVICEOBJECTDATA,rgdod, LPDWORD,pdwInOut, DWORD,fl) + ICOM_METHOD4(HRESULT,SendDeviceData, DWORD,cbObjectData, LPCDIDEVICEOBJECTDATA,rgdod, LPDWORD,pdwInOut, DWORD,fl) #define IDirectInputDevice2A_IMETHODS \ IDirectInputDeviceA_IMETHODS \ IDirectInputDevice2A_METHODS @@ -932,6 +1182,7 @@ ICOM_DEFINE(IDirectInputDevice2A,IDirectInputDeviceA) #define IDirectInputDevice2_Poll(p) ICOM_CALL (Poll,p) #define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) ICOM_CALL4(SendDeviceData,p,a,b,c,d) +#if DIRECTINPUT_VERSION >= 0x0700 /***************************************************************************** * IDirectInputDevice7A interface */ @@ -940,8 +1191,7 @@ ICOM_DEFINE(IDirectInputDevice2A,IDirectInputDeviceA) ICOM_METHOD4(HRESULT,EnumEffectsInFile,LPCSTR,lpszFileName,LPDIENUMEFFECTSINFILECALLBACK,pec,LPVOID,pvRef,DWORD,dwFlags) \ ICOM_METHOD4(HRESULT,WriteEffectToFile,LPCSTR,lpszFileName,DWORD,dwEntries,LPDIFILEEFFECT,rgDiFileEft,DWORD,dwFlags) #define IDirectInputDevice7A_IMETHODS \ - IDirectInputDeviceA_IMETHODS \ - IDirectInputDevice2A_METHODS \ + IDirectInputDevice2A_IMETHODS \ IDirectInputDevice7A_METHODS ICOM_DEFINE(IDirectInputDevice7A,IDirectInputDevice2A) #undef ICOM_INTERFACE @@ -979,6 +1229,61 @@ ICOM_DEFINE(IDirectInputDevice7A,IDirectInputDevice2A) /*** IDirectInputDevice7 methods ***/ #define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) ICOM_CALL4(EnumEffectsInFile,p,a,b,c,d) #define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) ICOM_CALL4(WriteEffectToFile,p,a,b,c,d) +#endif /* DI7 */ + +#if DIRECTINPUT_VERSION >= 0x0800 +/***************************************************************************** + * IDirectInputDevice8A interface + */ +#define ICOM_INTERFACE IDirectInputDevice8A +#define IDirectInputDevice8A_METHODS \ + ICOM_METHOD3(HRESULT,BuildActionMap, LPDIACTIONFORMATA,lpdiaf, LPCSTR,lpszUserName, DWORD,dwFlags) \ + ICOM_METHOD3(HRESULT,SetActionMap, LPDIACTIONFORMATA,lpdiaf, LPCSTR,lpszUserName, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetImageInfo, LPDIDEVICEIMAGEINFOHEADERA,lpdiDevImageInfoHeader) +#define IDirectInputDevice8A_IMETHODS \ + IDirectInputDevice7A_IMETHODS \ + IDirectInputDevice8A_METHODS +ICOM_DEFINE(IDirectInputDevice8A,IDirectInputDevice7A) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IDirectInputDevice8_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectInputDevice8_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectInputDevice8_Release(p) ICOM_CALL (Release,p) +/*** IDirectInputDevice methods ***/ +#define IDirectInputDevice8_GetCapabilities(p,a) ICOM_CALL1(GetCapabilities,p,a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) ICOM_CALL3(EnumObjects,p,a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) ICOM_CALL2(GetProperty,p,a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) ICOM_CALL2(SetProperty,p,a,b) +#define IDirectInputDevice8_Acquire(p) ICOM_CALL (Acquire,p) +#define IDirectInputDevice8_Unacquire(p) ICOM_CALL (Unacquire,p) +#define IDirectInputDevice8_GetDeviceState(p,a,b) ICOM_CALL2(GetDeviceState,p,a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) ICOM_CALL4(GetDeviceData,p,a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) ICOM_CALL1(SetDataFormat,p,a) +#define IDirectInputDevice8_SetEventNotification(p,a) ICOM_CALL1(SetEventNotification,p,a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) ICOM_CALL3(GetObjectInfo,p,a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) ICOM_CALL1(GetDeviceInfo,p,a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) ICOM_CALL2(RunControlPanel,p,a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) ICOM_CALL3(Initialize,p,a,b,c) +/*** IDirectInputDevice2 methods ***/ +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) ICOM_CALL4(CreateEffect,p,a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) ICOM_CALL3(EnumEffects,p,a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) ICOM_CALL2(GetEffectInfo,p,a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) ICOM_CALL1(GetForceFeedbackState,p,a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) ICOM_CALL1(SendForceFeedbackCommand,p,a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) ICOM_CALL3(EnumCreatedEffectObjects,p,a,b,c) +#define IDirectInputDevice8_Escape(p,a) ICOM_CALL1(Escape,p,a) +#define IDirectInputDevice8_Poll(p) ICOM_CALL (Poll,p) +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) ICOM_CALL4(SendDeviceData,p,a,b,c,d) +/*** IDirectInputDevice7 methods ***/ +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) ICOM_CALL4(EnumEffectsInFile,p,a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) ICOM_CALL4(WriteEffectToFile,p,a,b,c,d) +/*** IDirectInputDevice8 methods ***/ +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) ICOM_CALL3(BuildActionMap,p,a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) ICOM_CALL3(SetActionMap,p,a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) ICOM_CALL1(GetImageInfo,p,a) +#endif /* DI8 */ /* "Standard" Mouse report... */ typedef struct DIMOUSESTATE { @@ -1068,6 +1373,7 @@ ICOM_DEFINE(IDirectInput2A,IDirectInputA) /*** IDirectInput2A methods ***/ #define IDirectInput2A_FindDevice(p,a,b,c) ICOM_CALL3(FindDevice,p,a,b,c) +#if DIRECTINPUT_VERSION >= 0x0700 /***************************************************************************** * IDirectInput7A interface */ @@ -1094,6 +1400,42 @@ ICOM_DEFINE(IDirectInput7A,IDirectInput2A) #define IDirectInput7A_FindDevice(p,a,b,c) ICOM_CALL3(FindDevice,p,a,b,c) /*** IDirectInput7A methods ***/ #define IDirectInput7A_CreateDeviceEx(p,a,b,c,d) ICOM_CALL4(CreateDeviceEx,p,a,b,c,d) +#endif /* DI7 */ + +#if DIRECTINPUT_VERSION >= 0x0800 +/***************************************************************************** + * IDirectInput8A interface + */ +#define ICOM_INTERFACE IDirectInput8A +#define IDirectInput8A_METHODS \ + ICOM_METHOD3(HRESULT,CreateDevice, REFGUID,rguid, LPDIRECTINPUTDEVICE8A*,lplpDirectInputDevice, LPUNKNOWN,pUnkOuter) \ + ICOM_METHOD4(HRESULT,EnumDevices, DWORD,dwDevType, LPDIENUMDEVICESCALLBACKA,lpCallback, LPVOID,pvRef, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetDeviceStatus, REFGUID,rguidInstance) \ + ICOM_METHOD2(HRESULT,RunControlPanel, HWND,hwndOwner, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,Initialize, HINSTANCE,hinst, DWORD,dwVersion) \ + ICOM_METHOD3(HRESULT,FindDevice, REFGUID,rguid, LPCSTR,pszName, LPGUID,pguidInstance) \ + ICOM_METHOD5(HRESULT,EnumDevicesBySemantics, LPCSTR,ptszUserName, LPDIACTIONFORMATA,lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBA,lpCallback, LPVOID,pvRef, DWORD,dwFlags) \ + ICOM_METHOD4(HRESULT,ConfigureDevices,LPDICONFIGUREDEVICESCALLBACK,lpdiCallback, LPDICONFIGUREDEVICESPARAMSA,lpdiCDParams, DWORD,dwFlags, LPVOID,pvRefData) +#define IDirectInput8A_IMETHODS \ + IUnknown_IMETHODS \ + IDirectInput8A_METHODS +ICOM_DEFINE(IDirectInput8A,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IDirectInput8A_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectInput8A_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectInput8A_Release(p) ICOM_CALL (Release,p) + /*** IDirectInput8A methods ***/ +#define IDirectInput8A_CreateDevice(p,a,b,c) ICOM_CALL3(CreateDevice,p,a,b,c) +#define IDirectInput8A_EnumDevices(p,a,b,c,d) ICOM_CALL4(EnumDevices,p,a,b,c,d) +#define IDirectInput8A_GetDeviceStatus(p,a) ICOM_CALL1(GetDeviceStatus,p,a) +#define IDirectInput8A_RunControlPanel(p,a,b) ICOM_CALL2(RunControlPanel,p,a,b) +#define IDirectInput8A_Initialize(p,a,b) ICOM_CALL2(Initialize,p,a,b) +#define IDirectInput8A_FindDevice(p,a,b,c) ICOM_CALL3(FindDevice,p,a,b,c) +#define IDirectInput8A_EnumDevicesBySemantics(p,a,b,c,d,e) ICOM_CALL5(EnumDevicesBySemantics,p,a,b,c,d,e) +#define IDirectInput8A_ConfigureDevices(p,a,b,c,d) ICOM_CALL4(ConfigureDevices,p,a,b,c,d) +#endif /* DI8 */ /* Export functions */ @@ -1101,6 +1443,10 @@ ICOM_DEFINE(IDirectInput7A,IDirectInput2A) 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,LPDIRECTINPUTA *,LPUNKNOWN); #define DirectInputCreate WINELIB_NAME_AW(DirectInputCreate)