refactor(camera): drop errno saves around guest copies #26189

Merged
LeandroLP23 merged 1 commit from upstream-pr/26189 into main 2026-11-23 12:59:56 +00:00
LeandroLP23 commented 2026-11-23 12:28:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-11-23T12:28:27Z.


What

Same change as #25937, #25944 and #25945, for libSceCamera. GuestCopyIn_nid_no_patch, GuestCopyOut_nid_no_patch and GuestWritable_nid_no_patch restore errno themselves since #21243 (RestoreErrno in libc/src/General.cpp), so saving and restoring errno around them does nothing.

12 inline saves around a guest copy are removed, in Export.cpp, Attributes.cpp, Config.cpp, Device.cpp and Handles.cpp. A save is kept where the saved value is used again later in the function. 26 lines removed and 1 added.

No open pull request touches these files.

No change in behaviour.

Tested

Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release. ctest -R 'camera', with its 3 build outputs from tools/select_tests.py targets: 3 of 3 on main 709342e209 and 3 of 3 with this change applied to it. tools/check_conventions.py passes. tools/pr_overlap.py --branch finds no overlap with the 2549 open pull requests.

Not run: Linux and macOS.

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:5453105603 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26189). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-11-23T12:28:27Z. --- ### What Same change as #25937, #25944 and #25945, for `libSceCamera`. `GuestCopyIn_nid_no_patch`, `GuestCopyOut_nid_no_patch` and `GuestWritable_nid_no_patch` restore `errno` themselves since #21243 (`RestoreErrno` in `libc/src/General.cpp`), so saving and restoring `errno` around them does nothing. 12 inline saves around a guest copy are removed, in `Export.cpp`, `Attributes.cpp`, `Config.cpp`, `Device.cpp` and `Handles.cpp`. A save is kept where the saved value is used again later in the function. 26 lines removed and 1 added. No open pull request touches these files. No change in behaviour. ### Tested Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release. `ctest -R 'camera'`, with its 3 build outputs from `tools/select_tests.py targets`: 3 of 3 on `main` `709342e209` and 3 of 3 with this change applied to it. `tools/check_conventions.py` passes. `tools/pr_overlap.py --branch` finds no overlap with the 2549 open pull requests. Not run: Linux and macOS. ### 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
mihiii1337 commented 2026-11-23 12:43:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T12:43:51Z.

Review: APPROVED


I ran an independent native Windows GCC 15.2 A/B test of all five changed camera sources on 709342e209 and 27662ec589. Both revisions passed 18 export calls with 14 read-hook and 5 write-hook calls. The hooks deliberately changed errno, and the caller's value survived each copy. The audio probe rejected unreadable memory after the read hook, and the config getter accepted a valid size from read-only memory then rejected the write without altering the config. The device and frame queries also kept their before-open/after-close return values. The fixture needed no camera hardware.

The merge with #25691's camera-index change is clean. The Windows CI log shows one passing test, patched_libraries. The focused hook fixture was a separate run.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6021896217 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26189#pullrequestreview-6021896217). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T12:43:51Z. **Review:** APPROVED --- I ran an independent native Windows GCC 15.2 A/B test of all five changed camera sources on 709342e209 and 27662ec589. Both revisions passed 18 export calls with 14 read-hook and 5 write-hook calls. The hooks deliberately changed errno, and the caller's value survived each copy. The audio probe rejected unreadable memory after the read hook, and the config getter accepted a valid size from read-only memory then rejected the write without altering the config. The device and frame queries also kept their before-open/after-close return values. The fixture needed no camera hardware. The merge with #25691's camera-index change is clean. The Windows CI log shows one passing test, patched_libraries. The focused hook fixture was a separate run. AI-assisted: yes
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!26189
No description provided.