Skip to content

Ocarina of Time v131072: Output Native draws the full output size instead of the game's 80 % frame (DM_OUTPUT) - #2020

Closed
padsiwono wants to merge 1 commit into
seedds:mainfrom
padsiwono:oot-native-output
Closed

padsiwono wants to merge 1 commit into
seedds:mainfrom
padsiwono:oot-native-output

Conversation

@padsiwono

@padsiwono padsiwono commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Ocarina of Time draws its picture into 80 % of the output and the system scales it up: at the docked 2560x1440 the window crop (nvnWindowSetCrop) is 2048x1152, which is why main's full resolution is 1536x864 (the top level, ×0.75 of the crop). The 80 % is in code, not in ModelSceneExtensionParam: the crop function in v131072's main (around main+0x6505b4) multiplies the base size ([entry+0x64]) by a float pair per mode and level, 0.8 here, read from [obj+0xf0 + mode×0x208 + level×0x60 + (signed byte [obj+0x54a])×8 + 0x1e4 / +0x1e8]. Each side is clamped to a size from main+0x112c5e0 and stored through the setter at main+0x1087f40; main+0x650538 reads it back for nvnWindowSetCrop (called from main+0x11e7b74). I found the writer by watching the crop object's size field: one store, 3024x1702 → 2419x1361, pc main+0x1087f64, lr main+0x650604.

A new launcher setting, Output (DM_OUTPUT): Game (the default) keeps the 80 % frame; Native skips the two multiplies (main+0x6505c4, +0x6505d4), so the crop, the 3D and its depth are the full output size and nothing is scaled. The stubs read state +0x44 (the loader writes 1 for DM_OUTPUT=native), keep the original multiply otherwise, and declare the NATIVE_OUTPUT capability. x16 is free at both sites: a call (bl main+0x112c5e0) follows within three instructions and nothing between reads it. Placed by address, only when the matched frame-step function sits at v131072's place.

Discussed in #1789 (the resolution levels, and the crop: #1789 (reply in thread)). Independent of #1848 / #1849 / #2021; with #2021 the crop follows the chosen size.

Game note: Native output. Also docs/settings.md (Output), docs/env_switches.tsv, the state page in patch_nso.py's comment, docs/agents/game-patches.md (regenerated), the BINDING entry.

Checked

  • Rewriter: patch_nso.py on v131072's main with this branch: both stubs placed (main.cuts.tsv), # NATIVE_OUTPUT 1 in main.fixups.tsv; disassembled: adrp x16, state; ldr w16, [x16, #0x44]; cbnz w16, skip; fmul s0, s2, s0; b back (and fmul s0, s1, s0 for the height).

  • Tests: test_patches, test_docs, test_settings, test_launcher_settings, test_env_switches, test_game_profile pass; make -C dm/host/tests GAME=0400486024DEC000 run passes (50 suites, 0 failed).

  • Games run, with title ID and version: Ocarina of Time (0400486024DEC000) v131072, on our own build (main 270b6fd5 plus Ocarina of Time changes, including our output size and the 3D levels at ×1.0 from a data overlay, neither on main), Castle Town market save, Link standing, output 3024x1702, headless, n=1 each. With these stubs: Game logs WindowCrop 0,0 2419x1361 and [res] scene 2419x1361 (100.0 % of the crop), depth target 2419x1361; Native logs main: output native (DM_OUTPUT), WindowCrop 0,0 3024x1702 and scene 3024x1702 … depth target 3024x1702; no crash. Frames 2401 to 2700 (the scene settled), two pairs of runs, the first with the multiplies as no-ops (the same effect):

    Game, 3D 2419x1361 Native, 3D 3024x1702
    first pair: frame p50 / p95 16.67 / 17.64 ms 19.47 / 21.29 ms
    first pair: GPU p50 / p95 13.36 / 14.20 ms 17.34 / 18.37 ms
    these stubs: frame p50 / p95 16.64 / 17.92 ms 16.54 / 18.53 ms
    these stubs: GPU p50 / p95 13.09 / 13.90 ms 14.37 / 15.41 ms

    So 1.56 times the pixels cost between 1.1 and 1.3 times the GPU here; macOS sets the GPU clock per run, and one window each can't tell it apart. In the first pair the market no longer held 60 at this size. Framing and field of view are the same; the pause menu, speech bubbles and button prompts draw at the full size (screenshots every 50 frames, 2150 to 3300).

  • Devices and OS: M5 Max, macOS 26.6.2.

  • Not checked: a game run on a build of main; the game's own 2560x1440 output and its own levels (native makes the crop 2560x1440, the 3D top 1920x1080); other areas in play; handheld; other builds.

