Skip to content
Snippets Groups Projects
Commit ea93f283 authored by Rémi Bernon's avatar Rémi Bernon :speech_balloon: Committed by Alexandre Julliard
Browse files

dinput: Return DIERR_INVALIDPARAM instead of DIERR_INPUTLOST from Acquire.


MSDN states that the function can only return one of DIERR_INVALIDPARAM,
DIERR_NOTINITIALIZED, DIERR_OTHERAPPHASPRIO, on error, and DI_OK, or
DI_NOEFFECT, on success.

Some games will try to call Acquire again in a tight loop and block the
main thread if DIERR_INPUTLOST is returned. There's a small chance for
this to happen with Resident Evil 2, whenever a joystick is plugged,
then quickly unplugged.

Signed-off-by: default avatarRémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard's avatarAlexandre Julliard <julliard@winehq.org>
parent ac442a78
Branches
Tags
No related merge requests found
......@@ -866,7 +866,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface )
{
impl->device = CreateFileW( impl->device_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, 0 );
if (impl->device == INVALID_HANDLE_VALUE) return DIERR_INPUTLOST;
if (impl->device == INVALID_HANDLE_VALUE) return DIERR_INVALIDPARAM;
}
memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) );
......@@ -876,7 +876,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface )
{
CloseHandle( impl->device );
impl->device = INVALID_HANDLE_VALUE;
return DIERR_INPUTLOST;
return DIERR_INVALIDPARAM;
}
IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment