Author: akhaldi
Date: Sat Jul 2 15:38:59 2016
New Revision: 71759
URL:
http://svn.reactos.org/svn/reactos?rev=71759&view=rev
Log:
[DINPUT] Sync with Wine Staging 1.9.11. CORE-11368
Modified:
trunk/reactos/dll/directx/wine/dinput/device.c
trunk/reactos/dll/directx/wine/dinput/device_private.h
trunk/reactos/dll/directx/wine/dinput/effect_linuxinput.c
trunk/reactos/dll/directx/wine/dinput/joystick_linux.c
trunk/reactos/dll/directx/wine/dinput/joystick_osx.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] Sat Jul 2 15:38:59 2016
@@ -764,7 +764,6 @@
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR
lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
{
- static const WCHAR emptyW[] = { 0 };
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
DIDATAFORMAT data_format;
DIOBJECTDATAFORMAT *obj_df = NULL;
@@ -855,7 +854,10 @@
dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dps.diph.dwObj = 0;
dps.diph.dwHow = DIPH_DEVICE;
- lstrcpynW(dps.wsz, (dwFlags & DIDSAM_NOUSER) ? emptyW : username,
sizeof(dps.wsz)/sizeof(WCHAR));
+ if (dwFlags & DIDSAM_NOUSER)
+ dps.wsz[0] = '\0';
+ else
+ lstrcpynW(dps.wsz, username, sizeof(dps.wsz)/sizeof(WCHAR));
IDirectInputDevice8_SetProperty(iface, DIPROP_USERNAME, &dps.diph);
/* Save the settings to disk */
@@ -1095,9 +1097,6 @@
/* Free action mapping */
HeapFree(GetProcessHeap(), 0, This->action_map);
- /* Free username */
- HeapFree(GetProcessHeap(), 0, This->username);
-
EnterCriticalSection( &This->dinput->crit );
list_remove( &This->entry );
LeaveCriticalSection( &This->dinput->crit );
@@ -1255,9 +1254,7 @@
if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
- ps->wsz[0] = 0;
- if (This->username)
- lstrcpynW(ps->wsz, This->username,
sizeof(ps->wsz)/sizeof(WCHAR));
+ lstrcpynW(ps->wsz, This->username, sizeof(ps->wsz)/sizeof(WCHAR));
break;
}
case (DWORD_PTR) DIPROP_VIDPID:
@@ -1339,14 +1336,7 @@
if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
- if (!This->username)
- This->username = HeapAlloc(GetProcessHeap(), 0, sizeof(ps->wsz));
- if (!This->username)
- return DIERR_OUTOFMEMORY;
-
- This->username[0] = 0;
- if (ps->wsz)
- lstrcpynW(This->username, ps->wsz,
sizeof(ps->wsz)/sizeof(WCHAR));
+ lstrcpynW(This->username, ps->wsz,
sizeof(This->username)/sizeof(WCHAR));
break;
}
default:
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] Sat Jul 2
15:38:59 2016
@@ -73,7 +73,7 @@
/* Action mapping */
int num_actions; /* number of actions mapped */
ActionMap *action_map; /* array of mappings */
- WCHAR *username; /* set by 'SetActionMap' */
+ WCHAR username[MAX_PATH];
};
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
Modified: trunk/reactos/dll/directx/wine/dinput/effect_linuxinput.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/ef…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/effect_linuxinput.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/effect_linuxinput.c [iso-8859-1] Sat Jul 2
15:38:59 2016
@@ -67,6 +67,11 @@
return CONTAINING_RECORD(iface, LinuxInputEffectImpl, IDirectInputEffect_iface);
}
+static double ff_effect_direction_to_rad(unsigned int dir)
+{
+ return (dir & 0xffff) * M_PI / 0x8000;
+}
+
/******************************************************************************
* LinuxInputEffectImpl
*/
@@ -172,8 +177,10 @@
return diErr;
else {
if (peff->dwFlags & DIEFF_CARTESIAN) {
- peff->rglDirection[0] = sin(M_PI * 3 * This->effect.direction / 0x7FFF) * 1000;
- peff->rglDirection[1] = cos(M_PI * 3 * This->effect.direction / 0x7FFF) * 1000;
+ /* rotate so 0 points right */
+ double angle = ff_effect_direction_to_rad(This->effect.direction + 0xc000);
+ peff->rglDirection[0] = sin(angle) * 1000;
+ peff->rglDirection[1] = -cos(angle) * 1000;
} else {
/* Polar and spherical coordinates are the same for two or less
* axes.
@@ -505,9 +512,11 @@
/* One condition block. This needs to be rotated to direction,
* and expanded to separate x and y conditions. */
int i;
- double factor[2];
- factor[0] = asin((This->effect.direction * 3.0 * M_PI) / 0x7FFF);
- factor[1] = acos((This->effect.direction * 3.0 * M_PI) / 0x7FFF);
+ double factor[2], angle;
+ /* rotate so 0 points right */
+ angle = ff_effect_direction_to_rad(This->effect.direction + 0xc000);
+ factor[0] = sin(angle);
+ factor[1] = -cos(angle);
for (i = 0; i < 2; ++i) {
This->effect.u.condition[i].center = (int)(factor[i] *
(tsp->lOffset / 10) * 32);
This->effect.u.condition[i].right_coeff = (int)(factor[i] *
(tsp->lPositiveCoefficient / 10) * 32);
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] Sat Jul 2
15:38:59 2016
@@ -143,7 +143,7 @@
#ifdef JSIOCGAXES
if (ioctl(fd, JSIOCGAXES, &joydev.axis_count) < 0)
{
- WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n",
joydev.device, strerror(errno));
+ WARN("ioctl(%s,JSIOCGAXES) failed: %s, defaulting to 2\n",
joydev.device, strerror(errno));
joydev.axis_count = 2;
}
#else
@@ -153,7 +153,7 @@
#ifdef JSIOCGBUTTONS
if (ioctl(fd, JSIOCGBUTTONS, &joydev.button_count) < 0)
{
- WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n",
joydev.device, strerror(errno));
+ WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defaulting to 2\n",
joydev.device, strerror(errno));
joydev.button_count = 2;
}
#else
Modified: trunk/reactos/dll/directx/wine/dinput/joystick_osx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/jo…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/joystick_osx.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/joystick_osx.c [iso-8859-1] Sat Jul 2 15:38:59
2016
@@ -1474,7 +1474,7 @@
TRACE("%p %s %p\n", This, debugstr_guid(guid), out);
- if(IsEqualIID(guid, &IID_IDirectInputEffect)){
+ if(IsEqualIID(guid, &IID_IUnknown) || IsEqualIID(guid,
&IID_IDirectInputEffect)){
*out = iface;
IDirectInputEffect_AddRef(iface);
return S_OK;
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] Sat Jul 2 15:38:59 2016
@@ -30,7 +30,7 @@
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/devenum # Synced to WineStaging-1.9.11
-reactos/dll/directx/wine/dinput # Synced to WineStaging-1.9.4
+reactos/dll/directx/wine/dinput # Synced to WineStaging-1.9.11
reactos/dll/directx/wine/dinput8 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/dmusic # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/dplay # Synced to WineStaging-1.9.4