The Insert menu's Controls page: rebind the gamepad and the keyboard #350

Merged
gab9281 merged 3 commits from input/controls-page into main 2026-11-07 23:47:54 +00:00
gab9281 commented 2026-11-07 22:01:38 +00:00 (Migrated from github.com)

Part of splitting #83 into small PRs. Depends on #343 (and through it on #335): this branch is built on them, so its first two commits are theirs. Only the last one is new here.

Until now the controls could only be changed by editing hookshot_options.ini (#335). The Insert menu now has a Controls row that opens a page listing each Switch button with its gamepad input and its keys.

  • Enter, or the bottom face button, waits for the new input. Delete clears it, and Reset to defaults puts them all back.
  • A gamepad input taken from another button swaps with it, so no button is left without one. A key is taken away from the others.
  • The page saves the bindings in hookshot_options.ini with the options.
  • The renderer's host table gains binding and bind (host/nn_hid.c; API version 3).
  • On Linux, [ ] \ ' become keys too (VK_OEM_4 to VK_OEM_7), so they can be bound.

the Controls page

Binding A to the pad's top button: the page waits for it, then shows it. X, which had the top button, takes A's old right button:

binding a gamepad button

Binding A's key to G:

binding a key

Delete clears A's gamepad input; Reset to defaults puts everything back:

clear and reset

Tested on Linux (game built from this branch, a virtual Xbox 360 pad through uinput, and the keyboard):

  • Each step above wrote the file as expected: pad_a=3 and pad_x=1 after the swap, key_a=71, pad_a=-1 after Delete, and pad_a=1 and key_a=69 after Reset.
  • On the title screen, the newly bound top button then acted as A and opened the Load screen.
  • tests/ gives the same result as on main (the 4 test_cpp_preflight checks need Visual Studio).

🤖 Generated with Claude Code

Part of splitting #83 into small PRs. **Depends on #343** (and through it on #335): this branch is built on them, so its first two commits are theirs. Only the last one is new here. Until now the controls could only be changed by editing `hookshot_options.ini` (#335). The Insert menu now has a **Controls** row that opens a page listing each Switch button with its gamepad input and its keys. - Enter, or the bottom face button, waits for the new input. Delete clears it, and Reset to defaults puts them all back. - A gamepad input taken from another button swaps with it, so no button is left without one. A key is taken away from the others. - The page saves the bindings in `hookshot_options.ini` with the options. - The renderer's host table gains `binding` and `bind` (host/nn_hid.c; API version 3). - On Linux, `[ ] \ '` become keys too (VK_OEM_4 to VK_OEM_7), so they can be bound. ![the Controls page](https://raw.githubusercontent.com/gab9281/Hookshot/pr-assets/controls-page/page.png) Binding A to the pad's top button: the page waits for it, then shows it. X, which had the top button, takes A's old right button: ![binding a gamepad button](https://raw.githubusercontent.com/gab9281/Hookshot/pr-assets/controls-page/bind-gamepad.png) Binding A's key to G: ![binding a key](https://raw.githubusercontent.com/gab9281/Hookshot/pr-assets/controls-page/bind-key.png) Delete clears A's gamepad input; Reset to defaults puts everything back: ![clear and reset](https://raw.githubusercontent.com/gab9281/Hookshot/pr-assets/controls-page/clear-and-reset.png) **Tested on Linux** (game built from this branch, a virtual Xbox 360 pad through uinput, and the keyboard): - Each step above wrote the file as expected: `pad_a=3` and `pad_x=1` after the swap, `key_a=71`, `pad_a=-1` after Delete, and `pad_a=1` and `key_a=69` after Reset. - On the title screen, the newly bound top button then acted as A and opened the Load screen. - `tests/` gives the same result as on main (the 4 `test_cpp_preflight` checks need Visual Studio). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Cretezy commented 2026-11-07 22:46:38 +00:00 (Migrated from github.com)

Similar to #372 btw

Similar to https://git.magicbean.dev/MagicBeanDev/Hookshot/pulls/372 btw
gab9281 commented 2026-11-07 23:18:03 +00:00 (Migrated from github.com)

Similar to #372 btw

look at the base pr of that (#83)

> Similar to #372 btw look at the base pr of that (https://git.magicbean.dev/MagicBeanDev/Hookshot/pulls/83)
gab9281 commented 2026-11-07 23:26:34 +00:00 (Migrated from github.com)

@NotRexed rebased on current main (9e8fb5b). It sits on the rebased #343.

@NotRexed rebased on current main (9e8fb5b). It sits on the rebased #343.
Commenting is not possible because the repository is archived.
No description provided.