feat(tools): press several buttons together from pad_input.py #9079

Merged
JJenkx merged 2 commits from upstream-pr/9079 into main 2026-10-22 22:09:00 +00:00
JJenkx commented 2026-10-21 11:55:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T11:55:50Z.


What

Some titles wait for a chord: RollerCoaster Tycoon Adventures Deluxe (PPSA17330) asks for L1 + R1 on its title screen. The pad command file already carries a button bit field, but tools/pad_input.py accepted only one button name, so a scripted test could not get past that screen.

  • Chords. Button names joined by +, such as l1+r1, are combined into one command and pressed together for the same hold time.
  • Rejected input. Unknown names, a duplicate name, an empty part, and release inside a chord are reported as argument errors (exit code 2) without touching the command file.
  • Unchanged. Single names work as before, and so do the stick options.
  • Docs. docs/user/USAGE.md lists the form.

Tested

Linux 7.2.9, Python 3.

  • python3 -m unittest tests.test_pad_input in tools: 14 tests pass.
  • The two new tests fail with main's pad_input.py:
    • l1+r1 gives 0x400 | 0x800, and cross+square+up with --hold-ms 40 keeps the hold and advances the sequence;
    • the invalid forms are rejected and leave the command file as it was.
  • PPSA17330 01.002.000, natively on main b5d763770a:
    • Cross-only input stayed on the title screen for 240 s;
    • an L1 + R1 command (mask 0xc00, written in this format) reached the play-mode menu and the tutorial park (discussion #9078).

#6531 changes other lines of the same file (path validation and output encoding); the two do not overlap.

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 (testing tool)
  • GPUs tested: none needed (Python tool)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4951129141 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9079). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T11:55:50Z. --- ### What Some titles wait for a chord: RollerCoaster Tycoon Adventures Deluxe (PPSA17330) asks for **L1 + R1** on its title screen. The pad command file already carries a button bit field, but `tools/pad_input.py` accepted only one button name, so a scripted test could not get past that screen. - **Chords.** Button names joined by `+`, such as `l1+r1`, are combined into one command and pressed together for the same hold time. - **Rejected input.** Unknown names, a duplicate name, an empty part, and `release` inside a chord are reported as argument errors (exit code 2) without touching the command file. - **Unchanged.** Single names work as before, and so do the stick options. - **Docs.** `docs/user/USAGE.md` lists the form. ### Tested Linux 7.2.9, Python 3. - `python3 -m unittest tests.test_pad_input` in `tools`: 14 tests pass. - The two new tests fail with main's `pad_input.py`: - `l1+r1` gives `0x400 | 0x800`, and `cross+square+up` with `--hold-ms 40` keeps the hold and advances the sequence; - the invalid forms are rejected and leave the command file as it was. - PPSA17330 01.002.000, natively on main `b5d763770a`: - Cross-only input stayed on the title screen for 240 s; - an L1 + R1 command (mask `0xc00`, written in this format) reached the play-mode menu and the tutorial park ([discussion #9078](https://github.com/boykopovar/AnyPS5/discussions/9078)). #6531 changes other lines of the same file (path validation and output encoding); the two do not overlap. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 (testing tool) - [x] GPUs tested: none needed (Python tool) - [x] AI-assisted: yes
harisibrar1 commented 2026-10-21 14:08:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-21T14:08:23Z.

Review: APPROVED


Verified on Windows 11, Python 3.14, merged onto main 80565c594:

  • python -m unittest tests.test_pad_input (tools/): 14 run, 2 skipped (POSIX-only permission tests), rest pass. Same at the PR head. tests.test_pad_timeline also passes, since it imports BUTTONS/next_sequence from this module.
  • With main's pad_input.py swapped in, the new tests fail (1 error in test_joined_buttons_are_pressed_together, 5 failing subtests in test_invalid_joined_buttons_report_error_and_preserve_command), so they cover the change.
  • Command-line runs: l1+r1 writes mask 3072 (0xC00), release still writes 0, and L1+r1 exits 2 with the "invalid button" message.
  • Consumer check: InputCommandFile.hpp reads the button field as one integer and only rejects bits outside 0x10fffe | TouchLeftBit | TouchRightBit, so every OR of BUTTONS values is accepted. The file format is unchanged, and the existing C++ test already uses a multi-bit mask (0x4800).
  • python tools/check_conventions.py --base main: all checks passed.
  • Minor, non-blocking: with choices= gone, --help no longer lists the button names. They still appear in the error message.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5601040442 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9079#pullrequestreview-5601040442). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-21T14:08:23Z. **Review:** APPROVED --- Verified on Windows 11, Python 3.14, merged onto main 80565c594: - `python -m unittest tests.test_pad_input` (tools/): 14 run, 2 skipped (POSIX-only permission tests), rest pass. Same at the PR head. `tests.test_pad_timeline` also passes, since it imports `BUTTONS`/`next_sequence` from this module. - With main's `pad_input.py` swapped in, the new tests fail (1 error in `test_joined_buttons_are_pressed_together`, 5 failing subtests in `test_invalid_joined_buttons_report_error_and_preserve_command`), so they cover the change. - Command-line runs: `l1+r1` writes mask 3072 (0xC00), `release` still writes 0, and `L1+r1` exits 2 with the "invalid button" message. - Consumer check: `InputCommandFile.hpp` reads the button field as one integer and only rejects bits outside `0x10fffe | TouchLeftBit | TouchRightBit`, so every OR of `BUTTONS` values is accepted. The file format is unchanged, and the existing C++ test already uses a multi-bit mask (0x4800). - `python tools/check_conventions.py --base main`: all checks passed. - Minor, non-blocking: with `choices=` gone, `--help` no longer lists the button names. They still appear in the error message. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
