1) Larger dead zone for analog controls. Also fixed possible
issue where negative side of dead zone might not be applied.
(right bitwise shift applied to negative integers, implementation seems to vary)
2) Analog controls can now be assigned to buttons, and
non-analog controls can now be assigned to the directional controls.
3) Differentiates between positive and negative movement
for analog controls.
4) In the GTK and Glade ports, directional buttons can now
be set independently of their "twins".
5) Hat/POV/D-Pad controls are usable now.
6) Differentiates between multiple controllers.
7) Slightly modified method of storing joypad key codes, in
a way similar to VBA-M's method of configging controls, though
I kept the codes as u16's. The way it's arranged now will allow
for up to 16 unique joypads, and up to 128 axes, 64 POV hats,
and 256 Buttons per joypad, which should probably be enough.
The method of determining a key code is explained in ctrlssdl.cpp.
Basically, it starts with 0x1000 * joypad_index.
For buttons, add 0x200 + button_index.
For hats, add 0x100 + 4 * hat_index + (0, 1, 2, or 3 for R, L, U, D).
For axes, add 2 * axis_index + (0 or 1 for negative or positive).
Maybe there's a way to get the config file to save these values in
a hexadecimal representation for easier editing, but I didn't really
mess with the configs.
So, the reason I decided to try this was that I was having some issues
with my wired XBox 360 controller in the Linux GTK, Glade, and CLI ports
(The controller works fine otherwise).
It seemed to be very sensitive, so it was impossible to "zero" the axes,
which leads to constantly scrolling through menus, etc. The slightest
touch would trigger the input. Also wanted to be able to use the D-Pad
and Analog triggers for something useful. The distinction between multiple
"joypads" should also help anyone with any other odd input devices being
recognized, like accelerometers.
[rm: removed clear_events() from ctrlsdl.cpp since it is unused ]