feat(zlib): implement sequential libSceZlib decompression #1824
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1824"
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 Mouhand-Kaddo on 2026-10-08T20:35:25Z.
What
Add the five
libSceZlibexports required by Prospero Explorer in #1578. Reuse the existing JPEG dependency's bundled zlib for bounded RFC1950 decompression with checksum validation. Submission completes immediately and produces a request ID for the wait/result lifecycle.This is partial sequential support. Timed waits, multiple outstanding requests, repeated result retrieval and finalization with unread results throw. SharpProspero supplies the caller ABI and output limits. Error-status mappings follow shadPS4. Conflicting PS4 signatures and unverified PS5 scheduling, scratch-buffer and result semantics are listed in TechnicalDebt.
Tested
Linux x86-64.
guest_zlibpasses independent compressed fixtures, plaintext checks, checksum/truncation failures, exact and insufficient capacity, alignment, output canaries, request IDs and lifecycle guards. Standalone ASan/UBSan passes. Existing JPEG and PNG decoder tests also pass.Native Windows 11 Pro (build 26300), MinGW-w64 GCC 15.2.0 (WinLibs x86_64-ucrt-posix-seh r7), Release. Reproduced the reported abort at
sceZlibInitialize(nullptr, 1)before removing the test's-fasynchronous-unwind-tablesoverride. At commit913279b8,guest_zlibpasses five consecutive runs;windows_exceptionsand the four JPEG/PNG decoder tests also pass. The rebuilt test uses DWARF unwind frames and__gxx_personality_v0.WSL Ubuntu 24.04 x86-64, GCC 13.3.0, Release, at the same fixed commit.
guest_zlibpasses five consecutive runs;exception_runtime,exception_personality,exception_c_cleanupand the four JPEG/PNG decoder tests also pass. The Linux compile command contains neither Windows unwind flag. Repository conventions and test-registration checks pass.A local consumer compiled for FreeBSD against ps5-payload-sdk v0.43 headers passes through the patched NID exports. It checks 64-bit request IDs, 32-bit results and output bytes. Host z_stream and errno never cross the Sony API. SDK tooling is outside the repository. No PS5 execution was performed.
The released Prospero Explorer v1.0 binary previously stopped at missing
libSceZlib.prx. With this module it reaches the next unresolvedmadviseimport. All five Zlib imports resolve. This does not make the title run.Independent code review passes both standards and spec, with no actionable findings.
Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T08:56:00Z.
Progress report (
b271417→810eda2)📈 System libraries: 85.63% (+0.02%, +5 implemented functions)
✅ 5 implemented
sceZlibFinalizesceZlibGetResultsceZlibInflatesceZlibInitializesceZlibWaitForDoneImported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:44:54Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
1d3337c4, merged ontomaind70b8998in one build with 38 other PRs that had no Windows run. The current headaa3e4e4cis a rebase with the same zlib files, including the-fasynchronous-unwind-tablesblock below.guest_zlibaborts on Windows in every run:RequireThrows,sceZlibInitialize(nullptr, 1).-fasynchronous-unwind-tableson MinGW, so GCC emits SEH unwind data (__gxx_personality_seh0) instead of DWARF frames..ehframsection is empty (4 bytes).Removing that block fixes it.
guest_zlibthen passes 5 of 5, and the full suite in that build passes (519 of 519):🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-09T16:08:23Z.
Fixed the reported Windows abort in 913279b89476faa3f1b2f48093079170f17d05fe by removing the
guest_zlib_testsoverride for-fasynchronous-unwind-tables. The test now inherits the project's DWARF unwind configuration.I reproduced the abort at
sceZlibInitialize(nullptr, 1)before the change. The original executable imported__gxx_personality_seh0and had a four-byte.ehframsection. After the change, it imports__gxx_personality_v0and has populated DWARF unwind frames.Verification of the fixed commit:
guest_zlibpassed five consecutive runs.windows_exceptions,decoder_jpeg,guest_jpeg_dec,decoder_pngandguest_png_decall passed.guest_zlibpassed five consecutive runs.exception_runtime,exception_personality,exception_c_cleanupand the four JPEG/PNG tests above all passed. The Linux compile command contains neither Windows unwind flag.Repository conventions and test-registration checks passed. The PR description now includes the Windows and WSL results. This fix and verification were AI-assisted.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:05:33Z.
Checked the five exports against SharpProspero (ABI, 64 KiB / 2 KiB limits) and shadPS4 (error values, status mapping); full build and ctest are green on current main (
guest_zlibincluded).Added one commit: a TechnicalDebt note that shadPS4 also requires the output length to be a multiple of 2 KiB and returns
0x81120016for invalid arguments, while this PR accepts any length up to 64 KiB (as SharpProspero documents only the pointer alignment) and throws. Rebased onto current main.Merging once CI is green on the new head.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:28:49Z.
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.
main)docs/dev/TechnicalDebt.mdL251docs/dev/TechnicalDebt.mdL251Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:54:07Z.
Checked the five exports against SharpProspero (ABI, limits) and shadPS4 (error values), the TechnicalDebt entry, and the template. Full build and ctest are green on current main (
guest_zlibincluded), and the test fails to build without the change. The Windows abort popcoder565 reported is fixed in 913279b8. Merging once CI is green on the current head.