mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:35:41 +00:00
[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. svn path=/trunk/; revision=73934
This commit is contained in:
parent
ab65241c66
commit
b2b175013f
5 changed files with 79 additions and 35 deletions
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include <wine/wine_common_ver.rc>
|
#include <wine/wine_common_ver.rc>
|
||||||
|
|
||||||
|
#pragma makedep po
|
||||||
|
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||||
|
|
||||||
STRINGTABLE
|
STRINGTABLE
|
||||||
|
|
|
@ -911,7 +911,9 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
|
||||||
LPDIRECTINPUTDEVICE8A lpdid;
|
LPDIRECTINPUTDEVICE8A lpdid;
|
||||||
DWORD callbackFlags;
|
DWORD callbackFlags;
|
||||||
int i, j;
|
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,
|
FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This, debugstr_a(ptszUserName), lpdiActionFormat,
|
||||||
lpCallback, pvRef, dwFlags);
|
lpCallback, pvRef, dwFlags);
|
||||||
|
@ -939,18 +941,36 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
|
||||||
{
|
{
|
||||||
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
|
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 */
|
/* Default behavior is to enumerate attached game controllers */
|
||||||
enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
|
enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
|
||||||
if (enumSuccess == S_OK)
|
if (enumSuccess == S_OK)
|
||||||
{
|
{
|
||||||
IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid, NULL);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (lpCallback(&didevi, lpdid, callbackFlags, 0, pvRef) == DIENUM_STOP)
|
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;
|
return DI_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, didevis);
|
||||||
|
|
||||||
if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
|
if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
|
||||||
|
|
||||||
|
@ -982,6 +1002,9 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
|
||||||
LPDIRECTINPUTDEVICE8W lpdid;
|
LPDIRECTINPUTDEVICE8W lpdid;
|
||||||
DWORD callbackFlags;
|
DWORD callbackFlags;
|
||||||
int i, j;
|
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,
|
FIXME("(this=%p,%s,%p,%p,%p,%04x): semi-stub\n", This, debugstr_w(ptszUserName), lpdiActionFormat,
|
||||||
lpCallback, pvRef, dwFlags);
|
lpCallback, pvRef, dwFlags);
|
||||||
|
@ -999,18 +1022,36 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
|
||||||
{
|
{
|
||||||
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
|
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 */
|
/* Default behavior is to enumerate attached game controllers */
|
||||||
enumSuccess = dinput_devices[i]->enum_deviceW(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
|
enumSuccess = dinput_devices[i]->enum_deviceW(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
|
||||||
if (enumSuccess == S_OK)
|
if (enumSuccess == S_OK)
|
||||||
{
|
{
|
||||||
IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid, NULL);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (lpCallback(&didevi, lpdid, callbackFlags, 0, pvRef) == DIENUM_STOP)
|
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;
|
return DI_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, didevis);
|
||||||
|
|
||||||
if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
|
if (dwFlags & DIEDBSFL_FORCEFEEDBACK) return DI_OK;
|
||||||
|
|
||||||
|
|
|
@ -234,11 +234,16 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetEffectStatus(
|
||||||
LPDIRECTINPUTEFFECT iface,
|
LPDIRECTINPUTEFFECT iface,
|
||||||
LPDWORD pdwFlags)
|
LPDWORD pdwFlags)
|
||||||
{
|
{
|
||||||
TRACE("(this=%p,%p)\n", iface, pdwFlags);
|
LinuxInputEffectImpl *This = impl_from_IDirectInputEffect(iface);
|
||||||
|
|
||||||
|
TRACE("(this=%p,%p)\n", This, pdwFlags);
|
||||||
|
|
||||||
if (!pdwFlags)
|
if (!pdwFlags)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
|
if (This->effect.id == -1)
|
||||||
|
return DIERR_NOTDOWNLOADED;
|
||||||
|
|
||||||
/* linux sends the effect status through an event.
|
/* linux sends the effect status through an event.
|
||||||
* that event is trapped by our parent joystick driver
|
* that event is trapped by our parent joystick driver
|
||||||
* and there is no clean way to pass it back to us. */
|
* and there is no clean way to pass it back to us. */
|
||||||
|
@ -633,9 +638,9 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
|
||||||
|
|
||||||
This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
|
This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
|
||||||
This->effect.u.periodic.offset = (tsp->lOffset / 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;
|
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)
|
if (tsp->dwPeriod <= 1000)
|
||||||
This->effect.u.periodic.period = 1;
|
This->effect.u.periodic.period = 1;
|
||||||
else
|
else
|
||||||
|
|
|
@ -69,6 +69,8 @@ HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, struct list *parent_lis
|
||||||
HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
|
HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
|
||||||
HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW 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;
|
typedef struct JoystickImpl JoystickImpl;
|
||||||
static const IDirectInputDevice8AVtbl JoystickAvt;
|
static const IDirectInputDevice8AVtbl JoystickAvt;
|
||||||
static const IDirectInputDevice8WVtbl JoystickWvt;
|
static const IDirectInputDevice8WVtbl JoystickWvt;
|
||||||
|
@ -726,18 +728,10 @@ static HRESULT WINAPI JoystickWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
|
||||||
TRACE("(this=%p)\n",This);
|
TRACE("(this=%p)\n",This);
|
||||||
res = IDirectInputDevice2WImpl_Unacquire(iface);
|
res = IDirectInputDevice2WImpl_Unacquire(iface);
|
||||||
if (res==DI_OK && This->joyfd!=-1) {
|
if (res==DI_OK && This->joyfd!=-1) {
|
||||||
effect_list_item *itr;
|
|
||||||
struct input_event event;
|
struct input_event event;
|
||||||
|
|
||||||
/* For each known effect:
|
/* Stop and unload all effects */
|
||||||
* - stop it
|
JoystickWImpl_SendForceFeedbackCommand(iface, DISFFC_RESET);
|
||||||
* - 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enable autocenter. */
|
/* Enable autocenter. */
|
||||||
event.type = EV_FF;
|
event.type = EV_FF;
|
||||||
|
@ -883,7 +877,7 @@ static void joy_polldev(LPDIRECTINPUTDEVICE8A iface)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
FIXME("joystick cannot handle type %d event (code %d)\n",ie.type,ie.code);
|
TRACE("skipping event\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (inst_id >= 0)
|
if (inst_id >= 0)
|
||||||
|
@ -1312,9 +1306,9 @@ static HRESULT WINAPI JoystickWImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE
|
||||||
{
|
{
|
||||||
case DISFFC_STOPALL:
|
case DISFFC_STOPALL:
|
||||||
{
|
{
|
||||||
/* Stop all effects */
|
|
||||||
effect_list_item *itr;
|
effect_list_item *itr;
|
||||||
|
|
||||||
|
/* Stop all effects */
|
||||||
LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry)
|
LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry)
|
||||||
IDirectInputEffect_Stop(itr->ref);
|
IDirectInputEffect_Stop(itr->ref);
|
||||||
break;
|
break;
|
||||||
|
@ -1322,12 +1316,14 @@ static HRESULT WINAPI JoystickWImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE
|
||||||
|
|
||||||
case DISFFC_RESET:
|
case DISFFC_RESET:
|
||||||
{
|
{
|
||||||
effect_list_item *itr, *ptr;
|
effect_list_item *itr;
|
||||||
|
|
||||||
/* Stop, unload, release and free all effects */
|
/* Stop and unload all effects. It is not true that effects are released */
|
||||||
/* This returns the device to its "bare" state */
|
LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry)
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(itr, ptr, &This->ff_effects, effect_list_item, entry)
|
{
|
||||||
IDirectInputEffect_Release(itr->ref);
|
IDirectInputEffect_Stop(itr->ref);
|
||||||
|
IDirectInputEffect_Unload(itr->ref);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DISFFC_PAUSE:
|
case DISFFC_PAUSE:
|
||||||
|
@ -1341,7 +1337,7 @@ static HRESULT WINAPI JoystickWImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FIXME("Unknown Force Feedback Command!\n");
|
WARN("Unknown Force Feedback Command %u!\n", dwFlags);
|
||||||
return DIERR_INVALIDPARAM;
|
return DIERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
return DI_OK;
|
return DI_OK;
|
||||||
|
|
|
@ -30,7 +30,7 @@ reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.9.4
|
||||||
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.9.23
|
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/ddraw # Synced to WineStaging-1.9.4
|
||||||
reactos/dll/directx/wine/devenum # Synced to WineStaging-1.9.23
|
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/dinput8 # Synced to WineStaging-1.9.23
|
||||||
reactos/dll/directx/wine/dmusic # 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
|
reactos/dll/directx/wine/dplay # Synced to WineStaging-1.9.23
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue