feat(pad): reload the input mapping when its file changes #17596

Merged
MarcZX10 merged 16 commits from upstream-pr/17596 into main 2026-11-14 04:41:43 +00:00
MarcZX10 commented 2026-11-09 00:22:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-09T00:22:39Z.


What

With ANYPS5_INPUT_WATCH=1, the input mapping file and the title's profile are checked about once a second on a background thread (modification time and size). A change is reloaded only after it has stayed the same for one check, so a file that is still being written is not read half-way.

Stacked on the reload PR: this branch contains its commits.

Tested

Linux, Debian kernel 6.1.0-54-amd64, Intel Xeon E5-1620 v2. Pad tests do not need a display. Head d4be196be3:

flock <build lock> env VERIFY_DIR=<worktree> VERIFY_TAG=split2 ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(pad_input_mapping|pad_keyboard_mouse)$' pad_input_mapping_tests pad_keyboard_mouse_tests

Output:

BUILD-EXIT 0
1/2 Test #3872: pad_input_mapping ................   Passed    0.02 sec
2/2 Test #3878: pad_keyboard_mouse ...............   Passed    0.02 sec
100% tests passed, 0 tests failed out of 2

Rebased head 4da405bab61fa09d8c48793ee2124bcfa34949eb on base f83d7e1f5444bb813393c10af8422b4c33de31f9 (Linux, GCC 12.2.0, system SDL2 2.26.5). Focused CPU-only checks run after the rebase:

c++ -std=c++20 -O0 -Icore/libs -I/usr/include/SDL2 core/libs/prx/libSceVideoOut/tests/InputMapping.cpp core/libs/prx/libSceVideoOut/src/InputMapping.cpp -o /tmp/anyps5-17596-focused-tests/pad_input_mapping_tests -lSDL2
SDL_VIDEODRIVER=dummy /tmp/anyps5-17596-focused-tests/pad_input_mapping_tests
c++ -std=c++20 -O0 -Icore/libs -I/usr/include/SDL2 core/libs/prx/libSceVideoOut/tests/KeyboardMouse.cpp core/libs/prx/libSceVideoOut/src/KeyboardMouse.cpp -o /tmp/anyps5-17596-focused-tests/pad_keyboard_mouse_tests
/tmp/anyps5-17596-focused-tests/pad_keyboard_mouse_tests

Both tests passed. Syntax-only checks also passed for tests/InputMapping.cpp, src/InputMapping.cpp (with -Wall -Wextra -Werror), and src/PadInput.cpp. No GPU or console test was run on the rebased head.

Overlap: pr_overlap fails closed on 45 PRs that share files. The identifier scan (InputBinding, wheelDirection, ReloadInputMapping, InputMappingWatch, PadChord, padButtons, ANYPS5_INPUT_WATCH, PAD:) finds only #17149 and #17500 (the PR this series replaces). No open PR implements the same functions.

Not verified:

  • A real controller and real window focus. The unit tests use the test drivers.
  • Other operating systems: nothing was run on Windows or macOS.
  • Titles: no title was run with these changes.

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: #17595
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5216723778 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17596). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-09T00:22:39Z. --- ### What With `ANYPS5_INPUT_WATCH=1`, the input mapping file and the title's profile are checked about once a second on a background thread (modification time and size). A change is reloaded only after it has stayed the same for one check, so a file that is still being written is not read half-way. Stacked on the reload PR: this branch contains its commits. ### Tested Linux, Debian kernel 6.1.0-54-amd64, Intel Xeon E5-1620 v2. Pad tests do not need a display. Head `d4be196be3`: ``` flock <build lock> env VERIFY_DIR=<worktree> VERIFY_TAG=split2 ANYPS5_REQUIRE_DISPLAY=1 bash <main checkout>/.git/info/tools/run_tests.sh '^(pad_input_mapping|pad_keyboard_mouse)$' pad_input_mapping_tests pad_keyboard_mouse_tests ``` Output: ``` BUILD-EXIT 0 1/2 Test #3872: pad_input_mapping ................ Passed 0.02 sec 2/2 Test #3878: pad_keyboard_mouse ............... Passed 0.02 sec 100% tests passed, 0 tests failed out of 2 ``` Rebased head `4da405bab61fa09d8c48793ee2124bcfa34949eb` on base `f83d7e1f5444bb813393c10af8422b4c33de31f9` (Linux, GCC 12.2.0, system SDL2 2.26.5). Focused CPU-only checks run after the rebase: ```sh c++ -std=c++20 -O0 -Icore/libs -I/usr/include/SDL2 core/libs/prx/libSceVideoOut/tests/InputMapping.cpp core/libs/prx/libSceVideoOut/src/InputMapping.cpp -o /tmp/anyps5-17596-focused-tests/pad_input_mapping_tests -lSDL2 SDL_VIDEODRIVER=dummy /tmp/anyps5-17596-focused-tests/pad_input_mapping_tests c++ -std=c++20 -O0 -Icore/libs -I/usr/include/SDL2 core/libs/prx/libSceVideoOut/tests/KeyboardMouse.cpp core/libs/prx/libSceVideoOut/src/KeyboardMouse.cpp -o /tmp/anyps5-17596-focused-tests/pad_keyboard_mouse_tests /tmp/anyps5-17596-focused-tests/pad_keyboard_mouse_tests ``` Both tests passed. Syntax-only checks also passed for `tests/InputMapping.cpp`, `src/InputMapping.cpp` (with `-Wall -Wextra -Werror`), and `src/PadInput.cpp`. No GPU or console test was run on the rebased head. Overlap: pr_overlap fails closed on 45 PRs that share files. The identifier scan (InputBinding, wheelDirection, ReloadInputMapping, InputMappingWatch, PadChord, padButtons, ANYPS5_INPUT_WATCH, PAD:) finds only #17149 and #17500 (the PR this series replaces). No open PR implements the same functions. Not verified: - A real controller and real window focus. The unit tests use the test drivers. - Other operating systems: nothing was run on Windows or macOS. - Titles: no title was run with these changes. ### 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: #17595 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!17596
No description provided.