Skip to content

Animal Crossing: New Horizons in a taller screen's own shape (DM_SCREEN_ASPECT; builds on #969) - #1091

Closed
zxcheergo wants to merge 4 commits into
seedds:mainfrom
zxcheergo:acnh-screen-shape
Closed

zxcheergo wants to merge 4 commits into
seedds:mainfrom
zxcheergo:acnh-screen-shape

Conversation

@zxcheergo

Copy link
Copy Markdown
Contributor

What and why

Animal Crossing: New Horizons in a screen's own shape on a screen taller than 16:9, such as the iPhone Duo's (about 1.43:1), instead of a 16:9 picture with bars or stretched: 16:9's sides with more above and below, the layouts in their own shape, centred, their edge widgets at the taller screen's edges.

This builds on #969, which adds the host side (DM_SCREEN_ASPECT in loader.c, the screen_aspect profile key and the launcher setting Picture shape) with Breath of the Wild. Only the last commit (00232109) is new here: it adds this game's profile files and touches nothing in the host. Please review it after #969, or with it.

  • Profile (dm/games/01006F8002326000/: a new patches.py, duo_anchor.c, screen_aspect on in game.tsv), stubs of the 3.0.3 main only, one bit of DM_SCREEN_ASPECT_SITES each:
    • sizes: the platform config's display and layout sizes (the graphics create arg, its static display size and 1280x720, another arg's 1920x1080), the per-frame resolution table entry (without it the 1920x1344 window was cropped back to its top 1920x1080) and the layouts' DrawInfo framebuffer size take the screen's height;
    • the view: the island camera's vertical angle (+0x2cc, read twice) and the other camera path's half angle are widened to 2 atan(tan(fovy/2) k), k = (16/9) / ratio, since the aspect already follows the viewport and the picture had lost a fifth of each side;
    • layouts: nn::ui2d::DrawInfo::SetProjectionMtx's 16:9 perspective projection has its y row divided by the vertical stretch, so layouts keep their shape (only a 16:9 one: the game copies a DrawInfo's projection into another, and the title came out divided twice); duo_anchor.c, run after Pane::Calculate's global matrix, stretches full-screen and full-height background leaves and moves edge widgets out with the taller edges. The game's panes have no RTTI, so what draws is told by the vtable's DrawSelf against nn::ui2d::Pane::DrawSelf.

DUO_ANCHOR is duo_anchor.c built with the command in the comment above it (182 words, no relocations; rebuilding it gives the same words). The game note's new section has the addresses and what each stub fixed (Screen shape).

Checked

  • Tests: make -C dm/host/tests GAME=01006F8002326000 run (all pass); dm/tools/tests test_docs, test_game_profile, test_env_switches, test_launcher_settings, test_settings; dm/tools/lint_python.py with .github/requirements/lint.txt (0 new). The Metal graphics tests ran on Breath of the Wild: a picture of a taller screen's own shape (DM_SCREEN_ASPECT) #969's branch (Breath of the Wild's profile); this commit changes no host or graphics code.
  • Games run, with title ID and version: Animal Crossing: New Horizons 01006F8002326000 3.0.3 with its DLC, built on this base (e5620b1a + Breath of the Wild: a picture of a taller screen's own shape (DM_SCREEN_ASPECT) #969) with the NSP script (--platform mac --allow-other-metal: this Mac's Metal compiler is Xcode 27.1's 32023.921, the lock's 32023.922), headless with an island save, at DM_SCREEN_ASPECT=1.43 against the same route with it unset: the title (the logo, the version, press-A and settings lines at the new edges), the island (16:9's sides with more above and below; the ZL icon, the clock and the minimap at the new edges), the pocket and the NookPhone in their own shape. With DM_SCREEN_ASPECT unset the route looks as before. No [RED] line.
  • Devices and OS: Apple M1, macOS 27.0.1; an iPhone Duo (A20 Pro), iOS 27.1, with the same stubs on an older base, where the picture looked right to its player.
  • scripts/regress.py check was not run (no harness root or route saves on this Mac); this commit adds a profile's stubs only, which keep the original instructions while DM_SCREEN_ASPECT is unset.
  • Open, in the game note: an NPC's dialog box stays at its 16:9 place rather than the taller screen's bottom edge, and the NookPhone's blurred backdrop has a hard edge at its top left.

Docs

  • The finding is in its game note (dm/games/01006F8002326000/README.md, Screen shape); docs/agents/game-patches.md regenerated (the profile's BINDING)
  • A chain tool changed (none)
  • No game files, keys or data extracted from a game in the change or the attachments

🤖 Generated with Claude Code

zxcheergo and others added 3 commits November 2, 2026 22:01
…EN_ASPECT)

On a screen taller than 16:9, such as the iPhone Duo's 1.43:1, the game
is shown as a 16:9 picture: stretched, or with bars. With
DM_SCREEN_ASPECT=1.43 (launcher setting "Picture shape", offered for
profiles with screen_aspect on) the host gives the game a 1920x1344
output and a 1280x896 layout space, and stubs in this profile make the
game follow it:

- sead::PerspectiveProjection takes the vertical angle that keeps 16:9's
  sides in view and stores it, so shadow cascades and culling see the
  view as drawn (widening only sin/cos/tan left the ground black in
  patches); the camera's fovy getters follow, the HUD camera takes the
  screen's ratio.
- In Pane::Calculate (duo_anchor.c, compiled into the profile) widgets
  at the 720 space's edges, and a list of edge-anchored widgets
  generated from the layout files (dialog box, subtitles, names, logos),
  move out with the taller edges; full-screen backgrounds stretch, page
  frames grow once, side masks scale about the centre so the scope's
  circle stays round, the title art scales without stretching, and the
  map's scrolling cut-outs are left alone.
- Full-screen captures and their copied rect follow the layout height,
  projected background textures map the whole height, the map's
  footprint trail keeps its 720-pane projection, and the camera rune's
  photo takes the screen's middle 16:9 band instead of the whole screen
  squeezed into its 854x480 picture.

Checked on an M1 Mac (macOS 27.0.1) against the same routes at 16:9:
the map and footprint mode at four zooms (trail offsets 0), inventory,
system, options, album, compendium, weapon wheels, scope, camera rune
and its shutter, a memory cutscene, the Adventure Log, sensor settings,
fast travel, loading screens and a shrine. A photo taken at 1.43 now
matches the 16:9 photo at scale 1.0 (it needed a 1.24 stretch). NPC
dialogs and shops were checked against the layout rules only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dialog's backing

Two things seen on an iPhone Duo at DM_SCREEN_ASPECT=1.43:

- The title screen showed a bright band left of the menu. The menu's
  backing is two 480x720 halves side by side (FBLayout_00/01 from -320
  to 160, FBLayout_02/03 from 160 to the right edge); the half against
  the side was taken for a side mask and scaled about the centre, which
  moved its inner edge out to 199. duo_anchor.c now stretches those
  panes like a middle panel, so the halves still meet.
- An NPC's dialog box was dark across its bottom from the 720 space's
  edge down. Its blurred backing is a copy of the screen behind the box
  made by the second capture class (main+0xf66xxx, the same code as the
  first one at main+0xf5a0dc / main+0xf5a4b8), which still read the
  layout file's 720: its copied rect stood 88 units below the moved box,
  and its lower quarter read past the screen's bottom edge, black through
  the clamp-to-border sampler. The texture size (main+0xf66118) and the
  copied rect (main+0xf66334) now take the screen's layout height, as the
  first class does.

Checked on this base on an M1 Mac, the game built with the NSP script
(--allow-other-metal: this Mac's Xcode 27.1 Metal compiler), headless,
with a save by an NPC in Kakariko Village: the title, the field, the
dialog (the backing's copy centred on the box, v 0.8605 against 0.9587
before; the box as dark below the 720 edge as above it), the inventory
and the map at 1.43, and the same route at 16:9 unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…EN_ASPECT)

On a screen taller than 16:9, such as the iPhone Duo's 1.43:1, the game
is shown as a 16:9 picture with bars or stretched. With
DM_SCREEN_ASPECT=1.43 (the host side of Breath of the Wild's screen
shape: a 1920x1344 output, a 1280x896 layout space) the stubs of this
profile's new patches.py (3.0.3 main) make the game render that shape,
one bit of DM_SCREEN_ASPECT_SITES each:

- Sizes: the platform config's display and layout sizes (the graphics
  create arg, its static display size and 1280x720, another arg's
  1920x1080), the per-frame resolution table entry (without it the
  1920x1344 window was cropped back to its top 1920x1080) and the
  layouts' DrawInfo framebuffer size take the screen's height.
- The view: the island camera's vertical angle (+0x2cc, read twice) and
  the other camera path's half angle are widened to 2 atan(tan(fovy/2) k),
  k = (16/9) / ratio, so 16:9's sides stay in view with more above and
  below (the aspect already follows the viewport, so the picture had
  lost a fifth of each side).
- Layouts: nn::ui2d::DrawInfo::SetProjectionMtx's 16:9 perspective
  projection has its y row divided by the vertical stretch, so layouts
  keep their shape, centred (only a 16:9 one: the game copies a
  DrawInfo's projection into another, and the title came out divided
  twice). duo_anchor.c, run after Pane::Calculate's global matrix,
  stretches full-screen and full-height background leaves and moves the
  edge widgets out with the taller edges; the game's panes have no RTTI,
  so what draws is told by the vtable's DrawSelf.

Checked on an M1 Mac (macOS 27.0.1), the game built on this base with
the NSP script (--allow-other-metal), headless with an island save, at 1.43 against the same route at 16:9:
the title (logo, version, press-A and settings lines at the new edges),
the island (16:9's sides with more above and below; the ZL icon, clock
and minimap at the new edges), the pocket and the NookPhone in their own
shape. No [RED] line. The host tests pass with this profile; the words
of duo_anchor.c rebuild to DUO_ANCHOR exactly. Open: an NPC's dialog box
stays at its 16:9 place, and the phone's blurred backdrop has a hard edge
at its top left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) rewriter The NSO rewriter and per-build patches tools Tools and scripts (dm/tools, scripts) docs Documentation game: 01006F8002326000 Animal Crossing: New Horizons game: 01007EF00011E000 The Legend of Zelda: Breath of the Wild labels Nov 3, 2026
# Conflicts:
#	docs/agents/game-patches.md
seedds pushed a commit that referenced this pull request Nov 3, 2026
…EN_ASPECT) (#1091)

On a screen taller than 16:9, such as the iPhone Duo's 1.43:1, the game
is shown as a 16:9 picture with bars or stretched. With
DM_SCREEN_ASPECT=1.43 (the host side of Breath of the Wild's screen
shape: a 1920x1344 output, a 1280x896 layout space) the stubs of this
profile's new patches.py (3.0.3 main) make the game render that shape,
one bit of DM_SCREEN_ASPECT_SITES each:

- Sizes: the platform config's display and layout sizes (the graphics
  create arg, its static display size and 1280x720, another arg's
  1920x1080), the per-frame resolution table entry (without it the
  1920x1344 window was cropped back to its top 1920x1080) and the
  layouts' DrawInfo framebuffer size take the screen's height.
