fix(libScePad): return an error for unsupported port probes #10935

Merged
mashingaan merged 2 commits from upstream-pr/10935 into main 2026-11-02 19:45:11 +00:00
mashingaan commented 2026-10-25 11:04:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mashingaan on 2026-10-25T11:04:05Z.


What

Restore the pre-#10361 error path for scePadOpen port types 3 and 4. They were previously rejected with INVALID_ARG, but the measured validation change made them throw NotImplemented_nid_no_patch after user validation. This aborts titles that probe these port types and handle a negative return.

The measured invalid-user result for user -1 is unchanged. INVALID_ARG is returned only for the two unsupported types with a valid user. GuestPad covers both probes. This remains a temporary compatibility fallback: console evidence indicates that the VR-port gate can reject types 3 and 4 before user validation, while an open gate can return a VR handle. This change does not model those attribute-dependent regimes.

Issue #10904 reports PPSA02530 stopping at scePadOpen after #10361 and running past the same point before that change. A maintainer also reported Monster Hunter Wilds (PPSA24191) stopping at this call on main and passing it with this change, then reaching a separate unimplemented converted-float image path tracked by #11580. These reports support the startup compatibility regression, while the VR gate and successful VR handles remain unimplemented.

Implementation constraint: current main exposes param.json attribute3 through GetAppAttribute3_nid_no_patch, but sceKernelGetAppInfo only writes the app ID and title ID, not the observed fields at offsets 0x2c and 0x4c. The single-title observation does not yet establish that its 0x4c value can be derived from attribute3 for all titles. A complete gate needs that mapping and the successful VR-handle behavior verified separately.

