Skip to content

games/0400486024DEC000: Ocarina of Time fills a Mac screen wider than 16:9 (Wide screen, DM_SCREEN_WIDE) - #2538

Open
Farflan wants to merge 1 commit into
seedds:mainfrom
Farflan:oot-screen-wide
Open

Farflan wants to merge 1 commit into
seedds:mainfrom
Farflan:oot-screen-wide

Conversation

@Farflan

@Farflan Farflan commented Nov 13, 2026

Copy link
Copy Markdown

What and why

On a 21:9 monitor (3440x1440) Ocarina of Time showed its 16:9 picture with bars at the sides. The game sizes its swap chain and frame buffers from fixed constants (2560x1440 docked, 1920x1080 handheld), and three of its scene cameras copy a 16/9 aspect of their own into the view's projection. Everything else the engine lays out from the size of its frame buffer.

This adds a launcher setting, Wide screen (DM_SCREEN_WIDE), for builds whose stubs declare a new SCREEN_WIDE capability. On the Mac it is Match screen by default: the picture takes the main screen's shape when that is wider than 16:9 (up to 32:9), with the same view up and down, more of the scene at the sides and the HUD at the screen's edges. Nothing is decided at build time, so one build serves any screen, and with 0 every stub runs the game's original instruction.

  • The game (patches.py, screen_wide): stubs in five functions found by fingerprint under the frame step rule, all or none. Three size sites (nnMain's create arg, the framework constructor's docked and handheld sizes) give the width of the screen's ratio at the site's own height, from the ratio in the state page (+0xa0, 16.16). Three camera updates replace an aspect within 0x100 ulps of 16/9 with the ratio (+0xa4, a float), so a camera with a shape of its own keeps it.
  • The host: loader.c reads DM_SCREEN_WIDE (<width>x<height>, auto, 0), writes the state page, tells mtl_present_screen the picture's shape and leaves the variable holding what it decided; front_mac.m answers auto with the main screen's size and opens a window of the picture's shape. Handheld mode keeps 16:9 (see Open).
  • The launcher: one row in settings.tsv, shown for fixups:SCREEN_WIDE; auto on the Mac, 0 on iOS, where no front end answers.
  • docs_patches.py: its dry run placed a rule's other functions 16 MB apart, which put this rule's seventh beyond a b's reach of the patch area; they are 8 MB apart now.

Relation to #1460

#1460 (vladbondarenko97) found the same three size sites first and cuts them at build time for one size, together with the output width as a float (main+0xecbc80) and the output resolution table (main+0x3f58540), and no camera. I tried those two on top of these stubs: neither the play HUD nor the menus changed. With them and without the camera stubs, play in Goron City showed the 16:9 view stretched over the wide picture, so the camera stubs are what this adds besides the launch-time setting. Both runs are in the game note. If you take this in, #1460's author deserves the credit for the size sites.

Open (in the game note)

  • The UI's 2D pictures are stretched over the wider picture, 1.34 times at 3440x1440: the pause menu's art and slots, the load menu's panels, the minimap. Text, glyphs and 3D-rendered items keep their shape. The UI is drawn with an orthographic projection of 2/1280 by 2/720 whose source I did not find; the note lists the places ruled out.
  • Handheld mode (DM_OPMODE=0) does not follow: the game crops its handheld picture to 1920x1080 from somewhere the stubs do not reach, so the loader keeps 16:9 there.

Checked

  • Tests, on 8d44aaf: make -C dm/host/tests GAME=0400486024DEC000 run (all passed); python -m unittest discover -s dm/tools/tests (1,556 tests OK, 28 skipped); docs_patches.py, env_switches.py, docs_symptoms.py (no further change); lint_python.py (0 new findings).
  • Games run: Ocarina of Time 0400486024DEC000 v131072.
    • In the game, on 1ee0252 (the main this was written on), headless at DM_SCREEN_WIDE=3440x1440 from a Goron City save: the title, the load menu, play, the pause menu and the map as 3440x1440 screenshots; 3D targets 2580x1080 (1920x1080 at 16:9); Link, the Goron and the pot at their 16:9 proportions with more of the scene at the sides; hearts, item slots and minimap at the screen's edges; the same one red line as at 16:9 (stage 5 cb3 has no uniform buffer bound); GPU 11-12 ms a frame.
    • In a window with auto: the main screen is 3440x1440, a 1720x720 window. With the variable unset (headless) or 0: 2560x1440 as before.
    • On 8d44aaf, after the rebase: patch_nso.py finds all five functions and writes a main byte-identical to the one played; the host builds and at its start logs the wide screen for 3440x1440, nothing for 0 or unset without a window, the red line for 1920x1080, and the handheld line for DM_OPMODE=0.
  • Devices and OS: M5 Pro MacBook Pro (48 GB), macOS 27.2, Xcode 27.2, a 3440x1440 monitor.
  • Not run: the game itself on 8d44aaf (the shader chain changed since 1ee0252 and I did not rebuild the library); cutscenes and movies; a 32:9 screen; the frame rate against 16:9 on a bench route; lint_c.py (no clang-tidy on this Mac); make -C dm/gfx/tests; iOS. No regress.py report: the stubs are one game's, and the loader acts only on a build that declares SCREEN_WIDE.

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)
  • A chain tool changed: dmsh_chain.py --header was run and dm/gfx/nvn/dmsh_chain.h is part of the change (not applicable: no chain tool changed)
  • No game files, keys or data extracted from a game in the change or the attachments

