handling different joystick button mappings

Hi guys, i'm looking to create controller manager using allegro that allows for different controllers with different button mapping - eg xbox and ps3 controllers. I figured I could use al_get_joystick_name get specific IDs for connected controllers and use that to load the button mapping for the controller, this way the button mapping for players doesn't change regardless of whatever controller they opt to use.

al_get_joystick_name is not being helpful however, in my tests it just returns "Joystick" - generic. Could someone point me in the right direction please. How do I get controller specific info via allegro? Thanks.


Well, I think this is a problem of the Windows driver of the Allegro library. On Linux the name comes out just fine. I don't have Windows so I 'm afraid I'll have to ask you if you are willing to look into this and improve the Windows joystick driver so it returns a proper name. You'll have to download the Allegro git version to get down and drirty.


Actually it's on OSX I'm having this issue. The controller I'm with is a PS3 controller. al_get_joystick_name returns "Joystick". There's also this bug where al_get_num_joysticks returns 2 when you have just one controller connected via both bluetooth and usb.


Well, this may have something to do with it:

static const char *get_joystick_name(ALLEGRO_JOYSTICK *joy_)
   return "Joystick";

(From src/macosx/hidjoy.m).

Someone will need to investigate how to do it and implement it, which is probably not very hard but will require some time.


Alright, will sort it out.

Thread #613139. Printed from Allegro.cc