@@ -859,15 +939,14 @@ JoystickImpl *This = (JoystickImpl *)iface; int xfd = This->joyfd; int i,axes,buttons;
int wasacquired = 1;
TRACE("%p->(%p)\n",iface,lpDIDevCaps);
if (xfd==-1) {
/* yes, games assume we return something, even if unacquired */
JoystickAImpl_Acquire(iface);
xfd = This->joyfd;
wasacquired = 0;
if (xfd==-1) {
}IDirectInputDevice8_Acquire(iface);
- lpDIDevCaps->dwFlags = DIDC_ATTACHED; if (This->dinput->dwVersion >= 0x0800) lpDIDevCaps->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
@@ -885,15 +964,20 @@ lpDIDevCaps->dwAxes = axes; lpDIDevCaps->dwButtons = buttons;
- if (!wasacquired)
JoystickAImpl_Unacquire(iface);
if (xfd==-1) {
IDirectInputDevice8_Unacquire(iface);
}
return DI_OK;
}
What's up with the change from JoystickAImpl_Acquire to IDirectInputDevice8_Acquire?
It will break this function; in the middle of GetCapabilities is
axes=0; for (i=0;i<ABS_MAX;i++) if (test_bit(This->absbits,i)) axes++; buttons=0; for (i=0;i<KEY_MAX;i++) if (test_bit(This->keybits,i)) buttons++;
if (This->has_ff) lpDIDevCaps->dwFlags |= DIDC_FORCEFEEDBACK;
absbits, keybits, and has_ff are all set properly only when the joystick is acquired with JoystickAImpl_Acquire. absbits and keybits are also set during joydev_have, but if you have more than one device they may not be set for the correct device unless you explicitly acquire it. has_ff is not set at all until the stick is acquired.