feat(libSceContentExport): write FromDataWithThumbnail's content and thumbnail as FromData does #28141
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28141"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-11-28T18:13:46Z.
What
sceContentExportFromDataWithThumbnail(uZTQHI50WpY) now writes its content and its thumbnail through their callbacks, the waysceContentExportFromDataalready writes its content. Onmainit makes its checks and then throws.Source. @noisyweather's reading of firmware 9.20's
libSceContentExport.sprxon #25863 (comment, worker0x17d0). It is disassembly only, not measured on a console, and the reading notes that 13.42 may differ. Past the checksmainalready makes:/av_contents/content_tmp/sce_cmgcnt<session ptr %p>.<subtype>through the same chunk writersceContentExportFromDatauses (0x1413–0x143a,0x1460). Written bytes different from the content length give0x809D3016(0x19ad–0x19ba);/av_contents/content_tmp/sce_cmgthm<session ptr %p>.jpg, and a byte count different from the thumbnail length gives0x809D3016(0x19c0–0x1a2d);0x1bd9), soGetProgressthen answers 100, or0x809D3002below SDK 6.00.Change (
Export.cpp):sceContentExportFromData's callback loop and path copy move intoWriteCallbackFileandCopyExportPath, unchanged.FromData's behaviour, including itsAfterFromDatastate, is unchanged, and the existing rows still pass.FromDataWithThumbnailwrites the content file, then the thumbnail file, with the two length checks, and copies out the content file's path, asFromDatadoes. It sets the session toEndedon every result past its callback-parameter checks.sceContentExportGetProgressdoesn't deadlock. Each slot counts itssceContentExportStartcalls, and after the callbacks the session is ended only if its slot hasn't been started again. A session finished and restarted in the same slot during the callbacks is left as it is (57147fde81, from @MarcZX10's review).FromData.Debt. This edits
main's pendingfeat-content-export-progress-checks.md(from #27221) in place:FromDataWithThumbnailleaves the combined Functional entry for the calls that throw past their checks;No open PR touches
libSceContentExportor either entry. It folds cleanly.Test (
GuestContentExport.cpp, ctestguest_content_export):0x809D3016, andGetProgressgoes from 0 to 100;sce_cmgcnt…pngpath, and the two files hold the content and the thumbnail bytes.GetProgressgoes from 0 to 100, or0x809D3002at SDK 5.00;0x809D3016;0x809D301B;0x809D3016and keepserrno;GetProgresson its own session gets 100 and returns, so the lock isn't held.GetProgress0 after the export returns.Tested
cfb0d0ecf8onmain00b892439c. Windows 11 Home 25H2 (26200.9974), i7-11800H, WinLibs GCC 15.2.0 r7 UCRT, CMake 4.3.1, Ninja 1.13.2, Release,BUILD_TESTING=ON.guest_content_exportpasses. No warnings.main'sExport.cpp(ae0df0e03e, unchanged since00b892439c) with the branch's test. It aborts (0xc0000409) withsceContentExportFromDataWithThumbnail not implementedat the first new export, the short-content row (GuestContentExport.cpp:329), after theGetProgressrow before it passed.cfb0d0ecf8. Ubuntu 24.04, GCC 13.3, Ninja, Release.guest_content_exportpasses. Control:main'sExport.cppwith the new test aborts. Again at57147fde81(review), with the same result.cfb0d0ecf8. Arch Linux 7.3.5 x86-64, GCC 16.2.1, Release.guest_content_exportpasses, and passes again at57147fde81(report).57147fde81, the restart fix. Same machine and toolchain as above.guest_content_exportpasses with no warnings, and the branch merges cleanly withmain67d64e4e52. Control:cfb0d0ecf8'sExport.cppwith the new test aborts at the restart row'sGetProgress(1) == 0, because the old code marks the restarted session ended (GetProgress(1)returned 100). The macOS harness gives the same result.57147fde81merged intomain, with the whole ctest suite: GitHub-hosted Windows Server 2022 and 2025, WinLibs GCC 15.2.0, 7443 tests each. Nothing fails that doesn't also fail onmainon the same machine.Export.cppand the wholeGuestContentExport.cppbuilt natively, with stubs for the guest copies, the process parameters and three kernel file calls. The head passes. Control:main'sExport.cppwith the branch's test aborts at the first export that gets past the checks, withsceContentExportFromDataWithThumbnail not implemented. The only warnings aremain's existing unused parameters in the file-export stubs.GuestContentExportfixture passes. Their extra reentrant test shows a temp-file overwrite when a slot is started again during a callback. #28370, which sits on this branch, fixes that.git merge-treefinds no conflict withmain(ae0df0e03e) or with any open PR that merges withmain.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-28T18:17:04Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
cfb0d0ecf8:tools/check_conventions.pypassed.guest_content_export_testsbuilt cleanly.guest_content_export):core/libs/prx/libSceContentExport/Export.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T18:21:47Z.
Review: COMMENTED
Actionable comments posted: 1
7fb24403-4240-4590-b6e8-b77ed9b6dc20Reviewing files that changed from the base of the PR and between
ae0df0e03eandcfb0d0ecf8.core/libs/prx/libSceContentExport/Export.cppcore/libs/tests/GuestContentExport.cppdocs/dev/debt/changes/feat-content-export-progress-checks.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T18:28:37Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this change, but the code has a session lifetime race during callbacks.
What I ran
Reviewed head
cfb0d0ecf8acf55d12bc9debe0e918f3a768731c. I readreview/description.md,review/commits.md,review/manifest.json,review/diff.patch, and the full text of all three changed files. I did not run tests or a build; the test results in the description are author reported.Results
Findings
Blocking
None.
Non-blocking
sceContentExportFromDataWithThumbnaildropsg_sessionMutexwhile invoking guest callbacks, then reacquires it and marks the session ended only if it still exists. Another thread can callsceContentExportFinishfor this session during the callback, erase it, and allowsceContentExportStartto reuse the same ID. The in-flight export can then write files named for the reused ID and return success without marking the new session ended. Consider reserving the session for the export or tracking an in-flight state so finish/start cannot invalidate or reuse it. (core/libs/prx/libSceContentExport/Export.cpp:568)Not verified
No build, test suite, concurrency test, or console behavior was run or independently confirmed. The author's reported checks and firmware reading are not independently verified.
files.jsonwas not available through the reader; the manifest and directory listing show all three changed files included and read.To get this to a good state
Nothing is required. The session lifetime race is optional feedback; consider protecting the session against finish/start while callbacks run.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-28T19:48:16Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
57147fde81:tools/check_conventions.pypassed.guest_content_export_testsbuilt cleanly.guest_content_export):core/libs/prx/libSceContentExport/Export.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T19:58:54Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and added test cases support merging, and the points below are optional.
What I ran
Reviewed head
57147fde8185ccfe951c0cca5af8fae8ee1dd92b. No commands or tests were run in this review session; the platform results in the PR description are author or reviewer reports.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Builds, tests, console behavior, and the firmware disassembly claims were not independently verified. The PR description reports Windows and Linux test passes and a macOS native harness run. Read:
core/libs/prx/libSceContentExport/Export.cpp,core/libs/tests/GuestContentExport.cpp, anddocs/dev/debt/changes/feat-content-export-progress-checks.md. No files were excluded from the review bundle.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T06:54:43Z.
Review: COMMENTED
The complete GuestContentExport fixture passed on Linux. An additional reentrant callback test reproduced content corruption when the execution ID is reused during a callback.
AI-assisted: yes.