[DINPUT] Sync with Wine Staging 2.16. CORE-13762

5214b47 dinput: Do not wait for hook thread startup in IDirectInput8::Initialize.
83a3887 dinput: Avoid possible deadlock when CS are acquired in different order.
49fdde1 dinput: Use proper size for combobox controls.
b50d1fa dinput: Limit axes while remaping broken devices.

svn path=/trunk/; revision=75855
This commit is contained in:
Amine Khaldi 2017-09-16 20:44:43 +00:00
parent 52433225ed
commit 48e74aa082
5 changed files with 15 additions and 11 deletions

View file

@ -976,9 +976,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
EnterCriticalSection(&This->crit);
res = This->acquired ? S_FALSE : DI_OK;
This->acquired = 1;
if (res == DI_OK)
check_dinput_hooks(iface);
LeaveCriticalSection(&This->crit);
if (res == DI_OK)
check_dinput_hooks(iface, TRUE);
return res;
}
@ -1004,9 +1004,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
EnterCriticalSection(&This->crit);
res = !This->acquired ? DI_NOEFFECT : DI_OK;
This->acquired = 0;
if (res == DI_OK)
check_dinput_hooks(iface);
LeaveCriticalSection(&This->crit);
if (res == DI_OK)
check_dinput_hooks(iface, FALSE);
return res;
}

View file

@ -50,8 +50,8 @@ FONT 8, "MS Shell Dlg"
DEFPUSHBUTTON "OK", IDOK, 10, 236, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 65, 236, 50, 14
PUSHBUTTON "Reset", IDC_RESET, 210, 236, 50, 14
COMBOBOX IDC_PLAYERCOMBO, 10, 50, 90, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
COMBOBOX IDC_CONTROLLERCOMBO, 10, 20, 90, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
COMBOBOX IDC_PLAYERCOMBO, 10, 50, 90, 60, CBS_DROPDOWNLIST | CBS_HASSTRINGS
COMBOBOX IDC_CONTROLLERCOMBO, 10, 20, 90, 60, CBS_DROPDOWNLIST | CBS_HASSTRINGS
LTEXT "Player", IDC_PLAYERTEXT, 10, 40, 90, 8, SS_LEFT
LTEXT "Device", IDC_DEVICETEXT, 10, 10, 90, 8, SS_LEFT
LTEXT "Actions", IDC_ACTIONTEXT, 10, 70, 90, 8, SS_LEFT

View file

@ -1754,7 +1754,7 @@ static BOOL check_hook_thread(void)
return hook_thread_id != 0;
}
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface)
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
{
static HHOOK callwndproc_hook;
static ULONG foreground_cnt;
@ -1764,7 +1764,7 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface)
if (dev->dwCoopLevel & DISCL_FOREGROUND)
{
if (dev->acquired)
if (acquired)
foreground_cnt++;
else
foreground_cnt--;

View file

@ -85,7 +85,7 @@ extern const struct dinput_device joystick_linux_device DECLSPEC_HIDDEN;
extern const struct dinput_device joystick_linuxinput_device DECLSPEC_HIDDEN;
extern const struct dinput_device joystick_osx_device DECLSPEC_HIDDEN;
extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W) DECLSPEC_HIDDEN;
extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W, BOOL) DECLSPEC_HIDDEN;
extern void check_dinput_events(void) DECLSPEC_HIDDEN;
typedef int (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM);

View file

@ -233,10 +233,14 @@ static INT find_joystick_devices(void)
/* If no axes were configured but there are axes assume a 1-to-1 (wii controller) */
if (joydev.axis_count && !found_axes)
{
int axes_limit = min(joydev.axis_count, 8); /* generic driver limit */
ERR("Incoherent joystick data, advertised %d axes, detected 0. Assuming 1-to-1.\n",
joydev.axis_count);
for (j = 0; j < joydev.axis_count; j++)
joydev.axis_count);
for (j = 0; j < axes_limit; j++)
joydev.dev_axes_map[j] = j;
joydev.axis_count = axes_limit;
}
}