Tested

  • git diff --check
  • Hosted Windows build and guest_pad CTest passed on PR head 895e0341d9cfa7b7f97f7b108344f533fc1fa8de: https://github.com/boykopovar/AnyPS5/actions/runs/41285013727
  • Hosted Windows CI on head 9db217314: configuration and test-registration audit passed. The full build and CTest execution were skipped by workflow policy, and no changed host-only test executables required linking. Conventions passed.
  • No local build was run because the Windows C drive is below the repository build threshold

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); the unsupported scePadOpen probes return the compatibility error documented in technical debt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: #10904
  • Unblocks: PPSA02530 #10904
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5004137691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10935). Originally posted by [mashingaan](https://github.com/mashingaan) on 2026-10-25T11:04:05Z. --- ### What Restore the pre-#10361 error path for `scePadOpen` port types 3 and 4. They were previously rejected with `INVALID_ARG`, but the measured validation change made them throw `NotImplemented_nid_no_patch` after user validation. This aborts titles that probe these port types and handle a negative return. The measured invalid-user result for user -1 is unchanged. `INVALID_ARG` is returned only for the two unsupported types with a valid user. `GuestPad` covers both probes. This remains a temporary compatibility fallback: console evidence indicates that the VR-port gate can reject types 3 and 4 before user validation, while an open gate can return a VR handle. This change does not model those attribute-dependent regimes. Issue #10904 reports PPSA02530 stopping at `scePadOpen` after #10361 and running past the same point before that change. A maintainer also reported Monster Hunter Wilds (PPSA24191) stopping at this call on main and passing it with this change, then reaching a separate unimplemented converted-float image path tracked by #11580. These reports support the startup compatibility regression, while the VR gate and successful VR handles remain unimplemented. Implementation constraint: current main exposes param.json attribute3 through GetAppAttribute3_nid_no_patch, but sceKernelGetAppInfo only writes the app ID and title ID, not the observed fields at offsets 0x2c and 0x4c. The single-title observation does not yet establish that its 0x4c value can be derived from attribute3 for all titles. A complete gate needs that mapping and the successful VR-handle behavior verified separately. ### Tested - `git diff --check` - Hosted Windows build and `guest_pad` CTest passed on PR head `895e0341d9cfa7b7f97f7b108344f533fc1fa8de`: https://github.com/boykopovar/AnyPS5/actions/runs/41285013727 - Hosted Windows CI on head 9db217314: configuration and test-registration audit passed. The full build and CTest execution were skipped by workflow policy, and no changed host-only test executables required linking. Conventions passed. - No local build was run because the Windows C drive is below the repository build threshold ### 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`); the unsupported `scePadOpen` probes return the compatibility error documented in technical debt - [x] No notes, investigation `.md` files or images added to the repository - [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: #10904 - [x] Unblocks: PPSA02530 #10904 - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 11:22:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T11:22:25Z.

Review: APPROVED


Reviewed exact head fc3a292. The unsupported types 3/4 still follow user validation first, then return INVALID_ARG for a valid user, matching the newly documented compatibility fallback and the reported title regression. The regression covers both types and preserves invalid-user precedence. Local diff and conventions checks passed. Hosted checks report conventions and labels successful; no local build was run, consistent with the author’s report.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5642904194 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10935#pullrequestreview-5642904194). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T11:22:25Z. **Review:** APPROVED --- Reviewed exact head fc3a292. The unsupported types 3/4 still follow user validation first, then return INVALID_ARG for a valid user, matching the newly documented compatibility fallback and the reported title regression. The regression covers both types and preserves invalid-user precedence. Local diff and conventions checks passed. Hosted checks report conventions and labels successful; no local build was run, consistent with the author’s report.
ahmadmuj commented 2026-10-25 11:51:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T11:51:37Z.

Review: COMMENTED


Reviewed head fc3a292 merged onto main a5a780e (clean merge). WSL2 Ubuntu 24.04, GCC 13.3, Release.

What I ran:

  • Built guest_pad_tests. As far as I can tell this is the first build of this head; hosted CI only ran conventions and labels.
  • ctest -R '^guest_pad$' on the merge: passes, 3 of 3 repeats. guest_pad_vibration_mode passes too.
  • Red check: main's Export.cpp with this PR's test line. guest_pad aborts with scePadOpen_nid_postfix not implemented, the same message as #10904. So the new line does catch the regression.
  • tools/check_conventions.py --base origin/main: passes.
  • tools/pr_overlap.py --branch: only #5038 shows up, and it doesn't touch the scePadOpen type 3/4 line.

The code reads right. The type and user checks still run first, so user -1 keeps 0x809b0001 on types 0, 2, 3 and 4. scePadOpen now also agrees with scePadGetHandle and scePadOpenExt, which already reject 3 and 4 through ValidPort.

One thing for a maintainer to decide, not a code bug: #10361 chose the throw on purpose ("a title that probes them will stop here instead of getting a made-up error"). CONTRIBUTING and REVERSE_ENGINEERING.md also say an unknown result throws. In the 13.60 payload run, every measured INVALID_ARG comes from the type check, and 3 and 4 get past it, so the measurement doesn't back this value. If it's fine as a stopgap for PPSA02530, a maintainer OK linked from the debt entry would help it hold up later. The Ngs2 Delay entry does this with its "agreed compatibility path" link (#9337).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643083081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10935#pullrequestreview-5643083081). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T11:51:37Z. **Review:** COMMENTED --- Reviewed head `fc3a292` merged onto main `a5a780e` (clean merge). WSL2 Ubuntu 24.04, GCC 13.3, Release. What I ran: - Built `guest_pad_tests`. As far as I can tell this is the first build of this head; hosted CI only ran `conventions` and `labels`. - `ctest -R '^guest_pad$'` on the merge: passes, 3 of 3 repeats. `guest_pad_vibration_mode` passes too. - Red check: main's `Export.cpp` with this PR's test line. `guest_pad` aborts with `scePadOpen_nid_postfix not implemented`, the same message as #10904. So the new line does catch the regression. - `tools/check_conventions.py --base origin/main`: passes. - `tools/pr_overlap.py --branch`: only #5038 shows up, and it doesn't touch the `scePadOpen` type 3/4 line. The code reads right. The type and user checks still run first, so user -1 keeps 0x809b0001 on types 0, 2, 3 and 4. `scePadOpen` now also agrees with `scePadGetHandle` and `scePadOpenExt`, which already reject 3 and 4 through `ValidPort`. One thing for a maintainer to decide, not a code bug: #10361 chose the throw on purpose ("a title that probes them will stop here instead of getting a made-up error"). CONTRIBUTING and REVERSE_ENGINEERING.md also say an unknown result throws. In the 13.60 payload run, every measured `INVALID_ARG` comes from the type check, and 3 and 4 get *past* it, so the measurement doesn't back this value. If it's fine as a stopgap for PPSA02530, a maintainer OK linked from the debt entry would help it hold up later. The Ngs2 Delay entry does this with its "agreed compatibility path" link (#9337).
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!10935
No description provided.