feat: controller layout presets and camera inversion #372

Merged
oscarlosu-lab merged 1 commit from feat/controller-remapping-and-quality-presets into main 2026-11-08 19:22:24 +00:00
oscarlosu-lab commented 2026-11-07 22:40:50 +00:00 (Migrated from github.com)

Summary of Changes

As requested by @NotRexed, this PR has been rebased and adapted on top of the in-game bindings system (#335 -> #343 -> #350) and recent main commits. The hardware quality presets have been extracted to be submitted separately in a dedicated PR.

1. Quick Controller Layout Presets (built on top of the bindings system)

  • Added a Layout preset option in the F1 / Insert menu:
    • Nintendo (Default): Switch native button order (Bottom = B, Right = A, Top = X, Left = Y).
    • Xbox / PC Standard: Western PC standard (Bottom = A for Talk/Action/Roll, Right = B for Attack, Left = X, Top = Y).
    • Swap Face Buttons: Quick swap of face buttons.
    • Custom: Automatically detected and displayed whenever a player modifies single buttons in the Controls > sub-page.
  • Synchronized directly with host->bind(HOS_BIND_PAD, ...) and saved into hookshot_options.ini.

2. Right-Stick Camera Inversion

  • Added Invert camera X and Invert camera Y options in the menu and persistent in hookshot_options.ini.
  • Wired dynamically through callback t.option(16) and t.option(17) across both controller backends:
    • XInput (host/nn_hid.c)
    • SDL2 (host/pad_sdl.c)

🧪 Verification Report

  • Unit & Regression Tests:
    • nx2/test_nup_paths.py: 21 tests OK
    • tests/test_make_game_cache.py: 6 tests OK
    • tests/test_failure_reason.py: 6 tests OK
    • tests/test_dispatch_clock.py: PASS
    • tests/test_desc_clock.py: PASS
    • nx2/test_version.py: OK
  • Controllers Tested:
    • Xbox Series Controller (XInput)
    • DualSense Controller (SDL2)
  • Scenarios Verified:
    • Cycling between Nintendo and Xbox / PC instantly swaps the face buttons.
    • Toggling Invert camera X and Invert camera Y inverts the right analog stick smoothly in-game.
    • Modifying bindings individually in Controls > automatically reflects Custom in the layout preset selector.
### Summary of Changes As requested by @NotRexed, this PR has been rebased and adapted on top of the in-game bindings system (#335 -> #343 -> #350) and recent main commits. The hardware quality presets have been extracted to be submitted separately in a dedicated PR. #### 1. Quick Controller Layout Presets (built on top of the bindings system) * Added a Layout preset option in the <kbd>F1</kbd> / <kbd>Insert</kbd> menu: * Nintendo (Default): Switch native button order (Bottom = B, Right = A, Top = X, Left = Y). * Xbox / PC Standard: Western PC standard (Bottom = A for Talk/Action/Roll, Right = B for Attack, Left = X, Top = Y). * Swap Face Buttons: Quick swap of face buttons. * Custom: Automatically detected and displayed whenever a player modifies single buttons in the Controls > sub-page. * Synchronized directly with host->bind(HOS_BIND_PAD, ...) and saved into hookshot_options.ini. #### 2. Right-Stick Camera Inversion * Added Invert camera X and Invert camera Y options in the menu and persistent in hookshot_options.ini. * Wired dynamically through callback t.option(16) and t.option(17) across both controller backends: * **XInput** (host/nn_hid.c) * **SDL2** (host/pad_sdl.c) --- ### 🧪 Verification Report * **Unit & Regression Tests**: * nx2/test_nup_paths.py: 21 tests OK * tests/test_make_game_cache.py: 6 tests OK * tests/test_failure_reason.py: 6 tests OK * tests/test_dispatch_clock.py: PASS * tests/test_desc_clock.py: PASS * nx2/test_version.py: OK * **Controllers Tested**: * Xbox Series Controller (XInput) * DualSense Controller (SDL2) * **Scenarios Verified**: * Cycling between Nintendo and Xbox / PC instantly swaps the face buttons. * Toggling Invert camera X and Invert camera Y inverts the right analog stick smoothly in-game. * Modifying bindings individually in Controls > automatically reflects Custom in the layout preset selector.
Cretezy (Migrated from github.com) approved these changes 2026-11-07 22:44:54 +00:00
Cretezy (Migrated from github.com) left a comment

LGTM

LGTM
NotRexed commented 2026-11-07 23:08:23 +00:00 (Migrated from github.com)

Thanks! Controller rebinding just landed through #335 -> #343 -> #350 (a Controls page in the Insert menu, bindings in hookshot_options.ini), and #359 adds input in the background, so this now overlaps them. Could you rebase on main and keep what they don't cover (camera inversion, the layout presets on top of the new bindings)? The quality presets would be better as their own PR: the 7.5-11 GB texture budgets need testing on 8-12 GB cards, where running out of VRAM is already the top cause of device-lost reports (#132, #150).

Thanks! Controller rebinding just landed through #335 -> #343 -> #350 (a Controls page in the Insert menu, bindings in hookshot_options.ini), and #359 adds input in the background, so this now overlaps them. Could you rebase on main and keep what they don't cover (camera inversion, the layout presets on top of the new bindings)? The quality presets would be better as their own PR: the 7.5-11 GB texture budgets need testing on 8-12 GB cards, where running out of VRAM is already the top cause of device-lost reports (#132, #150).
oscarlosu-lab commented 2026-11-07 23:30:10 +00:00 (Migrated from github.com)

@NotRexed Thanks for the guidance! Rebased and updated:

  1. Layout Presets: Added the Layout preset selector (Nintendo (Default), Xbox / PC Standard, Swap Face Buttons, and Custom) integrated directly on top of the bindings infrastructure (host->bind). Changing the preset instantly updates the bindings and saves to hookshot_options.ini; customizing any button in the Controls > sub-page automatically switches the preset row to Custom.
  2. Camera Inversion: Added Invert camera X and Invert camera Y options wired across both XInput (host/nn_hid.c) and SDL2 (host/pad_sdl.c) backends.
  3. Quality Presets: Extracted completely from this PR so they can be submitted and benchmarked separately as requested.
@NotRexed Thanks for the guidance! Rebased and updated: 1. **Layout Presets**: Added the `Layout preset` selector (`Nintendo (Default)`, `Xbox / PC Standard`, `Swap Face Buttons`, and `Custom`) integrated directly on top of the bindings infrastructure (`host->bind`). Changing the preset instantly updates the bindings and saves to `hookshot_options.ini`; customizing any button in the `Controls >` sub-page automatically switches the preset row to `Custom`. 2. **Camera Inversion**: Added `Invert camera X` and `Invert camera Y` options wired across both XInput (`host/nn_hid.c`) and SDL2 (`host/pad_sdl.c`) backends. 3. **Quality Presets**: Extracted completely from this PR so they can be submitted and benchmarked separately as requested.
oscarlosu-lab commented 2026-11-08 00:36:53 +00:00 (Migrated from github.com)

Rebased on top of #350 as requested!

Just a heads-up regarding the conflict indicator shown by GitHub: because PR #350 is currently open and has not yet been merged into main, GitHub is comparing this branch against the current main (which does not yet have #350's input rebinding foundation). Once #335 / #343 / #350 land on main, this PR will merge cleanly without conflicts.

Also, the hardware quality presets have been completely extracted into #398 to keep this PR strictly focused on controller presets and camera inversion.

Rebased on top of #350 as requested! Just a heads-up regarding the conflict indicator shown by GitHub: because PR #350 is currently open and has not yet been merged into main, GitHub is comparing this branch against the current main (which does not yet have #350's input rebinding foundation). Once #335 / #343 / #350 land on main, this PR will merge cleanly without conflicts. Also, the hardware quality presets have been completely extracted into #398 to keep this PR strictly focused on controller presets and camera inversion.
Commenting is not possible because the repository is archived.
No description provided.