Skip to content

iOS: adapt gameplay to Duo portrait and tabletop poses - #683

Closed
jonochocki wants to merge 1 commit into
seedds:mainfrom
jonochocki:ios/native-experience-duo-airplay
Closed

jonochocki wants to merge 1 commit into
seedds:mainfrom
jonochocki:ios/native-experience-duo-airplay

Conversation

@jonochocki

@jonochocki jonochocki commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Add native iPhone Duo gameplay layouts. Portrait places the aspect-fitted 16:9 game picture above the virtual controls; a partially open horizontal hinge uses UIKit’s division region for tabletop play. Landscape retains the existing overlay when no tabletop division applies.

  • Observe UIHingeInteraction and reserved regions on iOS 27.1+, including inactive division boundaries. Other SDKs/OS versions retain the geometry fallback.
  • Reuse the existing Metal view, gamepad layers and input pipeline across pose changes. Touch coordinates follow the actual video rectangle, and layout changes release held virtual inputs.
  • Preserve multitouch, controller player slots and motion state. Existing landscape control positions remain intact.
  • Keep iPhone landscape-only for regular iPhones and the Duo outer display. The Duo inner display follows UIKit’s native orientation behavior and current bounds. iPad permits all four orientations without UIRequiresFullScreen; UILaunchScreen: {} replaces the empty storyboard entry. The existing launcher gets an orientation-capable hosting controller; its design and settings are unchanged.
  • Keep the approved portrait control placement, including the side-by-side joystick and D-pad. This placement was tuned by the contributor for handheld comfort.

