Joystick mappings weird on Mac

Monkey Forums/Monkey Bug Reports/Joystick mappings weird on Mac

skape(Posted 2014) [#1]
Hi,

Not a critical issue, but kind of annoying:

The joystick commands seem to be mapping wonky on Mac. Analog stick 1 x and y-axis map correctly. Analog stick 2 maps x-axis to analog stick 1 z-axis, y-axis to analog stick 2 x-axis, and so on.

The buttons also map funny. Lettered buttons map to d-pad buttons, etc.

I have tried the Xbox 360 controller and this driver with several games and the mappings are correct automatically, so I suspect that this is something to do with Monkey.

See this thread for more information: http://www.monkey-x.com/Community/posts.php?topic=8876

As for reproducability, just run the joytest banana on a Mac with a 360 controller. ;)


marksibly(Posted 2014) [#2]
Just looking at the joystick stuff now, and it's all pretty ugly.

The bottom line is all joysticks seem to map axes/buttons differently, and there isn't an easy way to deal with that as the glfw lib (and the underlying OS lib it uses on windows, not sure about mac) doesn't have any way to return the 'names' of axes/buttons. You can get the device name, but on windows at least that just returns 'windows generic joystick' for all devices, so you can't even cheat by provide a mapping-per-device easily.

I tried tweaking the code to 'guess' what device might be plugged in based on number of axes/buttons, but I'm not sure if that's a particularly good idea as it probably just stuffs up other devices. And, number of axes/buttons returned looks like it's different on Windows/Mac anyway...

That said, on 2 of my test joysticks, I encountered the problem you are describing (don't ask about the third - it was all over the map!). I initially couldn't use the xbox 360 controller at all, but installed http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver#toc1 which seems to do the trick. So, I'm not sure how to fudge this really - I could just swap appropriate axis values around on Mac, but with no idea of what this could mean for other devices. And where does it end etc...? Anyone got any other ideas?

I pretty much gave up on using joysticks with PC's (and pretty much PC gaming in general I guess) after buying Grid a few years back and having to trawl the internet for *hours* before I worked out how to tweak the appropriate freakin' XML file to get my joystick working - gah!


Erik(Posted 2014) [#3]
There is a pull request for joynames on windows scheduled for glfw 3.1

https://github.com/glfw/glfw/pull/98/files

There is also a few other fixes for joysticks in the latest versions of glfw.