http://bugs.winehq.org/show_bug.cgi?id=3747
------- Additional Comments From tom8311@wp.pl 2007-05-05 12:50 ------- I belive the problem is related not only to IDirectInputAImpl_GetDeviceStatus, but also to IDirectInputAImpl_EnumDevices and to dinput.h (and maby others). When the game is searching for a joystick, it calls the EnumDevices function, before the GetDeviceStatus function, and passes DIEDFL_ATTACHEDONLY as the last (dwFlags) argument. It means that it looks for attached joystick(s), and then checks it's (their) status (see lines 4008-4014 of the fourth attachment - http://bugs.winehq.org/attachment.cgi?id=4770&action=view).
The problem is that in dinput.h the DIEDFL_ATTACHEDONLY constant has the same value as the DIEDFL_ALLDEVICES (it's 0, see http://source.winehq.org/source/include/dinput.h#L188 and http://source.winehq.org/source/include/dinput.h#L189), while the DIEDFL_ATTACHEDONLY should have value of 1 (ref. to Microsoft's DX SDK). However, I don't know if this is a bug or if this has some purpose (eg. the DIEDFL_ATTACHEDONLY is yet an unsupported flag in Wine).
The other problem is with the EnumDevices function - I've changed the value of the DIEDFL_ATTACHEDONLY constant to 1 (in dinput.h), but it changes nothing. Seems like EnumDevices ignores this value and always claims that the joystick is present (don't know how it works, tho - haven't looked deeper into the code). But the fact is that EnumDevices finds "Wine Linux-input joystick driver" - see line 4012 of the fourth attachment - and in case of no device present it shouldn't enumerate that driver when it's beeing called with dwFlags=1.