Guessing physical layout of joystick axes

If a joystick has a bunch of axes, is there a good way for a program to know which ones make sense to use, or how they are laid out on the physical device? Axis names are a start, but they don't seem to be standardized across controllers. Having a configuration UI and saving bindings and profiles seems like a lot of work for a simple game that just needs to use one or two analog sticks.



For example, I have a Logitech Wingman RumblePad USB with two analog sticks and a throttle. My first guess was that the x and y axes on the left stick would be 0 and 1, but that was wrong: the x axis is 4 and the y axis is 3. At least they are named "X axis" and "Y axis", so I hard-coded my game to look for those names. My brother tried my game with a different controller and his axes don't have those names. I'll try to figure out what names he has, maybe I need to make the check case-insensitive. But at some point I'll want to use both analog sticks and have that work for different controllers, and the right stick axes on my controller are named "Extra" and "Rudder". Somehow I doubt that these are standard names used by other controllers. At least the throttle is named "Throttle". :slight_smile: