feat(overlay): show controller status on demand or on connect, disconnect and battery drop #12702

Merged
MarcZX10 merged 25 commits from upstream-pr/12702 into main 2026-10-30 12:05:28 +00:00
MarcZX10 commented 2026-10-29 03:08:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T03:08:54Z.


What

An optional, temporary controller status panel in the overlay. It is never visible all the time: by default (ANYPS5_PAD_STATUS unset or 0) the presentation is exactly as before.

  • ANYPS5_PAD_STATUS=1 (events mode): the panel shows for 4 s when a controller connects (also one already connected at start), disconnects, is replaced in its slot, or its battery enters a lower class (full, medium, low, empty). A new event restarts the 4 s. Any other value stops the game at video-out start with an error naming the variable.
  • ShowPadStatus input action, F9 by default, rebindable and keyboard-only like Screenshot: shows the panel for 4 s, also with the variable at 0. F9 was chosen because no default binding uses it (F7, F10, F11, F12 are taken; #12569 takes F5, F6 and F8).
  • Content: one line per slot that has had a controller (with the variable at 0, since the first F9 press: nothing is tracked before), P1 DUALSENSE WIRED, P2 XBOX BATTERY MEDIUM, P3 DISCONNECTED, or NO CONTROLLER. The overlay font is upper-case only. Battery is SDL's SDL_JoystickCurrentPowerLevel class (SDL 2.0.4 API, submodule 4b69833); BATTERY UNKNOWN when SDL reports none. Names of other controllers are reduced to the font's glyphs and cut to 12 columns.
  • Priority: the system keyboard wins; the panel is not drawn while it is shown (its 4 s keep running). The panel sits in the corner mirrored horizontally from ANYPS5_OVERLAY_POS, so it does not cover the performance overlay (tested for both pages, all corners, 640x360 to 3840x2160). Screenshots do not include it.
  • While hidden nothing is drawn and nothing is allocated; each present and each video-out loop pass takes a lock and reads the clock, and with the variable unset or 0 and no F9 press no controller name is copied and no battery level is read.
  • Host-only; no console behaviour.

Design: the timeout is a pure state machine (PadStatusDisplay, injected clock) in libSceAgcDriver; PadStatusProvider/PadStatusSnapshot carry no SDL types; libSceVideoOut maps SDL types and power levels and reports only changed snapshots; the presentation draws it with its own overlay instance between the keyboard and the performance overlay. No new overlay slot was needed.

Commits (25 plus two merges of upstream/main): state machine + test; line formatting + test; layout/priority/shared display + test; presentation drawing; ShowPadStatus action (native + input mapper catalogue and its source-contract tests) + C++ tests + mapper test; SDL mappings + test; PadInput wiring; Vulkan flip test with the panel under the validation layer; docs (ENVIRONMENT, USAGE, INPUT_MAPPING); then, after review, the host-only link of pad_status_sdl_tests on MinGW, gating of the controller snapshot (PadStatusDisplay::Poll) and its test, and the docs on what runs while hidden and on a key shared with ShowPadStatus.

Overlaps with open PRs: #12569 edits PadInput.cpp, InputMapping.hpp/.cpp, KeyboardMouse, PadInputTypes.hpp, mapping.js, USAGE.md and ENVIRONMENT.md (adjacent lines, no shared logic; I did not depend on it). #12379 edits PadInput.cpp and KeyboardOverlay.*; this PR touches neither KeyboardOverlay file. Default keys are distinct from #12569's.

Tested

Linux x86-64 (Debian 12 kernel 6.1), GCC 12, archive build with the host CPU gate patched. Head 4378b67efd (merge of upstream/main edf6804cf5 plus two unrelated tools commits). Build and ctest results below are from the same tree at edf6804cf5; the last two upstream commits touch only tools/symbolize_samples.py and its test. Baseline is upstream/main edf6804cf5 in a second tree.

Per test, branch / baseline (ctest, headless): agc_performance_overlay_statistics pass / pass, agc_keyboard_overlay pass / pass, pad_input_mapping pass / pass, pad_keyboard_mouse pass / pass. New: agc_pad_status_overlay, _shared, _events, _invalid, pad_status_sdl pass. Input mapper node --test tests: 26 pass on the branch (25 on main plus the new test). Windows: pad_status_sdl_tests now uses configure_host_test_executable like the maintainer's fix for the rumble test; cross-linked with Debian's x86_64-w64-mingw32 g++ 12 (SJLJ exceptions, not CI's SEH GCC 15), where the old flags give an undefined __gxx_personality_sj0 and the helper's flags link; not run.

Under Xvfb (-DANYPS5_VIDEO_OUT_TEST_DRIVER=x11, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -V -R '^(video_out_flip_.*|agc_performance_overlay.*)$'): baseline 21/21 pass, branch 22/22 pass (the extra one is video_out_flip_padstatus). was not found but was requested by env var VK_INSTANCE_LAYERS: 0 on both. VUID- lines and Validation Error lines: 0 on both.

Negative controls (code broken in the archive copy, the new test fails at the intended case, restored): corner mirroring, keyboard priority, panel width, env default and env parse (shared, events, invalid), a power text, name truncation, the seen-slot filter, the request flag, the keyboard-only restriction, the default key (fails pad_input_mapping and pad_keyboard_mouse), the show-only-when-asked check (fails video_out_flip_padstatus and the unit tests). The state machine (13 mutations) and SDL mappings (10) were broken in standalone builds and fail. Mapper: moving the default, dropping the keyboard-only rule and dropping the action each fail the mapper tests. Breaking the layout chain of the panel's pass makes the validation layer report UNASSIGNED-CoreValidation-DrawState-InvalidRenderpass while the test still passes, so the flip test is a validation check, not an assertion. A duplicate action name in the parser table is not caught by any test (not controlled); skipping an unchanged snapshot in Poll is behaviour-neutral and no test fails without it. Gating: Wants always true, or true only in events mode, fails the poll tests. Conventions, git diff --check, env_reference.py --check, header audit: clean.

NOT RUN: Windows, macOS, a hardware GPU, any real controller. No real controller battery was read: the power-level mapping is tested on SDL's enum values only, and the panel was never seen with a real DualSense, Xbox or Switch pad or checked for what each driver reports. The panel's pixels were not inspected (the flip test checks that frames present and the validation layer is silent; layout is checked as rectangles). A real-time 4 s expiry was not run; expiry is tested with an injected clock.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: llvmpipe (LLVM 15.0.6, 256 bits), Mesa software rasterizer via Xvfb, Debian 12 (kernel 6.1); no hardware GPU
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5061417647 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12702). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T03:08:54Z. --- ### What An optional, temporary controller status panel in the overlay. It is never visible all the time: by default (`ANYPS5_PAD_STATUS` unset or `0`) the presentation is exactly as before. - `ANYPS5_PAD_STATUS=1` (events mode): the panel shows for 4 s when a controller connects (also one already connected at start), disconnects, is replaced in its slot, or its battery enters a lower class (full, medium, low, empty). A new event restarts the 4 s. Any other value stops the game at video-out start with an error naming the variable. - `ShowPadStatus` input action, F9 by default, rebindable and keyboard-only like `Screenshot`: shows the panel for 4 s, also with the variable at 0. F9 was chosen because no default binding uses it (F7, F10, F11, F12 are taken; #12569 takes F5, F6 and F8). - Content: one line per slot that has had a controller (with the variable at 0, since the first F9 press: nothing is tracked before), `P1 DUALSENSE WIRED`, `P2 XBOX BATTERY MEDIUM`, `P3 DISCONNECTED`, or `NO CONTROLLER`. The overlay font is upper-case only. Battery is SDL's `SDL_JoystickCurrentPowerLevel` class (SDL 2.0.4 API, submodule `4b69833`); `BATTERY UNKNOWN` when SDL reports none. Names of other controllers are reduced to the font's glyphs and cut to 12 columns. - Priority: the system keyboard wins; the panel is not drawn while it is shown (its 4 s keep running). The panel sits in the corner mirrored horizontally from `ANYPS5_OVERLAY_POS`, so it does not cover the performance overlay (tested for both pages, all corners, 640x360 to 3840x2160). Screenshots do not include it. - While hidden nothing is drawn and nothing is allocated; each present and each video-out loop pass takes a lock and reads the clock, and with the variable unset or 0 and no F9 press no controller name is copied and no battery level is read. - Host-only; no console behaviour. Design: the timeout is a pure state machine (`PadStatusDisplay`, injected clock) in libSceAgcDriver; `PadStatusProvider`/`PadStatusSnapshot` carry no SDL types; libSceVideoOut maps SDL types and power levels and reports only changed snapshots; the presentation draws it with its own overlay instance between the keyboard and the performance overlay. No new overlay slot was needed. Commits (25 plus two merges of upstream/main): state machine + test; line formatting + test; layout/priority/shared display + test; presentation drawing; `ShowPadStatus` action (native + input mapper catalogue and its source-contract tests) + C++ tests + mapper test; SDL mappings + test; PadInput wiring; Vulkan flip test with the panel under the validation layer; docs (ENVIRONMENT, USAGE, INPUT_MAPPING); then, after review, the host-only link of `pad_status_sdl_tests` on MinGW, gating of the controller snapshot (`PadStatusDisplay::Poll`) and its test, and the docs on what runs while hidden and on a key shared with `ShowPadStatus`. Overlaps with open PRs: #12569 edits PadInput.cpp, InputMapping.hpp/.cpp, KeyboardMouse, `PadInputTypes.hpp`, mapping.js, USAGE.md and ENVIRONMENT.md (adjacent lines, no shared logic; I did not depend on it). #12379 edits PadInput.cpp and KeyboardOverlay.*; this PR touches neither KeyboardOverlay file. Default keys are distinct from #12569's. ### Tested Linux x86-64 (Debian 12 kernel 6.1), GCC 12, archive build with the host CPU gate patched. Head `4378b67efd` (merge of upstream/main `edf6804cf5` plus two unrelated tools commits). Build and ctest results below are from the same tree at `edf6804cf5`; the last two upstream commits touch only `tools/symbolize_samples.py` and its test. Baseline is upstream/main `edf6804cf5` in a second tree. Per test, branch / baseline (ctest, headless): `agc_performance_overlay_statistics` pass / pass, `agc_keyboard_overlay` pass / pass, `pad_input_mapping` pass / pass, `pad_keyboard_mouse` pass / pass. New: `agc_pad_status_overlay`, `_shared`, `_events`, `_invalid`, `pad_status_sdl` pass. Input mapper `node --test tests`: 26 pass on the branch (25 on main plus the new test). Windows: `pad_status_sdl_tests` now uses `configure_host_test_executable` like the maintainer's fix for the rumble test; cross-linked with Debian's x86_64-w64-mingw32 g++ 12 (SJLJ exceptions, not CI's SEH GCC 15), where the old flags give an undefined `__gxx_personality_sj0` and the helper's flags link; not run. Under Xvfb (`-DANYPS5_VIDEO_OUT_TEST_DRIVER=x11`, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ctest -V -R '^(video_out_flip_.*|agc_performance_overlay.*)$'`): baseline 21/21 pass, branch 22/22 pass (the extra one is `video_out_flip_padstatus`). `was not found but was requested by env var VK_INSTANCE_LAYERS`: 0 on both. `VUID-` lines and `Validation Error` lines: 0 on both. Negative controls (code broken in the archive copy, the new test fails at the intended case, restored): corner mirroring, keyboard priority, panel width, env default and env parse (shared, events, invalid), a power text, name truncation, the seen-slot filter, the request flag, the keyboard-only restriction, the default key (fails `pad_input_mapping` and `pad_keyboard_mouse`), the show-only-when-asked check (fails `video_out_flip_padstatus` and the unit tests). The state machine (13 mutations) and SDL mappings (10) were broken in standalone builds and fail. Mapper: moving the default, dropping the keyboard-only rule and dropping the action each fail the mapper tests. Breaking the layout chain of the panel's pass makes the validation layer report `UNASSIGNED-CoreValidation-DrawState-InvalidRenderpass` while the test still passes, so the flip test is a validation check, not an assertion. A duplicate action name in the parser table is not caught by any test (not controlled); skipping an unchanged snapshot in `Poll` is behaviour-neutral and no test fails without it. Gating: `Wants` always true, or true only in events mode, fails the poll tests. Conventions, `git diff --check`, `env_reference.py --check`, header audit: clean. NOT RUN: Windows, macOS, a hardware GPU, any real controller. No real controller battery was read: the power-level mapping is tested on SDL's enum values only, and the panel was never seen with a real DualSense, Xbox or Switch pad or checked for what each driver reports. The panel's pixels were not inspected (the flip test checks that frames present and the validation layer is silent; layout is checked as rectangles). A real-time 4 s expiry was not run; expiry is tested with an injected clock. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: llvmpipe (LLVM 15.0.6, 256 bits), Mesa software rasterizer via Xvfb, Debian 12 (kernel 6.1); no hardware GPU - [x] AI-assisted: yes
adriadam10 commented 2026-10-29 04:05:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-29T04:05:18Z.

Review: CHANGES_REQUESTED


Thanks for the thorough tests. Three things before this can merge:

  • windows fails linking pad_status_sdl_tests: PadStatusSdl.cpp.obj: undefined reference to __gxx_personality_v0 (core/libs/prx/libSceVideoOut/CMakeLists.txt:161-164). The target does not link libc; pad_input_mapping_tests just above links SDL2-static libc and sets PATH=path_list_prepend:$<TARGET_FILE_DIR:libc> on its test under WIN32. Do the same here (or the -static -static-libgcc -static-libstdc++ MinGW block used by pad_keyboard_mouse_tests).
  • Dean's first request is still open: docs/user/USAGE.md:457 says the presentation "does nothing" while the panel is hidden, but each present takes the display mutex and reads the clock, and each loop pass builds the pad snapshot. Reword it to what runs, or build the snapshot only when the mode is on or the panel was requested.
  • Dean's second request is still open: add a sentence to docs/user/INPUT_MAPPING.md saying a key shared with another action triggers both, so someone who moved Screenshot or TogglePerformanceOverlay to F9 should rebind ShowPadStatus.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692720753 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12702#pullrequestreview-5692720753). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-29T04:05:18Z. **Review:** CHANGES_REQUESTED --- Thanks for the thorough tests. Three things before this can merge: - `windows` fails linking `pad_status_sdl_tests`: `PadStatusSdl.cpp.obj: undefined reference to __gxx_personality_v0` (`core/libs/prx/libSceVideoOut/CMakeLists.txt:161-164`). The target does not link `libc`; `pad_input_mapping_tests` just above links `SDL2-static libc` and sets `PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>` on its test under `WIN32`. Do the same here (or the `-static -static-libgcc -static-libstdc++` MinGW block used by `pad_keyboard_mouse_tests`). - Dean's first request is still open: `docs/user/USAGE.md:457` says the presentation "does nothing" while the panel is hidden, but each present takes the display mutex and reads the clock, and each loop pass builds the pad snapshot. Reword it to what runs, or build the snapshot only when the mode is on or the panel was requested. - Dean's second request is still open: add a sentence to `docs/user/INPUT_MAPPING.md` saying a key shared with another action triggers both, so someone who moved `Screenshot` or `TogglePerformanceOverlay` to F9 should rebind `ShowPadStatus`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!12702
No description provided.