feat(libSceJxr): implement the pixel format hash, image IID lookups, aligned allocation and IDPEmpty #14905
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14905"
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 Noxy-HNR on 2026-11-02T00:06:22Z.
What
Six named libSceJxr exports currently throw:
GetPixelFormatFromHash,GetImageEncodeIID,GetImageDecodeIID,PKAllocAligned,PKFreeAlignedandIDPEmpty. Implement them from Microsoft's jxrlib at the pinned submodule commit, JXRGlue.c and strcodec.c:GetPixelFormatFromHashcalls the pinned jxrlib through a C bridge, likePixelFormatLookup, and returns its read-only GUID for the hash (the GUID's last byte), or null.GetImageEncodeIID/GetImageDecodeIIDmatch.jxr,.wdpand.hdpas case-insensitive prefixes and store the exportedIID_PKImageWmpEncode(101) /IID_PKImageWmpDecode(201)..wdpand.hdpencoding store a privateIID_PKImageUnsupported(100), which the module does not export. Unknown extensions returnWMP_errUnsupportedFormat(-106) without writing the output.PKAllocAlignedtakessize + 8 + alignment - 1bytes from the guestcalloc, stores the original pointer just below the aligned block and returnsWMP_errOutOfMemory(-101) whencallocfails.PKFreeAlignedreleases that original pointer through the guestfree.IDPEmptyreturnsICERR_OK(0).The third-party algorithms stay in the unmodified, source-built
3rdparty/jxrlibdependency, with its license notices retained.NativeGlue.cbridges toJXRGlue.candstrcodec.c;GlueHelpers.cppsupplies the guest ABI, argument checks and IID-object mapping. A dedicatedJXRGlue.cbuild routescallocandfreethrough the guest heap. Null outputs, alignments below 8 and overflowing block sizes throw before entering jxrlib. That the console's module is jxrlib with these prototypes is inferred from the export names; nothing is checked on a console. These limits are recorded in the library's debt file. No title unblock is claimed.Merge order: this PR follows #14425 and #14631. Both merge cleanly with current main individually, but their combination with this branch conflicts in the shared JXR files. There is no runtime dependency on either implementation; the dependency line records integration order. Rebase and rerun
guest_jxrafter those PRs merge. The current pairwise preview with #7645 is clean.Tested
Latest follow-up verification at
c7a34875b0: rebuiltguest_jxr_glue_tests,guest_jxr_stream_testsandguest_jxr_testson Windows 11 x86-64, WinLibs MinGW GCC 15.2.0, Release.ctest -R '^guest_jxr(_glue|_stream)?$': 3/3 passed. This directly checks the new native glue, the guest allocator routing and existing stream helpers. Conventions and whitespace checks passed. The hosted Windows, conventions and library-portability checks also pass at this head. The earlier 10-test runs below are retained as prior verification; Linux and patched lookup tests were not rerun in this follow-up.New
guest_jxr_gluetest: all 256 hashes against the pinned jxrlib'sGetPixelFormatFromHash(null-ness and GUID bytes), the IID lookups for each extension, case, prefix and unknown extension with and without an output, aligned allocation for alignments 8, 16, 24, 64 and 4096 and sizes 0, 1 and 100 through a recording application allocator (calloc arguments, alignment, zero fill, stored original pointer, release), calloc failure, null and too-small alignments and size overflow.0580e5c951:ctest -R guest_jxr10/10 passed.ctest -R guest_jxr10/10 passed, including the_patchedlookup tests against the patchedlibSceJxr.prx.python tools/check_conventions.py --base origin/main,git diff --checkandpython core/libs/tests/test_public_headers.py --audit-only(399 libraries, 26,743 exports): passed.python tools/pr_overlap.py --branch claude/jxr-glue-helpers(1,849 open PRs): #14425 (PKAlloc) and #14631 (WMPAlloc,WMPFree, memory stream) touch neighbouring lines ofCMakeLists.txt,Export.cpp,include/Api.hppand the debt file; neither shares an export or new file. Whichever lands second needs a small rebase. #7645 also editslibSceJxr/CMakeLists.txt(Windows DLL staging forguest_jxr_lookup_tests); if it lands first,guest_jxr_glue_testsmay need the same treatment.No console or retail-title test.
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)