The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Can't get SDL to recognize controllers on Mac working Window
^DJ_Link^


Joined: 10 Jun 2011
Posts: 28
Hi.

I've been trying to get this to work for some time with no success. I added some code to detect gamepads on SDL. It's working in Windows, whenever I plug/unplug the cable it detects, all buttons detected and properly mapped.
But that same code is not working on Mac. I've tried using a wired xbox 360 controller and a PS4 one via Blutooth. Both these controllers are being detected (and usable) on other games and some emulators so it's not a matter of not being properly connected to the OS itself.

I'm using Yosimite and SDL 2.0.3

I'm initing like this
Code:

if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_GAMECONTROLLER) != 0 ){

}


Then detecting the controller like this

Code:

while ( SDL_PollEvent( &event ) )
   {
      switch ( event.type )
      {
      case SDL_CONTROLLERDEVICEADDED:
                    // Do stuff
                case SDL_CONTROLLERDEVICEREMOVED:
                  // Do stuff
               }
         }


SDL_NumJoysticks returns 0 also.
On windows this code works properly and SDL_NumJoysticks returns 1 if connected at start.

Can anyone shed some light on this, kind of lost here
Can't get SDL to recognize controllers on Mac working Window
Ryan C. Gordon
Guest

Quote:
I'm using Yosimite and SDL 2.0.3

I _think_ we fixed something related to this since 2.0.3 shipped.

--ryan.



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
Is there any estimated time when 2.0.4 will be released in a stable state ? Very Happy
Re: Can't get SDL to recognize controllers on Mac working Wi
^DJ_Link^


Joined: 10 Jun 2011
Posts: 28
Ryan C. Gordon wrote:

I _think_ we fixed something related to this since 2.0.3 shipped.

--ryan.


I just grabbed the source from the repo. Built it (the 2.0.4) same thing happens Sad
Can't get SDL to recognize controllers on Mac working Window
Eric Wing
Guest

On 12/11/14, ^DJ_Link^ wrote:
Quote:
Hi.

I've been trying to get this to work for some time with no success. I added
some code to detect gamepads on SDL. It's working in Windows, whenever I
plug/unplug the cable it detects, all buttons detected and properly mapped.
But that same code is not working on Mac. I've tried using a wired xbox 360
controller and a PS4 one via Blutooth. Both these controllers are being
detected (and usable) on other games and some emulators so it's not a matter
of not being properly connected to the OS itself.

I'm using Yosimite and SDL 2.0.3

Gamepad support has worked for me in Yosemite on the 2.0.3 branch.

Try this binary. It has basic gamepad support.
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrCMac.zip

I have an old wired USB Gravis Xterminator (1990's era DirectInput
gamepad). I have not tried Xbox 360 or PS4 on Mac, nor Bluetooth.

I did need to add my Xterminator to the optional gamecontroller.txt
mapping file because this is not in the standard database.

(Aside: How do I submit this game controller to the database for
official inclusion?)


Also, if you are codesigning and enabling App Sandboxing, you need to
add the USB entitlement for a USB gamepad. Presumably, you'll need the
Bluetooth entitlement for the Bluetooth gamepad, unless there is a
special one for gamepads now that Apple has their official Bluetooth
controller support (which I have not tried).

Thanks,
Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Can't get SDL to recognize controllers on Mac working Wi
^DJ_Link^


Joined: 10 Jun 2011
Posts: 28
Eric Wing wrote:

Also, if you are codesigning and enabling App Sandboxing, you need to
add the USB entitlement for a USB gamepad. Presumably, you'll need the
Bluetooth entitlement for the Bluetooth gamepad, unless there is a
special one for gamepads now that Apple has their official Bluetooth
controller support (which I have not tried).


You sir are my saviour. I feed stupid, totally forgot about sandboxing mode. Controller started working right away after activating USB. Even the PS4 one via blutooth.
Sorry for all the trouble for something that wasn't even SDL related. Maybe this can help other people too