Skip to content

game: Ocarina of Time's camera takes the full screen's aspect - #2978

Open
oxyp1e wants to merge 1 commit into
seedds:mainfrom
oxyp1e:pr/oot-auto-aspect
Open

oxyp1e wants to merge 1 commit into
seedds:mainfrom
oxyp1e:pr/oot-auto-aspect

Conversation

@oxyp1e

@oxyp1e oxyp1e commented Nov 18, 2026

Copy link
Copy Markdown

What and why

Ocarina of Time renders a 16:9 canvas, so Mac full screen on a MacBook (3024x1898 below the notch, 1.593) shows it with black bars above and below. This adds an Auto aspect, as Tears of the Kingdom has: the game's camera takes the full screen's shape live and the present stretches the 16:9 canvas to it, so the picture fills the screen and circles stay round.

  • Game side (dm/games/0400486024DEC000/patches.py): the camera's aspect is its DefaultAspect parameter, which the camera's apply, init and reset hand to the projection with ldr s0,[x19,#0x140]. A stub at each of the three loads takes the f32 at state +0x2a0 instead when that word is not 0 (Hor-). The three functions are found by fingerprint as more others of the frame step rule; the stubs go in only when all three match, and the rewriter then declares ASPECT_LIVE. x16 is free at each site. Profile: aspect_live on.
  • Host side: dm_aspect_live_set (hle_nvn.c) stores the ratio with one atomic 32-bit store and sets a present shape the host owns (mtl_present_stretch, checked first in present_shape, so vi::CreateLayer can't replace it). The mouse map and presented-frame shots follow it. It does nothing unless the profile has aspect_live, main has the stubs and there is a state page, so every other game's present is unchanged.
  • Mac Auto (front_mac.m): in full screen, the drawable's own width / height, pushed on entering full screen and on drawable size changes, and 16:9 from the start of leaving it. A window, and a screen within 1 % of 16:9, keep 16:9.

Game note: Auto aspect. Reference entry updated: "A crop only picks texels" in docs/reference/rendering.md.

Settings

DM_ASPECT (launcher: Game › Aspect ratio, shown only for builds whose main has ASPECT_LIVE):

  • auto (the Mac's default): the screen's shape in full screen, 16:9 in a window or on a 16:9 screen. Not offered on iOS, which keeps 16:9.
  • 0: always 16:9 (the iOS default).
  • 1.6 or 16:10 (any ratio from 1 to 4, or w:h): that shape from the start, in a window too.
  • Anything else: a [RED] [aspect] line, and 16:9.
Not done yet
  • The HUD is stretched with the picture (about 11-12 % taller at 1.593) until a per-draw HUD squeeze, which needs OoT's UI shader keys from a capture.
  • The scripted projections (main+0x3b50b44, 0x28e72a0, 0x293d80c, cutscenes) and the layer's default projection (main+0xea5074) are not patched; the game note lists them.
  • iOS pushes nothing (Auto = 16:9 there).

Checked

  • Tests, on this branch (GAME=0400486024DEC000, Xcode 27.2):
    • make -C dm/gfx/tests check_t_present_crop: 4/4 runs, 197 checks, 0 failed. New checks: a 16:9 texture fills a 16:10 canvas with no black pixel on the classic and Metal 4 presents; a sized layer does not replace the shape; the shot (1920x1200 at 1.6) and the reported shape follow; 0 gives back both canvases byte for byte; the gates; DM_ASPECT parsing on 22 values.
    • test_patches (the three stubs by disassembly, and nothing written when one function is missing), test_docs, test_settings, test_launcher_settings, test_game_profile: OK. The whole dm/tools/tests: 1760 tests, the only failures are test_shader_toolchain_cache (NameError: dmsh_rewrite, fails the same on main) and a timing test in test_triage_report that passes when run alone.
    • make -C dm/host/tests run (including symbols and nro, which stub dm_aspect_start): OK. make -C dm/host dmhost: links, no new warnings. env_switches.py --check: OK. docs_patches.py regenerated docs/agents/game-patches.md.
    • Not run: lint_c.py tidy (only LLVM 22 here, CI pins 23); lint_python.py (ruff and pyright not installed).
  • Games run: Ocarina of Time 0400486024DEC000 v131072, played by me on the Mac:
    • native full screen on the built-in screen: a 3024x1898 drawable, [aspect] auto: 1.593, the picture fills it with no bars;
    • full screen on a 16:9 Studio Display: stays 16:9, no push;
    • entering and leaving full screen several times: switches live, no restart.
    • Not checked: cutscene projections, first person on its own, the HUD squeeze.
  • Devices and OS: Apple M5 MacBook Pro, macOS 27, and a Studio Display. Not run on iOS, other Macs or M1/M2.
  • regress.py: not run. Every other game is unaffected by construction: the stretch is set only by dm_aspect_live_set, which returns at once without aspect_live and ASPECT_LIVE, and t_present_crop shows presents at 0 are byte-identical to before. No shader chain change (dmsh_chain.h and the lock untouched).

Docs

  • The finding is in its game note or its docs/reference/<subsystem>.md entry, and python3 dm/tools/docs_symptoms.py was run (the symptom index)
  • No game files, keys or data extracted from a game in the change or the attachments

Also: docs/settings.md (Aspect ratio), docs/env_switches.tsv (DM_ASPECT), docs/agents/game-patches.md (regenerated).

🤖 Generated with Claude Code

Ocarina of Time renders a 16:9 canvas, so Mac full screen on a MacBook
(3024x1898 below the notch, 1.593) showed it with black bars at the top
and bottom. The camera's aspect is its DefaultAspect parameter, which the
camera's apply, init and reset hand from the camera's +0x140 to the
projection's +0xb0 with ldr s0,[x19,#0x140]. A stub at each of the three
loads runs the load and then takes the f32 at state +0x2a0 in its place
when that word is not 0 (Hor-, as Tears of the Kingdom's Auto). The three
functions are more others of the frame step rule, by fingerprint; the
stubs go in only when all three match, and the rewriter then declares
ASPECT_LIVE. x16 is free at each site (on every path from the load to the
next call or return it is written before it is read, or not used). The
persistent copies (+0xc8, +0x140) are left alone, so a 0 word gives 16:9
again on the next apply. Profile: aspect_live on.

On the host, dm_aspect_live_set (hle_nvn.c) writes the ratio into state
+0x2a0 with one atomic 32-bit store and sets a present shape the host owns
(mtl_present_stretch): the 16:9 canvas is drawn stretched into that ratio,
so it fills a full screen of that shape. present_shape checks it before
the screen and layer shapes, so vi::CreateLayer cannot replace it, and 0
leaves the present as it was. The shape reported to the front ends (mouse
map) and the presented-frame screenshots follow it. It acts only when the
profile has aspect_live (DM_GAME_ASPECT_LIVE), main's fixups table has
ASPECT_LIVE (loader.c dm_aspect_stubs) and there is a state page;
otherwise a stretch alone would distort the picture. Every other game's
present is unchanged.

DM_ASPECT: auto (the Mac's default) = in full screen the drawable's own
shape, pushed from front_mac.m on entering full screen and on drawable
size changes, and 16:9 from the start of leaving it; a window and a screen
within 1 % of 16:9 keep 16:9; 0 = 16:9; a ratio (1.6) or w:h (16:10) from
the start. Malformed: a [RED] line and 16:9. Launcher row "Aspect ratio"
for builds with ASPECT_LIVE (Auto on the Mac only). Until the HUD is
squeezed back per draw it is stretched with the picture (about 11 %
taller at 1.593).

Checked: t_present_crop (a 16:9 texture fills a 16:10 canvas with no black
pixel on both encoders, a sized layer does not replace the shape, the shot
and the reported shape follow, 0 gives back both canvases byte for byte,
the gates and DM_ASPECT's parsing); test_patches (the three stubs by
disassembly). Played on an M5 MacBook Pro, macOS 27: native full screen on
the built-in screen fills 3024x1898 at 1.593, a 16:9 Studio Display stays
16:9, and entering and leaving full screen switches live. Not checked: the
scripted (cutscene) projections, iOS, other Macs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) rewriter The NSO rewriter and per-build patches mac The Mac front end and app (dm/mac, front_mac.m) tools Tools and scripts (dm/tools, scripts) docs Documentation game: 0400486024DEC000 A game labels Nov 18, 2026
oxyp1e added a commit to oxyp1e/nxnative that referenced this pull request Nov 18, 2026
Native full screen keeps a notched MacBook's picture below the menu bar
(3024x1898 on a 14" MacBook Pro), and the strips beside the camera housing
stay black. With DM_FULLSCREEN=2, full screen on a screen with a top
safe-area inset is instead a borderless window over the screen's whole
frame (3024x1964): the custom full screen Apple documents with
NSScreen.safeAreaInsets and auxiliaryTopLeftArea, built as SDL3 and GLFW
build theirs. DmGameWindow is key and main while borderless, and its
constrainFrameRect:toScreen: leaves the frame alone while the panel is up;
level NSMainMenuWindowLevel+1, HideDock|HideMenuBar (0xa, so no menu bar on
hover). A screen without a notch gets native full screen, exactly as
DM_FULLSCREEN=1. The present fits the game's 16:9 picture into the panel
as into any drawable, with bars at the sides; a game that takes the
screen's shape fills it.

DmGameWindow's toggleFullScreen: picks the panel or native full screen, so
⌃⌘F, the green button, the startup request and the GPU-lost path all
follow the setting. win_full() replaces the full-screen style checks
(screen_match_apply, so the 120 Hz screen match still applies; startup).
Screen changes refit the panel, or leave it when its screen has no notch
(a Studio Display in clamshell). While another app is active the window
drops to its own level and the presentation options are cleared;
activation puts both back. While a modal box is up (the software
keyboard, the user choice, a Cheats question) the panel takes the
window's own level, so the box shows above it; the Cheats panel is raised
above the game window. One [notch] line on entering and on leaving.

pack_app.py writes NSPrefersDisplaySafeAreaCompatibilityMode false, so
macOS never letterboxes the screen below the camera housing instead.
Launcher: Display mode gets "Fullscreen around the notch". Docs:
env_switches.tsv, settings.md, development.md.

Checked: the OoT host builds with no new warnings; test_launcher_settings
and test_nsp_mac_app cover the new option and the Info.plist key. Played
on an M5 MacBook Pro, macOS 27: a prototype of this window, and Ocarina of
Time on a branch with PR seedds#2978's Auto aspect, filled 3024x1964 at about
120 fps, with no menu bar on hover. This branch alone (16:9 with side bars)
was not run. Not checked:
other Macs, the M1 and M2, Game Mode (off in nxnative apps anyway).

Front-ends: new: DM_FULLSCREEN=2 needs NSPrefersDisplaySafeAreaCompatibilityMode false in the app's Info.plist (pack_app.py writes it); an app packed another way needs the key too.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@oxyp1e

oxyp1e commented Nov 18, 2026

Copy link
Copy Markdown
Author

Related: #2979 (Fullscreen around the notch, independent and off main). With both, the camera takes the panel's 1.54 (3024x1964); if both land, panel_enter/panel_leave need the two Auto-aspect calls the native DidEnter/WillExit observers make. I can rebase whichever goes in second.

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

Labels

docs Documentation game: 0400486024DEC000 A game host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) 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.

1 participant