- The view: the island camera's vertical angle (+0x2cc, read twice) and
  the other camera path's half angle are widened to 2 atan(tan(fovy/2) k),
  k = (16/9) / ratio, so 16:9's sides stay in view with more above and
  below (the aspect already follows the viewport, so the picture had
  lost a fifth of each side).
- Layouts: nn::ui2d::DrawInfo::SetProjectionMtx's 16:9 perspective
  projection has its y row divided by the vertical stretch, so layouts
  keep their shape, centred (only a 16:9 one: the game copies a
  DrawInfo's projection into another, and the title came out divided
  twice). duo_anchor.c, run after Pane::Calculate's global matrix,
  stretches full-screen and full-height background leaves and moves the
  edge widgets out with the taller edges; the game's panes have no RTTI,
  so what draws is told by the vtable's DrawSelf.

Checked on an M1 Mac (macOS 27.0.1), the game built on this base with
the NSP script (--allow-other-metal), headless with an island save, at 1.43 against the same route at 16:9:
the title (logo, version, press-A and settings lines at the new edges),
the island (16:9's sides with more above and below; the ZL icon, clock
and minimap at the new edges), the pocket and the NookPhone in their own
shape. No [RED] line. The host tests pass with this profile; the words
of duo_anchor.c rebuild to DUO_ANCHOR exactly. Open: an NPC's dialog box
stays at its 16:9 place, and the phone's blurred backdrop has a hard edge
at its top left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
seedds added a commit that referenced this pull request Nov 3, 2026
….43:1 picture under DM_SCREEN_ASPECT fills a 1.43:1 screen instead of being fitted into a 16:9 view (from #1091)

The iOS front end sized the game's view to the largest 16:9 rectangle (DmLayout.h
dm_aspect_fit / dm_aspect_fill) and the present then fitted the 1920x1344 frame of
Breath of the Wild's or Animal Crossing's screen shape into that 16:9 drawable, so in
Fit an iPhone Duo showed it smaller than the 16:9 picture, with bars on all four sides;
the Mac mapped the mouse on a 16:9 rectangle of the window too.

