Skip to content

games/0400486024DEC000: screen shape (DM_SCREEN_ASPECT) renders taller aspects without stretched HUD or transition gaps - #2651

Open
PiinoStudio wants to merge 3 commits into
seedds:mainfrom
PiinoStudio:oot-screen-aspect
Open

PiinoStudio wants to merge 3 commits into
seedds:mainfrom
PiinoStudio:oot-screen-aspect

Conversation

@PiinoStudio

Copy link
Copy Markdown

With screen_aspect on and DM_SCREEN_ASPECT set (e.g. 1.6 for 16:10 MacBook displays or 1.333 for 4:3 iPad displays; launcher setting Picture shape), places fifteen fingerprint-matched stubs under MATCH_FRAME_STEP (others, inactive when state +0x48 is 0):

  • Eleven height sites across graphics init, scene app init, base scene defaults, display mgr defaults, base res read, and display target a/b/c.
  • 3D perspective projection (sead::PerspectiveProjection::doUpdateMatrixImpl_ at 0x3485cc0), scaling fovyTan by k = (16/9) / ratio for Vert+ framing (preserving horizontal 16:9 framing with extra vertical scene view).
  • Layout2 ortho projection builders (layout ortho at main+0x1520c80 and layout view ortho at main+0x773b90), scaling canvas height so 2D HUD elements (hearts, buttons, minimap) keep a 1:1 pixel aspect ratio in the safe area.
  • Layout2 CalculateMtx (layout calc matrix at main+0x14e9980), scaling full-screen PicturePane elements (width >= 1000, height >= 700, |width*9 - height*16| < 200) so scene faders and door/warp transitions (such as P_Black_00 and P_White_00 in EventFade_00) cover the expanded canvas without un-faded bands at top and bottom.

Verification

Verified in active gameplay on macOS (v131072, Kokiri Forest and Goron City):

  • 16:9 (0, 2560x1440), 16:10 (1.6, 2560x1600), and 4:3 (1.333, 2560x1920) all keep heart1 at 68x33 (h/w = 0.485, shifted vertically by half the extra height) with unstretched HUD widgets and Vert+ 3D framing.
  • Door and scene transition wipes verified in gameplay with zero background bleed (top_non_black = 0, bot_non_black = 0).
  • Documentation check (python3 dm/tools/docs_patches.py --check) and test suite pass cleanly.

@github-actions github-actions Bot added rewriter The NSO rewriter and per-build patches tools Tools and scripts (dm/tools, scripts) docs Documentation game: 0400486024DEC000 A game labels Nov 14, 2026
@UserDerezzed

Copy link
Copy Markdown
Contributor

This is an Ocarina of Time fix, writing this here so that agents can properly search for it as opposed to using the game ID

…r aspects without stretched HUD or transition gaps

With screen_aspect on and DM_SCREEN_ASPECT set (e.g. 1.6 for 16:10 MacBook
or 1.333 for 4:3 iPad), places seventeen fingerprint-matched stubs under
MATCH_FRAME_STEP:

- Eleven height sites across graphics init, scene app init, base scene
  defaults, display mgr defaults, base res read, and display targets.
- 3D perspective projection (sead::PerspectiveProjection::doUpdateMatrixImpl_)
  and inlined devirtualized projection matrix updates in camera update
  (main+0x33b82c) and device proj (main+0x23b9a8) scaling aspect and Vert+
  fovyTan so gameplay and 3D subscreen/item models maintain 1:1 circular
  proportions without distortion on any screen ratio.
- Layout2 ortho projection builders (main+0x1520c80 and main+0x773b90)
  scaling canvas height so HUD widgets keep 1:1 pixel aspect ratio.
- Layout2 CalculateMtx (main+0x14e9980) scaling full-screen PicturePanes
  so scene transitions and faders cover the expanded canvas without gaps.

Verified in gameplay on macOS across 16:9, 16:10, and 4:3.
@padsiwono

Copy link
Copy Markdown
Contributor

Thanks for this. I've been doing the same for Ocarina of Time on a fork (a 1.54 laptop screen) and asked about the scope in #2588, so a few notes from that work, in case they're useful:

  • Camera: I went in one step earlier than the projection. The camera is copied into the projection in three places (fovy from the camera's +0x13c, aspect from +0x140: main+0x4c52f8 / +0x4c5334, +0x2e1bb30 / +0x2e1bb64, +0x2e1c794 / +0x2e1c7c8). Stubbing those six loads gives Vert+ on taller screens and Hor+ on wider ones from the same code (a 1.54 and a 2.39 picture, one run each). That may matter for The Legend of Zelda: Ocarina of Time renders native ultrawide (21:9) with DM_ULTRAWIDE #1460, where Ayymeric found the projection's own aspect has no effect at 21:9.
  • Menus: what worked best for us on a taller screen was to keep the menu bars at the picture's top and bottom edges and scale the content as far as it goes without cropping anything, with the dimmed game scene as the backdrop over the whole picture instead of black bars.
  • Cost: none measurable from the layout itself. Between our two taller output sizes the GPU difference was within the run-to-run spread (n=3 each).

Our version touches the same fades and HUD paths, so the two would collide if both went in. I'd rather test yours on the 1.54 screen than offer a second one. Is there anything specific you'd like checked?

@PiinoStudio

Copy link
Copy Markdown
Author

@padsiwono Thanks for the detailed notes and for offering to test on your 1.54 screen!

I just pushed two updates to this PR:

  1. 6ff3c4a3: Letterboxes the intro movie shader (8f9728d9b2b88600) on taller aspects so FMVs keep 16:9 instead of stretching vertically.
  2. 1b94bc59: Adds edge-anchoring for HUD widgets and menu header/footer bars plus vertical scaling for fullscreen backdrops/faders in CalculateMtx (duo_anchor.c). On 16:10 (2560x1600), the pause/load menus now fill the full height with the blurred scene backdrop and edge-aligned bars, while keeping centered dialogs/buttons and 3D item previews undistorted.

If you get a chance to test on your 1.54 laptop screen, it would be great to check:

  • Title screen, Load menu, Pause/Inventory menu, and in-game HUD alignment (especially checking that no centered buttons/dialogs shift or clip).
  • Movie playback (intro) and level transitions.

Your note about stubbing the earlier camera loads for unified Vert+/Hor+ (including 21:9) also sounds very clean—happy to look into folding that in or keeping it in mind if maintainers want ultrawide covered in the same PR.

@github-actions github-actions Bot added the nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) label Nov 16, 2026
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 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.

3 participants