Game Development Community

DirectInput Gamepads

by Pat Wilson · in Technical Issues · 05/25/2005 (3:19 pm) · 12 replies

Any thoughts on this:

I'm telling DirectInput to enumerate all devices. I have two gamepads hooked up to the PC, and they come through as joysticks. If I tell it to only enumerate gamepads then nothing gets returned. Any thoughts?

#1
05/25/2005 (4:17 pm)
What I did was query the joystick and just assume it's a dual-analog gamepad if it has 4 axes. I don't think this is a good way to do it, anyone else have any better ideas?
#2
05/26/2005 (12:50 am)
I had the same trouble over here Pat. At first my XBox pad was coming up as a Joystick... then i updated the drivers and found that it now has an option in the driver to show up as one or the other.

The assumption on for 4 axes seems like the only option when a driver can change the device classification on the users whim.
#3
05/26/2005 (1:29 am)
Pat: I'm a linux nerd, obviously.

But from where I stand, *good*. gamepads and joysticks should be abstracted; they're both axes and buttons, and used to control games. Linux treats both the same from a user/developer perspective.

Or, losing the idealism, update your drivers. They're pretty much solely responsible for stuff like that.

Gary (-;
#4
05/26/2005 (2:14 am)
Interesting, Tom. I tried it with both a Logitech Dual Analog and an Xbox controler and both came up as joysticks. My guess is that the DInput calls anything with analog control a "joystick" and things that just have digital control a "gamepad" because back then, that's the way things were (DInput 8).

Gary, I really have no idea what you are saying.
#5
05/26/2005 (6:33 am)
Humm. I was rather annoyed after the work i did merging in "gamepad" support into Torque to find out that my XBox pad was perfectly happy being a joystick. Your guess may be correct, but i bet there will be some odd device out there that will report itself as a gamepad.

This seems like a good question to post to the DirectX developers list. The MS guys frequent it and if you ask i'm sure one of them will tell you what the hell is going on.
#6
05/26/2005 (8:25 am)
If you pull up DXCaps and look at the input devices, it lists them as joysticks...every dual-analog gamepad I try does it.
#7
05/26/2005 (8:28 am)
What about a single analog gamepad? Does it come up as a joystick as well ?
#8
05/26/2005 (9:22 am)
Don't have one. My guess would be yes.
#9
05/26/2005 (9:37 am)
Chunkys point was that both a gamepad and an analog stick gamepad have analog axis's, and buttons...

In essence the only difference is how the user holds them... Since they are practically the same thing, Linux treats them as the same thing.

Why can you not also treat your dual analog gamepad as a joystick? They are in essence the same thing. They have the same composition in a different layout .
#10
05/26/2005 (10:00 am)
The problem I hit is it loads my dual analog gamepad as a joystick (the same as everyone has been saying), but for some reason I can't figure out how to access the D-Pad... I've mapped all the actionmaps I can find and every button works, both analog sticks work, but the D-Pad doesn't seem to return anything, but then again maybe I'm missing something ? (or is this something that would work when loaded as a "gamepad" vs a "joystick")
#11
05/26/2005 (10:02 am)
I don't really care. I have a very specific use in mind, which is making it easy for people to get their Torque games Xbox/Next Gen ready, and I want to know when someone plugs in a dual-analog gamepad. I want to let people do something like this
GlobalActionMap.bindCmd( gamepad, btn_a, "echo(make);", "echo(break);" );

Because that makes sense, whereas:
GlobalActionMap.bindCmd( joystick, button0, "echo(make);, "echo(break);" );
Is a poor substitute (though I have 'btn_a' simply set to an alias of 'button0').

When someone plugs a joystick into your flight sim, they shouldn't have to rebind their commands because their z-axis is looking up instead of controling speed. My question is simple, "How can I determine what kind of device is plugged in to the computer?" I am not interested in a philosophical debate about how joysticks and gamepads are really the same thing. Yeah, they are. They have analog input on multiple axes, and buttons. That doesn't give me a solution to my problem.
#12
05/26/2005 (10:03 am)
D-pad is treated as the POV hat.