Also updated: docs/settings.md (Wide screen), docs/env_switches.tsv, docs/agents/game-patches.md (regenerated).

🤖 Generated with Claude Code

… 16:9 (Wide screen, DM_SCREEN_WIDE)

On a 21:9 monitor (3440x1440) the game showed its 16:9 picture with bars at the sides. It sizes its swap chain and its frame buffers from fixed constants (2560x1440 docked, 1920x1080 handheld), and three of its scene cameras copy a 16/9 aspect of their own into the view's projection. The engine lays everything else out from the size of its frame buffer: given a wider one it makes its 3D targets and its composite that wide and keeps the HUD at the screen's edges, with no further change.

The game's patches.py gets screen_wide, stubs in five functions found by fingerprint under the frame step rule (others), all or none: nnMain's create arg (the swap chain's size), the framework constructor's docked and handheld frame buffer sizes, and the three camera updates (ldr s0,[x19,#0x140] before the store of the sead::PerspectiveProjection's aspect at +0xb0). A size stub gives the width of the screen's ratio at the site's own height, (height x ratio + 0x8000) >> 16, from the ratio in 16.16 fixed point at state +0xa0; a camera stub replaces an aspect within 0x100 ulps of 16/9 with the ratio as a float at state +0xa4, so a camera with a shape of its own keeps it. With 0 there every stub runs the original instruction. The stubs declare the SCREEN_WIDE capability, which the fixups table carries to the host (module_t screen_wide) and to the launcher.

The loader (dm_fps_state_apply) reads DM_SCREEN_WIDE: <width>x<height> of a screen wider than 16:9, up to 32:9; auto, the main screen's size when it is wider than 16:9, asked of the front end through dm_front_screen, which front_mac.m sets; 0 for 16:9. A build with the stubs takes auto by default, so a build without them is never asked. It writes the ratio into the state page, gives the picture's shape to mtl_present_screen, and leaves the variable holding what it decided, by which the Mac front end opens a window of that shape. Handheld mode keeps 16:9: the game crops its handheld picture to 1920x1080 from somewhere the stubs do not reach. The launcher row Wide screen (settings.tsv, shown for fixups:SCREEN_WIDE) is Match screen by default on the Mac and 16:9 on iOS, where no front end answers.

docs_patches.py placed a rule's other functions 16 MB apart in its dry run, which put the seventh beyond a b's reach of the patch area; they are 8 MB apart now (OTHER_STEP), room for twelve.

The same three size sites are in PR seedds#1460 (vladbondarenko97), as cuts made at build time for one size, with the output width as a float (main+0xecbc80) and the output resolution table (main+0x3f58540) and no camera. Tried here on top of the stubs, those two changed neither the play HUD nor the menus; with them and without the camera stubs, play in Goron City showed the 16:9 view stretched over the wide picture, so the cameras are needed.

Checked on an M5 Pro MacBook Pro (48 GB, macOS 27.2, Xcode 27.2) with Ocarina of Time v131072. In the game, on 1ee0252 (the main this was written on), headless at DM_SCREEN_WIDE=3440x1440 from a Goron City save: the title, the load menu, play, the pause menu and the map as 3440x1440 screenshots, 3D targets 2580x1080, Link, the Goron and the pot at their 16:9 proportions with more of the scene at the sides, the hearts, item slots and minimap at the screen's edges, the same one red line as at 16:9 (stage 5 cb3 has no uniform buffer bound), GPU 11-12 ms a frame; in a window with auto: "the main screen is 3440x1440", a 1720x720 window; with the variable unset or 0, 2560x1440 as before. On 8d44aaf, after the rebase: patch_nso.py finds all five functions and writes a main byte-identical to the one played; the host builds and at its start logs the wide screen for 3440x1440, nothing for 0 or unset without a window, the red line for 1920x1080 and the handheld line for DM_OPMODE=0; make -C dm/host/tests run (all passed), the tool tests (1,556, with test_docs, test_env_switches, test_patches and test_launcher_settings), docs_patches.py, env_switches.py, lint_python.py (0 new).

Open, in the game note: the UI's 2D pictures (the pause menu's art, the load menu's panels, the minimap) are stretched over the wider picture, 1.34 times at 3440x1440, while text and 3D-rendered items keep their shape; the UI's 1280-wide orthographic projection was not found (the note lists what was ruled out). Handheld mode. Not run: the game on 8d44aaf (the shader chain changed since 1ee0252 and its library was not rebuilt here), cutscenes and movies, a 32:9 screen, the frame rate against 16:9 on a bench route, lint_c.py (no clang-tidy here), make -C dm/gfx/tests, regress.py (the stubs are one game's and the loader acts only on a build that declares SCREEN_WIDE), iOS.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) 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 13, 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 host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m) 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