JJenkx commented 2026-10-21 16:11:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T16:11:19Z.


Addressed the help-text nit in ba09143027: --help lists every button name again, keeps the l1+r1 example, and states that release must be used alone. Input parsing is unchanged.

Linux validation: python3 -m unittest tests.test_pad_input tests.test_pad_timeline in tools passes all 30 tests; convention checks pass against origin/main. The updated branch merges cleanly with main cecb540a63. No additional Windows run is claimed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6320659796 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9079#issuecomment-6320659796). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T16:11:19Z. --- Addressed the help-text nit in `ba09143027`: `--help` lists every button name again, keeps the `l1+r1` example, and states that `release` must be used alone. Input parsing is unchanged. Linux validation: `python3 -m unittest tests.test_pad_input tests.test_pad_timeline` in `tools` passes all 30 tests; convention checks pass against `origin/main`. The updated branch merges cleanly with main `cecb540a63`. No additional Windows run is claimed.
harisibrar1 commented 2026-10-21 17:56:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-21T17:56:50Z.

Review: APPROVED


Rechecked ba0914302 merged onto main 950388bfd on Windows 11: --help lists every button name again with the l1+r1 example and the note that release must be used alone, and tests.test_pad_input/tests.test_pad_timeline pass (3 POSIX-only skips).

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5603989766 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9079#pullrequestreview-5603989766). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-21T17:56:50Z. **Review:** APPROVED --- Rechecked ba0914302 merged onto main 950388bfd on Windows 11: `--help` lists every button name again with the `l1+r1` example and the note that `release` must be used alone, and `tests.test_pad_input`/`tests.test_pad_timeline` pass (3 POSIX-only skips). Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
THEMANnt commented 2026-10-21 18:51:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-21T18:51:17Z.

Review: APPROVED


Reviewed at ba0914302 on Windows 11, Python 3.11.9, with both commits cherry-picked onto main f894ba69d300. No blocking findings.

  • Pad-input and timeline suites: 27 passed, 3 POSIX-only skips (30 run), both on the exact PR head and the local cherry-pick.
  • Negative control with main's helper rejects the new valid chord; the two new tests reproduce one error and five diagnostic-assertion failures.
  • Compiled a standalone oracle with GCC 15.2 against the production InputCommandFile.hpp (identical on main and this PR). All 174 Python-generated commands round-trip correctly: every button pair, single buttons, an all-button chord and a three-button chord, with hold/release timing, sticks and touchpad flags checked.
  • All 19 single-button cases match main. Six real CLI chord/release probes pass; 40 invalid chord/hold/stick cases leave existing or absent command files unchanged, without leftover temporary files. Help lists all names and the release-only rule.
  • Conventions and whitespace checks pass.

The #6531 overlap concerns adjacent argument/path validation and output encoding, rather than another chord implementation; both validations need to be retained when combining those changes.

No game, physical controller, Linux/POSIX permissions or full native project build was tested. The native check above exercises the file reader only.

AI-assisted: yes (Codex); all results above were run locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5604642095 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9079#pullrequestreview-5604642095). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-21T18:51:17Z. **Review:** APPROVED --- Reviewed at `ba0914302` on Windows 11, Python 3.11.9, with both commits cherry-picked onto main `f894ba69d300`. No blocking findings. - Pad-input and timeline suites: 27 passed, 3 POSIX-only skips (30 run), both on the exact PR head and the local cherry-pick. - Negative control with main's helper rejects the new valid chord; the two new tests reproduce one error and five diagnostic-assertion failures. - Compiled a standalone oracle with GCC 15.2 against the production `InputCommandFile.hpp` (identical on main and this PR). All 174 Python-generated commands round-trip correctly: every button pair, single buttons, an all-button chord and a three-button chord, with hold/release timing, sticks and touchpad flags checked. - All 19 single-button cases match main. Six real CLI chord/release probes pass; 40 invalid chord/hold/stick cases leave existing or absent command files unchanged, without leftover temporary files. Help lists all names and the release-only rule. - Conventions and whitespace checks pass. The #6531 overlap concerns adjacent argument/path validation and output encoding, rather than another chord implementation; both validations need to be retained when combining those changes. No game, physical controller, Linux/POSIX permissions or full native project build was tested. The native check above exercises the file reader only. AI-assisted: yes (Codex); all results above were run locally.
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!9079
No description provided.