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
tvOS / Apple TV support
Alex Szpakowski
Guest

Hey all,

Since the recent announcement of the new Apple TV and tvOS, and developer kids of said Apple TV getting in the hands of some people who use SDL, there has been a lot of interest in getting SDL working on tvOS.

As far as I know, there are at least three people working independently on that problem (four if I include myself.) Having 3+ slightly different implementations of the same idea probably isn’t ideal, so I figured I should let everyone know that I definitely intend to have tvOS support in SDL proper ASAP.

I’m a bit hesitant to put code in SDL’s main repository that relies on a beta SDK though – I’ll likely have things in a fork for now. I’ll post that here when I create it.

tvOS is itself a fork of iOS 9 and there aren’t a whole lot of differences between the two operating systems right now, so the good news is not a lot needs to change in SDL to have it working on an Apple TV. I also added MFi game controller support to SDL’s iOS backend yesterday, which will work on tvOS as well.

Phil Hassey is one of the people who got an Apple TV developer kit, and he got SDL working on it very quickly – we’ve been talking a bit, and initial tvOS support in SDL will probably be based at least in part on his work.

- Alex
_______________________________________________
SDL mailing list

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


Joined: 09 Feb 2012
Posts: 179
This might be a tad off-topic, but do you know if tvOS libraries are currently-slated to require compilation via separate Xcode targets, or might SDL's existing iOS projects + targets work with tvOS, off the bat?

I have a few projects I wouldn't mind trying to experimentally-port to tvOS, but probably only if it won't require too much effort (in terms of build setup, etc.)

Cheers!
-- David L.
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
Hi, here's two scripts to compile SDL libs from command line with 'xcodebuild'.
One to compile for IOS and the other for TvOS. They could be easily merged in one script but currently TVOs requires xcodebeta 7.1.
https://bugzilla.libsdl.org/show_bug.cgi?id=2302
Cheers, Sylvain Le 22 sept. 2015 01:43, "DLudwig" a écrit :
Quote:
This might be a tad off-topic, but do you know if tvOS libraries are currently-slated to require compilation via separate Xcode targets, or might SDL's existing iOS projects + targets work with tvOS, off the bat?

I have a few projects I wouldn't mind trying to experimentally-port to tvOS, but probably only if it won't require too much effort (in terms of build setup, etc.)

Cheers!
-- David L.


_______________________________________________
SDL mailing list

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

tvOS / Apple TV support
Alex Szpakowski
Guest

