[AD] The huge Windows force feedback patch. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
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.