This is the Duo-only portion of the previously combined contribution, split at the maintainer’s request. It includes no AirPlay scene, launcher redesign, artwork fetching/bundling, accent extraction or desktop-builder changes. The AirPlay follow-up is prepared separately; the launcher redesign is deferred for discussion with NX2Apple’s shell work (LNPANDY/NX2Apple#226 / LNPANDY/NX2Apple#144).

Checked

Rebased onto current main. The fork retains the ee6648cb upstream pin, existing patches 0030 and 0031, and Duo patch 0033. The patch and commits use the contributor’s own Git identity. The redundant g_root assignment is removed; upstream’s Nintendo-controller mapping is retained.

  • Physical Duo: the contributor tested build 1.3.19 from the extracted Duo work. The outer display stays landscape in both directions; the inner display retains both portrait directions, landscape and tabletop layouts.
  • iPad windowing: native Stage Manager gestures resize the existing launcher and gameplay window before and after Play. Narrow and wide windows select the appropriate layout from current bounds. The 16:9 Metal viewport and drawable dimensions follow resizing, and newly delivered native center taps reach normalized video coordinates near (0.5, 0.5) after resizing and rotation.
  • Regression coverage: repeated production-root resizing through six sizes checks Metal drawable scaling, button hit centers and normalized game touches. Existing coverage includes safe areas, native division regions, multitouch, pose-change input release, controller slots and motion-state preservation.
  • Upstream Duo harness: 27 passed, zero failures or skips.
  • Fork iPad harness: 26 passed, one iOS 27.1 hinge-API availability skip on the iOS 27.0 runtime, zero failures.
  • Documentation, environment registry, orientation policy and patch tooling: 31 checks passed in the fork.
  • Companion NX2Apple patch reproduction: 22 patches reproduce 2,446 vendored files.

The iPad checks use synthetic Metal frames through the production presentation and input code. Full-game testing on a physical iPad and game-performance measurements under resizing remain outstanding. The existing launcher’s two-column layout wraps long titles heavily in narrow windows; this PR does not redesign it.

Earlier device-SDK compile/link smoke checks passed with synthetic game modules and resources; those checks and physical Duo 1.3.19 acceptance predate this rebase. No shader, game-profile or guest-code changes are included. Existing screenshots below are from the previously approved physical Duo build; no new 1.3.19 screenshots are claimed.

Screenshots

Owner-provided physical Duo gameplay; the launcher and external-display screenshots are intentionally excluded.

Inner display: portrait game above controls Inner display: portrait game above controls
Inner display: landscape overlay Inner display: landscape overlay
Outer display: landscape overlay Outer display: landscape overlay

Docs

  • General behavior and validation limits are recorded in docs/reference/rendering.md; the symptom index was regenerated.
  • No shader-chain, game-profile or guest-code changes.
  • No keys, game binaries, ROMFS, shaders or IPAs in the change. The only game imagery linked here is the owner-provided gameplay screenshots.

Companion forwarded patch: LNPANDY/NX2Apple#230. Reversible UIKit/input change; no app-identity or save-data migration.

@jonochocki
jonochocki marked this pull request as ready for review October 29, 2026 23:06
@jonochocki
jonochocki force-pushed the ios/native-experience-duo-airplay branch from a26df95 to 45ae6aa Compare October 29, 2026 23:57
@jonochocki jonochocki changed the title iOS: add a native Duo and external-display experience iOS: adapt gameplay to Duo portrait and tabletop poses Oct 29, 2026
@mbndrock

mbndrock commented Nov 2, 2026

Copy link
Copy Markdown

Hi, I have an iPhone Duo and can test this on real hardware if it helps. I can check out the branch, build it locally, and report back on the portrait poses and the half-open tabletop pose. Let me know what specifically you want verified.

@github-actions github-actions Bot added ios The iPhone and iPad app (dm/ios) docs Documentation labels Nov 3, 2026
seedds added a commit that referenced this pull request Nov 3, 2026
…ure above the controls, the picture can Fill the screen, and a gear opens an in-game menu whose settings take effect at once (#683, #1083)

DmLayout.h computes the picture and controls rectangles from the view's bounds, its safe area and UIKit's division region (UIHingeInteraction, iOS 27.1). Landscape keeps the overlay unless the hinge is half open over a horizontal fold; portrait puts a fitted 16:9 picture above the controls. The iPad drops UIRequiresFullScreen and takes all four orientations, so a game runs in a resizable window. Game touches map through the picture rectangle, and a layout change releases held inputs.

Picture (DM_PICTURE_FIT): Fit, the default, or Fill, which covers the screen in landscape and crops the edges without stretching. Portrait splits and a TV stay fitted.

The 2D/3D button becomes a gear that opens a UIMenu (GameMenu.swift): the controller layout, then Console mode, Picture, Frame-rate counter, Touch feedback and Game rumble, applied while the game runs (front_ios.m dm_setting_live) and saved as the settings screen saves them. The gear stays while a controller hides the other controls. Docking drops the Tap layout.

Merged with the TV output: the drawable's scale is set only in DmGameView layoutSubviews, at most maxPixelWidth across, so a layout pass no longer undoes the TV's 1080p cap; while the TV shows the picture the phone is all controls. Rumble: vibration handles are given with rumble off too, as on a Switch whose vibration is off, so turning it on during play works in a game that asked once.

Checked: iOS compile check and build_smoke; the Duo harness, 33 Simulator tests passing (1 skipped, iOS 27.1 only); t_hid, t_haptics; test_docs, test_launcher_settings, test_launcher_storage, test_orientation_policy. Not tested on a device.

Co-authored-by: Jon Ochocki <[email protected]>
Co-authored-by: v0lumehi <[email protected]>
@seedds

seedds commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Landed in e2fadf2 with you as co-author, together with #1083. Thank you for the layout work and the harness.

Changes from the PR while merging it onto current main:

  • The TV output (iOS: play on a connected TV (cable or AirPlay), picture capped at 1080p #367) landed after your branch. Your layoutSubviews reset contentsScale on every pass, which would have undone the TV's 1080p cap, so the scale is now set only there, capped by a new maxPixelWidth that the TV sets. While a TV shows the picture, the phone's layout is all controls (dm_layout_pad_only).
  • The 2D/3D button is now a gear that opens an in-game menu: the controller layout plus the settings that take effect at once (picture, console mode, frame-rate counter, touch feedback, rumble). Its hit target follows your nearest-target rule against − / +.
  • The harness keeps its Simulator unit tests, with the swap tests rewritten for the menu button and new ones for the menu. The operator-driven rotation UI test is dropped, since nothing can run it unattended.
  • The log line is one front end: layout ... line per change, and the reference entry was rewritten as "iOS layouts: portrait, a half-folded Duo, iPad windows".

Not yet tested on a device with this repository's build. @mbndrock, your Duo offer would help: portrait both ways, the half-open tabletop pose, and the gear menu in each. A log.txt with the front end: layout lines would be useful.

@seedds seedds closed this Nov 3, 2026
Fbenhaddou pushed a commit to Fbenhaddou/NX2Apple that referenced this pull request Nov 3, 2026
Drops three patches that landed upstream: Duo layout (0061, seedds/nxnative#683),
picture fit (0063, LNPANDY#1083) and the Home button quit (0064, LNPANDY#1084). Refreshes the
rest for the new pin. Adds the launch.set.DM_UPSCALER texts in all six languages.
@earths-voluble

Copy link
Copy Markdown

Tested on an iPhone Duo (iOS 27.2) from 4e0333a with Rhythm Heaven Groove: unfolded, the picture sits above the controls in portrait and the layout follows all four orientations, upside down included. Half folded in portrait it looks the same as unfolded, which matches dm_layout (portrait splits the same way open or half open).

Jacob-Tate pushed a commit to Jacob-Tate/nxnative that referenced this pull request Nov 5, 2026
… MetalFX upscalers (chain from upstream)

Conflicts: the iPhone Duo files take upstream's merged version (seedds#683, seedds#1083); the TV mirror setting (e41f09b) is applied again on upstream's front end;
Pokopia's note keeps this branch's iPhone and 1.0.4 facts with upstream's depth_mode, archive and shader-build findings; the games table and gallery keep
both sides' games; the TiledDownsample entry Ikaruga's note links to is kept; symptoms.md and game-patches.md are regenerated.
@mbndrock

mbndrock commented Nov 6, 2026

Copy link
Copy Markdown

Tested the Duo layout build on hardware, following up on the tag.

Setup: iPhone Duo, main at 88c7e03, Pokemon Brilliant Diamond (0100000011D90000), picture Fill, MetalFX upscale. One session of about 160 seconds at a steady 60 fps (frame p50 about 16.7 ms).

I ran the poses you listed: portrait both ways, the half-open tabletop pose, flat open, and the gear menu in each. Everything looked right on screen. Picture and controls stayed on their own sides of the hinge in every pose, controls landed where expected, and the menu sat correctly.

The "front end: layout" lines from the session. The front end moved between overlay and split as the pose changed, at both hinge states:

[dm] front end: layout overlay, Fill, hinge 2 (half open), divisions (
    "{{455.5, 0}, {40, 669}} active=0"
), picture {{-119.16666666666663, 0}, {1189.3333333333333, 669}}, controls {{0, 0}, {951, 669}}
[dm] front end: layout overlay, Fill, hinge 2 (half open), divisions (
    "{{455.5, 0}, {40, 669}} active=1"
), picture {{-119.16666666666663, 0}, {1189.3333333333333, 669}}, controls {{0, 0}, {951, 669}}
[dm] front end: layout split, hinge 2 (half open), divisions (
    "{{0, 455.5}, {669, 40}} active=1"
), picture {{0, 39}, {669, 376.3125}}, controls {{0, 495.5}, {669, 455.5}}
[dm] front end: layout split, hinge 3, divisions (
    "{{0, 455.5}, {669, 40}} active=1"
), picture {{0, 39}, {669, 376.3125}}, controls {{0, 495.5}, {669, 455.5}}
[dm] front end: layout split, hinge 3, divisions (
    "{{0, 455.5}, {669, 40}} active=0"
), picture {{0, 39}, {669, 376.3125}}, controls {{0, 495.5}, {669, 455.5}}
[dm] front end: layout overlay, Fill, hinge 3, divisions (
    "{{455.5, 0}, {40, 669}} active=0"
), picture {{-119.16666666666663, 0}, {1189.3333333333333, 669}}, controls {{0, 0}, {951, 669}}

One observation: every split line has the same geometry, picture at the top and controls at the bottom. The log does not show a flipped split for portrait in the other direction. Happy to send the full log.txt if you want it.

Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…ure above the controls, the picture can Fill the screen, and a gear opens an in-game menu whose settings take effect at once (seedds#683, seedds#1083)

DmLayout.h computes the picture and controls rectangles from the view's bounds, its safe area and UIKit's division region (UIHingeInteraction, iOS 27.1). Landscape keeps the overlay unless the hinge is half open over a horizontal fold; portrait puts a fitted 16:9 picture above the controls. The iPad drops UIRequiresFullScreen and takes all four orientations, so a game runs in a resizable window. Game touches map through the picture rectangle, and a layout change releases held inputs.

Picture (DM_PICTURE_FIT): Fit, the default, or Fill, which covers the screen in landscape and crops the edges without stretching. Portrait splits and a TV stay fitted.

The 2D/3D button becomes a gear that opens a UIMenu (GameMenu.swift): the controller layout, then Console mode, Picture, Frame-rate counter, Touch feedback and Game rumble, applied while the game runs (front_ios.m dm_setting_live) and saved as the settings screen saves them. The gear stays while a controller hides the other controls. Docking drops the Tap layout.

Merged with the TV output: the drawable's scale is set only in DmGameView layoutSubviews, at most maxPixelWidth across, so a layout pass no longer undoes the TV's 1080p cap; while the TV shows the picture the phone is all controls. Rumble: vibration handles are given with rumble off too, as on a Switch whose vibration is off, so turning it on during play works in a game that asked once.

Checked: iOS compile check and build_smoke; the Duo harness, 33 Simulator tests passing (1 skipped, iOS 27.1 only); t_hid, t_haptics; test_docs, test_launcher_settings, test_launcher_storage, test_orientation_policy. Not tested on a device.

Co-authored-by: Jon Ochocki <[email protected]>
Co-authored-by: v0lumehi <[email protected]>
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
…nt, and layout

Upstream-Status: pending [builds on seedds#683]
Reason: Let players resize and reposition touch controls with editor and gameplay geometry parity
Issue: LNPANDY/NX2Apple#347
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation ios The iPhone and iPad app (dm/ios)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants