feat(pad): let controller timelines hold stick positions #16097

Merged
LeandroLP23 merged 1 commit from upstream-pr/16097 into main 2026-11-11 11:23:46 +00:00
LeandroLP23 commented 2026-11-05 16:46:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-11-05T16:46:36Z.


What

A controller timeline (APS5_PAD_INPUT_FILE, tools/pad_timeline.py) could only press buttons, while a single pulse can already set the four stick axes. Titles whose menus move only with the left stick cannot be driven by a timeline. SuperTuxKart (PPSA69421) is one: its input.xml binds menuUp/Down/Left/Right to axes 0 and 1 and menuSelect to button 0, so d-pad presses do nothing in its menus.

  • Runtime (InputCommandFile.hpp): a timeline row may be start duration buttons or start duration buttons lx ly rx ry, the same axis order and 0..255 range as a pulse. While the row is active its axes replace the physical sticks; rows without axes keep them as before. The row is split with the separators the numeric extraction accepted before (whitespace, or a + sign starting the next number), so existing timelines such as 0+500+16 still parse.
  • pad_timeline.py: events may hold left_stick and/or right_stick as [x, y]; an event naming one stick writes the other centred (128). Unknown event fields are still rejected.
  • pad_input.py (reading an existing timeline for the next sequence) and preview_pad_timeline.py accept the 7-column rows; the preview shows both sticks.
  • INPUT_MAPPING.md documents the fields.

Tested

  • pad_command_file_tests (InputCommandFile.cpp) with the new cases passes. Built against main's header, the same test fails (input command assertion failed). The new cases: a stick row followed by a button-only row, rows with 4, 6 and 8 columns, an axis of 256 and a non-numeric axis are all refused, and a +-joined 7-column row is accepted.
  • python -m unittest tools.tests.test_pad_timeline tools.tests.test_pad_input tools.tests.test_preview_pad_timeline: 64 pass (3 skipped as on main). New cases cover stick rows, position validation (missing, extra, out of range, bool and float axes), unknown event fields, and sequence handling of stick rows in pad_input.py.
  • Windows 11, Radeon 860M, main 4741457fed with this header: a timeline {"at_ms":0,"hold_ms":400,"buttons":[],"left_stick":[255,128]} sent to SuperTuxKart moves its tutorial dialog's focus from "No" to "Yes" (dumped frames), which button-only timelines could not do. A temporary log in scePadReadState showed the title reading port 0 with the injected buttons and connected=1.
  • python tools/check_conventions.py --base origin/main passes.

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. #15340 adds other cases to tools/tests/test_pad_timeline.py, and #11360 changes pad_input.py's error reporting, not its timeline parsing; whichever lands second rebases.
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (controller input; the live check used a Radeon 860M)
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5175250056 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16097). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-11-05T16:46:36Z. --- ### What A controller timeline (`APS5_PAD_INPUT_FILE`, `tools/pad_timeline.py`) could only press buttons, while a single pulse can already set the four stick axes. Titles whose menus move only with the left stick cannot be driven by a timeline. SuperTuxKart (PPSA69421) is one: its `input.xml` binds `menuUp/Down/Left/Right` to axes 0 and 1 and `menuSelect` to button 0, so d-pad presses do nothing in its menus. - **Runtime** (`InputCommandFile.hpp`): a timeline row may be `start duration buttons` or `start duration buttons lx ly rx ry`, the same axis order and 0..255 range as a pulse. While the row is active its axes replace the physical sticks; rows without axes keep them as before. The row is split with the separators the numeric extraction accepted before (whitespace, or a `+` sign starting the next number), so existing timelines such as `0+500+16` still parse. - **`pad_timeline.py`**: events may hold `left_stick` and/or `right_stick` as `[x, y]`; an event naming one stick writes the other centred (128). Unknown event fields are still rejected. - **`pad_input.py`** (reading an existing timeline for the next sequence) and **`preview_pad_timeline.py`** accept the 7-column rows; the preview shows both sticks. - **`INPUT_MAPPING.md`** documents the fields. ### Tested - `pad_command_file_tests` (`InputCommandFile.cpp`) with the new cases passes. Built against `main`'s header, the same test fails (`input command assertion failed`). The new cases: a stick row followed by a button-only row, rows with 4, 6 and 8 columns, an axis of 256 and a non-numeric axis are all refused, and a `+`-joined 7-column row is accepted. - `python -m unittest tools.tests.test_pad_timeline tools.tests.test_pad_input tools.tests.test_preview_pad_timeline`: 64 pass (3 skipped as on `main`). New cases cover stick rows, position validation (missing, extra, out of range, bool and float axes), unknown event fields, and sequence handling of stick rows in `pad_input.py`. - Windows 11, Radeon 860M, `main` `4741457fed` with this header: a timeline `{"at_ms":0,"hold_ms":400,"buttons":[],"left_stick":[255,128]}` sent to SuperTuxKart moves its tutorial dialog's focus from "No" to "Yes" (dumped frames), which button-only timelines could not do. A temporary log in `scePadReadState` showed the title reading port 0 with the injected buttons and `connected=1`. - `python tools/check_conventions.py --base origin/main` passes. ### 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. #15340 adds other cases to `tools/tests/test_pad_timeline.py`, and #11360 changes `pad_input.py`'s error reporting, not its timeline parsing; whichever lands second rebases. - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (controller input; the live check used a Radeon 860M) - [x] AI-assisted: yes (Claude Code)
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!16097
No description provided.