The present reports the shape of the frame it draws (nvn_mtl.m present_now, the valid
rectangle of the presented texture, when its width / height changes) through
front_picture_shape (front.h). DmLayout.h takes the shape as a parameter; front_ios.m
lays the view out in it (overlay, split, Fill, the TV) and front_mac.m maps the mouse
on it. A 16:9 game reports 16:9 and keeps its layout.

Checked: the Duo harness on an iPhone 18 Pro simulator, 36 tests (1 skipped), two new
(a taller picture in Fit, Fill and on a wider screen; the production root following a
reported shape and back); the host build and host tests (Animal Crossing's profile),
t_present_crop and t_present_rescue, the docs and settings tests, lint-c (no new
findings). Not run on a device or in a windowed game.
@seedds

seedds commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Landed on main, with #969 under it, as these commits. Your three commits keep you as their author:

The last commit is a fix on top. On the current main, the iOS game view was always the largest 16:9 rectangle (DmLayout.h dm_aspect_fit / dm_aspect_fill, since the Duo layouts in e2fadf2). The present then fitted the 1920x1344 frame inside that 16:9 drawable, so in Fit an iPhone Duo showed the taller picture smaller than the 16:9 one, with bars on all four sides; only Fill filled the screen. The Mac also mapped the mouse on a 16:9 rectangle. Now present_now reports the presented frame's shape through front_picture_shape (front.h), and the iOS layout and the Mac mouse mapping use it. The Duo harness has two new tests for this. It has not been run on a device: a test on a Duo with this main would be welcome.

Left open, for a follow-up:

  • loader.c writes values tuned for Breath of the Wild for every game: the HUD distances 280 and 100, the full-screen pane size 1270x710 and tallest pane 1300, and the HUD camera's 16:9 / near 1 / far 10000. Animal Crossing ignores them. They belong in each profile, with the host writing only the output height, layout height, ratio, k and the site mask.
  • Animal Crossing's FRAME_STEP only gives it the state page, but with a state page the host treats a main as having frame-step stubs (hle_nvn.c fps_present_cap). A hand-set DM_FPS_TARGET=60 would make the host choose steps the game never follows. The launcher hides that setting for this game, so it is latent.
  • Nothing checks that DUO_ANCHOR matches duo_anchor.c.
  • The open items in the game note: the NPC dialog box stays at its 16:9 place, and the NookPhone backdrop has a hard edge at its top left.

Thanks for the work!

@seedds seedds closed this Nov 3, 2026
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…EN_ASPECT) (seedds#1091)

On a screen taller than 16:9, such as the iPhone Duo's 1.43:1, the game
is shown as a 16:9 picture with bars or stretched. With
DM_SCREEN_ASPECT=1.43 (the host side of Breath of the Wild's screen
shape: a 1920x1344 output, a 1280x896 layout space) the stubs of this
profile's new patches.py (3.0.3 main) make the game render that shape,
one bit of DM_SCREEN_ASPECT_SITES each:

- Sizes: the platform config's display and layout sizes (the graphics
  create arg, its static display size and 1280x720, another arg's
  1920x1080), the per-frame resolution table entry (without it the
  1920x1344 window was cropped back to its top 1920x1080) and the
  layouts' DrawInfo framebuffer size take the screen's height.
