tvOS / Apple TV support

It works great! Thanks for the quick work.

Alex Szpakowski wrote:> I just pushed a commit to my Apple TV branch of SDL which removes the old hint (SDL_HINT_APPLE_TV_REMOTE_KEYPRESS) and adds a new hint (SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS) which, when set to ???1???, will cause the app to be backgrounded when the menu button is pressed.

A bit more description is in the commit (and the comment in the declaration of the hint #define): https://bitbucket.org/slime73/sdl-experiments/commits/034d986 (https://bitbucket.org/slime73/sdl-experiments/commits/034d986)

Let me know if that works for everyone!

On Oct 28, 2015, at 5:13 PM, divad <dapirian at bittorrent.com (dapirian at bittorrent.com)> wrote:
So, is there a way to turn on/off the detection of the menu button? I too want the default functionality when you press the menu button.
_______________________________________________SDL mailing listSDL at lists.libsdl.org (SDL at lists.libsdl.org)http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

On the Apple TV, the SteelSeries Nimbus game controller is reporting inverse Y values for the two thumbsticks. I’m getting a positive value when they’re pushed up, which is the opposite of what I get with an xbox 360 controller on a mac or pc.
Also, the nimbus is not recognized by SDL on the mac.

ace491 wrote:

On the Apple TV, the SteelSeries Nimbus game controller is reporting inverse Y values for the two thumbsticks. I’m getting a positive value when they’re pushed up, which is the opposite of what I get with an xbox 360 controller on a mac or pc.
Also, the nimbus is not recognized by SDL on the mac.

It seems the nimbus is recognized as a joystick but not a game controller.

Also, the nimbus triggers are only reporting values from about 16383 to 32767, instead of 0 to 32767.

Thanks for the reports! I?ve fixed the iOS joystick code to use the proper ranges for the triggers, and to invert the y-axis values for the thumbsticks.> On Nov 9, 2015, at 4:07 PM, ace491 wrote:

Also, the nimbus triggers are only reporting values from about 16383 to 32767, instead of 0 to 32767.


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The OS X joystick code doesn?t currently use Apple?s GameController framework like the iOS backend does, so in OS X different HID gamepads need their individual mappings added to SDL?s game controller database to be recognized as SDL game controllers.

If you run Steam?s Big Picture mode and configure the Nimbus from there to match the expected layout, could you post the resulting SDL gamecontroller mapping string here? The mapping string will be in the ~/Application Support/Steam/config/config.vdf text file near the bottom (labelled with "SDL_GamepadBind?.)> On Nov 8, 2015, at 10:59 PM, ace491 wrote:

It seems the nimbus is recognized as a joystick but not a game controller.


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The Nimbus mapping is unusual. The dpad and menu button are not recognized by Steam or SDL’s testjoystick.

Mapping:
“11010000000000002014000000000000,Nimbus,a:b0,b:b1,y:b3,x:b2,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,right trigger:b7”

testjoystick log:
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: There are 1 joysticks attached
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: Joystick 0: Nimbus
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: axes: 4
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: balls: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: hats: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: buttons: 8
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: instance id: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: guid: 11010000000000002014000000000000

Yeah, all the stratus Controllers seems to behave the same way,
The stratus XL does not detect the dpad in my mac too.

Note that, using the dpad in the Apple TV simulator in the same machine does work.

I reported the bug here:

ace491 wrote:> The Nimbus mapping is unusual. The dpad and menu button are not recognized by Steam or SDL’s testjoystick.

Mapping:
“11010000000000002014000000000000,Nimbus,a:b0,b:b1,y:b3,x:b2,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,right trigger:b7”

testjoystick log:
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: There are 1 joysticks attached
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: Joystick 0: Nimbus
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: axes: 4
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: balls: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: hats: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: buttons: 8
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: instance id: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: guid: 11010000000000002014000000000000


Rodrigo Cardoso Rocha
@RodrigoRodrigoR - x.com
Chibata Creations - chibatacreations.com

A few games of mine were validated for the Apple TV, so I can bring some
feedback about the previous issues:

  • it is actually allowed to exit naturally from the application. You can
    "return" from you “main()” function so that it exits.
    file “src/video/uikit/SDL_uikitappdelegate.m”, function
    "postFinishLaunch", quick fix is to uncomment the last line to make sure
    that “exit(exit_status)” is called after the SDL_main has returned.

    It may be a play on words, but
    https://developer.apple.com/tvos/human-interface-guidelines/remote-and-interaction/
    tells explicitly that the Menu Button can perform an “exit to home-screen”.

  • the default remote of the AppleTV (micro-game-pad) can act as a D-PAD. It
    is actually very accurate.
    I believe the issue is in “SDL_SYS_MFIJoystickHatStateForDPad” :
    But the current function is not accurate enough because
    "dpad.{up,down,left,right}.isPressed" only means that there is a value on
    the axis.
    It does not tells the amplitude of this value : if you have a very-small
    Down + big Left, you will mostly deduced a diagonal Down_Left whereas it
    may only be a Left.

    See the implementation of “SDL_SYS_MFIJoystickHatStateForDPad” that I
    have provided before.

  • I have no SteelSeries Nimbus gamepad so I cannot give some feedback about
    them. But my applications handle joysticks so that if you want to double
    check you’re welcome.

Cheers,
Sylvain

Thanks to Nat Brown?s comment in the SDL bugzilla ( Steelseries Stratus XL mFi controller on OSX does not detect the DPAD · Issue #1973 · libsdl-org/SDL · GitHub ), SDL’s latest Mercurial code should have support for the missing buttons on the Steelseries controllers. If you?re up for building SDL yourself you could give it a test.

I also added SDL_GameController mappings for the Stratus XL and Nimbus controllers, now that the buttons are exposed.

However the GameController mappings aren?t capable of inverting axis values ( SDL_gamecontrollerdb mapping configuration format extension to handle inverted axis · Issue #1166 · libsdl-org/SDL · GitHub ), and unfortunately those controllers still report the opposite of the expected values for their thumbstick y-axis values. So not everything is perfect yet. :(> On Nov 9, 2015, at 10:44 PM, ace491 wrote:

The Nimbus mapping is unusual. The dpad and menu button are not recognized by Steam or SDL’s testjoystick.

Mapping:
“11010000000000002014000000000000,Nimbus,a:b0,b:b1,y:b3,x:b2,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,right trigger:b7”

testjoystick log:
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: There are 1 joysticks attached
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: Joystick 0: Nimbus
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: axes: 4
2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: balls: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: hats: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: buttons: 8
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: instance id: 0
2015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: guid: 11010000000000002014000000000000


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Alex Szpakowski wrote:

Thanks to Nat Brown???s comment in the SDL bugzilla ( Steelseries Stratus XL mFi controller on OSX does not detect the DPAD · Issue #1973 · libsdl-org/SDL · GitHub (Steelseries Stratus XL mFi controller on OSX does not detect the DPAD · Issue #1973 · libsdl-org/SDL · GitHub) ), SDL’s latest Mercurial code should have support for the missing buttons on the Steelseries controllers. If you???re up for building SDL yourself you could give it a test.

I tested it with the Nimbus. The dpad and menu buttons are reporting correctly.
Thanks!

I have an issue where if you quit the app while the app is backgrounded, my code crashes in SDL_PollEvent(&e). I would expect I’d get an SDL_QUIT event, but the app is just waiting in SDL_PollEvent, and when quit while backgrounded, crashes there. Anyone encounter this, or know what’s going on?

Quitting the app may terminate it immediately without letting the app?s code decide anything. That will look somewhat like a crash if you try to debug it, but it?s not. Maybe that?s what?s happening?

on iOS platforms (tvOS / iOS) you shouldn?t be doing anything important in SDL_QUIT since it might not ever be received, you should use the SDL_APP_* foreground/background events for that kind of thing.

This explains app termination a bit: UIKit | Apple Developer Documentation> On Jun 9, 2016, at 2:30 PM, divad wrote:

I have an issue where if you quit the app while the app is backgrounded, my code crashes in SDL_PollEvent(&e). I would expect I’d get an SDL_QUIT event, but the app is just waiting in SDL_PollEvent, and when quit while backgrounded, crashes there. Anyone encounter this, or know what’s going on?


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org