Gamepad: joystick's button press doesn't register

Help with Setup, Hardware, Performance or other Issues...Or just pimp your rig.
Post Reply
User avatar
Workaphobia
Master Sergeant
Master Sergeant
Posts: 252
Joined: Wed May 26, 2004 7:29 pm

Gamepad: joystick's button press doesn't register

Post by Workaphobia »

I have a logitech dual action gamepad, and I'm wondering why every normal button can be assigned to a command via the input menu or the configuration file, but not the signal generated when I press either of the joysticks in (I'm not talking about the axes, but the "click"). Kcontrol recognizes these as digital inputs 11 and 12, and does not appear to distinguish them from the other buttons in any way.

When I try to add a bind statement to the configuration file containing "Joystick Button 11", I find that bzflag erases it, but it lets it stay if I use a lower button number.
"Nifty News Fifty: When news breaks, we give you the pieces."
User avatar
Workaphobia
Master Sergeant
Master Sergeant
Posts: 252
Joined: Wed May 26, 2004 7:29 pm

Post by Workaphobia »

Wow. I just did something I've never done before: I took a serious look at the insides of bzflag. While searching for an unrelated part of bz code, I stumbled upon ./src/common/KeyManager.cxx, where I saw that the array

Code: Select all

const char* KeyManager::buttonNames[] = { ...
does not contain definitions beyond button ten. A couple of couts in ./src/platform/SDLJoystick.cxx showed me that SDL itself has no problem recognizing all 12 buttons.


Do I need to go through any special channels to ask one of the devs to add in the extra two definitions? In any case, I'm going to experiment with it myself for a bit.

[edit]
Solved! I changed the following:
./include/BzfEvent.h, around line 128: added "BZ_Button_11, BZ_Button_12,"
./src/common/KeyManager.cxx, around line 104: added ""Joystick Button" 11", "Joystick Button 12"",
./src/bzflag/playing.cxx, around line 5761 (that's one huge file): added "BzfKeyEvent::BZ_Button_11, BzfKeyEvent::BZ_Button_12"

Of course, I'm sure anyone with any trivial experience with the source will think this is all obvious. :)
"Nifty News Fifty: When news breaks, we give you the pieces."
User avatar
Skeeve
Private First Class
Private First Class
Posts: 122
Joined: Sun Jun 04, 2006 3:27 pm
Location: Near Aix La Chappel

Post by Skeeve »

Thanks! That helped me a lot!

Now all I'm missing is the "Hatswitch". I bought a Thrustmaster FireStorm Dual Analog 3 just yesterday and it has a nice D-Pad which is identified by "Joystick Tester" as a "Hatswitch".

Wouldn't it be greate one could use these 4-8 additional buttons too?
Avatar created with South Park Studio

Don't you hate it when your posts get deleted without any note?
khonkhortisan
Private
Private
Posts: 2
Joined: Sat Dec 24, 2011 11:31 pm

Re: Gamepad: joystick's button press doesn't register

Post by khonkhortisan »

I submitted patch #3498089 in Workaphobia's honor: https://sourceforge.net/tracker/?func=d ... tid=303248
Post Reply