feat(contentexport): export images to a persistent host catalog #2232

Closed
erick-dsnk wants to merge 1 commit from upstream-pr/2232 into main
erick-dsnk commented 2026-10-09 12:36:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by erick-dsnk on 2026-10-09T12:36:10Z.


What

Guest code can now start an export session, import JPEG/PNG/GIF images from a guest file or a data-provider callback, import an explicit image thumbnail, and finish the session. The five exports previously threw unconditionally. Imports preserve source bytes and publish media plus metadata into a persistent host catalog that a separate content-search change can query.

The catalog lives under the launch root's /data/anyps5-content. Each successful import receives its own guest-readable path. An exclusive pending directory reserves the content ID; complete media and metadata are published by directory rename. Native file locks serialize publication and catalog snapshots across processes. A generation assigned at publication advances the update ID even when two exports finish in the opposite order from their start.

Guest allocator callbacks supply the streaming copy buffer and receive their original user data. Callback imports enforce the declared byte total and the 0/more, 1/done protocol; malformed callbacks, allocation failures and failed imports leave the output and published catalog unchanged. Live sessions enforce the ten-execution limit, and an active callback cannot finish, terminate or reenter its own session.

Scope: image imports. PNG/JPEG use the existing source-built decoders; GIF uses the existing stb submodule and validates its first frame. Video imports and nonzero bytes in the ambiguous reserved/comment field throw. Automatic thumbnails, console gallery notifications and sharing are not implemented. Host storage paths, session-limit application, error precedence and all recovered ABI contracts remain unverified on PS5 hardware; these gaps are recorded in TechnicalDebt.

ABI evidence:

Draft limitation: no commercial title has been shown reaching these exports on current main. Maintainer feedback on #1582 requests a title ID and stop log for library additions. This draft supplies working implementation and host test evidence; it does not claim that acceptance requirement is met.

Completion accounting: the unchanged progress scanner reports five newly implemented exports, libSceContentExport 2/7 → 7/7, and overall libraries 2578/3044 (84.69%) → 2583/3044 (84.86%). These figures classify declared exports and do not establish full console compatibility.

Tested

Linux, GCC 13.3.0, Release, BUILD_TESTING=ON, dedicated worktree based on upstream main d70b89989473ba1f6ae13e44e079e67f1f8a44b0.

  • Focused build and guest_content_export: passed in 0.06 seconds. Checks byte-for-byte JPEG/PNG/GIF import, explicit thumbnail bytes, chunked callbacks including separate final completion, dimensions and ownership metadata, session limits, callback reentrance, allocator balance and failure, malformed callbacks, unsupported images and MIME mismatches, output preservation and rollback, parallel exports, concurrent readers during publication, out-of-order publication generations, reinitialization persistence, and a fresh child process reading and publishing the catalog.
  • tools/check_conventions.py --base upstream/main: passed.
  • tools/check_test_registration.py build: passed; no new unregistered tests.
  • git diff --check: passed.
  • Exact commit 88e5bdeebed5b4923b2887c0e50490dc380add20 checked out in the existing USB validation worktree and configured afresh: full default build passed (1,140 rebuild steps), patched libs target passed, and guest_content_export passed again in 0.01 seconds. No build artifacts were copied between trees. The dedicated content-export branch and worktree remain separate and clean. No complete CTest suite was run for this content-export head.
  • No Windows, PS5 hardware or commercial title execution.

Checklist

  • Based on current main; no other open PR implements the same functions (complete paginated baseline audit plus newest PRs through #2231; #1128 only reformats this file)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (existing decoders and stb submodule reused)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4800487724 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2232). Originally posted by [erick-dsnk](https://github.com/erick-dsnk) on 2026-10-09T12:36:10Z. --- ### What Guest code can now start an export session, import JPEG/PNG/GIF images from a guest file or a data-provider callback, import an explicit image thumbnail, and finish the session. The five exports previously threw unconditionally. Imports preserve source bytes and publish media plus metadata into a persistent host catalog that a separate content-search change can query. The catalog lives under the launch root's `/data/anyps5-content`. Each successful import receives its own guest-readable path. An exclusive pending directory reserves the content ID; complete media and metadata are published by directory rename. Native file locks serialize publication and catalog snapshots across processes. A generation assigned at publication advances the update ID even when two exports finish in the opposite order from their start. Guest allocator callbacks supply the streaming copy buffer and receive their original user data. Callback imports enforce the declared byte total and the 0/more, 1/done protocol; malformed callbacks, allocation failures and failed imports leave the output and published catalog unchanged. Live sessions enforce the ten-execution limit, and an active callback cannot finish, terminate or reenter its own session. Scope: image imports. PNG/JPEG use the existing source-built decoders; GIF uses the existing stb submodule and validates its first frame. Video imports and nonzero bytes in the ambiguous reserved/comment field throw. Automatic thumbnails, console gallery notifications and sharing are not implemented. Host storage paths, session-limit application, error precedence and all recovered ABI contracts remain unverified on PS5 hardware; these gaps are recorded in TechnicalDebt. ABI evidence: - [Orbital PS4 signature database](https://github.com/AlexAltea/orbital/blob/cc408367da6a6ebbf5ac1ac559fefeadc73b2831/tools/ida/db_types.json): all five export signatures. - [SharpProspero PS5 bindings](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Content/ContentExport.cs): matching signatures, 579-byte parameter, callback protocol and execution limit. - [shadPS4 parameter layout](https://github.com/shadps4-emu/shadPS4/blob/0fe263a4760dfbfa973366890061749b4af0de97/src/core/libraries/content_export/content_export.h): independent layout corroboration. Its middle 257 bytes are called `comment`; SharpProspero calls them reserved, so a nonzero value throws. - [fpPS4 error constants](https://github.com/red-prig/fpPS4/blob/04cefd43e6fddd1ab033e7980cd356d14c964905/src/ps4_libscecontentexport.pas) and [PS5 3.20 NID stubs](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceContentExport.c). Draft limitation: no commercial title has been shown reaching these exports on current main. [Maintainer feedback on #1582](https://github.com/boykopovar/AnyPS5/pull/1582#issuecomment-6077681304) requests a title ID and stop log for library additions. This draft supplies working implementation and host test evidence; it does not claim that acceptance requirement is met. Completion accounting: the unchanged progress scanner reports five newly implemented exports, `libSceContentExport` 2/7 → 7/7, and overall libraries 2578/3044 (84.69%) → 2583/3044 (84.86%). These figures classify declared exports and do not establish full console compatibility. ### Tested Linux, GCC 13.3.0, Release, `BUILD_TESTING=ON`, dedicated worktree based on upstream main `d70b89989473ba1f6ae13e44e079e67f1f8a44b0`. - Focused build and `guest_content_export`: passed in 0.06 seconds. Checks byte-for-byte JPEG/PNG/GIF import, explicit thumbnail bytes, chunked callbacks including separate final completion, dimensions and ownership metadata, session limits, callback reentrance, allocator balance and failure, malformed callbacks, unsupported images and MIME mismatches, output preservation and rollback, parallel exports, concurrent readers during publication, out-of-order publication generations, reinitialization persistence, and a fresh child process reading and publishing the catalog. - `tools/check_conventions.py --base upstream/main`: passed. - `tools/check_test_registration.py build`: passed; no new unregistered tests. - `git diff --check`: passed. - Exact commit `88e5bdeebed5b4923b2887c0e50490dc380add20` checked out in the existing USB validation worktree and configured afresh: full default build passed (1,140 rebuild steps), patched `libs` target passed, and `guest_content_export` passed again in 0.01 seconds. No build artifacts were copied between trees. The dedicated content-export branch and worktree remain separate and clean. No complete CTest suite was run for this content-export head. - No Windows, PS5 hardware or commercial title execution. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (complete paginated baseline audit plus newest PRs through #2231; #1128 only reformats this file) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (existing decoders and stb submodule reused) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-09 12:40:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T12:40:32Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2195 docs/dev/TechnicalDebt.md L40
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081080108 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2232#issuecomment-6081080108). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T12:40:32Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #2195 | `docs/dev/TechnicalDebt.md` [L40](https://github.com/boykopovar/AnyPS5/blob/8b393b6e9a8ade9188d4f74a0293e0efd9828597/docs/dev/TechnicalDebt.md#L40) | | |
oneandonlydean commented 2026-10-09 20:10:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:10:36Z.


Closing: as the description says, no title reaches these exports on main, and a host image catalog is a lot to carry without one. Reopen when a title stops at one of them.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6088451410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2232#issuecomment-6088451410). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T20:10:36Z. --- Closing: as the description says, no title reaches these exports on main, and a host image catalog is a lot to carry without one. Reopen when a title stops at one of them.

Pull request closed

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!2232
No description provided.