Author: akhaldi
Date: Sun Feb 26 16:36:28 2017
New Revision: 73934
URL:
http://svn.reactos.org/svn/reactos?rev=73934&view=rev
Log:
[DINPUT] Sync with Wine Staging 2.2. CORE-12823
f921b63 dinput: Do not wait for hook thread startup in IDirectInput8::Initialize.
f9b4be5 dinput: Allocate correct amount of memory in
IDirectInput8AImpl_EnumDevicesBySemantics.
04bddb6 dinput: Give correct count of devices still to be enumerated.
8339de0 dinput: Simplify JoystickWImpl_Unacquire for Linux.
27f4568 dinput: DISFFC_RESET will not release the effects.
2d2d833 dinput: Downgrade a FIXME to WARN in JoystickWImpl_SendForceFeedbackCommand.
cc37322 dinput: Fix GetEffectStatus for Linux when effect was not downloaded.
6bb2c4c dinput: Skip events that are not useful currently.
49d4261 dinput: Spelling and case fixes in comments.
Modified:
trunk/reactos/dll/directx/wine/dinput/dinput.rc
trunk/reactos/dll/directx/wine/dinput/dinput_main.c
trunk/reactos/dll/directx/wine/dinput/effect_linuxinput.c
trunk/reactos/dll/directx/wine/dinput/joystick_linuxinput.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/directx/wine/dinput/dinput.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/di…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/dinput.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/dinput.rc [iso-8859-1] Sun Feb 26 16:36:28 2017
@@ -32,6 +32,8 @@
#include <wine/wine_common_ver.rc>
+#pragma makedep po
+
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
Modified: trunk/reactos/dll/directx/wine/dinput/dinput_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/di…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/dinput_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/dinput_main.c [iso-8859-1] Sun Feb 26 16:36:28
2017
@@ -911,7 +911,9 @@
LPDIRECTINPUTDEVICE8A lpdid;
DWORD callbackFlags;
int i, j;
-
+ int device_count = 0;
+ int remain;
+ DIDEVICEINSTANCEA *didevis = 0;
FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This,
debugstr_a(ptszUserName), lpdiActionFormat,
lpCallback, pvRef, dwFlags);
@@ -939,18 +941,36 @@
{
TRACE(" - checking device %u ('%s')\n", i,
dinput_devices[i]->name);
- callbackFlags = diactionformat_priorityA(lpdiActionFormat,
lpdiActionFormat->dwGenre);
/* Default behavior is to enumerate attached game controllers */
enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL,
DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
if (enumSuccess == S_OK)
{
- IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid,
NULL);
-
- if (lpCallback(&didevi, lpdid, callbackFlags, 0, pvRef) ==
DIENUM_STOP)
- return DI_OK;
+ if (device_count++)
+ didevis = HeapReAlloc(GetProcessHeap(), 0, didevis,
sizeof(DIDEVICEINSTANCEA)*device_count);
+ else
+ didevis = HeapAlloc(GetProcessHeap(), 0,
sizeof(DIDEVICEINSTANCEA)*device_count);
+ didevis[device_count-1] = didevi;
}
}
}
+
+ remain = device_count;
+ if (!(dwFlags & DIEDBSFL_FORCEFEEDBACK))
+ remain += sizeof(guids)/sizeof(guids[0]);
+
+ for (i = 0; i < device_count; i++)
+ {
+ callbackFlags = diactionformat_priorityA(lpdiActionFormat,
lpdiActionFormat->dwGenre);
+ IDirectInput_CreateDevice(iface, &didevis[i].guidInstance, &lpdid,
NULL);
+
+ if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) ==
DIENUM_STOP)
+ {
+ HeapFree(GetProcessHeap(), 0, didevis);
+ return DI_OK;
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, didevis);
if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
@@ -982,6 +1002,9 @@
LPDIRECTINPUTDEVICE8W lpdid;
DWORD callbackFlags;
int i, j;
+ int device_count = 0;
+ int remain;
+ DIDEVICEINSTANCEW *didevis = 0;
FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This,
debugstr_w(ptszUserName), lpdiActionFormat,
lpCallback, pvRef, dwFlags);
@@ -999,18 +1022,36 @@
{
TRACE(" - checking device %u ('%s')\n", i,
dinput_devices[i]->name);
- callbackFlags = diactionformat_priorityW(lpdiActionFormat,
lpdiActionFormat->dwGenre);
/* Default behavior is to enumerate attached game controllers */
enumSuccess = dinput_devices[i]->enum_deviceW(DI8DEVCLASS_GAMECTRL,
DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
if (enumSuccess == S_OK)
{
- IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid,
NULL);
-
- if (lpCallback(&didevi, lpdid, callbackFlags, 0, pvRef) ==
DIENUM_STOP)
- return DI_OK;
+ if (device_count++)
+ didevis = HeapReAlloc(GetProcessHeap(), 0, didevis,
sizeof(DIDEVICEINSTANCEW)*device_count);
+ else
+ didevis = HeapAlloc(GetProcessHeap(), 0,
sizeof(DIDEVICEINSTANCEW)*device_count);
+ didevis[device_count-1] = didevi;
}
}
}
+
+ remain = device_count;
+ if (!(dwFlags & DIEDBSFL_FORCEFEEDBACK))
+ remain += sizeof(guids)/sizeof(guids[0]);
+
+ for (i = 0; i < device_count; i++)
+ {
+ callbackFlags = diactionformat_priorityW(lpdiActionFormat,
lpdiActionFormat->dwGenre);
+ IDirectInput_CreateDevice(iface, &didevis[i].guidInstance, &lpdid,
NULL);
+
+ if (lpCallback(&didevis[i], lpdid, callbackFlags, --remain, pvRef) ==
DIENUM_STOP)
+ {
+ HeapFree(GetProcessHeap(), 0, didevis);
+ return DI_OK;
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, didevis);
if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
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] Sun Feb 26
16:36:28 2017
@@ -234,10 +234,15 @@
LPDIRECTINPUTEFFECT iface,
LPDWORD pdwFlags)
{
- TRACE("(this=%p,%p)\n", iface, pdwFlags);
+ LinuxInputEffectImpl *This = impl_from_IDirectInputEffect(iface);
+
+ TRACE("(this=%p,%p)\n", This, pdwFlags);
if (!pdwFlags)
return E_POINTER;
+
+ if (This->effect.id == -1)
+ return DIERR_NOTDOWNLOADED;
/* linux sends the effect status through an event.
* that event is trapped by our parent joystick driver
@@ -633,9 +638,9 @@
This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
- /* phase ranges from 0 - 35999 in dinput and 0 - 65535 on linux */
+ /* phase ranges from 0 - 35999 in dinput and 0 - 65535 on Linux */
This->effect.u.periodic.phase = (tsp->dwPhase / 36) * 65;
- /* dinput uses microseconds, linux uses miliseconds */
+ /* dinput uses microseconds, Linux uses milliseconds */
if (tsp->dwPeriod <= 1000)
This->effect.u.periodic.period = 1;
else
Modified: trunk/reactos/dll/directx/wine/dinput/joystick_linuxinput.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/jo…
==============================================================================
--- trunk/reactos/dll/directx/wine/dinput/joystick_linuxinput.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dinput/joystick_linuxinput.c [iso-8859-1] Sun Feb 26
16:36:28 2017
@@ -69,6 +69,8 @@
HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info);
+static HRESULT WINAPI JoystickWImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface,
DWORD dwFlags);
+
typedef struct JoystickImpl JoystickImpl;
static const IDirectInputDevice8AVtbl JoystickAvt;
static const IDirectInputDevice8WVtbl JoystickWvt;
@@ -726,18 +728,10 @@
TRACE("(this=%p)\n",This);
res = IDirectInputDevice2WImpl_Unacquire(iface);
if (res==DI_OK && This->joyfd!=-1) {
- effect_list_item *itr;
struct input_event event;
- /* For each known effect:
- * - stop it
- * - unload it
- * But, unlike DISFFC_RESET, do not release the effect.
- */
- LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry) {
- IDirectInputEffect_Stop(itr->ref);
- IDirectInputEffect_Unload(itr->ref);
- }
+ /* Stop and unload all effects */
+ JoystickWImpl_SendForceFeedbackCommand(iface, DISFFC_RESET);
/* Enable autocenter. */
event.type = EV_FF;
@@ -883,7 +877,7 @@
break;
#endif
default:
- FIXME("joystick cannot handle type %d event (code
%d)\n",ie.type,ie.code);
+ TRACE("skipping event\n");
break;
}
if (inst_id >= 0)
@@ -1312,9 +1306,9 @@
{
case DISFFC_STOPALL:
{
- /* Stop all effects */
effect_list_item *itr;
+ /* Stop all effects */
LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry)
IDirectInputEffect_Stop(itr->ref);
break;
@@ -1322,17 +1316,19 @@
case DISFFC_RESET:
{
- effect_list_item *itr, *ptr;
-
- /* Stop, unload, release and free all effects */
- /* This returns the device to its "bare" state */
- LIST_FOR_EACH_ENTRY_SAFE(itr, ptr, &This->ff_effects, effect_list_item,
entry)
- IDirectInputEffect_Release(itr->ref);
+ effect_list_item *itr;
+
+ /* Stop and unload all effects. It is not true that effects are released */
+ LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry)
+ {
+ IDirectInputEffect_Stop(itr->ref);
+ IDirectInputEffect_Unload(itr->ref);
+ }
break;
}
case DISFFC_PAUSE:
case DISFFC_CONTINUE:
- FIXME("No support for Pause or Continue in linux\n");
+ FIXME("No support for Pause or Continue in linux\n");
break;
case DISFFC_SETACTUATORSOFF:
@@ -1341,8 +1337,8 @@
break;
default:
- FIXME("Unknown Force Feedback Command!\n");
- return DIERR_INVALIDPARAM;
+ WARN("Unknown Force Feedback Command %u!\n", dwFlags);
+ return DIERR_INVALIDPARAM;
}
return DI_OK;
#else
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] Sun Feb 26 16:36:28 2017
@@ -30,7 +30,7 @@
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.9.23
reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/devenum # Synced to WineStaging-1.9.23
-reactos/dll/directx/wine/dinput # Synced to WineStaging-1.9.23
+reactos/dll/directx/wine/dinput # Synced to WineStaging-2.2
reactos/dll/directx/wine/dinput8 # Synced to WineStaging-1.9.23
reactos/dll/directx/wine/dmusic # Synced to WineStaging-1.9.23
reactos/dll/directx/wine/dplay # Synced to WineStaging-1.9.23