I’ve created an Apple TV / tvOS branch of SDL here: https://bitbucket.org/slime73/sdl-experiments/branch/AppleTV
Once you have that code (make sure to use the correct branch! A direct download is here: https://bitbucket.org/slime73/sdl-experiments/get/AppleTV.zip ), you can build SDL for tvOS if you have the Xcode 7.1 beta by choosing the libSDL-tv target in the SDL xcode project in Xcode-iOS/SDL/.

I haven’t actually done any testing yet, since the Apple TV simulator isn’t showing up in Xcode for some reason (I’ll see about that tomorrow maybe). I expect there will be bugs. If anyone finds any please let me know. Smile

Comments and suggestions for the code and how to deal with Apple TV platform-specific things are also welcome.
- Alex
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
Hi Alex,

I tried your branch and it is good ! Here's some feedback:

1/ I got a very small problem of linking:
Undefined symbols of  "_UIKit_GetSupportedOrientations", referenced from:
      -[SDL_uikitviewcontroller supportedInterfaceOrientations] in libSDL2.a(SDL_uikitviewcontroller.o)

I commented out "supportedInterfaceOrientations" and "shouldAutorotateToInterfaceOrientation" from the files SDL_uikitviewcontroller.{h,m}


2/ OSTV-Simulator wasn't working neither for me at first. But I got it running by changing the "build settings > architectures" of my xcode project to "Standard architectures (arm64) - $(ARCHS_STANDARD)".  (I generated my xcode app project with a CMakeFile ...).



3/ On the OSTV-Simulator: it seems to detect an "ExtendedGamepad" but no data (Axis, Dpad) comes from it. Even if the "Apple TV Remote" of the simulator is shown/hidden.

Though the keyboard works.


4/ On the real AppleTV, it detect correctly the real remote as a micro-gamepad and datas (Axis, DPad, Button) are coming.


5/ But the DPad datas are impossible to use. It's almost never in the state Up/Down/Left/Right, but always in a diagonal state.

I have looked at the code of "SDL_SYS_MFIJoystickHatStateForDPad" and it is correct.

It's just the way the data are coming. Maybe the raw datas should be used.



6/ I tried mixer/image/ttf and all was working with no modification.


So for me it is in a very good state,

Thanks,
Sylvain
Re: tvOS / Apple TV support
DLudwig


Joined: 09 Feb 2012
Posts: 179
Alex Szpakowski wrote:
I’ve created an Apple TV / tvOS branch of SDL here: https://bitbucket.org/slime73/sdl-experiments/branch/AppleTV


Neat!

Now if Microsoft would just release the Win10 + Xbox One dev tools, I could get started on Xbox One support. Wink

-- David L.
tvOS / Apple TV support
slime73


Joined: 07 Jan 2012
Posts: 4
Thanks for testing!

Quote:
1/ I got a very small problem of linking:
Undefined symbols of "_UIKit_GetSupportedOrientations", referenced from:
-[SDL_uikitviewcontroller supportedInterfaceOrientations] in libSDL2.a(SDL_uikitviewcontroller.o)
I commented out "supportedInterfaceOrientations" and "shouldAutorotateToInterfaceOrientation" from the files SDL_uikitviewcontroller.{h,m}

Oops. I just pushed a commit that should fix that.

Quote:
3/ On the OSTV-Simulator: it seems to detect an "ExtendedGamepad" but no data (Axis, Dpad) comes from it. Even if the "Apple TV Remote" of the simulator is shown/hidden.
Though the keyboard works.

4/ On the real AppleTV, it detect correctly the real remote as a micro-gamepad and datas (Axis, DPad, Button) are coming.

I suspect the beta Apple TV Simulator is just buggy right now – it didn’t support the remote as a GameController at all in beta 1, apparently.

Quote:
5/ But the DPad datas are impossible to use. It's almost never in the state Up/Down/Left/Right, but always in a diagonal state.
I have looked at the code of "SDL_SYS_MFIJoystickHatStateForDPad" and it is correct.
It's just the way the data are coming. Maybe the raw datas should be used.

Weird. If you set the reportsAbsoluteDpadValues boolean property of GCMicroGamepad to YES somewhere in the joystick code, does it report more sensible values?

- Alex

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
"reportsAbsoluteDpadValues" seems to center the coordinates or not. It could be used in SDL anyway but not for this I guess.

In fact, I have dumped the field "value" (dpad.{up,down,left,right}.value) together with "isPressed".

INFO: Hat/isPressed/Value up/0/0.000000/ down/1/0.009222 left/1/0.699115 right/0/0.000000
INFO: Hat/isPressed/Value up/0/0.000000/ down/1/0.009222 left/1/0.699115 right/0/0.000000
INFO: Hat/isPressed/Value up/0/0.000000/ down/1/0.009222 left/1/0.699115 right/0/0.000000


Even a very small "value" triggers the "isPressed", so we have more likely diagonals.



I have changed the function "SDL_SYS_MFIJoystickHatStateForDPad" to use the raws values, and it works better like this (sorry for the copy paste):

SDL_SYS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad)
{
    float values[4];
    int   arrows[4];
    int   nb = 0;

    if (dpad.up.value != 0) {
      values[nb] = dpad.up.value;
      arrows[nb] = SDL_HAT_UP;
      nb += 1;
    }

    if (dpad.down.value != 0) {
      values[nb] = dpad.down.value;
      arrows[nb] = SDL_HAT_DOWN;
      nb += 1;
    }

    if (dpad.left.value != 0) {
      values[nb] = dpad.left.value;
      arrows[nb] = SDL_HAT_LEFT;
      nb += 1;
    }

    if (dpad.right.value != 0) {
      values[nb] = dpad.right.value;
      arrows[nb] = SDL_HAT_RIGHT;
      nb += 1;
    }

    // (nb == 3) and (nb == 4) would be an error, since Up and Down are exclusive. and also Left and Right are exclusive
    if (nb == 0 || nb == 3 || nb == 4) {
      return SDL_HAT_CENTERED;
    }

    // Only one direction
    if (nb == 1) {
      return arrows[0];
    }

    // Two values.  let's find which
    float angle = SDL_atan(values[1] / values[0]);

    if (angle < M_PI / 8.0) {
       return arrows[0];
    } else if (angle > 3.0 * M_PI / 8.0) {
       return arrows[1];
    } else {
       return arrows[0] | arrows[1];
    }
}
RodrigoCard


Joined: 23 Apr 2011
Posts: 113
Location: Brazil
About this: "Figure out what to do with reportsAbsoluteDpadValues"
Since it changes the Siri Remote behavior, I think you can implement that the same way as you did with controllerUserInteractionEnabled, as a Hint.
tanis


Joined: 01 Oct 2015
Posts: 8
I checked out slime73's repo on the AppleTV branch but even though it compiles and installs fine on the Apple TV, I keep seeing a grey screen. Any clue what might be wrong? I've been using the XCode-iOS/Demo projects. I only changed that project to use the tvOS instead of iOS SDK.
Thanks!
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
Also, I have seen another issue on the real box:

