Commit c405019e authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- DInput WideChar classes support. This time all dinput versions have

widechar classes. - fix a stupid bug in callback handling caught by Lionel. - add some forgotten IID on class factory (better if we want to active the code) - many cleanups on COM Macros (don't need A and W variants as they are the same)
parent bf2121a3
......@@ -28,6 +28,7 @@
#include <string.h>
#include "wine/debug.h"
#include "wine/unicode.h"
#include "winbase.h"
#include "winerror.h"
#include "windef.h"
......@@ -107,6 +108,13 @@ void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) {
}
}
void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) {
if (TRACE_ON(dinput)) {
DPRINTF(" - enumerating : %s - %2ld - 0x%08lx - %s\n",
debugstr_guid(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName));
}
}
/* Conversion between internal data buffer and external data buffer */
void fill_DataFormat(void *out, void *in, DataFormat *df) {
int i;
......@@ -267,6 +275,39 @@ DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_f
return ret;
}
BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA lpddi, LPVOID lpvRef) {
DIDEVICEOBJECTINSTANCEW ddtmp;
device_enumobjects_AtoWcb_data* data;
data = (device_enumobjects_AtoWcb_data*) lpvRef;
memset(&ddtmp, 0, sizeof(DIDEVICEINSTANCEW));
ddtmp.dwSize = sizeof(DIDEVICEINSTANCEW);
ddtmp.guidType = lpddi->guidType;
ddtmp.dwOfs = lpddi->dwOfs;
ddtmp.dwType = lpddi->dwType;
ddtmp.dwFlags = lpddi->dwFlags;
MultiByteToWideChar(CP_ACP, 0, lpddi->tszName, -1, ddtmp.tszName, MAX_PATH);
if (lpddi->dwSize == sizeof(DIDEVICEINSTANCEA)) {
/**
* if dwSize < sizeof(DIDEVICEINSTANCEA of DInput version >= 5)
* force feedback and other newer datas aren't available
*/
ddtmp.dwFFMaxForce = lpddi->dwFFMaxForce;
ddtmp.dwFFForceResolution = lpddi->dwFFForceResolution;
ddtmp.wCollectionNumber = lpddi->wCollectionNumber;
ddtmp.wDesignatorIndex = lpddi->wDesignatorIndex;
ddtmp.wUsagePage = lpddi->wUsagePage;
ddtmp.wUsage = lpddi->wUsage;
ddtmp.dwDimension = lpddi->dwDimension;
ddtmp.wExponent = lpddi->wExponent;
ddtmp.wReserved = lpddi->wReserved;
}
return data->lpCallBack(&ddtmp, data->lpvRef);
}
/******************************************************************************
* IDirectInputDeviceA
*/
......@@ -355,6 +396,37 @@ HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
return E_FAIL;
}
HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(
LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj
)
{
ICOM_THIS(IDirectInputDevice2AImpl,iface);
TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (IsEqualGUID(&IID_IUnknown,riid)) {
IDirectInputDevice2_AddRef(iface);
*ppobj = This;
return DI_OK;
}
if (IsEqualGUID(&IID_IDirectInputDeviceW,riid)) {
IDirectInputDevice2_AddRef(iface);
*ppobj = This;
return DI_OK;
}
if (IsEqualGUID(&IID_IDirectInputDevice2W,riid)) {
IDirectInputDevice2_AddRef(iface);
*ppobj = This;
return DI_OK;
}
if (IsEqualGUID(&IID_IDirectInputDevice7W,riid)) {
IDirectInputDevice7_AddRef(iface);
*ppobj = This;
return DI_OK;
}
TRACE("Unsupported interface !\n");
return E_FAIL;
}
ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
LPDIRECTINPUTDEVICE8A iface)
{
......@@ -378,6 +450,22 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
LPDIRECTINPUTDEVICE8W iface,
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
LPVOID lpvRef,
DWORD dwFlags)
{
FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags);
if (TRACE_ON(dinput)) {
DPRINTF(" - flags = ");
_dump_EnumObjects_flags(dwFlags);
DPRINTF("\n");
}
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid,
......@@ -404,6 +492,18 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(
LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEOBJECTINSTANCEW pdidoi,
DWORD dwObj,
DWORD dwHow)
{
FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
iface, pdidoi, dwObj, dwHow);
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEINSTANCEA pdidi)
......@@ -413,6 +513,15 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEINSTANCEW pdidi)
{
FIXME("(this=%p,%p): stub!\n",
iface, pdidi);
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
LPDIRECTINPUTDEVICE8A iface,
......@@ -466,6 +575,20 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
LPDIRECTINPUTDEVICE8W iface,
LPDIENUMEFFECTSCALLBACKW lpCallback,
LPVOID lpvRef,
DWORD dwFlags)
{
FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
iface, lpCallback, lpvRef, dwFlags);
if (lpCallback)
lpCallback(NULL, lpvRef);
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
LPDIRECTINPUTDEVICE8A iface,
LPDIEFFECTINFOA lpdei,
......@@ -476,6 +599,16 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
LPDIRECTINPUTDEVICE8W iface,
LPDIEFFECTINFOW lpdei,
REFGUID rguid)
{
FIXME("(this=%p,%p,%s): stub!\n",
iface, lpdei, debugstr_guid(rguid));
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
LPDIRECTINPUTDEVICE8A iface,
LPDWORD pdwOut)
......@@ -547,6 +680,17 @@ HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
LPCWSTR lpszFileName,
LPDIENUMEFFECTSINFILECALLBACK pec,
LPVOID pvRef,
DWORD dwFlags)
{
FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
LPCSTR lpszFileName,
DWORD dwEntries,
......@@ -558,6 +702,17 @@ HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
LPCWSTR lpszFileName,
DWORD dwEntries,
LPDIFILEEFFECT rgDiFileEft,
DWORD dwFlags)
{
FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
LPDIACTIONFORMATA lpdiaf,
LPCSTR lpszUserName,
......@@ -568,6 +723,16 @@ HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A ifa
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
LPDIACTIONFORMATW lpdiaf,
LPCWSTR lpszUserName,
DWORD dwFlags)
{
FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
LPDIACTIONFORMATA lpdiaf,
LPCSTR lpszUserName,
......@@ -578,6 +743,16 @@ HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
LPDIACTIONFORMATW lpdiaf,
LPCWSTR lpszUserName,
DWORD dwFlags)
{
FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
{
......@@ -585,3 +760,11 @@ HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface
return DI_OK;
}
HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
{
FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
return DI_OK;
}
......@@ -70,12 +70,24 @@ extern DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT
} \
}
/**
* Callback Data used by specific callback
* for EnumObject on 'W' interfaces
*/
typedef struct {
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallBack;
LPVOID lpvRef;
} device_enumobjects_AtoWcb_data;
extern BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA, LPVOID);
/* Various debug tools */
extern void _dump_cooperativelevel_DI(DWORD dwFlags) ;
extern void _dump_EnumObjects_flags(DWORD dwFlags) ;
extern void _dump_DIPROPHEADER(DIPROPHEADER *diph) ;
extern void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) ;
extern void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) ;
/* And the stubs */
extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
......@@ -85,8 +97,8 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj ) ;
extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
LPDIRECTINPUTDEVICE8A iface) ;
extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
......@@ -94,6 +106,11 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
LPVOID lpvRef,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
LPDIRECTINPUTDEVICE8W iface,
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
LPVOID lpvRef,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid,
......@@ -103,9 +120,16 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
LPDIDEVICEOBJECTINSTANCEA pdidoi,
DWORD dwObj,
DWORD dwHow) ;
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEOBJECTINSTANCEW pdidoi,
DWORD dwObj,
DWORD dwHow);
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEINSTANCEA pdidi) ;
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEINSTANCEW pdidi) ;
extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
LPDIRECTINPUTDEVICE8A iface,
HWND hwndOwner,
......@@ -126,10 +150,19 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
LPDIENUMEFFECTSCALLBACKA lpCallback,
LPVOID lpvRef,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
LPDIRECTINPUTDEVICE8W iface,
LPDIENUMEFFECTSCALLBACKW lpCallback,
LPVOID lpvRef,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
LPDIRECTINPUTDEVICE8A iface,
LPDIEFFECTINFOA lpdei,
REFGUID rguid) ;
extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
LPDIRECTINPUTDEVICE8W iface,
LPDIEFFECTINFOW lpdei,
REFGUID rguid) ;
extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
LPDIRECTINPUTDEVICE8A iface,
LPDWORD pdwOut) ;
......@@ -157,20 +190,40 @@ extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDE
LPDIENUMEFFECTSINFILECALLBACK pec,
LPVOID pvRef,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
LPCWSTR lpszFileName,
LPDIENUMEFFECTSINFILECALLBACK pec,
LPVOID pvRef,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
LPCSTR lpszFileName,
DWORD dwEntries,
LPDIFILEEFFECT rgDiFileEft,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
LPCWSTR lpszFileName,
DWORD dwEntries,
LPDIFILEEFFECT rgDiFileEft,
DWORD dwFlags) ;
extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
LPDIACTIONFORMATA lpdiaf,
LPCSTR lpszUserName,
DWORD dwFlags);
extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
LPDIACTIONFORMATW lpdiaf,
LPCWSTR lpszUserName,
DWORD dwFlags);
extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
LPDIACTIONFORMATA lpdiaf,
LPCSTR lpszUserName,
DWORD dwFlags);
extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
LPDIACTIONFORMATW lpdiaf,
LPCWSTR lpszUserName,
DWORD dwFlags);
extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
#endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */
@ stdcall DirectInputCreateA(long long ptr ptr)
@ stub DirectInputCreateW
@ stdcall DirectInputCreateW(long long ptr ptr)
@ stdcall DirectInputCreateEx(long long ptr ptr ptr)
@ stdcall DllCanUnloadNow() DINPUT_DllCanUnloadNow
@ stdcall DllGetClassObject(ptr ptr ptr) DINPUT_DllGetClassObject
......
......@@ -23,8 +23,8 @@
#include "dinput.h"
/* Implementation specification */
typedef struct IDirectInputAImpl IDirectInputAImpl;
struct IDirectInputAImpl
typedef struct IDirectInputImpl IDirectInputImpl;
struct IDirectInputImpl
{
LPVOID lpVtbl;
DWORD ref;
......@@ -38,11 +38,13 @@ struct IDirectInputAImpl
/* Function called by all devices that Wine supports */
typedef struct dinput_device {
INT pref;
BOOL (*enum_device)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version);
HRESULT (*create_device)(IDirectInputAImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version);
BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version);
HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev);
} dinput_device;
extern void dinput_register_device(dinput_device *device) ;
extern void dinput_register_device(dinput_device *device);
extern HINSTANCE DINPUT_instance;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment