Re: [AD] The huge Windows force feedback patch.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Yes, the names are different. XInput API supports no names so XInput
Joysticks are named XInput Joystick 0, 1, 2 or 3. Also, XInput
joysticks are always listed first before their "shadows".

For example this is what I get with ex_haptic with a F710 and a Strike
2 connected:

Joystick XInput Joystick 0 supports force feedback.
Joystick Controller (Wireless Gamepad F710) does not support force feedback.
Joystick   USB  Joystick   supports force feedback.

The DirectInput "shadow" works just as well as a joystick, apart from
the fact that it cannot support force feedback. If the end user of an
Allegro game accidentally chooses the "wrong" joystick then this has
no effect on their ability to play the game.

Also, if this really bothers you, there is a configuration setting
[joystick] driver = which can be set to xinput or directinput to
disable the wrapper driver and only use one of the two drivers
exclusively.

The reason why I needed this "shadowing" is because AFAICS there is no
way in either the DirectInput API to see if a joystick really is an
XInput one, or in the XInput API, which DirectInput device corresponds
to the XInput joystick. It might be possible though a different API to
find out about this, so I could filter out the "shadows" but SDL does
something I don't understand, so that's why I opted for the simplest
solution. If you'd really like me to filter out those "shadows", then
I'll need some help with that.

Kind Regards,

B.

On 8/9/14, Trent Gamblin <trent@xxxxxxxxxx> wrote:
> How do the joysticks show up as "shadows", Logitech F710 (DirectInput) and
> Logitech F710 (XInput) or something like that? Otherwise that's quite
> annoying to me.
>
> ----- Original Message -----
> From: <beoran@xxxxxxxxxx>
> To: "Allegro Development" <Alleg-developers@xxxxxxxxxx>
> Sent: Saturday, August 09, 2014 11:38 AM
> Subject: [AD] The huge Windows force feedback patch.
>
>
>> Get it here:
>>
>> https://github.com/liballeg/allegro5/pull/8
>> https://github.com/liballeg/allegro5/pull/8.patch
>>
>> It is a huge patch because it covers a lot of ground.
>>
>> The situation of joystics and force feedback on Windows is complex.
>> There are several input and force feedback APIs for Windows.
>> Amongst those DirectInput and XInput are most useful.
>>
>> DirectInput, alhough it has been declared legacy by Microsoft has
>> the best support for force feedback though a very complex
>> and quirky API. But it works reasonably well for older joysticks
>> and joypads that have a DirectInput compatible driver.
>>
>> XInput, supposedly the successor to DirectInput is a much simpler
>> API, but also far less powerful. It is only compatible with newer
>> joysticks and joypads that emulate the XBox's controllers.
>> XInput devices are "backwards compatible" with DirectInput
>> but that compatibility is limited invarious ways. For example,
>> the only way to get force feedback on XInput devices is through
>> the XInput API.
>>
>> Furtermore, older devices generally don't have an XInput driver
>> available.  Some newer joypads such as those of Logitech have a
>> switch to  set them to DirectInput or XInput mode. All in all
>> this means that both API's must be supported simultaneously
>> on Windows.
>>
>> To deal with all that I have implemented an haptics driver for
>> DirectInput, a joystick and haptics driver for XInput, and then
>> a "wrapper" driver that enables both drivers to be used
>> simulaneously. The only downside of the wrapper is that
>> for some devices, the same  device may show up twice
>> as a "shadow" of itself if it is  supported by both API's.
>> However, since a game should let the user choose their joystick,
>> I think this  is not really a problem.
>>
>> This patch includes an uncrustify.cfg I used to adjust the
>> style of what I had programmed. I added it because I feel
>> uncrustify is more powerful and effective than indent, and
>> the uncrustify configuration will be generally useful.
>>
>> This patch has been compiled and tested versus Mingw on
>> linux and wine, and in with msys2 a Windows VM. Therefore
>> it's still needed that someone tests it with MSVC,
>> I was not able to get it to install on the VM.
>>
>> Finally I'd like to thank Tomasu for providing me with a Logitech F710
>> to thoughoughly test XInput with.
>>
>> Kind Regards,
>>
>> B.
>>
>> ------------------------------------------------------------------------------
>> --
>> https://lists.sourceforge.net/lists/listinfo/alleg-developers
>>
>
>
> ------------------------------------------------------------------------------
> --
> https://lists.sourceforge.net/lists/listinfo/alleg-developers
>




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/