feat(libc): implement libc++ base streambuf seek defaults #28565

Open
mihai1859 wants to merge 2 commits from upstream-pr/28565 into main
mihai1859 commented 2026-12-01 19:34:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihai1859 on 2026-12-01T19:34:34Z.


What

Implements the base std::__1::basic_streambuf<char>::seekoff and seekpos virtuals imported by the RetroArch Azahar core in #5927. Each reports an unsuccessful seek by returning the guest stream position with 128 zero state bytes and a signed 64-bit offset of -1. The calls leave the stream buffer intact. The guest layout and return behavior match ios.instantiations.cpp.o from PS5 Payload SDK v0.42.

The overlap tool flagged 15 CMake comparisons because those branches conflict with main. I checked each PR diff and confirmed its source or test registrations are at different entries.

Tested

  • Windows 11 x64, WinLibs GCC 16.2. guest_libcxx_stream_position passed against the built libc. The same fixture passed against the SDK reference functions. It checks every state byte, the full offset, nonzero input state for seekpos, multiple seek modes and offsets, and preservation of the stream buffer.
  • Rebuilt and packaged libc.prx, then ran the same Azahar startup diagnostic with the retained runtime libraries. Both target names resolved. The diagnostic reported 151 remaining names (129 functions and 22 data symbols). Adding back the two exports gives the 153-name estimate for the corresponding baseline.

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

Summary by CodeRabbit

  • New Features
    • Added stream-buffer seek entry points for requests by offset or position. Both currently return a failed position.
  • Tests
    • Added coverage verifying failed results across seek modes, directions, and offsets, and confirming the buffer remains unchanged.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5593040117 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28565). Originally posted by [mihai1859](https://github.com/mihai1859) on 2026-12-01T19:34:34Z. --- ### What Implements the base `std::__1::basic_streambuf<char>::seekoff` and `seekpos` virtuals imported by the RetroArch Azahar core in #5927. Each reports an unsuccessful seek by returning the guest stream position with 128 zero state bytes and a signed 64-bit offset of -1. The calls leave the stream buffer intact. The guest layout and return behavior match `ios.instantiations.cpp.o` from PS5 Payload SDK v0.42. The overlap tool flagged 15 CMake comparisons because those branches conflict with main. I checked each PR diff and confirmed its source or test registrations are at different entries. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Windows 11 x64, WinLibs GCC 16.2. `guest_libcxx_stream_position` passed against the built libc. The same fixture passed against the SDK reference functions. It checks every state byte, the full offset, nonzero input state for `seekpos`, multiple seek modes and offsets, and preservation of the stream buffer. - Rebuilt and packaged `libc.prx`, then ran the same Azahar startup diagnostic with the retained runtime libraries. Both target names resolved. The diagnostic reported 151 remaining names (129 functions and 22 data symbols). Adding back the two exports gives the 153-name estimate for the corresponding baseline. ### 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added stream-buffer seek entry points for requests by offset or position. Both currently return a failed position. * **Tests** * Added coverage verifying failed results across seek modes, directions, and offsets, and confirming the buffer remains unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-12-01 19:37:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T19:37:33Z.

Review: APPROVED


Reviewed — looks good

The reviewed change adds the two libc++ stream buffer seek defaults and their regression test; I found no blocking defect in the changed code.

What I ran

Reviewed head e0aa7efb01a5d41b6ea16986b87d83df444301a4 using the prepared diff and repo_read.py at the pinned head. No build or test was run.

env -u ANYPS5_READ_LOG python3 repo_read.py ls core/libs/prx/libc/tests/cmake
env -u ANYPS5_READ_LOG python3 repo_read.py cat core/libs/prx/libc/tests/cmake/guest_libcxx_stream_position.cmake 1 30
env -u ANYPS5_READ_LOG python3 repo_read.py cat core/libs/prx/libc/src/LibcxxStreamPosition.cpp 1 15

Results

Check Result Note
Changed code review passed All seven changed files read
Regression test not run Author reports it passed; independent run would compile
Firmware behavior not run Provider is documented as unverified

Negative control

Not run; the regression test was not executed.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The Windows test run, PR-reported packaging and Azahar startup diagnostic, and behavior on console firmware were not independently verified. All seven files listed under reviewed in files.json were read; files.json lists no excluded files.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6138624155 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28565#pullrequestreview-6138624155). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-12-01T19:37:33Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change adds the two libc++ stream buffer seek defaults and their regression test; I found no blocking defect in the changed code. ## What I ran Reviewed head `e0aa7efb01a5d41b6ea16986b87d83df444301a4` using the prepared diff and `repo_read.py` at the pinned head. No build or test was run. ```text env -u ANYPS5_READ_LOG python3 repo_read.py ls core/libs/prx/libc/tests/cmake env -u ANYPS5_READ_LOG python3 repo_read.py cat core/libs/prx/libc/tests/cmake/guest_libcxx_stream_position.cmake 1 30 env -u ANYPS5_READ_LOG python3 repo_read.py cat core/libs/prx/libc/src/LibcxxStreamPosition.cpp 1 15 ``` ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All seven changed files read | | Regression test | not run | Author reports it passed; independent run would compile | | Firmware behavior | not run | Provider is documented as unverified | ## Negative control Not run; the regression test was not executed. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Implementation at the reviewed commit](https://github.com/boykopovar/AnyPS5/blob/e0aa7efb01a5d41b6ea16986b87d83df444301a4/core/libs/prx/libc/src/LibcxxStreamPosition.cpp) - [Guest test at the reviewed commit](https://github.com/boykopovar/AnyPS5/blob/e0aa7efb01a5d41b6ea16986b87d83df444301a4/core/libs/tests/GuestLibcxxStreamPosition.cpp) ## Not verified The Windows test run, PR-reported packaging and Azahar startup diagnostic, and behavior on console firmware were not independently verified. All seven files listed under `reviewed` in `files.json` were read; `files.json` lists no excluded files. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 02:08:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T02:08:27Z.

Review: COMMENTED


The GuestLibcxxStreamPosition fixture passed on Linux with GCC 14.2, linked directly against the two exports. Both calls also returned offset -1 and all 128 state bytes zero with the receiver on an inaccessible page, confirming that the base seek methods do not access the stream object.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6162488943 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28565#pullrequestreview-6162488943). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T02:08:27Z. **Review:** COMMENTED --- The `GuestLibcxxStreamPosition` fixture passed on Linux with GCC 14.2, linked directly against the two exports. Both calls also returned offset `-1` and all 128 state bytes zero with the receiver on an inaccessible page, confirming that the base seek methods do not access the stream object. AI-assisted: yes.
Plyxen commented 2026-12-03 07:34:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T07:34:52Z.

Review: APPROVED


I read the diff at e0aa7efb01. Merged into main at 35e34b1a7f0 together with other open PRs (so not an isolated build), Release, on Windows 11 (GCC 15.2) and Ubuntu 24.04 under WSL2 (GCC 13.3).

  • guest_libcxx_stream_position: passes on both.
  • The other guest_libcxx_* tests of that tree pass too (39 on Linux).
  • No control: the test needs exports that main does not have.

Not checked: a title.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6165443014 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28565#pullrequestreview-6165443014). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-12-03T07:34:52Z. **Review:** APPROVED --- I read the diff at `e0aa7efb01`. Merged into `main` at `35e34b1a7f0` together with other open PRs (so not an isolated build), Release, on Windows 11 (GCC 15.2) and Ubuntu 24.04 under WSL2 (GCC 13.3). - `guest_libcxx_stream_position`: passes on both. - The other `guest_libcxx_*` tests of that tree pass too (39 on Linux). - No control: the test needs exports that `main` does not have. Not checked: a title. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-12-04 03:29:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T03:29:35Z.

Review: APPROVED


Reviewed — looks good

The reviewed change adds the two requested stream buffer seek defaults, and the inspected implementation and test registration support merging.

What I ran

Reviewed head 24c9a1ad1f0bdba0e96c4d6ef96b1160822bd66b using repo_read.py and the prepared diff. No tests or builds were run. The author reports Windows 11 x64 test and packaging results; I did not independently verify them.

Results

Check Result Note
Changed files passed All seven reviewed files read
Source context passed Implementation and test registration inspected
Tests and build not run No execution performed

Negative control

Not run; no source changes or tests were executed.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The author-reported Windows test, SDK reference comparison, packaging, and Azahar startup diagnostic were not independently verified. No console behavior was checked. All files listed as reviewed in files.json were read; files.json lists no excluded files.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6182680857 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28565#pullrequestreview-6182680857). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-12-04T03:29:35Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change adds the two requested stream buffer seek defaults, and the inspected implementation and test registration support merging. ## What I ran Reviewed head `24c9a1ad1f0bdba0e96c4d6ef96b1160822bd66b` using `repo_read.py` and the prepared diff. No tests or builds were run. The author reports Windows 11 x64 test and packaging results; I did not independently verify them. ## Results | Check | Result | Note | |---|---|---| | Changed files | passed | All seven reviewed files read | | Source context | passed | Implementation and test registration inspected | | Tests and build | not run | No execution performed | ## Negative control Not run; no source changes or tests were executed. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Implementation](https://github.com/boykopovar/AnyPS5/blob/24c9a1ad1f0bdba0e96c4d6ef96b1160822bd66b/core/libs/prx/libc/src/LibcxxStreamPosition.cpp) - [Test registration](https://github.com/boykopovar/AnyPS5/blob/24c9a1ad1f0bdba0e96c4d6ef96b1160822bd66b/core/libs/prx/libc/tests/cmake/guest_libcxx_stream_position.cmake) - [Test fixture](https://github.com/boykopovar/AnyPS5/blob/24c9a1ad1f0bdba0e96c4d6ef96b1160822bd66b/core/libs/tests/GuestLibcxxStreamPosition.cpp) ## Not verified The author-reported Windows test, SDK reference comparison, packaging, and Azahar startup diagnostic were not independently verified. No console behavior was checked. All files listed as reviewed in `files.json` were read; `files.json` lists no excluded files. ## To get this to a good state Nothing is required.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/28565:upstream-pr/28565'
git switch 'upstream-pr/28565'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/28565'
git switch 'upstream-pr/28565'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/28565'
git switch 'upstream-pr/28565'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/28565'
git switch 'main'
git merge --squash 'upstream-pr/28565'
git switch 'main'
git merge --ff-only 'upstream-pr/28565'
git switch 'main'
git merge 'upstream-pr/28565'
git push origin 'main'
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!28565
No description provided.