Datas coming from the Joystick Micro Remote are duplicated as Keyboard and Mouse.
I mean: in addition to Joystick events,  I always received Mouse events (SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP) and also Keyboard events) (SDL_KEYDOWN,  mostly ENTER and ESCAPE).


I have tried to use "SDL_HINT_APPLE_TV_REMOTE_KEYPRESS" but seems to have the same behavior (tried:  no used, "0" and also "1").



From my previous mail, the function "SDL_SYS_MFIJoystickHatStateForDPad" could be improved not calculating the SDL_atan each time. I only put the last part:


// Two values.  let's find which
// tan(Pi/Cool  == 0.41421
// tan(3Pi/Cool == 2.41421
float tan_angle = values[1] / values[0];
if (tan_angle < 0.41421) {
  return arrows[0];
} else if (tan_angle > 2.41421) {
  return arrows[1];
} else {
   return arrows[0] | arrows[1];
}


Thanks for you help,

Sylvain
tvOS / Apple TV support
Alex Szpakowski
Guest

Weird. The Apple documentation is pretty explicit about apple tv remote input being routed either through the GameController APIs *or* the other input APIs, and not both at once. Are you using the simulator or a real device?

I wonder if it’s a bug in tvOS...

Quote:
On Oct 2, 2015, at 9:24 AM, Sylvain Becker wrote:

Also, I have seen another issue on the real box:

Datas coming from the Joystick Micro Remote are duplicated as Keyboard and Mouse.
I mean: in addition to Joystick events, I always received Mouse events (SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP) and also Keyboard events) (SDL_KEYDOWN, mostly ENTER and ESCAPE).

I have tried to use "SDL_HINT_APPLE_TV_REMOTE_KEYPRESS" but seems to have the same behavior (tried: no used, "0" and also "1").

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
Yes, this is happens on the real device. Using xcode beta2, and latest tvOS firmware.

Indeed, it could be a bug in tvOS ...


On 2 October 2015 at 20:38, Alex Szpakowski wrote:
Quote:
Weird. The Apple documentation is pretty explicit about apple tv remote input being routed either through the GameController APIs *or* the other input APIs, and not both at once. Are you using the simulator or a real device?

I wonder if it’s a bug in tvOS...

Quote:
On Oct 2, 2015, at 9:24 AM, Sylvain Becker wrote:

Also, I have seen another issue on the real box:

Datas coming from the Joystick Micro Remote are duplicated as Keyboard and Mouse.
I mean: in addition to Joystick events,  I always received Mouse events (SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP) and also Keyboard events) (SDL_KEYDOWN,  mostly ENTER and ESCAPE).

I have tried to use "SDL_HINT_APPLE_TV_REMOTE_KEYPRESS" but seems to have the same behavior (tried:  no used, "0" and also "1").

_______________________________________________
SDL mailing list

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





--
Sylvain Becker
divad


Joined: 09 Jun 2015
Posts: 15
Is there a way to detect a click (on the touchpad, not just a finger press but an actual click)? I don't see any SDL event that comes through from a click.
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
The microgamepad remote is recognized as a joystick by SDL.
First, you need to call SDL_JoystickOpen, then, you'll received various joystick events (see SDL_JOYBUTTONDOWN).
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
By the way, Apple has released two days ago the latest version of xcode that includes tvOS sdk. So it's not a beta anymore.
Latest tvOS firmware has also been released.
ace491


Joined: 07 Jun 2014
Posts: 24
Alex,

Thanks for the branch! All the work you've done on SDL for iOS and tvOS has been a big help to me.
Currently, tvOS apps are required to exit an app and return to the home screen when the menu button is pressed. The following links provide some details.
https://forums.developer.apple.com/thread/17807
https://forums.developer.apple.com/thread/23786

It seems like SDL is permanently overriding the menu recognizer. What's the best way to solve this?
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
Hi,

I got the same issue.
More precisely, there are two distinct issues:



1/ SDL "overriding the menu recognizer" : I haven't seen this one because I handle the remote as a SDL joystick. Then, Menu button is seen as "SDL_CONTROLLER_BUTTON_X".


2/ When ending the application (returning from the SDL_main()), the application is not exiting:

I quicky modified the file "src/video/uikit/SDL_uikitappdelegate.m". In the function "postFinishLaunch", uncomment the last line to make sure that "exit(exit_status)" is called after the SDL_main has returned.

 

Cheers,

Sylvain



On 28 October 2015 at 04:16, ace491 wrote:
Quote:
Alex,

