Using PS3 controller for input on Mac OSX

| | August 5, 2015

I’ve managed to find a USB driver to connect to the PS3 controller in OSX, and as reported here, can connect to the controller via Bluetooth.

I’ve verified that the input is working properly via Snes9x.

Anyway, that’s just background for my actual question. Is there any way to access the PS3 HID, via C++, on the Mac? I’m relatively new to C++ development on Mac using XCode, and the internet has been disappointing in my search for a possibly library to use.

Does anybody have any ideas on how I could access the controller button/axis states in code, so I can transfer them to my input maps?

One Response to “Using PS3 controller for input on Mac OSX”

  1. So, an hour or so of fiddling and trying different libraries, and it seems OIS (and SDL) just recognises the controller as a joystick and provides me with everything I need.

    If you install OIS from the link above, and make/run the ‘ConsoleTest’ project, you can see the output from the controller in the debug window.

    Additionally, here’s enums i’ve been using that match to the axes/button numbers produced by SDL (note not OIS, which i’ve now decided not to use, numberings could well be the same). Notice that the trigger buttons are not classified as an axis, which i’m pretty sure they should be (0-255 from memory):

    //Values SDL attributes to individual PS3 axes
    enum EPS3RawAxesIndex
        EPS3RawAxesIndex_LeftX = 0,
        EPS3RawAxesIndex_LeftY = 1,
        EPS3RawAxesIndex_RightX = 2,
        EPS3RawAxesIndex_RightY = 3
    //Values SDL attributes to individual PS3 controller buttons
    enum EPS3RawButtonIndex
        EPS3RawButtonIndex_Select           = 0,
        EPS3RawButtonIndex_JoyClickLeft     = 1,
        EPS3RawButtonIndex_JoyClickRight    = 2,
        EPS3RawButtonIndex_Start            = 3,
        EPS3RawButtonIndex_DpadUp           = 4,
        EPS3RawButtonIndex_DpadRight        = 5,
        EPS3RawButtonIndex_DpadDown         = 6,
        EPS3RawButtonIndex_DpadLeft         = 7,
        EPS3RawButtonIndex_TriggerLeft      = 8,
        EPS3RawButtonIndex_TriggerRight     = 9,
        EPS3RawButtonIndex_ShoulderLeft     = 10,
        EPS3RawButtonIndex_ShoulderRight    = 11,
        EPS3RawButtonIndex_Triangle         = 12,
        EPS3RawButtonIndex_Circle           = 13,
        EPS3RawButtonIndex_Cross            = 14,
        EPS3RawButtonIndex_Square           = 15,
        EPS3RawButtonIndex_PSButton         = 16

Leave a Reply