- The view: the island camera's vertical angle (+0x2cc, read twice) and
  the other camera path's half angle are widened to 2 atan(tan(fovy/2) k),
  k = (16/9) / ratio, so 16:9's sides stay in view with more above and
  below (the aspect already follows the viewport, so the picture had
  lost a fifth of each side).
- Layouts: nn::ui2d::DrawInfo::SetProjectionMtx's 16:9 perspective
  projection has its y row divided by the vertical stretch, so layouts
  keep their shape, centred (only a 16:9 one: the game copies a
  DrawInfo's projection into another, and the title came out divided
  twice). duo_anchor.c, run after Pane::Calculate's global matrix,
  stretches full-screen and full-height background leaves and moves the
  edge widgets out with the taller edges; the game's panes have no RTTI,
  so what draws is told by the vtable's DrawSelf.

Checked on an M1 Mac (macOS 27.0.1), the game built on this base with
the NSP script (--allow-other-metal), headless with an island save, at 1.43 against the same route at 16:9:
the title (logo, version, press-A and settings lines at the new edges),
the island (16:9's sides with more above and below; the ZL icon, clock
and minimap at the new edges), the pocket and the NookPhone in their own
shape. No [RED] line. The host tests pass with this profile; the words
of duo_anchor.c rebuild to DUO_ANCHOR exactly. Open: an NPC's dialog box
stays at its 16:9 place, and the phone's blurred backdrop has a hard edge
at its top left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
….43:1 picture under DM_SCREEN_ASPECT fills a 1.43:1 screen instead of being fitted into a 16:9 view (from seedds#1091)

The iOS front end sized the game's view to the largest 16:9 rectangle (DmLayout.h
dm_aspect_fit / dm_aspect_fill) and the present then fitted the 1920x1344 frame of
Breath of the Wild's or Animal Crossing's screen shape into that 16:9 drawable, so in
Fit an iPhone Duo showed it smaller than the 16:9 picture, with bars on all four sides;
the Mac mapped the mouse on a 16:9 rectangle of the window too.

The present reports the shape of the frame it draws (nvn_mtl.m present_now, the valid
rectangle of the presented texture, when its width / height changes) through
front_picture_shape (front.h). DmLayout.h takes the shape as a parameter; front_ios.m
lays the view out in it (overlay, split, Fill, the TV) and front_mac.m maps the mouse
on it. A 16:9 game reports 16:9 and keeps its layout.

Checked: the Duo harness on an iPhone 18 Pro simulator, 36 tests (1 skipped), two new
(a taller picture in Fit, Fill and on a wider screen; the production root following a
reported shape and back); the host build and host tests (Animal Crossing's profile),
t_present_crop and t_present_rescue, the docs and settings tests, lint-c (no new
findings). Not run on a device or in a windowed game.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 01006F8002326000 Animal Crossing: New Horizons game: 01007EF00011E000 The Legend of Zelda: Breath of the Wild host The Horizon host: SVCs, services, threads, memory (dm/host) rewriter The NSO rewriter and per-build patches tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants