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;
}
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;
}
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
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;
if (dev->dwCoopLevel & DISCL_FOREGROUND)
{
- if (dev->acquired)
+ if (acquired)
foreground_cnt++;
else
foreground_cnt--;
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);
/* 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;
}
}