WIP: feat(mouse): native mouse look for the aim, lock-on, riding and event cameras #352

Draft
rerum9982 wants to merge 1 commit from rerum9982/Longshot:feat/native-mouse-cameras into main
First-time contributor

Why

With Mouse camera on Native, only the follow camera turned with the mouse. The aim, the locked-on aim, lock-on's manual
turn, riding and talk/event cameras still got it as an emulated stick, and the view jumped up when the aim ended.

What changed

  • host/mouse_native.c + hooks in nx2/oot_patches.py: the mouse turns, one to one, the aim (f_827c0470), the other
    stick-turned cameras (returns of f_80643e70/f_80643ac0), the locked-on aim (f_827de2a0) and lock-on's manual mode
    (f_8072da10).
  • Aim entry starts at the view's pitch; aim exit with Disable camera centering keeps the aim's direction, with the
    follow camera's view blend (+0x190) moved so the view no longer flicks up.
  • host/mouse_look.{h,c}: the game-agnostic math, separate from the glue.
  • host/nn_hid.c: hands ZR/L (latched toggles included) to the mouse code.
  • Menu hints in all languages, README, docs/development.md switches.

Everything is a no-op with Mouse camera off (the default).

Flags and settings

Flag What it does Default now Recommendation Helps on Doesn't help on Untested on
Mouse camera = Native Also turns the aims, lock-on, riding and event cameras As the stick Unchanged Keyboard and mouse Controller —
HOS_MOUSE_DEBUG (set) Logs and traces the mouse cameras Off Off Bug reports — —
HOS_MOUSE_AIM_SCALE=<x> Aim sensitivity against the camera's 1 Unset — — —

Measurements

Not a performance change: input only (a few float reads and writes per frame on the active camera). One run of each,
tested once, fine.

main: cf605c85 (2026-11-14)
this PR: feat/native-mouse-cameras @ b80b7299
Hardware: AMD Radeon RX 6600, Windows 10, 16 GB
Scene: title screen, 1920x1080, 60 fps cap, Mouse camera Native
Method: one run of each build, about 50 s, the log's last vk: N presents, F fps lines
How to reproduce: start each build at the title and read the log

main @ cf605c85 this PR @ b80b7299
fps at the title (1 run) 60.0 60.0
main @ cf605c85: presents, 60.1 fps / 59.9 fps / 60.0 fps
this PR @ b80b7299: presents, 60.0 fps / 60.0 fps / 60.0 fps

Testing

Tested: tests/run_all.py --strict: 482 passed; the failures are the same as on main @ cf605c85 (no Vulkan headers, glslang or spirv-val on this PC), plus one GPU-timing check that passes when run alone. In the game on this build (merged with main cf605c85): aim with
bow and slingshot, aim entry and exit (no flick), Z-target aim, lock-on turn, Epona, talk/event cameras, item wheel, and
controller-only play.

Not tested: the Tail and Fix cameras.

Needs other testers: None.

Screenshots

Nothing on screen: camera motion only.

Risk and rollback

Mouse camera off or As the stick: every hook is a no-op. Reverting the commit is enough.

Issues

None.

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above).
  • Tested in the game, or what wasn't is named under Testing.
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests).
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (One run each: not a performance change.)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

