[AD] Number of joystick buttons

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


Hello,

I have received this e-mail today, from someone using a program I released:

(Quote)
"
Anyway I found a small problem with the windows version, I use a Playstation 2 controller adapter to use my ps2 pad for emulated games on the pc and noticed that I could not correctly assign leftto the left d-pad. I checked the properties of my game controller on the control panel and noticed that lefton the pad counts as button 16, which is the highest button number. Since I can correctly assign every other control action to the pad, I assume that the emulator just has trouble going past button number 15. If you could add support
 for button 16 for direct input that would be awesome!
"

I looked in "allegro/include/allegro/joystick.h" and found:
#define MAX_JOYSTICK_BUTTONS     16

Could this be safely increased?
From what I looked, I think it's ok. But I don't have any 16+ buttons joystick to test with. I'm leaving the modification to someone who knows if there's would be any problem increasing the limit.

If the definition is changed, the "name_b" table in "allegro/src/win/wjoyhelp.c" also need to be updated
accordingly:
static char *name_b[MAX_JOYSTICK_BUTTONS] = {
   "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8",
   "B9", "B10", "B11", "B12", "B13", "B14", "B15", "B16"
};

Hope it helps,

Omar Cornut
(Note: I'm using Allegro 4.1.9, but did not find related modifications in the recent changelog up to 4.1.11)







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