Xbox One vs. Xbox 360 controllers


#1

Just wondering if these controllers have the same values for all the buttons on Windows, Mac and Linux? I only have a 360 controller and if I don’t need to buy an Xbox One controller that’s a plus. Thanks.

EDIT: Also anybody know what SDL_JoystickName will return for an Xbox One controller? Hopefully something that can identify it as such.


#2

I have both a wireless Xbox one controller and a wired Xbox 360 controller, and I can confirm that they have the exact same values for their buttons and their axis on a Windows platform. The returned name is “XInput Controller” for both with SDL_JoystickName.


#3

Thanks a lot, much appreciated!


#4

SDL_JoystickName should be returning the real name for the controller. i.e. “Xbox 360 Controller”, or “Xbox One Controller”. This “XInput” naming of known controllers is a bug, no?


#5

When I first saw this, I thought it was not ideal but still correct because the Xbox 360 and One controllers are indeed XInput controllers. But if this function is supposed to return an unique name for each controller, you’re right, this is a bug.


#6

The XINPUT API does not expose the product name string, so instead, SDL returns the “XInput Controller #1” (and #2, #3, #4) strings.


#7

OK so that function won’t do it, but there must be a way to detect the controller type? I’d like to give correct button names, for example the middle buttons are named differently between 360 and Xbox One. Anybody know how to get the specific controller type?

FWIW on Linux I get “Xbox 360 Wireless Receiver” for a wireless 360 controller with SDL_JoystickName.


#8

OK, I found out how to get a useful name. It’s a different SDL API (“game controllers”). Instead of using SDL_Joystick* you use SDL_GameController*. For example:

SDL_GameController *gc = SDL_GameControllerOpen(0);
printf("%s\n", SDL_GameControllerName(gc);

Will print X360 Wireless Controller instead of Xbox 360 Wireless Receiver on Linux, and for a PS4 controller it returns PS4 Controller instead of Wireless Controller. I guess this api also makes the button layouts all consistent. Unfortunately I wish I had known about it before because it’s not event based like the SDL_Joystick api.

EDIT: Actually, there may be events, I have to check it out more.

Well I’ll be damned. It has events, so this is a lot easier and better…