fix(libSceCamera): accept camera index 1 in sceCameraIsAttached #25691

Merged
mcarkade merged 1 commit from upstream-pr/25691 into main 2026-11-24 16:39:09 +00:00
mcarkade commented 2026-11-22 14:58:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mcarkade on 2026-11-22T14:58:33Z.


What

sceCameraIsAttached(1) returns 0x802E0000 on main. In two PS5 firmware 11.60 payload runs, index 1 returned 0, the same result as index 0. Indices -1 and 2 still returned 0x802E0000. Accept both camera indices and report that neither has a camera attached. Console measurement

Monopoly Plus (CUSA03312) calls this export at startup. The earlier title run established the caller. Title evidence

Tested

Windows 11, MinGW-w64 GCC 15.2.0, CMake/CTest 4.3.1 and Python 3.13.5. On main b7d463d4381c with the test change alone, guest_camera failed at the index 1 assertion. With the fix, guest_camera, guest_camera2, guest_camera_settings, public_headers and python tools/check_conventions.py --base origin/main passed. Local runtime verification was limited to these Windows guest tests.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5440196422 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25691). Originally posted by [mcarkade](https://github.com/mcarkade) on 2026-11-22T14:58:33Z. --- ### What `sceCameraIsAttached(1)` returns `0x802E0000` on main. In two PS5 firmware 11.60 payload runs, index 1 returned 0, the same result as index 0. Indices -1 and 2 still returned `0x802E0000`. Accept both camera indices and report that neither has a camera attached. [Console measurement](https://github.com/boykopovar/AnyPS5/pull/24428#issuecomment-7044665102) Monopoly Plus (CUSA03312) calls this export at startup. The earlier title run established the caller. [Title evidence](https://github.com/boykopovar/AnyPS5/pull/8111) ### Tested Windows 11, MinGW-w64 GCC 15.2.0, CMake/CTest 4.3.1 and Python 3.13.5. On main `b7d463d4381c` with the test change alone, `guest_camera` failed at the index 1 assertion. With the fix, `guest_camera`, `guest_camera2`, `guest_camera_settings`, `public_headers` and `python tools/check_conventions.py --base origin/main` passed. Local runtime verification was limited to these Windows guest tests. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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 - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-22 15:00:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T15:00:18Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 46aeb8a464:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_camera_tests built cleanly.
  • CTest (guest_camera):
    1/1 Test #3783: guest_camera .....................   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceCamera/Export.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #3783: guest_camera .....................Subprocess aborted***Exception:   0.19 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified sceCameraIsAttached index validation logic in core/libs/prx/libSceCamera/Export.cpp: bounds [0, 1] return 0 (not attached) and indices < 0 or > 1 return SCE_CAMERA_ERROR_PARAM (0x802E0000).
    • Verified Technical Debt fragment docs/dev/debt/changes/fix-camera-attachment-index.md replaces previous fragment docs-libscecamera-isattached-index.md cleanly with correct markdown structure and references.
    • Checked test coverage in core/libs/tests/GuestCamera.cpp verifying index 0, index 1, index 2, and negative index (-1) return expectations matching measured hardware behavior.
    • Verified AGENTS.md compliance: conventions passed, no banned comments, no stray files, and proper technical debt tracking.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012912001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25691#pullrequestreview-6012912001). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-22T15:00:18Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `46aeb8a464`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_camera_tests` built cleanly. - **CTest** (`guest_camera`): ``` 1/1 Test #3783: guest_camera ..................... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceCamera/Export.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #3783: guest_camera .....................Subprocess aborted***Exception: 0.19 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - Verified sceCameraIsAttached index validation logic in core/libs/prx/libSceCamera/Export.cpp: bounds [0, 1] return 0 (not attached) and indices < 0 or > 1 return SCE_CAMERA_ERROR_PARAM (0x802E0000). - Verified Technical Debt fragment docs/dev/debt/changes/fix-camera-attachment-index.md replaces previous fragment docs-libscecamera-isattached-index.md cleanly with correct markdown structure and references. - Checked test coverage in core/libs/tests/GuestCamera.cpp verifying index 0, index 1, index 2, and negative index (-1) return expectations matching measured hardware behavior. - Verified AGENTS.md compliance: conventions passed, no banned comments, no stray files, and proper technical debt tracking. Looks Good To Me
MarcZX10 commented 2026-11-22 15:17:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T15:17:12Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the inspected implementation matches the stated camera index behavior, and the reported guest tests cover both supported indices and out-of-range values.

What I ran

Reviewed head 46aeb8a464c447dbeaaee44800228361e7af9ff2. I read description.md, commits.md, manifest.json, diff.patch, the review folder README, and the full text of all included changed files. I did not run commands or tests.

Results

Check Result Note
Changed implementation and tests passed Behavior and assertions align
Reported guest checks not run Author-reported only
Deleted debt note not applicable No new text to inspect

Findings

Blocking

None.

Non-blocking

None.

Not verified

The deleted file docs/dev/debt/changes/docs-libscecamera-isattached-index.md was not available to read; its deleted contents are shown in the diff. I did not independently verify the PS5 payload measurements, title evidence, or the author-reported Windows guest tests. No runtime or build checks were run.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012976909 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25691#pullrequestreview-6012976909). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T15:17:12Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the inspected implementation matches the stated camera index behavior, and the reported guest tests cover both supported indices and out-of-range values. ## What I ran Reviewed head `46aeb8a464c447dbeaaee44800228361e7af9ff2`. I read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, the review folder README, and the full text of all included changed files. I did not run commands or tests. ## Results | Check | Result | Note | |---|---|---| | Changed implementation and tests | passed | Behavior and assertions align | | Reported guest checks | not run | Author-reported only | | Deleted debt note | not applicable | No new text to inspect | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The deleted file `docs/dev/debt/changes/docs-libscecamera-isattached-index.md` was not available to read; its deleted contents are shown in the diff. I did not independently verify the PS5 payload measurements, title evidence, or the author-reported Windows guest tests. No runtime or build checks were run. ## To get this to a good state Nothing is required.
throny commented 2026-11-22 15:28:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-22T15:28:44Z.

Review: APPROVED


Review: ✅ correct, index 1 returns 0 as measured on 11.60

Basis: code read; checked against the payload probe in #24428 (fw 11.60, two runs) · head 46aeb8a464

Checked

  • On main sceCameraIsAttached(1) returns SCE_CAMERA_ERROR_PARAM. The probe shows index 0 and 1 → 0, 2 and -1 → 0x802E0000 with the firmware's own invalid index log, so index < 0 || index > 1 matches.
  • No title check; sceCameraOpen (Handles.cpp:45) keeps its own index == 0 check (different export, not claimed). The updated guest_camera assertions fail on main at index 1.

Findings: none

Suggested action: merge

AI-assisted review (Claude Code) · head 46aeb8a464 · base main 2c08875217

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013020388 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25691#pullrequestreview-6013020388). Originally posted by [throny](https://github.com/throny) on 2026-11-22T15:28:44Z. **Review:** APPROVED --- ### Review: ✅ correct, index 1 returns 0 as measured on 11.60 **Basis:** code read; checked against the payload probe in #24428 (fw 11.60, two runs) · head `46aeb8a464` **Checked** - On main `sceCameraIsAttached(1)` returns `SCE_CAMERA_ERROR_PARAM`. The probe shows index 0 and 1 → 0, 2 and -1 → 0x802E0000 with the firmware's own `invalid index` log, so `index < 0 || index > 1` matches. - No title check; `sceCameraOpen` (`Handles.cpp:45`) keeps its own `index == 0` check (different export, not claimed). The updated `guest_camera` assertions fail on main at index 1. **Findings:** none **Suggested action:** merge <sub>AI-assisted review (Claude Code) · head `46aeb8a464` · base `main` `2c08875217`</sub>
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!25691
No description provided.