Castle Town market, frame 2600 (A scaled up for the picture):

Ocarina of Time, Castle Town market at frame 2600 with the 80 % frame (left) and Output Native (right): same framing and field of view

The same frames at 1:1, 800x450:

Detail at 1:1: the 80 % frame scaled up (left) is softer than the frame drawn at 3024x1702 (right)

Speech bubbles and the button prompt with Output Native (frame 2900; the two runs are not in step, so the NPCs differ):

Castle Town market at frame 2900: speech bubbles and the A Talk prompt with the 80 % frame (left) and with Output Native at 3024x1702 (right)

Docs

  • The finding is in its game note, and python3 dm/tools/docs_symptoms.py was run
  • No game files, keys or data extracted from a game in the change or the attachments

🤖 Generated with Claude Code

…tead of the game's 80 % frame (DM_OUTPUT)

The game draws its picture into 80 % of the output and the system scales it up. The 80 % is two multiplies in its crop function (main+0x6505c4, +0x6505d4: the base size times a per-mode, per-level 0.8 read from a table in code, not in ModelSceneExtensionParam), found by watching the crop object's size field. Stubs skip them when state +0x44 is set (DM_OUTPUT=native, the launcher's Output), so the crop, the 3D and its depth are the full output size and nothing is scaled. Placed only when the frame-step function sits at v131072's place; x16 is free at both sites (a call follows within three instructions). They declare the NATIVE_OUTPUT capability.

Measured on an M5 Max (macOS 26.6.2), Castle Town market at 3024x1702, headless, two pairs of runs, n=1 each: GPU p50 13.36 -> 17.34 ms and 13.09 -> 14.37 ms for 1.56 times the pixels. Framing, field of view, the pause menu, speech bubbles and button prompts are unchanged.
Fasen24-AI added a commit to Fasen24-AI/swordboiMacNative that referenced this pull request Nov 10, 2026
seedds#1901 seedds#1459 seedds#1928 seedds#1942 seedds#1940 seedds#1952 seedds#1611 seedds#2065 seedds#2083 seedds#2008 seedds#2079 seedds#2022 seedds#2075 seedds#2077 seedds#2020 seedds#2021 onto main 04811a6

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014eD437mxrMnW2UwLZhpwc7

