Repository navigation
Conversation
… 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>
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 newSCREEN_WIDEcapability. 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 with0every stub runs the game's original instruction.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.loader.creadsDM_SCREEN_WIDE(<width>x<height>,auto,0), writes the state page, tellsmtl_present_screenthe picture's shape and leaves the variable holding what it decided;front_mac.manswersautowith the main screen's size and opens a window of the picture's shape. Handheld mode keeps 16:9 (see Open).settings.tsv, shown forfixups:SCREEN_WIDE;autoon the Mac,0on 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 ab'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)
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
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).0400486024DEC000v131072.mainthis was written on), headless atDM_SCREEN_WIDE=3440x1440from 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.auto:the main screen is 3440x1440, a 1720x720 window. With the variable unset (headless) or0: 2560x1440 as before.patch_nso.pyfinds all five functions and writes amainbyte-identical to the one played; the host builds and at its start logs the wide screen for3440x1440, nothing for0or unset without a window, the red line for1920x1080, and the handheld line forDM_OPMODE=0.lint_c.py(no clang-tidy on this Mac);make -C dm/gfx/tests; iOS. Noregress.pyreport: the stubs are one game's, and the loader acts only on a build that declaresSCREEN_WIDE.Docs
docs/reference/<subsystem>.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index)dmsh_chain.py --headerwas run anddm/gfx/nvn/dmsh_chain.his part of the change (not applicable: no chain tool changed)Also updated:
docs/settings.md(Wide screen),docs/env_switches.tsv,docs/agents/game-patches.md(regenerated).🤖 Generated with Claude Code