Author: akhaldi
Date: Tue Jul 21 23:22:55 2015
New Revision: 68519
URL:
http://svn.reactos.org/svn/reactos?rev=68519&view=rev
Log:
[DINPUT] Sync with Wine Staging 1.7.47. CORE-9924
Modified:
trunk/reactos/dll/directx/wine/dinput/device.c
trunk/reactos/dll/directx/wine/dinput/device_private.h
trunk/reactos/dll/directx/wine/dinput/joystick.c
trunk/reactos/dll/directx/wine/dinput/joystick_linux.c
trunk/reactos/dll/directx/wine/dinput/keyboard.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/directx/wine/dinput/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/de…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/device.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/device.c [iso-8859-1] Tue Jul 21 23:22:55 2015
@@ -852,7 +852,7 @@
/* Save the settings to disk */
save_mapping_settings(iface, lpdiaf, username);
- return IDirectInputDevice8WImpl_SetActionMap(iface, lpdiaf, lpszUserName, dwFlags);
+ return DI_OK;
}
/******************************************************************************
@@ -1617,8 +1617,14 @@
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
if (!This->acquired) return DIERR_NOTACQUIRED;
- /* Because wine devices do not need to be polled, just return DI_NOEFFECT */
+
+#ifndef __REACTOS__
+ __wine_check_for_events( QS_ALLINPUT );
+ return DI_OK;
+#else
+ /* Devices do not need to be polled on ReactOS. */
return DI_NOEFFECT;
+#endif
}
HRESULT WINAPI IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
@@ -1705,16 +1711,6 @@
return DI_OK;
}
-HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
- LPDIACTIONFORMATW lpdiaf,
- LPCWSTR lpszUserName,
- DWORD dwFlags)
-{
- FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf,
debugstr_w(lpszUserName), dwFlags);
-
- return DI_OK;
-}
-
HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
{
Modified: trunk/reactos/dll/directx/wine/dinput/device_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/de…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/device_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/device_private.h [iso-8859-1] Tue Jul 21
23:22:55 2015
@@ -235,10 +235,6 @@
LPDIACTIONFORMATW lpdiaf,
LPCWSTR lpszUserName,
DWORD dwFlags) DECLSPEC_HIDDEN;
-extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
- LPDIACTIONFORMATW lpdiaf,
- LPCWSTR lpszUserName,
- DWORD dwFlags) DECLSPEC_HIDDEN;
extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) DECLSPEC_HIDDEN;
extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
Modified: trunk/reactos/dll/directx/wine/dinput/joystick.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/jo…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/joystick.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/joystick.c [iso-8859-1] Tue Jul 21 23:22:55
2015
@@ -28,6 +28,8 @@
#include "dinput_private.h"
+#include <stdio.h>
+
#include "joystick_private.h"
static inline JoystickGenericImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A
*iface)
@@ -407,13 +409,13 @@
TRACE("dwFlags: %08x\n", lpDIDevCaps->dwFlags);
switch(type)
{
- /* Directx <= 7 definitions */
+ /* Direct X <= 7 definitions */
DEBUG_TYPE(DIDEVTYPE_DEVICE);
DEBUG_TYPE(DIDEVTYPE_MOUSE);
DEBUG_TYPE(DIDEVTYPE_KEYBOARD);
DEBUG_TYPE(DIDEVTYPE_JOYSTICK);
DEBUG_TYPE(DIDEVTYPE_HID);
- /* Directx >= 8 definitions */
+ /* Direct X >= 8 definitions */
DEBUG_TYPE(DI8DEVTYPE_DEVICE);
DEBUG_TYPE(DI8DEVTYPE_MOUSE);
DEBUG_TYPE(DI8DEVTYPE_KEYBOARD);
@@ -606,6 +608,8 @@
LPDIDEVICEINSTANCEA pdidi)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
+ DIPROPDWORD pd;
+ DWORD index = 0;
TRACE("(%p,%p)\n", iface, pdidi);
@@ -619,13 +623,21 @@
WARN("invalid parameter: pdidi->dwSize = %d\n", pdidi->dwSize);
return DIERR_INVALIDPARAM;
}
+
+ /* Try to get joystick index */
+ pd.diph.dwSize = sizeof(pd);
+ pd.diph.dwHeaderSize = sizeof(pd.diph);
+ pd.diph.dwObj = 0;
+ pd.diph.dwHow = DIPH_DEVICE;
+ if (SUCCEEDED(IDirectInputDevice2_GetProperty(iface, DIPROP_JOYSTICKID,
&pd.diph)))
+ index = pd.dwData;
/* Return joystick */
pdidi->guidInstance = This->guidInstance;
pdidi->guidProduct = This->guidProduct;
/* we only support traditional joysticks for now */
pdidi->dwDevType = This->devcaps.dwDevType;
- strcpy(pdidi->tszInstanceName, "Joystick");
+ snprintf(pdidi->tszInstanceName, MAX_PATH, "Joystick %d", index);
strcpy(pdidi->tszProductName, This->name);
if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3A)) {
pdidi->guidFFDriver = GUID_NULL;
@@ -644,6 +656,9 @@
LPDIDEVICEINSTANCEW pdidi)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
+ CHAR buffer[MAX_PATH];
+ DIPROPDWORD pd;
+ DWORD index = 0;
TRACE("(%p,%p)\n", iface, pdidi);
@@ -652,13 +667,22 @@
WARN("invalid parameter: pdidi->dwSize = %d\n", pdidi->dwSize);
return DIERR_INVALIDPARAM;
}
+
+ /* Try to get joystick index */
+ pd.diph.dwSize = sizeof(pd);
+ pd.diph.dwHeaderSize = sizeof(pd.diph);
+ pd.diph.dwObj = 0;
+ pd.diph.dwHow = DIPH_DEVICE;
+ if (SUCCEEDED(IDirectInputDevice2_GetProperty(iface, DIPROP_JOYSTICKID,
&pd.diph)))
+ index = pd.dwData;
/* Return joystick */
pdidi->guidInstance = This->guidInstance;
pdidi->guidProduct = This->guidProduct;
/* we only support traditional joysticks for now */
pdidi->dwDevType = This->devcaps.dwDevType;
- MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, pdidi->tszInstanceName,
MAX_PATH);
+ snprintf(buffer, sizeof(buffer), "Joystick %d", index);
+ MultiByteToWideChar(CP_ACP, 0, buffer, -1, pdidi->tszInstanceName, MAX_PATH);
MultiByteToWideChar(CP_ACP, 0, This->name, -1, pdidi->tszProductName,
MAX_PATH);
if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3W)) {
pdidi->guidFFDriver = GUID_NULL;
@@ -740,7 +764,7 @@
DWORD type = 0x000000ff & (lpdiaf->rgoAction[i].dwSemantic >> 8);
DWORD genre = 0xff000000 & lpdiaf->rgoAction[i].dwSemantic;
- /* Don't touch an user configured action */
+ /* Don't touch a user configured action */
if (lpdiaf->rgoAction[i].dwHow == DIAH_USERCONFIG) continue;
/* Only consider actions of the right genre */
@@ -750,7 +774,7 @@
{
if (type & object_types[j])
{
- /* Assure that the object exists */
+ /* Ensure that the object exists */
LPDIOBJECTDATAFORMAT odf =
dataformat_to_odf_by_type(This->base.data_format.wine_df, inst, object_types[j]);
if (odf != NULL)
Modified: trunk/reactos/dll/directx/wine/dinput/joystick_linux.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/jo…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/joystick_linux.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/joystick_linux.c [iso-8859-1] Tue Jul 21
23:22:55 2015
@@ -203,6 +203,52 @@
return joystick_devices_count;
}
+static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version, int
id)
+{
+ DWORD dwSize = lpddi->dwSize;
+
+ TRACE("%d %p\n", dwSize, lpddi);
+ memset(lpddi, 0, dwSize);
+
+ /* Return joystick */
+ lpddi->dwSize = dwSize;
+ lpddi->guidInstance = DInput_Wine_Joystick_GUID;
+ lpddi->guidInstance.Data3 = id;
+ lpddi->guidProduct = DInput_Wine_Joystick_GUID;
+ /* we only support traditional joysticks for now */
+ if (version >= 0x0800)
+ lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD <<
8);
+ else
+ lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
+ strcpy(lpddi->tszInstanceName, joystick_devices[id].name);
+ strcpy(lpddi->tszProductName, joystick_devices[id].name);
+
+ lpddi->guidFFDriver = GUID_NULL;
+}
+
+static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version, int
id)
+{
+ DWORD dwSize = lpddi->dwSize;
+
+ TRACE("%d %p\n", dwSize, lpddi);
+ memset(lpddi, 0, dwSize);
+
+ /* Return joystick */
+ lpddi->dwSize = dwSize;
+ lpddi->guidInstance = DInput_Wine_Joystick_GUID;
+ lpddi->guidInstance.Data3 = id;
+ lpddi->guidProduct = DInput_Wine_Joystick_GUID;
+ /* we only support traditional joysticks for now */
+ if (version >= 0x0800)
+ lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD <<
8);
+ else
+ lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
+
+ MultiByteToWideChar(CP_ACP, 0, joystick_devices[id].name, -1,
lpddi->tszInstanceName, MAX_PATH);
+ MultiByteToWideChar(CP_ACP, 0, joystick_devices[id].name, -1,
lpddi->tszProductName, MAX_PATH);
+ lpddi->guidFFDriver = GUID_NULL;
+}
+
static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA
lpddi, DWORD version, int id)
{
int fd = -1;
@@ -223,21 +269,7 @@
WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices[id].name,
strerror(errno));
return S_FALSE;
}
-
- /* Return joystick */
- lpddi->guidInstance = DInput_Wine_Joystick_GUID;
- lpddi->guidInstance.Data3 = id;
- lpddi->guidProduct = DInput_Wine_Joystick_GUID;
- /* we only support traditional joysticks for now */
- if (version >= 0x0800)
- lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
- else
- lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
-
- strcpy(lpddi->tszInstanceName, joystick_devices[id].name);
- strcpy(lpddi->tszProductName, joystick_devices[id].name);
-
- lpddi->guidFFDriver = GUID_NULL;
+ fill_joystick_dideviceinstanceA( lpddi, version, id );
close(fd);
TRACE("Enumerating the linux Joystick device: %s (%s)\n",
joystick_devices[id].device, lpddi->tszProductName);
return S_OK;
@@ -266,20 +298,7 @@
WARN("open(%s,O_RDONLY) failed: %s\n", joystick_devices[id].device,
strerror(errno));
return S_FALSE;
}
-
- /* Return joystick */
- lpddi->guidInstance = DInput_Wine_Joystick_GUID;
- lpddi->guidInstance.Data3 = id;
- lpddi->guidProduct = DInput_Wine_Joystick_GUID;
- /* we only support traditional joysticks for now */
- if (version >= 0x0800)
- lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
- else
- lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
-
- MultiByteToWideChar(CP_ACP, 0, joystick_devices[id].name, -1,
lpddi->tszInstanceName, MAX_PATH);
- MultiByteToWideChar(CP_ACP, 0, joystick_devices[id].name, -1,
lpddi->tszProductName, MAX_PATH);
- lpddi->guidFFDriver = GUID_NULL;
+ fill_joystick_dideviceinstanceW( lpddi, version, id );
close(fd);
TRACE("Enumerating the linux Joystick device: %s (%s)\n",
joystick_devices[id].device, joystick_devices[id].name);
return S_OK;
@@ -568,6 +587,41 @@
{
JoystickImpl *This = impl_from_IDirectInputDevice8A(iface);
return JoystickLinuxWImpl_GetProperty(IDirectInputDevice8W_from_impl(This), rguid,
pdiph);
+}
+
+/******************************************************************************
+ * GetDeviceInfo : get information about a device's identity
+ */
+static HRESULT WINAPI JoystickLinuxAImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEINSTANCEA ddi)
+{
+ JoystickImpl *This = impl_from_IDirectInputDevice8A(iface);
+
+ TRACE("(%p) %p\n", This, ddi);
+
+ if (ddi == NULL) return E_POINTER;
+ if ((ddi->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) &&
+ (ddi->dwSize != sizeof(DIDEVICEINSTANCEA)))
+ return DIERR_INVALIDPARAM;
+
+ fill_joystick_dideviceinstanceA( ddi, This->generic.base.dinput->dwVersion,
+ get_joystick_index(&This->generic.base.guid)
);
+ return DI_OK;
+}
+
+static HRESULT WINAPI JoystickLinuxWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEINSTANCEW ddi)
+{
+ JoystickImpl *This = impl_from_IDirectInputDevice8W(iface);
+
+ TRACE("(%p) %p\n", This, ddi);
+
+ if (ddi == NULL) return E_POINTER;
+ if ((ddi->dwSize != sizeof(DIDEVICEINSTANCE_DX3W)) &&
+ (ddi->dwSize != sizeof(DIDEVICEINSTANCEW)))
+ return DIERR_INVALIDPARAM;
+
+ fill_joystick_dideviceinstanceW( ddi, This->generic.base.dinput->dwVersion,
+ get_joystick_index(&This->generic.base.guid)
);
+ return DI_OK;
}
/******************************************************************************
@@ -693,7 +747,7 @@
IDirectInputDevice2AImpl_SetEventNotification,
IDirectInputDevice2AImpl_SetCooperativeLevel,
JoystickAGenericImpl_GetObjectInfo,
- JoystickAGenericImpl_GetDeviceInfo,
+ JoystickLinuxAImpl_GetDeviceInfo,
IDirectInputDevice2AImpl_RunControlPanel,
IDirectInputDevice2AImpl_Initialize,
IDirectInputDevice2AImpl_CreateEffect,
@@ -729,7 +783,7 @@
IDirectInputDevice2WImpl_SetEventNotification,
IDirectInputDevice2WImpl_SetCooperativeLevel,
JoystickWGenericImpl_GetObjectInfo,
- JoystickWGenericImpl_GetDeviceInfo,
+ JoystickLinuxWImpl_GetDeviceInfo,
IDirectInputDevice2WImpl_RunControlPanel,
IDirectInputDevice2WImpl_Initialize,
IDirectInputDevice2WImpl_CreateEffect,
Modified: trunk/reactos/dll/directx/wine/dinput/keyboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/ke…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/keyboard.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/keyboard.c [iso-8859-1] Tue Jul 21 23:22:55
2015
@@ -515,6 +515,29 @@
return SysKeyboardWImpl_GetProperty(IDirectInputDevice8W_from_impl(This), rguid,
pdiph);
}
+static HRESULT WINAPI SysKeyboardWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
+{
+ SysKeyboardImpl *This = impl_from_IDirectInputDevice8W(iface);
+ HRESULT res;
+
+ TRACE("(%p)\n", This);
+
+ res = IDirectInputDevice2WImpl_Acquire(iface);
+ if (res == DI_OK)
+ {
+ TRACE("clearing keystate\n");
+ memset(This->DInputKeyState, 0, sizeof(This->DInputKeyState));
+ }
+
+ return res;
+}
+
+static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
+{
+ SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
+ return SysKeyboardWImpl_Acquire(IDirectInputDevice8W_from_impl(This));
+}
+
static HRESULT WINAPI SysKeyboardWImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
LPDIACTIONFORMATW lpdiaf,
LPCWSTR lpszUserName,
@@ -603,7 +626,7 @@
IDirectInputDevice2AImpl_EnumObjects,
SysKeyboardAImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty,
- IDirectInputDevice2AImpl_Acquire,
+ SysKeyboardAImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
SysKeyboardAImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
@@ -639,7 +662,7 @@
IDirectInputDevice2WImpl_EnumObjects,
SysKeyboardWImpl_GetProperty,
IDirectInputDevice2WImpl_SetProperty,
- IDirectInputDevice2WImpl_Acquire,
+ SysKeyboardWImpl_Acquire,
IDirectInputDevice2WImpl_Unacquire,
SysKeyboardWImpl_GetDeviceState,
IDirectInputDevice2WImpl_GetDeviceData,
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Jul 21 23:22:55 2015
@@ -30,7 +30,7 @@
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.7.47
reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.7.37
reactos/dll/directx/wine/devenum # Synced to WineStaging-1.7.47
-reactos/dll/directx/wine/dinput # Synced to WineStaging-1.7.37
+reactos/dll/directx/wine/dinput # Synced to WineStaging-1.7.47
reactos/dll/directx/wine/dinput8 # Synced to WineStaging-1.7.37
reactos/dll/directx/wine/dmusic # Synced to WineStaging-1.7.37
reactos/dll/directx/wine/dplay # Synced to WineStaging-1.7.37