How to determine gamepad/joystick components mapping?

I have an app that monitors user gamepad/joystick experience. And as I’m new to such stuff I ran at some issues and hope you’ll advice me something.

I have two gamepads: XBox 360 Wireless for PC and SEGA Mega Drive Joystick (it’s how it is identified by OS). The first one has 16 components the second one has only 12 components. And if XBox’s [12]'s component is Start, Sega joystick’s Start component is [5]. A friend of mine has Logitech gamepad and PS3 gamepad, and I’m not sure what buttons mapping do they have. So I decided to implement several gamepad classes with specific mappings (one for XBox, another one for Sega, next one for Logitech gamepad), but what if some other gamepad will be used with this app? For example, Buffalo SNES USB gamepad.

Is there any solution on how to resolve such situation when you don’t know what mappings has that or another gamepad?

Another idea is to suggest user to set buttons minimum himself. But I didn’t find anything that is connected with components remapping in API. Is there any way to do this?

There is no solution for this, you need to implement gamepad classes for all different gamepads with specific mappings. But lucky you, most gamepads are quite similar (most USB-controllers have the same buttons (and id’s)).

Maybe, if you’re lucky, someone already tested all types of gamepads and has posted all their buttons with its id’s for you on the internet.

Is it possible to change mapping in the following way:

  • I ask to press button A
  • User presses a button (not necessary button A)
  • I determine somehow (?) what component (from the components list) was pressed and save mapping to it: component pressed -> A

In such a way it could be a solution, I think.

I have never seen it and I would not recommend it…
Games that ask you to press the start-button (to start) do not do this to recognize your gamepad, (have you tried to press another button, it (probably) won’t work).

You can check what kind of controller it is and then give it a mapping. You can also let the user customize his buttons. If you have given the user the wrong mapping or whatsoever, you can navigate him to the page where he can customize his buttons, you can do that automatically if the user hasn’t responded for one minute in the start-screen, for example.

Also, to the n00bs but also the experts, check this feature out (I probably should add this link in my signature or whatever):
http://www.java-gaming.org/topics/new-feature-appreciation-results-in-post-medals/24011/view.html ::slight_smile:

Mmm, so the buttons can be customized? I mean one still can find out what components are stood for start, select and so on?

P.S> I don’t see “Appreciate” button :frowning:

I mean it more like:
Program says: Press button for jump.
User: Presses button
Program: Gets input, links it to jumping.
Program says: Press blabla.

I’d say take a cue from games such as Super Meat Boy and others; design your setup around a standard controller such as the XBox controller, then let users customize the settings to match their actual controller. Even if your button mappings don’t match the player’s controller the first time they play your game, they’ll be able to discover which of their buttons maps to action and cancel with minimal effort. From there it’s just a matter of them going to a setup screen, similar to what Herjan posted, and configuring their inputs to what they like. It’s futile to try and anticipate every possible controller configuration beforehand, especially once you consider that even if it was possible, preferences in how things are mapped can vary between owners of identical input devices.