Skip to content

games/acnh: adaptive-view adapter on the frame step state page - #2609

Open
lucaszhongsj wants to merge 1 commit into
seedds:mainfrom
lucaszhongsj:feat/acnh-adaptive-view
Open

lucaszhongsj wants to merge 1 commit into
seedds:mainfrom
lucaszhongsj:feat/acnh-adaptive-view

Conversation

@lucaszhongsj

Copy link
Copy Markdown
Contributor

Linked issue

Fixes #2568 (Animal Crossing: New Horizons adaptive view on a taller-than-16:9 picture)

Problem

On a taller-than-16:9 picture the game reuses projections and screen rectangles it cached before the shape changed, so scissors, captures, field ranges and the inline keyboard keep their 16:9 positions. The screen_shape stubs change the output size and camera angle but cannot invalidate those cached objects.

Fix

Register an owned ARM64 adapter from the profile's FRAME_STEP callback (view.s, assembled to position-independent code by gen_view_stubs.py, MIT-0 in view.LICENSE), gated to the 3.0.3 main build ID:

  • 21 hooks and 29 cache checks refresh cached projections, follow the current perspective in scissors and captures, widen field ranges and near-plane unprojection, and dock the inline keyboard and footer.
  • It shares the dm_fps_state frame-step state page with screen_shape (+0x58 target aspect, +0xa0..+0xb8 frame stamps); no VIEW table, VIEW_STATE_OFF, host file or general-code change is needed.
  • main+0x265140 is the one shared site: the single ret of nn::ui2d::DrawInfo::SetProjectionMtx. One chained stub runs the upstream y-row division first (its 16:9 test reads m0/m5, which the adapter's Lscreen_projection rewrites), then calls the adapter's keyboard dock; the three early returns are retargeted to the trailing ret. main+0x27d4c0 and main+0x27d570 were disassembled and coexist.

Verification

  • test_patches (22), test_view_stubs (3), test_docs (6) pass; patch_nso.py on 3.0.3 main produces 64 cuts, one at 0x265140, no VIEW_STATE_OFF in fixups; disassembly confirms the early returns and the BL target.
  • No shader chain input changed, so no shader rebuild is needed.
  • Not verified: device run (the dock offset's stretch division and the keyboard frame stamps need a real-device check).

On a picture taller than 16:9 the game reuses projections and screen
rectangles it cached before the shape changed, so scissors, captures,
field ranges and the inline keyboard keep their 16:9 positions. The
screen-shape stubs change the output size and camera angle but cannot
invalidate those cached objects.

Register an owned ARM64 adapter (view.s, assembled by gen_view_stubs.py,
MIT-0) from the profile's FRAME_STEP callback: 21 hooks and 29 cache
checks refresh cached projections, adapt scissors, captures and field
ranges, and dock the inline keyboard and footer. It shares dm_fps_state
with screen_shape (+0x58 target aspect, +0xa0..+0xb8 frame stamps), so
no VIEW table, VIEW_STATE_OFF, host file or general-code change is
needed. main+0x265140 is the one shared site: a single chained stub
runs the upstream y-row division first (its 16:9 test reads m0/m5,
which Lscreen_projection rewrites) then calls the adapter, with all
three early returns retargeted to the trailing ret. main+0x27d4c0 and
main+0x27d570 were disassembled and coexist.

Checked: test_patches (22), test_view_stubs (3), test_docs (6);
patch_nso.py on 3.0.3 main produces 64 cuts, one at 0x265140, no
VIEW_STATE_OFF in fixups; disassembly confirms the early returns and
the BL target. No chain input changed, so no shader rebuild. Device
validation is open: the dock offset's stretch division (option B) and
the pointer-free keyboard frame stamps need a real-device check.
@github-actions github-actions Bot added rewriter The NSO rewriter and per-build patches tools Tools and scripts (dm/tools, scripts) docs Documentation game: 01006F8002326000 Animal Crossing: New Horizons 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: 01006F8002326000 Animal Crossing: New Horizons 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.

Animal Crossing: New Horizons adaptive view on a taller-than-16:9 picture (DM_SCREEN_ASPECT 1.3-1.77)

1 participant