feat(overlay): show controller status on demand or on connect, disconnect and battery drop #12702
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12702"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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_STATUSunset or0) 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.ShowPadStatusinput action, F9 by default, rebindable and keyboard-only likeScreenshot: 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).P1 DUALSENSE WIRED,P2 XBOX BATTERY MEDIUM,P3 DISCONNECTED, orNO CONTROLLER. The overlay font is upper-case only. Battery is SDL'sSDL_JoystickCurrentPowerLevelclass (SDL 2.0.4 API, submodule4b69833);BATTERY UNKNOWNwhen SDL reports none. Names of other controllers are reduced to the font's glyphs and cut to 12 columns.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.Design: the timeout is a pure state machine (
PadStatusDisplay, injected clock) in libSceAgcDriver;PadStatusProvider/PadStatusSnapshotcarry 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;
ShowPadStatusaction (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 ofpad_status_sdl_testson MinGW, gating of the controller snapshot (PadStatusDisplay::Poll) and its test, and the docs on what runs while hidden and on a key shared withShowPadStatus.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/mainedf6804cf5plus two unrelated tools commits). Build and ctest results below are from the same tree atedf6804cf5; the last two upstream commits touch onlytools/symbolize_samples.pyand its test. Baseline is upstream/mainedf6804cf5in a second tree.Per test, branch / baseline (ctest, headless):
agc_performance_overlay_statisticspass / pass,agc_keyboard_overlaypass / pass,pad_input_mappingpass / pass,pad_keyboard_mousepass / pass. New:agc_pad_status_overlay,_shared,_events,_invalid,pad_status_sdlpass. Input mappernode --test tests: 26 pass on the branch (25 on main plus the new test). Windows:pad_status_sdl_testsnow usesconfigure_host_test_executablelike 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_sj0and 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 isvideo_out_flip_padstatus).was not found but was requested by env var VK_INSTANCE_LAYERS: 0 on both.VUID-lines andValidation Errorlines: 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_mappingandpad_keyboard_mouse), the show-only-when-asked check (failsvideo_out_flip_padstatusand 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 reportUNASSIGNED-CoreValidation-DrawState-InvalidRenderpasswhile 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 inPollis behaviour-neutral and no test fails without it. Gating:Wantsalways 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
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)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:
windowsfails linkingpad_status_sdl_tests:PadStatusSdl.cpp.obj: undefined reference to __gxx_personality_v0(core/libs/prx/libSceVideoOut/CMakeLists.txt:161-164). The target does not linklibc;pad_input_mapping_testsjust above linksSDL2-static libcand setsPATH=path_list_prepend:$<TARGET_FILE_DIR:libc>on its test underWIN32. Do the same here (or the-static -static-libgcc -static-libstdc++MinGW block used bypad_keyboard_mouse_tests).docs/user/USAGE.md:457says 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.docs/user/INPUT_MAPPING.mdsaying a key shared with another action triggers both, so someone who movedScreenshotorTogglePerformanceOverlayto F9 should rebindShowPadStatus.