Thanks for the branch! All the work you've done on SDL for iOS and tvOS has been a big help to me.
Currently, tvOS apps are required to exit an app and return to the home screen when the menu button is pressed. The following links provide some details.
https://forums.developer.apple.com/thread/17807
https://forums.developer.apple.com/thread/23786

It seems like SDL is permanently overriding the menu recognizer. What's the best way to solve this?


_______________________________________________
SDL mailing list

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

Re: tvOS / Apple TV support
ace491


Joined: 07 Jun 2014
Posts: 24
I don't think we're supposed to actually return from main. As long as nothing is intercepting the menu button, pressing it will leave the app as if you had pressed the home button on the iPhone.

If you disable interaction by setting setUserInteractionEnabled to NO on the view of the rootViewController of the uiwindow, then pressing menu will leave the app. Although, this isn't useful because you lose all interaction. It needs to be on a per button basis.
I tried adding the super function calls to the all the presses and touches functions in SDL_uikitview.m but that didn't work.

slvn wrote:
Hi,

I got the same issue.
More precisely, there are two distinct issues:



1/ SDL "overriding the menu recognizer" : I haven't seen this one because I handle the remote as a SDL joystick. Then, Menu button is seen as "SDL_CONTROLLER_BUTTON_X".


2/ When ending the application (returning from the SDL_main()), the application is not exiting:

I quicky modified the file "src/video/uikit/SDL_uikitappdelegate.m". In the function "postFinishLaunch", uncomment the last line to make sure that "exit(exit_status)" is called after the SDL_main has returned.

 

Cheers,

Sylvain



On 28 October 2015 at 04:16, ace491 wrote:
Quote:
Alex,

Thanks for the branch! All the work you've done on SDL for iOS and tvOS has been a big help to me.
Currently, tvOS apps are required to exit an app and return to the home screen when the menu button is pressed. The following links provide some details.
https://forums.developer.apple.com/thread/17807
https://forums.developer.apple.com/thread/23786

It seems like SDL is permanently overriding the menu recognizer. What's the best way to solve this?


_______________________________________________
SDL mailing list

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

divad


Joined: 09 Jun 2015
Posts: 15
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.
tvOS / Apple TV support
Alex Szpakowski
Guest

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

Let me know if that works for everyone!
Quote:
On Oct 28, 2015, at 5:13 PM, divad 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 mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: tvOS / Apple TV support
ace491


Joined: 07 Jun 2014
Posts: 24
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

Let me know if that works for everyone!
Quote:
On Oct 28, 2015, at 5:13 PM, divad 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 mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
tvOS / Apple TV support
ace491


Joined: 07 Jun 2014
Posts: 24
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.
Re: tvOS / Apple TV support
ace491


Joined: 07 Jun 2014
Posts: 24
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.
tvOS / Apple TV support
ace491


Joined: 07 Jun 2014
Posts: 24
Also, the nimbus triggers are only reporting values from about 16383 to 32767, instead of 0 to 32767.
tvOS / Apple TV support
Alex Szpakowski
Guest

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.
Quote:
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 mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
tvOS / Apple TV support
Alex Szpakowski
Guest

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”.)
Quote:
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 mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
ace491


Joined: 07 Jun 2014
Posts: 24
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
RodrigoCard


Joined: 23 Apr 2011
Posts: 113
Location: Brazil
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:
https://bugzilla.libsdl.org/show_bug.cgi?id=3124

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
tvOS / Apple TV support
slvn


Joined: 06 Oct 2012
Posts: 88
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
tvOS / Apple TV support
Alex Szpakowski
Guest

Thanks to Nat Brown’s comment in the SDL bugzilla ( https://bugzilla.libsdl.org/show_bug.cgi?id=3124#c5 ), 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 ( https://bugzilla.libsdl.org/show_bug.cgi?id=2181 ), and unfortunately those controllers still report the opposite of the expected values for their thumbstick y-axis values. So not everything is perfect yet. Sad
Quote:
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 attached2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: Joystick 0: Nimbus2015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: axes: 42015-11-09 20:40:01.855 testjoystick[10859:311172] INFO: balls: 02015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: hats: 02015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: buttons: 82015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: instance id: 02015-11-09 20:40:01.856 testjoystick[10859:311172] INFO: guid: 11010000000000002014000000000000
_______________________________________________SDL mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: tvOS / Apple TV support
ace491


Joined: 07 Jun 2014
Posts: 24
Alex Szpakowski wrote:
Thanks to Nat Brown’s comment in the SDL bugzilla ( https://bugzilla.libsdl.org/show_bug.cgi?id=3124#c5 ), 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!
divad


Joined: 09 Jun 2015
Posts: 15
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?
tvOS / Apple TV support
Alex Szpakowski
Guest

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: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html#//apple_ref/doc/uid/TP40007072-CH2-SW7
Quote:
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 mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org