Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm developing a browser plugin to provide joystick access to all browsers on all platforms. The issue that I'm running into is that OS X doesn't seem to provide Xbox 360 joystick input without installing some extra drivers, and even when those drivers are installed they map the buttons and axes completely differently than Windows and Linux.

I'm using xboxdrv on Linux, which has a pretty decent mapping and is very similar to the standard Windows XBox driver mapping. On windows XP using the default XBox Controller driver the order of the x and y axes are swapped. Is there an alternative driver that can be installed?

On OS X using Colin Munro's OS X Driver, the mapping is totally different though. The d-pad is mapped to the first four buttons and the axes are all switched.

What I want to know is what drivers do I need to install on each OS to get XBox 360 Controllers to register exactly the same as the do under Linux with xboxdrv.

OS: DRIVER
Linux: xboxdrv
Windows: ?
OS X: ?

The reason why I prefer the xboxdrv style of controller mapping is that the mapping is pretty much the same for any other random USB controller. The two primary axes are the same and the first 5 buttons are the same. This way the XBox controller will behave like an "enhanced" generic USB controller and any game logic won't need to know anything about the specific controller type. I want to be able to assume the basic axes and buttons will be mapped correctly (or at least consistently) and then use the extra buttons and axes for extra functionality.

The newer versions of the standard Linux X11 input also match exactly the xboxdrv mappings which is another reason that I prefer it.

share|improve this question

2 Answers 2

Is there an alternative driver that can be installed?

Let's assume there was; I have no idea one way or the other myself. But if there was, it would map the buttons differently. So installing a browser plugin would also install this driver, which would override the current driver and screw up the button settings in every program that uses the controller.

I don't see a lot of people appreciating you doing that to their systems.

It would be better for your plugin to simply detect what OS its running on and adjust the inputs accordingly. You should only install drivers if the device would not work at all without them.

share|improve this answer
    
+1 for suggesting not to install drivers unneccesarily. Simply determine the running platform (at compile-time) and compile the appropriate joystick mapper. Use this mapping class as a proxy between the actual joystick driver and the browser plugin logic, so the platform-specific code is isolated from the rest. –  ghost Jul 20 '11 at 11:50
1  
I agree; the way you write cross-platform games is to wrap the differences in platform behavior yourself so your higher level code can assume a homoegenous interface. Not to expect users to install possibly obscure, unknown drivers in order to provide that homogenity to your code. –  Josh Petrie Jul 20 '11 at 15:00
    
So then what is the "standard" OS X Xbox controller driver that I should assume? –  Daniel X Moore Jul 20 '11 at 17:05
    
@Daniel: The only platform that has a "standard" X-Box controller driver is Windows. For the rest, you should check for whatever drivers you know of that could be used. If one of them is available, then use that one. You shouldn't be looking to install a driver; just use what is already installed. –  Nicol Bolas Jul 20 '11 at 17:14
    
@Nicol What drivers are commonly installed, and if it is uncommon to have a driver installed for Xbox controllers on OS X, which one should I recommend that people install such that it will behave most closely with the existing Windows and Linux drivers? That essentially is my original question. –  Daniel X Moore Jul 20 '11 at 17:17

On Linux, I believe the standard driver is the xpad one (which is part of the kernel):

http://www.kernel.org/doc/Documentation/input/xpad.txt

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.