feat(pad): hold the sticks from the controller command file #4032

Merged
fma-rc merged 1 commit from upstream-pr/4032 into main 2026-10-12 08:37:31 +00:00
fma-rc commented 2026-10-11 21:41:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-11T21:41:33Z.


What

The controller command file for test runs (APS5_PAD_INPUT_FILE, tools/pad_input.py) could only press buttons. A command line may now carry four more fields, leftX leftY rightX rightY, each 0-255 with 128 as the centre, and the helper gets --left-stick X Y and --right-stick X Y:

python3 tools/pad_input.py /tmp/anyps5-pad release --left-stick 128 0 --hold-ms 2000

While such a command is active both sticks in the pad data come from it instead of the physical controller, and they go back when it expires. Three-field lines behave as before. A line with any other field count, an axis above 255 or a field that is not a whole number is ignored, like malformed lines were; the parser now splits the line into fields first and parses each one completely.

I needed this to get past the first tutorial of Astro's Playroom (PPSA01325) in a scripted run: the level asks for the left stick before anything else.

Tested

Arch Linux, GCC 16.2.1, main 752db7da7 with this commit. guest_pad passes. With PadState.cpp reverted it aborts on the new stick assertion. tools/check_conventions.py --base origin/main passes. guest_pad and the checker pass again after the rebase onto main 34a16b7f0 (2026-10-12), on NVIDIA, RADV and lavapipe. That rebase resolved a conflict in PadState.cpp with the analog trigger change merged since: the trigger rule is the one on main, with the command file's buttons as the injected ones. Not built on Windows; the new test code uses only <chrono>, <thread> and <fstream>.

Astro's Playroom on an RTX 5080 with #3669, #425, #3750, #3878 and #3933 merged locally (it does not reach the level without them): --left-stick 128 0 makes Astro run forward, 255 128 to the right and 128 255 toward the camera. PRs 3669 and 3750 have merged since; the title was not run again on the new base.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4822577072 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4032). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-11T21:41:33Z. --- ### What The controller command file for test runs (`APS5_PAD_INPUT_FILE`, `tools/pad_input.py`) could only press buttons. A command line may now carry four more fields, `leftX leftY rightX rightY`, each 0-255 with 128 as the centre, and the helper gets `--left-stick X Y` and `--right-stick X Y`: ```sh python3 tools/pad_input.py /tmp/anyps5-pad release --left-stick 128 0 --hold-ms 2000 ``` While such a command is active both sticks in the pad data come from it instead of the physical controller, and they go back when it expires. Three-field lines behave as before. A line with any other field count, an axis above 255 or a field that is not a whole number is ignored, like malformed lines were; the parser now splits the line into fields first and parses each one completely. I needed this to get past the first tutorial of Astro's Playroom (PPSA01325) in a scripted run: the level asks for the left stick before anything else. ### Tested Arch Linux, GCC 16.2.1, `main` 752db7da7 with this commit. `guest_pad` passes. With `PadState.cpp` reverted it aborts on the new stick assertion. `tools/check_conventions.py --base origin/main` passes. `guest_pad` and the checker pass again after the rebase onto `main` 34a16b7f0 (2026-10-12), on NVIDIA, RADV and lavapipe. That rebase resolved a conflict in `PadState.cpp` with the analog trigger change merged since: the trigger rule is the one on `main`, with the command file's buttons as the injected ones. Not built on Windows; the new test code uses only `<chrono>`, `<thread>` and `<fstream>`. Astro's Playroom on an RTX 5080 with #3669, #425, #3750, #3878 and #3933 merged locally (it does not reach the level without them): `--left-stick 128 0` makes Astro run forward, `255 128` to the right and `128 255` toward the camera. PRs 3669 and 3750 have merged since; the title was not run again on the new base. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-12 03:17:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T03:17:07Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3998 core/libs/prx/libScePad/include/InputCommandFile.hpp L3, L23-24, L27, L29-30, L33-34, L43, L45-47, L54-55
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117107548 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4032#issuecomment-6117107548). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T03:17:07Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3998 | `core/libs/prx/libScePad/include/InputCommandFile.hpp` [L3](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L3), [L23-24](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L23-L24), [L27](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L27), [L29-30](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L29-L30), [L33-34](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L33-L34), [L43](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L43), [L45-47](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L45-L47), [L54-55](https://github.com/boykopovar/AnyPS5/blob/9bc362351780feb4ac57e0c10790ce5727f78cc6/core/libs/prx/libScePad/include/InputCommandFile.hpp#L54-L55) | | |
EagleBearerYS commented 2026-10-12 06:03:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-12T06:03:35Z.


Built and tested on Windows 11 Home (10.0.26300) with MinGW-w64 GCC 15.2.0 (WinLibs r7), Release: e0eef6c57 cherry-picks cleanly onto main d146ec1b6, and guest_pad passes (3 runs).

In a title: Planet of Lana (PPSA19450) on an RTX 3070 Laptop GPU, with #4267 applied too, since the game stops before its first frame without it. --left-stick 255 128 walks Lana right and 0 128 left, and cross --left-stick 0 128 jumps while moving left. A script of about 20 such commands replays the first three minutes from a save.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118703678 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4032#issuecomment-6118703678). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-12T06:03:35Z. --- Built and tested on Windows 11 Home (10.0.26300) with MinGW-w64 GCC 15.2.0 (WinLibs r7), Release: e0eef6c57 cherry-picks cleanly onto `main` d146ec1b6, and `guest_pad` passes (3 runs). In a title: Planet of Lana (PPSA19450) on an RTX 3070 Laptop GPU, with #4267 applied too, since the game stops before its first frame without it. `--left-stick 255 128` walks Lana right and `0 128` left, and `cross --left-stick 0 128` jumps while moving left. A script of about 20 such commands replays the first three minutes from a save.
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!4032
No description provided.