Upstream pull requests applied in this commit (their authors' work, brought onto this tree with a three-way merge; the description is in each PR):
- seedds#1459 by PromethOps (open): DM_UPSCALER=metalfx takes agl's agl_ndsr_vr.pck networks too, and a variant with no curve and no power is drawn as one colour space: Ocarina of Time's upscaler is MetalFX's
- seedds#1611 by Esteban-V (open): An argument block whose only change is a uniform buffer is patched instead of encoded again
- seedds#1774 by uncraftablexd (closed): Compute threads that exit before a barrier keep arriving at it, and every shader loop has a cap (GPU hang defences), chain change
- seedds#1824 by cocoman93 (open): Clamp texel fetches past a sampled 2D texture's edge: no hard edge in Ocarina of Time's mist
- seedds#1901 by FifteenPen (open): The game's compute dispatches with no game barrier between them run side by side (profile key dispatch_overlap, on for Ocarina of Time): Kokiri Forest GPU p50 15.63 → 14.76 ms
- seedds#1928 by FeReuss (open): Ocarina of Time: enc_thread on, the replay encodes on a thread of its own
- seedds#1929 by FeReuss (open): Unused border corrections are compiled out of pipelines that bind no sampler with a twin (function constant DMSH_BORDER_FC)
- seedds#1930 by FeReuss (open): A float add to storage memory with no result read is one native atomic add instead of a compare-and-swap loop
- seedds#1940 by uncraftablexd (open): A prewarm list's lines after its #@after_first_frame line are built after the first frame, in the background, instead of in the prepare step (issue seedds#1747)
- seedds#1942 by uncraftablexd (open): Frame step: late frames with the GPU idle do not step up, and a longer hold the GPU does not explain is probed
- seedds#1952 by AdyaGMD (open): Compute moves ahead of scene passes past occlusion queries and conditional rendering; clears wait across dispatches
- seedds#2008 by bquilty25 (open): nvn: reactive memory watchdog, 16-way view cache, and texture upload batching
- seedds#2020 by padsiwono (open): Ocarina of Time v131072: Output Native draws the full output size instead of the game's 80 % frame (`DM_OUTPUT`)
- seedds#2021 by padsiwono (open): Ocarina of Time v131072 renders at the launcher's Resolution (`DM_RENDER_SIZE`), docked
- seedds#2022 by sleepyeyedjoe (closed): Ocarina of Time: large models no longer go black for one frame twice, 4–5 frames apart, when the game streams new textures into them (a texture ID a shader has read keeps its read mark when it gets another texture)
- seedds#2030 by humanperzeus (open): A NaN colour at alpha 0 is returned as 0, as NVIDIA's blender takes a zero factor: Ocarina of Time's white clouds over the ferns are gone
- seedds#2035 by Know-It-All-Brother (open): The shader build runs as worker processes, and no shader waits for a batch (Ocarina of Time's cold Mac map: 3,002 s to 1,298 s)
- seedds#2065 by Raymon82777 (closed): A vertex library with layer entry points of its own gets bases for its main0 pairs: Ocarina of Time's 230 ms camera-turn hitch in Hyrule Field goes to 39 ms
- seedds#2075 by sleepyeyedjoe (closed): Ocarina of Time: a patch of scenery no longer draws dark for one frame when the game gives it a sharper texture (a pool texture the walk does not make holds a stand-in of its own colours until its first read)
- seedds#2077 by roandegraaf (closed): Ocarina of Time: fix the "plaid" terrain / missing texture tiles (GPU-drawn textures now reach the storage the game copies)
- seedds#2079 by uncraftablexd (open): Render pipelines that share a vertex function are taken from the archive or compiled one at a time: the AGX driver crashes in createVertexProgramVariant's completion block
- seedds#2083 by FifteenPen (closed): Ocarina of Time's prewarm list gets 41 more task / mesh pipelines from later play
Fasen24-AI added a commit to Fasen24-AI/swordboiMacNative that referenced this pull request Nov 10, 2026
…a 23 was built from

Ours kept where main has not taken the change: the pool test of image_texture (virtual pools), need_make with seedds#2075's stand-in,
the copy absorb beside main's gsb_mark, DM_SHARPEN's copy_t2t_draw_x, the render scale (seedds#1903) and fixed resolution stubs beside
seedds#2020's native output and seedds#2021's render size. Main's own taken for the depth rule (fb_depth_rule), the family textures and the
movie network: the opt-in shortcut of PR seedds#1331 (DM_NVN_NDVE_MOVIE_DIRECT) is removed, main runs the network as host kernels.
Generated files (chain header, lock, translator binaries, symptoms, game-patches) are main's here and rebuilt in the next commit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014eD437mxrMnW2UwLZhpwc7

Upstream pull requests applied in this commit (their authors' work, brought onto this tree with a three-way merge; the description is in each PR):
- seedds#1331 by givethesourceplox (closed): Scale decoded NDVE movies on Metal and skip matched reconstruction
- seedds#1903 by FifteenPen (open): Ocarina of Time takes the launcher's Render scale: the 3D views at that fraction of the game's own size, the dynamic resolution held at its top level (Kokiri Forest docked at 0.75: GPU p50 15.77 → 14.31 ms, 60 fps held)
- seedds#2020 by padsiwono (open): Ocarina of Time v131072: Output Native draws the full output size instead of the game's 80 % frame (`DM_OUTPUT`)
- seedds#2021 by padsiwono (open): Ocarina of Time v131072 renders at the launcher's Resolution (`DM_RENDER_SIZE`), docked
- seedds#2075 by sleepyeyedjoe (closed): Ocarina of Time: a patch of scenery no longer draws dark for one frame when the game gives it a sharper texture (a pool texture the walk does not make holds a stand-in of its own colours until its first read)
@padsiwono

Copy link
Copy Markdown
Contributor Author

Closing this: since 084f5aa the host answers graphics scale tier 0, and Ocarina now draws 2560x1440 instead of 2048x1152 on main, which is what this did from inside the game. The two multiplies here are most likely where the game applies that tier's 0.8; I haven't checked the crop table's index against the tier.

@padsiwono padsiwono closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant