fix(libScePad): queue input states for scePadRead #1076

Merged
TideOPL merged 7 commits from upstream-pr/1076 into main 2026-10-11 08:49:45 +00:00
TideOPL commented 2026-10-07 09:16:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-07T09:16:00Z.


What

scePadRead reported only the current pad state and always returned 1, so input that changed and changed back between two reads (a quick tap) was lost.

  • libScePad: every state published by PadPublishInput is queued (up to 64, oldest dropped). scePadRead drains up to num entries oldest first, each with its own timestamp, and returns the count. With nothing queued it writes the current state and returns 1, as before. scePadReadState is unchanged. The scePadRead entry in TechnicalDebt added earlier in this PR is removed.

New test: CheckReadQueue in guest_pad (press and release between two reads must both be reported).

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 5070: full ctest, 386/387 pass. The one failure, agc_driver_scalar_sop1 (movrelsd_2_b32 s13 is 0x00007fff, expected 0xd4cbd76d), fails identically on main without these changes.
  • Ubuntu 24.04 (WSL), GCC 13.3: all non-GPU tests pass.
  • CI on 39463913 (merged into current main): linux and windows pass, including guest_pad, without the Time.cpp fix from #1501.
  • No title or homebrew tested.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4770528692 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1076). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-07T09:16:00Z. --- ### What `scePadRead` reported only the current pad state and always returned 1, so input that changed and changed back between two reads (a quick tap) was lost. - **libScePad:** every state published by `PadPublishInput` is queued (up to 64, oldest dropped). `scePadRead` drains up to `num` entries oldest first, each with its own timestamp, and returns the count. With nothing queued it writes the current state and returns 1, as before. `scePadReadState` is unchanged. The `scePadRead` entry in [TechnicalDebt](docs/dev/TechnicalDebt.md) added earlier in this PR is removed. New test: `CheckReadQueue` in `guest_pad` (press and release between two reads must both be reported). ### Tested - Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 5070: full `ctest`, 386/387 pass. The one failure, `agc_driver_scalar_sop1` (`movrelsd_2_b32 s13 is 0x00007fff, expected 0xd4cbd76d`), fails identically on `main` without these changes. - Ubuntu 24.04 (WSL), GCC 13.3: all non-GPU tests pass. - CI on `39463913` (merged into current `main`): `linux` and `windows` pass, including `guest_pad`, without the `Time.cpp` fix from #1501. - No title or homebrew tested. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-08 03:25:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T03:25:32Z.


Could you split the Time.cpp fix into its own PR? It's a real bug with its own test and can go in on its own. The scePadRead queue changes library behaviour, so that part needs a title that loses input on main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051537125 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1076#issuecomment-6051537125). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T03:25:32Z. --- Could you split the `Time.cpp` fix into its own PR? It's a real bug with its own test and can go in on its own. The `scePadRead` queue changes library behaviour, so that part needs a title that loses input on main.
TideOPL commented 2026-10-08 10:07:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-08T10:07:28Z.


Done: the Time.cpp fix and its tests are now in #1501. #1076 is just the scePadRead queue and depends on #1501 since guest_pad needs the fix. I'll look for a title that loses input on main for the pad part.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6057529229 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1076#issuecomment-6057529229). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-08T10:07:28Z. --- Done: the `Time.cpp` fix and its tests are now in #1501. #1076 is just the `scePadRead` queue and depends on #1501 since `guest_pad` needs the fix. I'll look for a title that loses input on main for the pad part.
adriadam10 commented 2026-10-09 22:15:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:15:25Z.

Review: CHANGES_REQUESTED


Checked on Linux (merged onto current main): build clean, full ctest green, guest_pad passes, and fails with the library changes reverted (test kept). Behaviour matches KytyPS5 PadRead and shadPS4 scePadRead, which both return queued states (oldest first) and fall back to one current state when none are queued, so I consider Dean's request for a title satisfied by those references.

  • Blocked on #1501: the guest_pad test relies on the sceKernelGetProcessTime fix (you report it fails on Windows/GCC 15 without it). Please keep this PR as is and rebase once #1501 is merged; it can be merged right after.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5475847078 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1076#pullrequestreview-5475847078). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T22:15:25Z. **Review:** CHANGES_REQUESTED --- Checked on Linux (merged onto current `main`): build clean, full ctest green, `guest_pad` passes, and fails with the library changes reverted (test kept). Behaviour matches KytyPS5 `PadRead` and shadPS4 `scePadRead`, which both return queued states (oldest first) and fall back to one current state when none are queued, so I consider Dean's request for a title satisfied by those references. - Blocked on #1501: the `guest_pad` test relies on the `sceKernelGetProcessTime` fix (you report it fails on Windows/GCC 15 without it). Please keep this PR as is and rebase once #1501 is merged; it can be merged right after.
TideOPL commented 2026-10-09 22:32:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-09T22:32:29Z.


Thanks for checking this, and for accepting the KytyPS5/shadPS4 references.

This PR no longer depends on #1501. Since 39463913, queued states keep their own timestamps, but orientation is fused once at read time, the same way scePadReadState does it. A wrapped first sceKernelGetProcessTime value then no longer stops tilt correction, which is what broke guest_pad.

CI on 39463913, merged into current main, is green on both linux and windows without the Time.cpp fix. Locally, merged onto main: Windows 479/479, Linux 485 pass (24 GPU tests skipped under WSL). I've updated the description to Depends on: none.

So this can go in on its own, before or after #1501. Could you take another look?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6090357806 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1076#issuecomment-6090357806). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-09T22:32:29Z. --- Thanks for checking this, and for accepting the KytyPS5/shadPS4 references. This PR no longer depends on #1501. Since `39463913`, queued states keep their own timestamps, but orientation is fused once at read time, the same way `scePadReadState` does it. A wrapped first `sceKernelGetProcessTime` value then no longer stops tilt correction, which is what broke `guest_pad`. CI on `39463913`, merged into current `main`, is green on both `linux` and `windows` without the `Time.cpp` fix. Locally, merged onto `main`: Windows 479/479, Linux 485 pass (24 GPU tests skipped under WSL). I've updated the description to `Depends on: none`. So this can go in on its own, before or after #1501. Could you take another look?
spiicez21 commented 2026-10-10 03:35:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by spiicez21 on 2026-10-10T03:35:53Z.


Checked on Windows 11 with WinLibs GCC 16.2.0 (UCRT, posix-seh), Release, 39463913 merged onto current main (c963432d):

  • Merge is clean; guest_pad_tests builds.
  • ctest -R '^guest_pad$': passed 3/3 runs (~0.33 s).
  • With the libScePad changes reverted (Export.cpp, PadState.hpp, PadState.cpp from main) and the new test kept, guest_pad fails (abort, 0xc0000409), so the test covers the change.

#1501 is now merged into main, so the blocker in the review no longer applies. Full ctest not run; GCC 16.2 instead of the documented 15.2.0.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6093360633 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1076#issuecomment-6093360633). Originally posted by [spiicez21](https://github.com/spiicez21) on 2026-10-10T03:35:53Z. --- Checked on Windows 11 with WinLibs GCC 16.2.0 (UCRT, posix-seh), Release, `39463913` merged onto current `main` (`c963432d`): - Merge is clean; `guest_pad_tests` builds. - `ctest -R '^guest_pad$'`: passed 3/3 runs (~0.33 s). - With the `libScePad` changes reverted (`Export.cpp`, `PadState.hpp`, `PadState.cpp` from `main`) and the new test kept, `guest_pad` fails (abort, `0xc0000409`), so the test covers the change. #1501 is now merged into `main`, so the blocker in the review no longer applies. Full ctest not run; GCC 16.2 instead of the documented 15.2.0.
adriadam10 commented 2026-10-11 08:49:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:49:42Z.

Review: APPROVED


Rechecked on the current head (39463913) merged onto main: builds clean, guest_pad and the libs/libScePad ctests pass, and guest_pad fails with the library changes reverted (test kept). The Time.cpp dependency is gone (read-time orientation fusion) and #1501 is merged, so the earlier blocker no longer applies. Behaviour (oldest-first drain, one current state when the queue is empty) matches KytyPS5 PadRead and shadPS4 scePadRead. CI linux and windows are green; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5482630559 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1076#pullrequestreview-5482630559). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T08:49:42Z. **Review:** APPROVED --- Rechecked on the current head (`39463913`) merged onto `main`: builds clean, `guest_pad` and the libs/libScePad ctests pass, and `guest_pad` fails with the library changes reverted (test kept). The `Time.cpp` dependency is gone (read-time orientation fusion) and #1501 is merged, so the earlier blocker no longer applies. Behaviour (oldest-first drain, one current state when the queue is empty) matches KytyPS5 `PadRead` and shadPS4 `scePadRead`. CI linux and windows are green; merging.
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!1076
No description provided.