feat(hid): warn on low controller battery and slow controller updates #3038

Open
cfw34683 wants to merge 1 commit from cfw34683/Longshot:feat/controller-battery-stall-warning into main
Contributor

Summary

A controller on a dying battery, or a PC where reading the controllers keeps stalling, makes input lag with nothing on
screen to say why. This adds a read-only Controller health row to the Controls tab (Controller section, after the
Xbox rows, before Controller menu button) that says so, and a line in the log:

  • Low battery: the controller used last runs on its battery at 15% or less, as hos_sdl_pad_battery reports it
    (the builder's pads included). Each pad is checked when it opens and every 30 s; each low pad is named once in the log.
  • Slow updates: SDL's controller update (SDL_UpdateGamepads, which serves every pad at once) took over 10 ms six
    times within any 5 seconds. It clears after 15 s with no stall, and the log says so; a later run raises it again.
    The row doesn't name a cause or a transport, since the timing can't tell a wireless link from a driver or a busy PC.
  • Low battery + slow updates: both.

The row and its hints are translated into the menu's 13 languages. There is no on-screen toast: the renderer has no
translated text, and its UI is moving into mods (#3069), so a toast can come later from a mod.

Read first: host/pad_health.h (the checks, pure C), the health block at the end of pads_poll in host/pad_sdl.c,
then the controller_health row in game/mods/controls/mod.toml. LsRendererStatus gains pad_health, so
LS_CAPS_LAYOUT moves to 24 (C and its Rust mirror). No change to host/hos_sdl.c: the battery is #3044's
hos_sdl_pad_battery.

See #2089 (input lag with stable FPS). Overlaps #1092 (a notice on low battery, connect and disconnect).

Testing

Tested: Windows 10 22H2, RTX 3070 Ti, on 22b733e20 (main d6e819e08 merged):

  • In game, a window, with a controller connected (no gyroscope): Insert, Controls. Controller health sits after Xbox direct rumble (Xbox direct's detail rows hidden while it is off) and before Controller menu button, reads OK, and its help box shows the help and the OK hint ("Controller battery and updates look healthy."). Screenshot in the comments.
  • dev.py smoke PASS on the same build: in play from kokiri-start, 900 frames, the Insert menu opened, every system mod started.
  • mise run test (run_all.py --strict, 848 checks): 682 passed at first; 117 more had no tool on this PC (gcc, g++, glslang...). With MSYS2's gcc 16.2 and tools.lock's glslang on the PATH, 113 of those pass and 0 fail; 4 still need tools this PC lacks (test_coverage_run llvm-nm, test_lifter llvm-mc, test_fsr4_tune spirv-val, test_native_zstd zstandard). The other 49 fail the same way on clean main d6e819e08 on this PC (all 49, none extra), none in this PR's area:
    the 49

test_game_font.py, test_seed_reader.py, test_capture_copy_helpers.py, test_report_words.py, test_jobs_wait_runs_queued.py, test_alt_enter.py, test_audio_deadline.py, test_audio_output_errors.py, test_audio_wave_buffer_release.py, test_bc_levels.py, test_bind_memo.py, test_collect_wide.py, test_dlss_actor.py, test_dlss_checks.py, test_dlss_math.py, test_draw_binds.py, test_fps_overlay_order.py, test_fps_rate.py, test_fps_stats.py, test_framegen_gate.py, test_fsr3_math.py, test_gpu_choice.py, test_helpers_extract.py, test_hle_guest_ranges.py, test_import_span.py, test_libc_hooks.py, test_longshot_builder.py, test_mirror_inherit.py, test_movie_upscale_policy.py, test_pass_hazard.py, test_pool_span.py, test_present_ahead.py, test_prof_clock.py, test_push_state.py, test_quick_pipelines.py, test_same_bind.py, test_same_draw.py, test_same_dyn.py, test_skip_code.py, test_sparse_bc_usage.py, test_status_line.py, test_submitted_page.py, test_table_track.py, test_tex_spans_once_a_present.py, test_texture_layout_sizes.py, test_ub_gap.py, test_upscale_independent.py, test_vertex_bind.py, test_wb_pages.py

- Linux (Ubuntu 26.04 under WSL 2, tools.lock's toolchain through `mise run tools`), on 22b733e20: - `scripts/check_host_compile.py` for Linux, with `dev.py env`'s build environment: 83 host units, 0 failed. - `scripts/check_host_compile.py` for Windows as CI's host-windows job runs it (`RX_TARGET=windows RX_MARCH=x86-64-v3`, llvm-mingw's Linux build, tools.lock's windows-x64 headers and FFmpeg): 81 host units, 0 failed. - `cargo test -p host-sys -p api --lib`: 23 and 566 passed, 0 failed. - `mise run test` (`run_all.py --strict`): 885 passed, 2 failed, 13 skipped (Windows-only or a Vulkan device). The 2, `test_gfx_world` and `test_lifter`, fail the same way on clean `main` d6e819e08 there. - `dev.py cargo -- test -p host-sys -p api --lib`: host-sys passes; api 565 of 566, `watch::tests::a_walked_reshade_folder_counts_a_change_once_two_walks_agree` failing on clean `main` too. - `longshot-builder mod test game/mods/menu` (this tree's builder): 73 of 74; "a held scroll, an open dropdown ... cost the script almost nothing a frame" fails on clean `main` too (2 of 74 there). - `test_pad_health` covers the battery threshold, the sliding window across a boundary, six stalls just over 5 s apart not counting, the 15 s recovery and a recurrence, and that no SDL power call bypasses the builder's pads.

Still to test:

  • Windows, a wireless controller below 15%: open Insert, Controls, expecting Controller health to say Low battery and the log one hid: "<pad>": low battery (<n>%) line (by hand).
  • Windows, two controllers, the low one idle: use the healthy one, expecting OK; press a button on the low one, expecting Low battery (by hand).
  • Linux, the same with a Bluetooth controller (by hand).
  • Any OS: a slow-update case (a Bluetooth controller at the edge of its range, or the CPU fully loaded), expecting Slow updates within a few seconds, then OK and hid: SDL's controller update is quick again 15 s after it stops (by hand).
  • Windows and Linux, any controller: the Controls tab's rows draw and navigate as on main (@Beanstalk open the Insert menu's Controls tab with a controller connected and screenshot it).

Measurements

Nothing to measure: one hos_now_ns() pair around the existing SDL_UpdateGamepads call, a ring of six timestamps and a battery read per pad every 30 s; no draw, no allocation, no thread.

Risks

  • A PC whose controller update often runs past 10 ms shows Slow updates, which is the point; it changes nothing else.
  • A pad that reports its battery wrongly can show Low battery while charged; the row is informational only.
  • LS_CAPS_LAYOUT 24: a renderer and host from different commits refuse each other's status, as for every layout change.
  • Revert is enough; nothing is saved, and settings.toml gains no key.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary A controller on a dying battery, or a PC where reading the controllers keeps stalling, makes input lag with nothing on screen to say why. This adds a read-only **Controller health** row to the Controls tab (Controller section, after the Xbox rows, before Controller menu button) that says so, and a line in the log: - **Low battery**: the controller used last runs on its battery at 15% or less, as `hos_sdl_pad_battery` reports it (the builder's pads included). Each pad is checked when it opens and every 30 s; each low pad is named once in the log. - **Slow updates**: SDL's controller update (`SDL_UpdateGamepads`, which serves every pad at once) took over 10 ms six times within any 5 seconds. It clears after 15 s with no stall, and the log says so; a later run raises it again. The row doesn't name a cause or a transport, since the timing can't tell a wireless link from a driver or a busy PC. - **Low battery + slow updates**: both. The row and its hints are translated into the menu's 13 languages. There is no on-screen toast: the renderer has no translated text, and its UI is moving into mods (#3069), so a toast can come later from a mod. Read first: `host/pad_health.h` (the checks, pure C), the health block at the end of `pads_poll` in `host/pad_sdl.c`, then the `controller_health` row in `game/mods/controls/mod.toml`. `LsRendererStatus` gains `pad_health`, so `LS_CAPS_LAYOUT` moves to 24 (C and its Rust mirror). No change to `host/hos_sdl.c`: the battery is #3044's `hos_sdl_pad_battery`. See #2089 (input lag with stable FPS). Overlaps #1092 (a notice on low battery, connect and disconnect). ## Testing **Tested:** Windows 10 22H2, RTX 3070 Ti, on 22b733e20 (main d6e819e08 merged): - In game, a window, with a controller connected (no gyroscope): Insert, Controls. Controller health sits after Xbox direct rumble (Xbox direct's detail rows hidden while it is off) and before Controller menu button, reads **OK**, and its help box shows the help and the OK hint ("Controller battery and updates look healthy."). Screenshot in the comments. - `dev.py smoke` PASS on the same build: in play from `kokiri-start`, 900 frames, the Insert menu opened, every system mod started. - `mise run test` (`run_all.py --strict`, 848 checks): 682 passed at first; 117 more had no tool on this PC (`gcc`, `g++`, `glslang`...). With MSYS2's gcc 16.2 and tools.lock's glslang on the PATH, 113 of those pass and 0 fail; 4 still need tools this PC lacks (`test_coverage_run` llvm-nm, `test_lifter` llvm-mc, `test_fsr4_tune` spirv-val, `test_native_zstd` zstandard). The other 49 fail the same way on clean `main` d6e819e08 on this PC (all 49, none extra), none in this PR's area: <details><summary>the 49</summary> `test_game_font.py`, `test_seed_reader.py`, `test_capture_copy_helpers.py`, `test_report_words.py`, `test_jobs_wait_runs_queued.py`, `test_alt_enter.py`, `test_audio_deadline.py`, `test_audio_output_errors.py`, `test_audio_wave_buffer_release.py`, `test_bc_levels.py`, `test_bind_memo.py`, `test_collect_wide.py`, `test_dlss_actor.py`, `test_dlss_checks.py`, `test_dlss_math.py`, `test_draw_binds.py`, `test_fps_overlay_order.py`, `test_fps_rate.py`, `test_fps_stats.py`, `test_framegen_gate.py`, `test_fsr3_math.py`, `test_gpu_choice.py`, `test_helpers_extract.py`, `test_hle_guest_ranges.py`, `test_import_span.py`, `test_libc_hooks.py`, `test_longshot_builder.py`, `test_mirror_inherit.py`, `test_movie_upscale_policy.py`, `test_pass_hazard.py`, `test_pool_span.py`, `test_present_ahead.py`, `test_prof_clock.py`, `test_push_state.py`, `test_quick_pipelines.py`, `test_same_bind.py`, `test_same_draw.py`, `test_same_dyn.py`, `test_skip_code.py`, `test_sparse_bc_usage.py`, `test_status_line.py`, `test_submitted_page.py`, `test_table_track.py`, `test_tex_spans_once_a_present.py`, `test_texture_layout_sizes.py`, `test_ub_gap.py`, `test_upscale_independent.py`, `test_vertex_bind.py`, `test_wb_pages.py` </details> - Linux (Ubuntu 26.04 under WSL 2, tools.lock's toolchain through `mise run tools`), on 22b733e20: - `scripts/check_host_compile.py` for Linux, with `dev.py env`'s build environment: 83 host units, 0 failed. - `scripts/check_host_compile.py` for Windows as CI's host-windows job runs it (`RX_TARGET=windows RX_MARCH=x86-64-v3`, llvm-mingw's Linux build, tools.lock's windows-x64 headers and FFmpeg): 81 host units, 0 failed. - `cargo test -p host-sys -p api --lib`: 23 and 566 passed, 0 failed. - `mise run test` (`run_all.py --strict`): 885 passed, 2 failed, 13 skipped (Windows-only or a Vulkan device). The 2, `test_gfx_world` and `test_lifter`, fail the same way on clean `main` d6e819e08 there. - `dev.py cargo -- test -p host-sys -p api --lib`: host-sys passes; api 565 of 566, `watch::tests::a_walked_reshade_folder_counts_a_change_once_two_walks_agree` failing on clean `main` too. - `longshot-builder mod test game/mods/menu` (this tree's builder): 73 of 74; "a held scroll, an open dropdown ... cost the script almost nothing a frame" fails on clean `main` too (2 of 74 there). - `test_pad_health` covers the battery threshold, the sliding window across a boundary, six stalls just over 5 s apart not counting, the 15 s recovery and a recurrence, and that no SDL power call bypasses the builder's pads. **Still to test:** - Windows, a wireless controller below 15%: open Insert, Controls, expecting Controller health to say Low battery and the log one `hid: "<pad>": low battery (<n>%)` line (by hand). - Windows, two controllers, the low one idle: use the healthy one, expecting OK; press a button on the low one, expecting Low battery (by hand). - Linux, the same with a Bluetooth controller (by hand). - Any OS: a slow-update case (a Bluetooth controller at the edge of its range, or the CPU fully loaded), expecting Slow updates within a few seconds, then OK and `hid: SDL's controller update is quick again` 15 s after it stops (by hand). - Windows and Linux, any controller: the Controls tab's rows draw and navigate as on `main` (@Beanstalk open the Insert menu's Controls tab with a controller connected and screenshot it). ## Measurements Nothing to measure: one `hos_now_ns()` pair around the existing `SDL_UpdateGamepads` call, a ring of six timestamps and a battery read per pad every 30 s; no draw, no allocation, no thread. ## Risks - A PC whose controller update often runs past 10 ms shows Slow updates, which is the point; it changes nothing else. - A pad that reports its battery wrongly can show Low battery while charged; the row is informational only. - `LS_CAPS_LAYOUT` 24: a renderer and host from different commits refuse each other's status, as for every layout change. - Revert is enough; nothing is saved, and `settings.toml` gains no key. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(hid): warn on low controller battery and Bluetooth poll stalls
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
6e2e34e8d6
Member

Possibly related, for context:

  • PR #1092 feat(input): show a notice when a controller's battery is low, when it disconnects and when it connects — Open PR overlaps battery warnings and controller-health UI
  • issue #2089 Game: Intermittent delayed controls during intense fights despite stable FPS — Open input-lag report; poll-stall diagnostics may help
Possibly related, for context: - PR #1092 feat(input): show a notice when a controller's battery is low, when it disconnects and when it connects — Open PR overlaps battery warnings and controller-health UI - issue #2089 Game: Intermittent delayed controls during intense fights despite stable FPS — Open input-lag report; poll-stall diagnostics may help
Merge branch 'main' into feat/controller-battery-stall-warning
Some checks failed
PR description / Title and description (pull_request_target) Failing after 8s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
c5658894b0
docs(hid): mention outdated controller firmware in stall warnings
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
a284dfb825
Merge branch 'main' into feat/controller-battery-stall-warning
Some checks failed
PR description / Title and description (pull_request_target) Failing after 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
3d6aa56b24
cfw34683 force-pushed feat/controller-battery-stall-warning from 3d6aa56b24
Some checks failed
PR description / Title and description (pull_request_target) Failing after 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 1a9fe82498
Some checks failed
PR description / Title and description (pull_request_target) Failing after 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-03 12:09:52 +00:00
Compare
cfw34683 force-pushed feat/controller-battery-stall-warning from 1a9fe82498
Some checks failed
PR description / Title and description (pull_request_target) Failing after 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to eee639f20c
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-03 17:43:26 +00:00
Compare
Merge branch 'main' into feat/controller-battery-stall-warning
Some checks failed
PR description / Title and description (pull_request_target) Failing after 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
32153408b9
cfw34683 force-pushed feat/controller-battery-stall-warning from 32153408b9
Some checks failed
PR description / Title and description (pull_request_target) Failing after 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to d2643ee30a
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-03 23:56:27 +00:00
Compare
Author
Contributor

Rebased onto main (0a68a1de) and pushed d2643ee3. CI hasn't run on this PR yet (every job shows blocked), so I ran the game-free checks locally. They found two things, fixed in their own commit, d2643ee3:

  • test_ui_renderer: menu_record's "nothing shows: no painter's frame" gate had && !toast added to the line the test pins. The gate now keeps main's line, and the toast is checked inside it, so ui::idle() is still skipped while the toast is up and its frame still begins.
  • test_i18n_complete: the Controller health row's 11 texts are now in all 13 languages, with each language's existing word for the controller (Mando, Control, Manette, 手柄, 手把…). Native speakers, please correct any wording.

Checked locally (Windows, tools.lock's llvm-mingw): tests/run_all.py --changed origin/main gives 111 passed and 7 failed. The 7 (test_fps_overlay_order, test_cursor_hidden_linux, test_fps_stats, test_gpu_choice, test_fps_rate, test_input_background, test_gfx_world) fail the same way on clean main on this PC, so they're unrelated to this PR.

A question for reviewers, which no test checks: the bottom-left toast draws its text straight from vk_menu.cpp (draw_pad_health_toast), in hardcoded English. Its three messages can't be translated, and the wording differs from the Controller health row's. Since #3069 routes UI through mods, would you rather the toast go through the notice path a mod can show, or drop it and keep only the menu row? I'll change it whichever way you prefer.

Rebased onto `main` (`0a68a1de`) and pushed `d2643ee3`. CI hasn't run on this PR yet (every job shows *blocked*), so I ran the game-free checks locally. They found two things, fixed in their own commit, `d2643ee3`: - **`test_ui_renderer`:** `menu_record`'s "nothing shows: no painter's frame" gate had `&& !toast` added to the line the test pins. The gate now keeps main's line, and the toast is checked inside it, so `ui::idle()` is still skipped while the toast is up and its frame still begins. - **`test_i18n_complete`:** the Controller health row's 11 texts are now in all 13 languages, with each language's existing word for the controller (Mando, Control, Manette, 手柄, 手把…). Native speakers, please correct any wording. **Checked locally (Windows, tools.lock's llvm-mingw):** `tests/run_all.py --changed origin/main` gives 111 passed and 7 failed. The 7 (`test_fps_overlay_order`, `test_cursor_hidden_linux`, `test_fps_stats`, `test_gpu_choice`, `test_fps_rate`, `test_input_background`, `test_gfx_world`) fail the same way on clean `main` on this PC, so they're unrelated to this PR. **A question for reviewers, which no test checks:** the bottom-left toast draws its text straight from `vk_menu.cpp` (`draw_pad_health_toast`), in hardcoded English. Its three messages can't be translated, and the wording differs from the Controller health row's. Since #3069 routes UI through mods, would you rather the toast go through the notice path a mod can show, or drop it and keep only the menu row? I'll change it whichever way you prefer.
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The warning can be missed at startup, remain active after polling recovers, and misidentify the controller or connection responsible. The status layout also changed without its required version bump.

Adds battery and polling warnings to the Controls menu and a temporary toast. The feature could help diagnose controller trouble, but its current state tracking and wording can mislead players.

Blocking (4): must change before merging.

  1. L1 game/settings_caps.h:151: The status layout changes without advancing LS_CAPS_LAYOUT. (more on the line) Do: Advance LS_CAPS_LAYOUT and its Rust mirror together so mismatched layouts are refused.
  2. L2 host/pad_health.h:61: Once set, the stall flag never clears while any controller remains connected. (more on the line) Do: Expire the stall state after a suitable healthy interval and test recovery and a subsequent recurrence.
  3. L3 gpu/vk/vk_menu.cpp:1700: A warning detected during startup can expire without ever being shown. (more on the line) Do: Queue the warning until it can be displayed, then start its display interval.
  4. L4 game/mods/controls/mod.toml:281: The row attributes a slow SDL update to Bluetooth even though the measurement does not identify a transport or a particular controller. (more on the line) Do: Describe the observed SDL polling delay without asserting its cause or transport, unless those can be established independently.

Should fix (5): not blocking, but worth doing before merging.

  • L5 host/pad_sdl.c:889: Battery health is combined across every open pad, although the row says it describes the active controller. (more on the line) Do: Report the selected active pad's battery state, or identify the affected pad and make the row's scope explicit.
  • L6 host/pad_health.h:55: The stall counter uses fixed windows, not the promised sliding window. (more on the line) Do: Keep the recent stall timestamps and count those within the last five seconds; add a boundary-crossing test.
  • L7 gpu/vk/vk_menu.cpp:1668: The toast messages are hardcoded in English. (more on the line) Do: Send the notice through a translatable UI path and provide translations for its messages.
  • L8 game/mods/controls/mod.toml:276: The new Controls row is absent from the user settings table. (more on the line) Do: Add the row in menu order to docs/user/graphics-and-controls.md.
  • L9: The description omits the required template sections, including in-game testing, remaining tests, measurements, risks and checklist. When: The reported verification contains compiler and game-free checks only, leaving reviewers without the required account of what ran in game and what remains to test. Do: Complete the PR template with the actual results, remaining runs, risks and applicable checklist.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L10: The feature has no reported in-game validation. When: The helper tests cannot show that a real controller's battery report reaches a readable toast and Controls row, or that polling warnings behave correctly in play. Do: Run the feature in game with a low-battery controller and a reproducible slow-poll case, checking the toast, row and recovery on supported Windows and Linux setups.

@fix can do L1, L2, L3, L4, L5, L6, L7, L8 and L9.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven: the reported checks exercise the helper and source wiring, but no in-game run demonstrates the warning or its presentation.

Other systems: The SDL update is shared by all open controllers, including wired and virtual devices; its elapsed time also includes time the polling thread is descheduled. The new status crosses the host, renderer and Rust settings ABI. Windows and Linux controller behavior and the on-screen presentation have not been reported tested in game.

Switches: None.

Reviewed: d2643ee30a against 0a68a1dea8: Read the repository rules, PR template, standards, commit messages, changed host and renderer hunks, the new helper and test, and the surrounding polling and status paths. Skimmed translations and the Rust and menu declaration changes; did not read every changed code file in full. docs/review-checklist.md was absent.; nothing run (a code review).

Checked and fine:

  • The new shared renderer health and toast values use atomics.
  • The helper test honours the supplied compiler argument and checks both SDL battery threshold branches.
  • No switch or compiled game output is added in the listed changes.

Testing: No commands from the project or tests were run, as requested. The author reports four targeted checks passing and seven broader checks failing identically on their clean base; CI is still running.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The warning can be missed at startup, remain active after polling recovers, and misidentify the controller or connection responsible. The status layout also changed without its required version bump. Adds battery and polling warnings to the Controls menu and a temporary toast. The feature could help diagnose controller trouble, but its current state tracking and wording can mislead players. **Blocking (4)**: must change before merging. 1. **L1** `game/settings_caps.h:151`: The status layout changes without advancing LS_CAPS_LAYOUT. (more on the line) **Do:** Advance LS_CAPS_LAYOUT and its Rust mirror together so mismatched layouts are refused. 2. **L2** `host/pad_health.h:61`: Once set, the stall flag never clears while any controller remains connected. (more on the line) **Do:** Expire the stall state after a suitable healthy interval and test recovery and a subsequent recurrence. 3. **L3** `gpu/vk/vk_menu.cpp:1700`: A warning detected during startup can expire without ever being shown. (more on the line) **Do:** Queue the warning until it can be displayed, then start its display interval. 4. **L4** `game/mods/controls/mod.toml:281`: The row attributes a slow SDL update to Bluetooth even though the measurement does not identify a transport or a particular controller. (more on the line) **Do:** Describe the observed SDL polling delay without asserting its cause or transport, unless those can be established independently. **Should fix (5)**: not blocking, but worth doing before merging. - **L5** `host/pad_sdl.c:889`: Battery health is combined across every open pad, although the row says it describes the active controller. (more on the line) **Do:** Report the selected active pad's battery state, or identify the affected pad and make the row's scope explicit. - **L6** `host/pad_health.h:55`: The stall counter uses fixed windows, not the promised sliding window. (more on the line) **Do:** Keep the recent stall timestamps and count those within the last five seconds; add a boundary-crossing test. - **L7** `gpu/vk/vk_menu.cpp:1668`: The toast messages are hardcoded in English. (more on the line) **Do:** Send the notice through a translatable UI path and provide translations for its messages. - **L8** `game/mods/controls/mod.toml:276`: The new Controls row is absent from the user settings table. (more on the line) **Do:** Add the row in menu order to docs/user/graphics-and-controls.md. - **L9**: The description omits the required template sections, including in-game testing, remaining tests, measurements, risks and checklist. *When:* The reported verification contains compiler and game-free checks only, leaving reviewers without the required account of what ran in game and what remains to test. **Do:** Complete the PR template with the actual results, remaining runs, risks and applicable checklist. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L10**: The feature has no reported in-game validation. *When:* The helper tests cannot show that a real controller's battery report reaches a readable toast and Controls row, or that polling warnings behave correctly in play. **Do:** Run the feature in game with a low-battery controller and a reproducible slow-poll case, checking the toast, row and recovery on supported Windows and Linux setups. `@fix` can do L1, L2, L3, L4, L5, L6, L7, L8 and L9. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported checks exercise the helper and source wiring, but no in-game run demonstrates the warning or its presentation. **Other systems:** The SDL update is shared by all open controllers, including wired and virtual devices; its elapsed time also includes time the polling thread is descheduled. The new status crosses the host, renderer and Rust settings ABI. Windows and Linux controller behavior and the on-screen presentation have not been reported tested in game. **Switches:** None. **Reviewed:** d2643ee30a1e against 0a68a1dea88d: Read the repository rules, PR template, standards, commit messages, changed host and renderer hunks, the new helper and test, and the surrounding polling and status paths. Skimmed translations and the Rust and menu declaration changes; did not read every changed code file in full. docs/review-checklist.md was absent.; nothing run (a code review). **Checked and fine:** - The new shared renderer health and toast values use atomics. - The helper test honours the supplied compiler argument and checks both SDL battery threshold branches. - No switch or compiled game output is added in the listed changes. **Testing:** No commands from the project or tests were run, as requested. The author reports four targeted checks passing and seven broader checks failing identically on their clean base; CI is still running. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -273,2 +273,4 @@
place = { tab = "controls", section = "controller", order = 90 }
[[settings]]
id = "controller_health"
Member

L8 (should fix): The new Controls row is absent from the user settings table.

When: A player consulting the Controls reference cannot find Controller health or what its status means.

Do: Add the row in menu order to docs/user/graphics-and-controls.md.

**L8** (should fix): The new Controls row is absent from the user settings table. *When:* A player consulting the Controls reference cannot find Controller health or what its status means. **Do:** Add the row in menu order to docs/user/graphics-and-controls.md.
@ -275,0 +278,4 @@
{ when = "status.pad_health == 0", text = "OK" },
{ when = "status.pad_health == 1", text = "Low battery" },
{ when = "status.pad_health == 2", text = "Slow poll (Bluetooth)" },
{ when = "status.pad_health == 3", text = "Low battery + slow poll" },
Member

L4 (blocking): The row attributes a slow SDL update to Bluetooth even though the measurement does not identify a transport or a particular controller.

When: Six slow updates with only a wired controller, or while the polling thread is descheduled, set the same flag and display “Slow poll (Bluetooth)” and a Bluetooth-specific explanation.

Do: Describe the observed SDL polling delay without asserting its cause or transport, unless those can be established independently.

**L4** (blocking): The row attributes a slow SDL update to Bluetooth even though the measurement does not identify a transport or a particular controller. *When:* Six slow updates with only a wired controller, or while the polling thread is descheduled, set the same flag and display “Slow poll (Bluetooth)” and a Bluetooth-specific explanation. **Do:** Describe the observed SDL polling delay without asserting its cause or transport, unless those can be established independently.
@ -148,6 +148,7 @@ typedef struct LsRendererStatus {
uint8_t render_thread; /* Threaded rendering as this run resolved it: bit 0 the render thread, bit 1 the recorder's */
uint8_t hdr_native; /* the game presents in native HDR now: an HDR display, HDR set to Native (host/nn_vi.c) */
uint8_t vibration; /* what plays the controller used last (menu_vibration_status_option) */
uint8_t pad_health; /* controller health bitmask: 0 OK, 1 low battery, 2 poll stall (host/pad_health.h) */
Member

L1 (blocking): The status layout changes without advancing LS_CAPS_LAYOUT.

When: A renderer and host built against opposite sides of this change both accept layout 23, but interpret the bytes after vibration as different fields; for example, the old menu_open byte is read as pad_health.

Do: Advance LS_CAPS_LAYOUT and its Rust mirror together so mismatched layouts are refused.

**L1** (blocking): The status layout changes without advancing LS_CAPS_LAYOUT. *When:* A renderer and host built against opposite sides of this change both accept layout 23, but interpret the bytes after vibration as different fields; for example, the old menu_open byte is read as pad_health. **Do:** Advance LS_CAPS_LAYOUT and its Rust mirror together so mismatched layouts are refused.
@ -1653,0 +1665,4 @@
void draw_pad_health_toast(ui::Ctx& c) {
const int h = pad_health_cache.load(std::memory_order_relaxed);
if (h <= 0) return;
const char* msg = (h & 3) == 3 ? "Controller battery low & polling stalling — check batteries, firmware, or USB"
Member

L7 (should fix): The toast messages are hardcoded in English.

When: A player using any translated menu receives the warning in English even though the new Controls row has translations.

Do: Send the notice through a translatable UI path and provide translations for its messages.

**L7** (should fix): The toast messages are hardcoded in English. *When:* A player using any translated menu receives the warning in English even though the new Controls row has translations. **Do:** Send the notice through a translatable UI path and provide translations for its messages.
@ -1669,13 +1697,19 @@ void menu_record(VkCommandBuffer cmd, uint32_t index, uint32_t w, uint32_t h, in
const bool start = startup_on.load(std::memory_order_acquire);
const bool open = open_now.load(std::memory_order_relaxed);
const bool ui = ui_shown(); // ((longshot) UI's frame: something to draw, or textures to take)
const bool toast = !start && pad_health_cache.load(std::memory_order_relaxed) > 0 &&
Member

L3 (blocking): A warning detected during startup can expire without ever being shown.

When: A low-battery controller is opened during a startup screen lasting at least seven seconds. The timer starts immediately, but the toast is suppressed while startup is active, and the unchanged health bit never starts it again.

Do: Queue the warning until it can be displayed, then start its display interval.

**L3** (blocking): A warning detected during startup can expire without ever being shown. *When:* A low-battery controller is opened during a startup screen lasting at least seven seconds. The timer starts immediately, but the toast is suppressed while startup is active, and the unchanged health bit never starts it again. **Do:** Queue the warning until it can be displayed, then start its display interval.
@ -0,0 +52,4 @@
}
return s->stalled;
}
if (!s->window_start_ns || now_ns - s->window_start_ns > PAD_HEALTH_STALL_WINDOW_NS) {
Member

L6 (should fix): The stall counter uses fixed windows, not the promised sliding window.

When: A stall at 0.1 seconds followed by six stalls between 4.9 and 5.1 seconds resets the counter at 5.1 seconds, so six stalls within five seconds do not trigger the warning.

Do: Keep the recent stall timestamps and count those within the last five seconds; add a boundary-crossing test.

**L6** (should fix): The stall counter uses fixed windows, not the promised sliding window. *When:* A stall at 0.1 seconds followed by six stalls between 4.9 and 5.1 seconds resets the counter at 5.1 seconds, so six stalls within five seconds do not trigger the warning. **Do:** Keep the recent stall timestamps and count those within the last five seconds; add a boundary-crossing test.
@ -0,0 +58,4 @@
} else {
s->window_stalls++;
}
if (s->window_stalls >= PAD_HEALTH_STALL_COUNT) s->stalled = 1;
Member

L2 (blocking): Once set, the stall flag never clears while any controller remains connected.

When: After six slow polls, the player fixes the connection or switches to a healthy controller while another pad remains open. The Controls row still says polling is stalling, and a later recurrence cannot trigger a new toast.

Do: Expire the stall state after a suitable healthy interval and test recovery and a subsequent recurrence.

**L2** (blocking): Once set, the stall flag never clears while any controller remains connected. *When:* After six slow polls, the player fixes the connection or switches to a healthy controller while another pad remains open. The Controls row still says polling is stalling, and a later recurrence cannot trigger a new toast. **Do:** Expire the stall state after a suitable healthy interval and test recovery and a subsequent recurrence.
host/pad_sdl.c Outdated
@ -859,0 +886,4 @@
}
low_bat |= pads[i].battery_low;
}
if (!any_pad) {
Member

L5 (should fix): Battery health is combined across every open pad, although the row says it describes the active controller.

When: An unused low-battery controller remains connected while the player uses a healthy one; the row and toast report low battery for the controller being used.

Do: Report the selected active pad's battery state, or identify the affected pad and make the row's scope explicit.

**L5** (should fix): Battery health is combined across every open pad, although the row says it describes the active controller. *When:* An unused low-battery controller remains connected while the player uses a healthy one; the row and toast report low battery for the controller being used. **Do:** Report the selected active pad's battery state, or identify the affected pad and make the row's scope explicit.
cfw34683 force-pushed feat/controller-battery-stall-warning from d2643ee30a
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 49173c5369
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-04 00:51:52 +00:00
Compare
Author
Contributor

Rebased onto main (45d1863b2) and pushed 49173c536, answering BeanBot's review:

  • L1: LS_CAPS_LAYOUT is now 24, in game/settings_caps.h and the Rust mirror CAPS_LAYOUT.
  • L2: the slow-update flag clears after 15 s with no stall, and the log says so. A later run raises it again. Tested: recovery, then a recurrence.
  • L3, L7: the renderer toast is gone. It couldn't be translated, and it could expire unseen during start-up. The warning is the translated Controls row plus the log line. A toast can come later from a mod (#3069).
  • L4: the row says what is measured, "reading the controllers keeps taking over 10 ms", and no longer mentions Bluetooth. All 13 languages are updated.
  • L5: Low battery is the battery of the controller used last (the same pad Test vibration reports on). Every low pad is still named once in the log.
  • L6: stalls are counted in a sliding 5 s window over the last six stall times. Tested: your boundary case (0.1 s, then six between 4.9 and 5.1 s), and six stalls just over 5 s apart not counting.
  • L8: the row is added to docs/user/graphics-and-controls.md, after DualSense HD Haptics.
  • L9: the description now follows the template.
  • L10: not done yet. This PC has no base to run the game, so the PR goes back to WIP until it has run in game. Still to test lists the runs.

Also: the Controller health texts were still on Rust's UNTRANSLATED list after being translated, which rows_data_tests refuses. They're off it now.

Rebased onto `main` (45d1863b2) and pushed 49173c536, answering BeanBot's review: - **L1:** `LS_CAPS_LAYOUT` is now 24, in `game/settings_caps.h` and the Rust mirror `CAPS_LAYOUT`. - **L2:** the slow-update flag clears after 15 s with no stall, and the log says so. A later run raises it again. Tested: recovery, then a recurrence. - **L3, L7:** the renderer toast is gone. It couldn't be translated, and it could expire unseen during start-up. The warning is the translated Controls row plus the log line. A toast can come later from a mod (#3069). - **L4:** the row says what is measured, "reading the controllers keeps taking over 10 ms", and no longer mentions Bluetooth. All 13 languages are updated. - **L5:** Low battery is the battery of the controller used last (the same pad Test vibration reports on). Every low pad is still named once in the log. - **L6:** stalls are counted in a sliding 5 s window over the last six stall times. Tested: your boundary case (0.1 s, then six between 4.9 and 5.1 s), and six stalls just over 5 s apart not counting. - **L8:** the row is added to `docs/user/graphics-and-controls.md`, after DualSense HD Haptics. - **L9:** the description now follows the template. - **L10:** not done yet. This PC has no base to run the game, so the PR goes back to WIP until it has run in game. Still to test lists the runs. Also: the Controller health texts were still on Rust's `UNTRANSLATED` list after being translated, which `rows_data_tests` refuses. They're off it now.
cfw34683 changed title from feat(hid): warn on low controller battery and Bluetooth poll stalls to WIP: feat(hid): warn on low controller battery and Bluetooth poll stalls 2026-12-04 00:52:07 +00:00
cfw34683 changed title from WIP: feat(hid): warn on low controller battery and Bluetooth poll stalls to WIP: feat(hid): warn on low controller battery and slow controller updates 2026-12-04 00:52:19 +00:00
Merge branch 'main' into feat/controller-battery-stall-warning
Some checks failed
PR description / Title and description (pull_request_target) Successful in 5s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
af2b934b38
Merge main into feat/controller-battery-stall-warning; the battery through hos_sdl_pad_battery
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
22b733e20c
Conflicts with #3044 (RenHDrum 0.7.1 and HD Haptics+) and the menu's new rows:
- The translations: both sides kept.
- game/mods/controls/mod.toml: Controller health moves from order 95 (now DualSense
  game-aware triggers') to 107, after the Xbox rows and before Controller menu button (110);
  menu.test.ts's PLACED and the user docs' table follow.
- host/hos_sdl.h, hos_sdl.c: main's. #3044's hos_sdl_pad_battery replaces this PR's
  hos_sdl_pad_battery_low, which called SDL with the pad's handle even when the builder
  serves the pads (game_builder_pads_remote), where that handle is the builder's.
  pad_health_battery_low now takes that percent: on its battery at 15 % or less.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Merged main (d6e819e08) into the branch and pushed 22b733e20. That merge resolves the conflicts with #3044 and the menu's new rows:

  • Battery source. This PR's hos_sdl_pad_battery_low passed the pad's handle straight to SDL, even when the builder serves the pads (game_builder_pads_remote), where that handle is the builder's. It's gone. The battery now comes from #3044's hos_sdl_pad_battery, which answers for both kinds of pad. Low means on its battery at 15% or less. host/hos_sdl.c and hos_sdl.h are now unchanged from main.
  • Row position. Controller health was at order 95, which DualSense game-aware triggers now uses. It moves to 107: after the Xbox rows, before Controller menu button (110). menu.test.ts and the user docs' table are updated to match.
  • Translations. Both sides kept.

Checks on the merge: the pad-health, menu, vibration, i18n and keyboard checks pass. The Rust and menu-mod tests pass apart from two that fail on clean main on this PC too; the description names them. The smoke run in game passed on the previous head. The Controls tab screenshot is still to take.

Merged `main` (d6e819e08) into the branch and pushed 22b733e20. That merge resolves the conflicts with #3044 and the menu's new rows: - **Battery source.** This PR's `hos_sdl_pad_battery_low` passed the pad's handle straight to SDL, even when the builder serves the pads (`game_builder_pads_remote`), where that handle is the builder's. It's gone. The battery now comes from #3044's `hos_sdl_pad_battery`, which answers for both kinds of pad. Low means on its battery at 15% or less. `host/hos_sdl.c` and `hos_sdl.h` are now unchanged from `main`. - **Row position.** Controller health was at order 95, which DualSense game-aware triggers now uses. It moves to 107: after the Xbox rows, before Controller menu button (110). `menu.test.ts` and the user docs' table are updated to match. - **Translations.** Both sides kept. Checks on the merge: the pad-health, menu, vibration, i18n and keyboard checks pass. The Rust and menu-mod tests pass apart from two that fail on clean `main` on this PC too; the description names them. The smoke run in game passed on the previous head. The Controls tab screenshot is still to take.
Author
Contributor

Ran in game on 22b733e20 (Windows 10, RTX 3070 Ti, a controller connected): Insert, Controls. Controller health sits after Xbox direct rumble and before Controller menu button, reads OK, and shows its help and hint. Screenshot attached. dev.py smoke passes on the same build, and the full mise run test has no failure of its own (the description names the 49 that fail on clean main on this PC too).

A maintainer, please approve this PR's CI run: it waits on approval as a PR from a fork. Its Linux build settles the last box.

controller-health-22b733e20.jpg

Ran in game on 22b733e20 (Windows 10, RTX 3070 Ti, a controller connected): Insert, Controls. Controller health sits after Xbox direct rumble and before Controller menu button, reads **OK**, and shows its help and hint. Screenshot attached. `dev.py smoke` passes on the same build, and the full `mise run test` has no failure of its own (the description names the 49 that fail on clean `main` on this PC too). A maintainer, please approve this PR's CI run: it waits on approval as a PR from a fork. Its Linux build settles the last box. ![controller-health-22b733e20.jpg](https://git.magicbean.dev/attachments/e9595fd5-3b48-49be-9753-46b28984d6e3)
Author
Contributor

The same spot on main and here: Insert, Controls, the end of the Controller section, with the same controller connected.

  • main (Nightly 1089, d6e819e08): Xbox direct rumble, then Controller menu button.
  • This PR (22b733e20, that main merged): Xbox direct rumble, then Controller health: OK, then Controller menu button.

controls-main-d6e819e08.jpg

controls-pr-22b733e20.jpg

The same spot on `main` and here: Insert, Controls, the end of the Controller section, with the same controller connected. - **`main`** (Nightly 1089, d6e819e08): Xbox direct rumble, then Controller menu button. - **This PR** (22b733e20, that `main` merged): Xbox direct rumble, then **Controller health: OK**, then Controller menu button. ![controls-main-d6e819e08.jpg](https://git.magicbean.dev/attachments/f6fe4848-6237-42ef-8af9-a677dfdfa5ca) ![controls-pr-22b733e20.jpg](https://git.magicbean.dev/attachments/5a174714-2c65-42ed-90b2-6df304541ffe)
Author
Contributor

Built and checked on Linux (Ubuntu 26.04 under WSL 2, tools.lock's toolchain), on 22b733e20:

  • Host C for Linux (check_host_compile.py with dev.py env): 83 units, 0 failed.
  • Host C for Windows, run as CI's host-windows job runs it (llvm-mingw's Linux build, tools.lock's windows-x64 headers and FFmpeg): 81 units, 0 failed.
  • Rust: cargo test -p host-sys -p api: 23 and 566 passed.
  • mise run test: 885 passed, 2 failed. The 2, test_gfx_world and test_lifter, fail the same way on clean main d6e819e08.

Every box of Ready for review is settled, so this leaves WIP.

Built and checked on Linux (Ubuntu 26.04 under WSL 2, tools.lock's toolchain), on 22b733e20: - **Host C for Linux** (`check_host_compile.py` with `dev.py env`): 83 units, 0 failed. - **Host C for Windows**, run as CI's host-windows job runs it (llvm-mingw's Linux build, tools.lock's windows-x64 headers and FFmpeg): 81 units, 0 failed. - **Rust:** `cargo test -p host-sys -p api`: 23 and 566 passed. - **`mise run test`:** 885 passed, 2 failed. The 2, `test_gfx_world` and `test_lifter`, fail the same way on clean `main` d6e819e08. Every box of Ready for review is settled, so this leaves WIP.
cfw34683 changed title from WIP: feat(hid): warn on low controller battery and slow controller updates to feat(hid): warn on low controller battery and slow controller updates 2026-12-04 14:22:03 +00:00
Merge branch 'main' into feat/controller-battery-stall-warning
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
88c1d73ddc
Owner
@rebase
Member

I didn't rebase this pull request: it doesn't allow edits from maintainers (the author can turn on Allow edits from maintainers).


Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I didn't rebase this pull request: it doesn't allow edits from maintainers (the author can turn on *Allow edits from maintainers*). --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Author
Contributor

Rebased onto latest main (8c0beeec5) and ported status forwarding from the removed gpu/vk/vk_menu.cpp to the new Rust device-status path (hos_pad_health_status() in host/pad_sdl.c → host-sys → api::services::devices, matching hos_vibration_status() with zero gpu/vk/ edits).

Verified tests/test_pad_health.py (passed) and dev.py cargo -- test -p host-sys (7/7 passed, 0 warnings). (Allow edits from maintainers is also now enabled.)

Rebased onto latest `main` (`8c0beeec5`) and ported status forwarding from the removed `gpu/vk/vk_menu.cpp` to the new Rust device-status path (`hos_pad_health_status()` in `host/pad_sdl.c` → `host-sys` → `api::services::devices`, matching `hos_vibration_status()` with zero `gpu/vk/` edits). Verified `tests/test_pad_health.py` (passed) and `dev.py cargo -- test -p host-sys` (7/7 passed, 0 warnings). (Allow edits from maintainers is also now enabled.)
cfw34683 force-pushed feat/controller-battery-stall-warning from 88c1d73ddc
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 8c0beeec5d
Some checks failed
CI / Game-free checks (run_all.py, part 2/2) (push) Blocked by required conditions
CI / What the change needs (push) Waiting to run
CI / Lint (pre-commit, ShellCheck, actionlint) (push) Blocked by required conditions
CI / Third-party parts and guide screenshots (push) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (push) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (push) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (push) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (push) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (push) Blocked by required conditions
CI / Website build and checks (push) Blocked by required conditions
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
PR description / Title and description (pull_request_target) Has been cancelled
2026-12-06 00:47:36 +00:00
Compare
feat(hid): warn on low controller battery and slow controller updates
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
f8bc686124
Adds a read-only Controller health status row to the Controls menu (translated across all 13 menu languages and documented in docs/user/graphics-and-controls.md) and logs low-battery / slow-poll warnings in host/pad_sdl.c.

- Track per-pad low battery (<=15% on battery via hos_sdl_pad_battery) for the active controller and sliding-window SDL poll stalls (>10 ms, 6 times in 5 s, clearing after 15 s without stalls) in host/pad_health.h.
- Export hos_pad_health_status() from host/pad_sdl.c -> host-sys -> api::services::devices into LsRendererStatus.pad_health (advancing LS_CAPS_LAYOUT in lockstep between game/settings_caps.h and host-sys).
- Add unit and wiring checks in tests/test_pad_health.py.

Assisted-by: Antigravity
Co-Authored-By: Antigravity <[email protected]>
cfw34683 force-pushed feat/controller-battery-stall-warning from f8bc686124
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to f040848faa
Some checks are pending
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
2026-12-06 02:44:19 +00:00
Compare
Some checks are pending
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/controller-battery-stall-warning:cfw34683-feat/controller-battery-stall-warning'
git switch 'cfw34683-feat/controller-battery-stall-warning'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!3038
No description provided.