Repository navigation
feat(oot): live output resolution up to the game's 2560x1440 swapchain - #1
Merged
Merged
Conversation
Ocarina of Time's output size (layer render targets and the NVN crop) is DisplayConfig's base size, written only by setBaseSize at main+0x1087f40. Two verified veneers redirect it to a host-chosen size: one at setBaseSize's entry, one in the per-frame cfg update at main+0x6502f8 that calls setBaseSize when the request changes, so the engine's own resize path (the one dock/undock uses) re-creates the targets and the 3D scene follows the output every frame. Both original words are checked, as is the padding after the frame-step stub and the loader's parameter page. The Resolution row in the settings panel, the "resolution WxH" input command and TOTK_OUTPUT_RES now work for Ocarina of Time: 16:9, both sides multiples of 8, from 640x360 up to the game's own 2560x1440 swapchain. The default stays the shipped 2048x1152 and TOTK_OUTPUT_RES=0 skips the patch. Aspect stays 16:9. TOTK_OOT_DISPLAY_LOG=1 logs request vs. what setBaseSize was given (off by default). runtime_output_size_valid is shared by the panel's choices and Custom input; Bananza's and Pokopia's acceptance rule is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Tested on an M-series 16 GB Mac, game 1.0.0, Kokiri Forest: live 2048×1152 → 2560×1440 → 1920×1080 → 1280×720 → 640×360 → 2048×1152, all applied with a correct picture; invalid sizes rejected. About 14 s at 1440p, so long-session memory is still open. |
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
Live output resolution for Ocarina of Time, up to the game's own 2560x1440 swapchain. One commit on top of
feat/oot(bd3e70e1).The output size (layer render targets and the NVN crop) is DisplayConfig's base size
cfg+0x10, written only bysetBaseSizeatmain+0x1087f40. Two veneers, placed after the frame-step stub:setBaseSize's entry (original29422408): every request takes the host's size;main+0x6502f8(original2941240b): callssetBaseSizewhen the request differs from the base.The engine's own resize path (the one dock/undock uses:
main+0x6549d0→main+0x6531c0→main+0x9cd030) then re-creates the targets, the crop follows, and the 3D scene follows the output every frame (still under the game's own dynamic resolution, 0.75 here). Both original words, the zero padding and the loader's parameter page are checked; any mismatch stops withruntime_fail.resolution WxHinput command andTOTK_OUTPUT_RESnow work for OoT: 16:9, both sides multiples of 8, 640x360 up to 2560x1440; the panel only offers sizes that pass the same check (unit-tested; the final list was not checked on screen).TOTK_OUTPUT_RES=0skips the patch entirely (panel row shows fixed).TOTK_OOT_DISPLAY_LOG=1logs request vs. whatsetBaseSizewas given; off by default.runtime_output_size_validis shared by the panel's choices and Custom input. Bananza's and Pokopia's acceptance rule is unchanged.Analysis notes
setBaseSizewrites a mode byte atcfg+0x18from a table of standard sizes (1080p → 4, 1440p → 5; shipped 2048x1152 → 7). A search of every byte load at+0x18and every route to cfg found no reader, and on its top tier the game itself outputs 1.0 × 2560x1440 (mode 5), so the natural value is kept.DynamicTextureAllocatorMem) is a fixed 305 MiB from the heap table. Scene and layer targets come from it; a live resize frees the old layer targets before allocating. Resolution-dependent use scales 1.5625× from 2048x1152 to 2560x1440; no exhaustion seen. If it ever happens it fails immediately (null return), not gradually; growing the pool via the creation-arg memcpy atmain+0xf2794cis mapped out but not needed so far.main+0x1202ee0); 4K would need that plus the pool.How it was tested
main7db9ddfd…), Kokiri Forest from a save: booted at 2560x1440 and switched live 2560x1440 ↔ 1920x1080 ↔ 960x540 repeatedly (earlier build) and 2560x1440 ↔ 1920x1080 (final build). Each request was taken bysetBaseSize, the crop followed, no crash, ~20 min sessions. FPS at 1440p about the same as 2048x1152 (the game's dynamic resolution absorbs it).make build/totk-native-oot, zero warnings.-fsyntax-onlywith the Makefile flags for GAME_DKB, GAME_POKOPIA, GAME_OOT (game_patches_ns2.c, input.c, frontend.m) and frontend.m for TotK default / V143. Preprocessed diff for Bananza and Pokopia shows no behaviour change. Bananza and Pokopia were not built or played (no dumps). iOS not built (OoT is Mac only; shared code compile-checked only).python -m unittest tests.test_ns2_resolution tests.test_settings_panel tests.test_aspect tests.test_frame_lock: 12 OK. New tests run the real veneer words on stand-insetBaseSize/cfg-update stubs, and checkruntime_output_size_validper game.Open
setBaseSizecallers (main+0x1087c68display init,main+0x650600per-frame update) can ever run concurrently: the veneer snapshots the request into one page slot. Believed single-threaded, not proven.🤖 Generated with Claude Code