If applicable

  • Flags noted, and the switch reference updated (docs/development.md, the README).
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
## Why With Mouse camera on Native, only the follow camera turned with the mouse. The aim, the locked-on aim, lock-on's manual turn, riding and talk/event cameras still got it as an emulated stick, and the view jumped up when the aim ended. ## What changed - `host/mouse_native.c` + hooks in `nx2/oot_patches.py`: the mouse turns, one to one, the aim (f_827c0470), the other stick-turned cameras (returns of f_80643e70/f_80643ac0), the locked-on aim (f_827de2a0) and lock-on's manual mode (f_8072da10). - Aim entry starts at the view's pitch; aim exit with Disable camera centering keeps the aim's direction, with the follow camera's view blend (+0x190) moved so the view no longer flicks up. - `host/mouse_look.{h,c}`: the game-agnostic math, separate from the glue. - `host/nn_hid.c`: hands ZR/L (latched toggles included) to the mouse code. - Menu hints in all languages, README, `docs/development.md` switches. Everything is a no-op with Mouse camera off (the default). ## Flags and settings | Flag | What it does | Default now | Recommendation | Helps on | Doesn't help on | Untested on | |---|---|---|---|---|---|---| | Mouse camera = Native | Also turns the aims, lock-on, riding and event cameras | As the stick | Unchanged | Keyboard and mouse | Controller | — | | `HOS_MOUSE_DEBUG` (set) | Logs and traces the mouse cameras | Off | Off | Bug reports | — | — | | `HOS_MOUSE_AIM_SCALE=<x>` | Aim sensitivity against the camera's | 1 | Unset | — | — | — | ## Measurements Not a performance change: input only (a few float reads and writes per frame on the active camera). One run of each, tested once, fine. main: cf605c85 (2026-11-14) this PR: feat/native-mouse-cameras @ b80b7299 Hardware: AMD Radeon RX 6600, Windows 10, 16 GB Scene: title screen, 1920x1080, 60 fps cap, Mouse camera Native Method: one run of each build, about 50 s, the log's last `vk: N presents, F fps` lines How to reproduce: start each build at the title and read the log | | main @ cf605c85 | this PR @ b80b7299 | |---|---|---| | fps at the title (1 run) | 60.0 | 60.0 | ``` main @ cf605c85: presents, 60.1 fps / 59.9 fps / 60.0 fps this PR @ b80b7299: presents, 60.0 fps / 60.0 fps / 60.0 fps ``` ## Testing **Tested:** `tests/run_all.py --strict`: 482 passed; the failures are the same as on main @ cf605c85 (no Vulkan headers, glslang or spirv-val on this PC), plus one GPU-timing check that passes when run alone. In the game on this build (merged with main cf605c85): aim with bow and slingshot, aim entry and exit (no flick), Z-target aim, lock-on turn, Epona, talk/event cameras, item wheel, and controller-only play. **Not tested:** the Tail and Fix cameras. **Needs other testers:** None. ## Screenshots Nothing on screen: camera motion only. ## Risk and rollback Mouse camera off or As the stick: every hook is a no-op. Reverting the commit is enough. ## Issues None. ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). - [x] Tested in the game, or what wasn't is named under Testing. - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). - [ ] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (One run each: not a performance change.) - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### If applicable - [x] Flags noted, and the switch reference updated (docs/development.md, the README). - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated.
feat(mouse): native mouse look for the aim, lock-on, riding and event cameras
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
b80b729949
With Mouse camera on Native the mouse now turns, one to one, the aim (bow, slingshot,
hookshot, first person), the aim while locked on, lock-on's manual turn, riding and the
talk/event cameras the stick turns, not only the camera that follows Link.

- hooks: hos_mouse_aim (f_827c0470), hos_mouse_turn (returns of f_80643e70/f_80643ac0),
  hos_mouse_lock_aim (f_827de2a0), hos_mouse_lockon (f_8072da10 at 8072ee0c/8072f2a4)
- the aim starts at the view's pitch; with Disable camera centering the follow camera
  keeps the aim's direction from the first frame, its view blend (+0x190) moved with it
- the follow camera yields to every other camera hook in the same frame
- HOS_MOUSE_DEBUG traces whose the mouse is, the lock-on mode and the follow camera
- the game-agnostic arithmetic in host/mouse_look.{h,c}
- tests: test_mouse_look, new test_mouse_native cases, the hold-to-toggle check for ZR
Author
First-time contributor

Measurement columns name their commits; the Linux build box added, unticked: not built here.

Measurement columns name their commits; the Linux build box added, unticked: not built here.
Author
First-time contributor

Measurements: the baseline column named, and why it is not main.

Measurements: the baseline column named, and why it is not main.
HumanBean force-pushed feat/native-mouse-cameras from b80b729949
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to ea1403cb89
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Successful in 5s
CI / Workflow lint (actionlint) (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 5s
Third-party parts / As their notes say (pull_request) Successful in 9s
Website / Website on Cloudflare (pull_request_target) Has been skipped
2026-11-15 18:46:33 +00:00
Compare
Owner

Rebased onto main @ 7bacf846: one conflict in host/nn_hid.c: kept main's new walk/movement code and this PR's last_buttons = *buttons; line before it. No tests were run here; the test boxes stay yours.

Rebased onto `main` @ 7bacf846: one conflict in host/nn_hid.c: kept main's new walk/movement code and this PR's `last_buttons = *buttons;` line before it. No tests were run here; the test boxes stay yours.
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Successful in 5s
CI / Workflow lint (actionlint) (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 5s
Third-party parts / As their notes say (pull_request) Successful in 9s
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request has changes conflicting with the target branch.
  • gpu/vk/menu_i18n.h
  • host/mouse_native.c
  • host/nn_hid.c
  • tests/test_mouse_native.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/native-mouse-cameras:rerum9982-feat/native-mouse-cameras'
git switch 'rerum9982-feat/native-mouse-cameras'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!352
No description provided.