controls: add live F10 -> Controls editor and 1-button Focus (LS+RS) #150

Manually merged
github merged 79 commits from github-bot/gh-150 into main 2026-12-05 22:38:34 +00:00 AGit
Owner

@⁠greedtv92 on GitHub · 2026-12-05 19:47 UTC · original
greedtv92:feat/f10-controls-editor → main · +1460 −162 · 4 files · 1 commits · merged 2026-12-05 22:35 UTC

Rebased cleanly onto latest main (reconciling PR #96's new-look settings panel, keyboard_driving, taps, and maps_keys() handoff) and adds a live Controls tab to the classic F10 overlay backed by controls.ini, plus a dedicated 1-button Focus / Special (LS+RS) binding.

Summary

  • Live F10 -> Controls tab (crates/larp-hle/src/settings/menu.rs, settings.rs, modules/gameinput.rs, modules/gameinput/mouse.rs):
    • Live tuning & toggles (enabled, sensitivity, invert_y, wheel_invert, vehicle_auto_center) plus [ / ] live sensitivity hotkeys while captured.
    • Comment-preserving upsert_ini_key persistence to controls.ini (atomic write via .ini.new rename).
    • Live key rebinding for every action (keyboard keys plus Mouse3 / Mouse4 / Mouse5), Delete to unbind, Esc to cancel, and GTA Standard PC / Standard FPS (crouch=Shift, sprint=Ctrl) presets.
    • Plays cleanly with PR #96 (STYLE_ROW switching between Classic and New Look, from_pad, Q/E/Space/F menu navigation safely ignored while actively capturing a rebind, and wait_release checks only CONFIRM + raw_vks so controller stick drift never stalls rebinding).
  • 1-button Focus / Special (LS+RS) (focus = CapsLock default, live-rebindable to Mouse4/Mouse5/Mouse3 or any key):
    • Presses LEFT_STICK | RIGHT_STICK simultaneously for single-button Focus/Special activation.
    • Suppresses the default hardcoded MB_X1 -> LB, MB_X2 -> RB, or MB_MIDDLE -> RS mapping only when that specific mouse button is explicitly bound to an action (leaving upstream default mouse buttons completely unchanged otherwise).
  • Lock-free hot paths:
    • CONFIG_REV thread-local Arc<Bindings> snapshot cache and AtomicBool settings::is_open() so the 8 ms input poll and raw-input handler never contend on mutexes.

Verification

  • cargo test -p larp-hle --lib: 63 passed, 0 failed (including focus_presses_ls_and_rs_and_mouse4_override_suppresses_default_lb, upsert_ini_key_preserves_comments_and_deduplicates_aliases, prompts_get_the_keys_that_drive_each_control, settings::look::tests::paints, and settings::extra::tests::every_start_option_has_a_default_first_and_distinct_values).
  • cargo check -p larp: clean build with zero new warnings.
  • Verified 1-button Focus (LS+RS) on CapsLock and Mouse4 live in-game on build 1.0.2.1.
**@⁠greedtv92** on GitHub · 2026-12-05 19:47 UTC · [original](https://github.com/gamingwithhomie/larp/pull/150) `greedtv92:feat/f10-controls-editor` → `main` · +1460 −162 · 4 files · 1 commits · merged 2026-12-05 22:35 UTC Rebased cleanly onto latest `main` (reconciling PR `#96`'s new-look settings panel, `keyboard_driving`, `taps`, and `maps_keys()` handoff) and adds a live **Controls** tab to the classic `F10` overlay backed by `controls.ini`, plus a dedicated 1-button **Focus / Special (`LS+RS`)** binding. ### Summary - **Live `F10 -> Controls` tab** (`crates/larp-hle/src/settings/menu.rs`, `settings.rs`, `modules/gameinput.rs`, `modules/gameinput/mouse.rs`): - Live tuning & toggles (`enabled`, `sensitivity`, `invert_y`, `wheel_invert`, `vehicle_auto_center`) plus `[` / `]` live sensitivity hotkeys while captured. - Comment-preserving `upsert_ini_key` persistence to `controls.ini` (atomic write via `.ini.new` rename). - Live key rebinding for every action (keyboard keys plus `Mouse3` / `Mouse4` / `Mouse5`), `Delete` to unbind, `Esc` to cancel, and **GTA Standard PC** / **Standard FPS** (`crouch=Shift, sprint=Ctrl`) presets. - Plays cleanly with PR `#96` (`STYLE_ROW` switching between Classic and New Look, `from_pad`, `Q`/`E`/`Space`/`F` menu navigation safely ignored while actively capturing a rebind, and `wait_release` checks only `CONFIRM` + `raw_vks` so controller stick drift never stalls rebinding). - **1-button Focus / Special (`LS+RS`)** (`focus = CapsLock` default, live-rebindable to `Mouse4`/`Mouse5`/`Mouse3` or any key): - Presses `LEFT_STICK | RIGHT_STICK` simultaneously for single-button Focus/Special activation. - Suppresses the default hardcoded `MB_X1 -> LB`, `MB_X2 -> RB`, or `MB_MIDDLE -> RS` mapping **only** when that specific mouse button is explicitly bound to an action (leaving upstream default mouse buttons completely unchanged otherwise). - **Lock-free hot paths**: - `CONFIG_REV` thread-local `Arc<Bindings>` snapshot cache and `AtomicBool` `settings::is_open()` so the 8 ms input poll and raw-input handler never contend on mutexes. ### Verification - `cargo test -p larp-hle --lib`: **63 passed, 0 failed** (including `focus_presses_ls_and_rs_and_mouse4_override_suppresses_default_lb`, `upsert_ini_key_preserves_comments_and_deduplicates_aliases`, `prompts_get_the_keys_that_drive_each_control`, `settings::look::tests::paints`, and `settings::extra::tests::every_start_option_has_a_default_first_and_distinct_values`). - `cargo check -p larp`: clean build with zero new warnings. - Verified 1-button `Focus (LS+RS)` on `CapsLock` and `Mouse4` live in-game on build `1.0.2.1`.
Layers a live in-game Controls tab ([Picture] [Controls] [Untested]) directly
on top of the existing mouse.rs + controls.ini input path without changing
default input behavior, mousehook, or mapmouse:
- Live toggles for Mouse & Keyboard, look sensitivity (also [ / ] hotkeys
  while captured), Invert Y, Invert wheel scroll, and Vehicle auto-center.
- Live rebinding for all 21 controls.ini actions (Enter -> press key, Esc
  cancels, Delete clears to 'none') + one-click Standard (GTA) and Standard FPS
  presets, written atomically to controls.ini while preserving comments and
  deduplicating aliases.
- Lock-free thread-local bindings cache (CONFIG_REV) and atomic is_open() so
  hot paths take zero mutexes.
- Preserves F7 First-Person toggle, 9-language F10 i18n, controller F10 chord,
  and all LARP_CONTROLS / controls.ini / bound_keys() behavior.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 19:49:31 +00:00
github-bot force-pushed github-bot/gh-150 from 00416ccd63 to 0de055ceeb 2026-12-05 20:11:33 +00:00 Compare
github-bot changed title from controls: add live F10 -> Controls editor backed by controls.ini to controls: add live F10 -> Controls editor and 1-button Focus (LS+RS) 2026-12-05 22:38:30 +00:00
github-bot force-pushed github-bot/gh-150 from 0de055ceeb to c5b0854949 2026-12-05 22:38:32 +00:00 Compare
github manually merged commit 18ef16d375 into main 2026-12-05 22:38:33 +00:00
github-bot referenced this pull request from a commit 2026-12-06 00:43:55 +00:00
Author
Owner

@⁠compl3xity1337 on GitHub · 2026-12-06 01:24 UTC · original

Tested merged with current main (after #96) and #153: the Controls tab works (live rebind, reset). It conflicts with #96's menu. What worked for us: keep #96's show as the dispatcher (new look, else show_classic) and make this PR's panel show_classic; keep the style row on the Picture tab; close does both look.choosing = None and set_menu_open(false); menu_input keeps main's shape and calls input_with_keys; drop the second vehicle_auto_center().

**@⁠compl3xity1337** on GitHub · 2026-12-06 01:24 UTC · [original](https://github.com/gamingwithhomie/larp/pull/150#issuecomment-7449152142) Tested merged with current main (after #96) and #153: the Controls tab works (live rebind, reset). It conflicts with #96's menu. What worked for us: keep #96's `show` as the dispatcher (new look, else `show_classic`) and make this PR's panel `show_classic`; keep the style row on the Picture tab; `close` does both `look.choosing = None` and `set_menu_open(false)`; `menu_input` keeps main's shape and calls `input_with_keys`; drop the second `vehicle_auto_center()`.
This discussion has been locked. Commenting is limited to contributors.
No description provided.