Skip to content

[3.x] [tvOS] Basic tvOS Support #45829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

naithar
Copy link
Contributor

@naithar naithar commented Feb 8, 2021

Added basic tvOS support.
Implements already closed but not implemented proposal: godotengine/godot-proposals#224

Platform code is based on iOS platform code with minor changes (some iOS stuff isn't available on tvOS).
Audio interruption was also removed - AppleTV don't seem post interruption notification correctly or in right order, which results in game freezing after application loses focus.
Keyboard input backed was changed so keyboard input actually works.
Input is handled by controllers. Apple/Siri Remote are also considered controller (micro)

Export code (including plugins) is also based on iOS platform since both of them export into Xcode project.
But export is also simpler:

  • Launch screen is storyboard based (no need for launch images)
  • tvOS project supports empty Apple Team ID
  • Icons, Signatures and certificates are handled by Xcode project

Core code has been modified to address tvOS unsupported features - no fork and execvp.
Rendering code has been modified for tvOS to use same paths/methods as iOS's.

Mono haven't been ported.
GDNative uses same configuration as iOS platform.

Build container and script PRs: godotengine/build-containers#71, godotengine/godot-build-scripts#21

Since linux-compiled binaries are required to use use_lto to pass App Store checks, I'll place macOS built tvOS templates and binaries here: unofficial tvOS templates

@naithar naithar force-pushed the feature/apple-tv branch 3 times, most recently from 9e68457 to a5ea4e3 Compare February 9, 2021 08:17
@Chaosus Chaosus added this to the 3.2 milestone Feb 9, 2021
@naithar naithar force-pushed the feature/apple-tv branch 4 times, most recently from 7b6f939 to ee5b064 Compare February 12, 2021 11:44
@naithar naithar force-pushed the feature/apple-tv branch 4 times, most recently from 0756c49 to 77e4b4a Compare February 19, 2021 14:03
@naithar naithar marked this pull request as ready for review February 19, 2021 19:38
@naithar naithar requested review from a team as code owners February 19, 2021 19:38
Copy link
Member

@touilleMan touilleMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ I only reviewed the gdnative part of this PR (and it seems pretty fine for me 😄 )

naithar added 5 commits April 1, 2021 23:17
Added delay for 'end' press. This should allow to use Input.is_joy_button_pressed with JOY_START.
Added separate tvOS delay settings in project settings.
Added 'tvOS.overrides_menu_button' value. This allows to enable system's default processing of menu button.
@naithar naithar force-pushed the feature/apple-tv branch from f233b70 to 881b653 Compare April 1, 2021 20:17
@akien-mga akien-mga requested a review from a team May 7, 2021 07:46
@naithar naithar marked this pull request as draft June 17, 2021 12:37
@naithar
Copy link
Contributor Author

naithar commented Jun 17, 2021

Reverting this PR (as well as one for master branch) back to draft for now.
I'm working on simplifying code sharing between UIKit based platforms - iOS and tvOS. Progress is here: naithar@4c30d17

It's working, but I'm not happy with the overall code structure/cleanliness for now.

@paulocoutinhox
Copy link

Hi,

Any news when it will be available?

@akien-mga akien-mga changed the title [3.4] [tvOS] Basic tvOS Support [3.x] [tvOS] Basic tvOS Support Oct 5, 2021
@akien-mga akien-mga modified the milestones: 3.4, 3.5 Oct 5, 2021
@akien-mga akien-mga force-pushed the 3.x branch 2 times, most recently from 71cb8d3 to c58391c Compare January 6, 2022 22:40
@Valeryn4
Copy link
Contributor

Valeryn4 commented Jan 19, 2022

Good day! There was a need for tvOS
Is it enough just to merge into the 3.4 branch?

@Calinou
Copy link
Member

Calinou commented Jan 19, 2022

Good day! There was a need for tvOS Is it enough just to merge into the 3.4 branch?

This won't be merged in 3.4.x as patch releases are now dedicated to bug fixes only. This can be merged for 3.5 if this is rebased against the latest 3.x branch and tested again.

@paulocoutinhox
Copy link

Good day! There was a need for tvOS Is it enough just to merge into the 3.4 branch?

This won't be merged in 3.4.x as patch releases are now dedicated to bug fixes only. This can be merged for 3.5 if this is rebased against the latest 3.x branch and tested again.

@naithar Can you rebase?

@Valeryn4
Copy link
Contributor

Good day! There was a need for tvOS Is it enough just to merge into the 3.4 branch?

This won't be merged in 3.4.x as patch releases are now dedicated to bug fixes only. This can be merged for 3.5 if this is rebased against the latest 3.x branch and tested again.

It was a question to the author of a branch.
I was unable to build a template for the emulator.
Also, the version worries me about the presence of errors in 3.4.beta.
Tomorrow I will try to merge locally with my branch 3.4. I will do this blindly. Without any understanding of the template device.

@naithar
Copy link
Contributor Author

naithar commented Jan 20, 2022

Good day! There was a need for tvOS

Is it enough just to merge into the 3.4 branch?

I'm planning to work on this PR and some other iOS issues, but I can't really give a time frame for when it will be ready.

You should be able to use this version of PR after some modifications, but I can't name them as I haven't been following development for some time.

@Valeryn4
Copy link
Contributor

Valeryn4 commented Jan 24, 2022

problem control...
remote control uses axes for dpad
image

I added this to my dpad block.
Otherwise, it is not possible to make smooth control of the remote control.
The second generation console always uses two vectors.
Therefore, counting the pressure is meaningless. If we want to emulate dpad clicks, we need to read vectors.
It is also necessary to enter deadzone.

Try dpad control in a 2D game. be surprised)

InputDefault::JoyAxis jx = {-1, gamepad.dpad.xAxis.value};
InputDefault::JoyAxis jy = {-1, -gamepad.dpad.yAxis.value}; //inverse y

OSAppleTV::get_singleton()->joy_axis(joy_id, JOY_AXIS_8, jx);
OSAppleTV::get_singleton()->joy_axis(joy_id, JOY_AXIS_9, jy);

//if axis over deadzone -0.5-0.5 - pressed button
if (jx.value < -0.5)
    OSAppleTV::get_singleton()->joy_button(joy_id, JOY_DPAD_LEFT, gamepad.dpad.left.isPressed);
elif (jx.value > 0.5)
    OSAppleTV::get_singleton()->joy_button(joy_id, JOY_DPAD_RIGHT, gamepad.dpad.left.isPressed);
    

@Valeryn4
Copy link
Contributor

tvOS unsupport NSDocumentDirectory directory.
tvOS prevents writing out of cache or NSUserDefaults

Need use NSUserDefaults (512kb limit)
Need use NSCachesDirectory

@naithar
Copy link
Contributor Author

naithar commented Mar 10, 2022

Superseded by #58976 and #58977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants