feat(libSceJxr): implement PKImageDecode query and metadata exports #15684

Merged
ashwin280802 merged 1 commit from upstream-pr/15684 into main 2026-11-07 21:25:55 +00:00
ashwin280802 commented 2026-11-04 04:33:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ashwin280802 on 2026-11-04T04:33:24Z.


What

Implements the libSceJxr PKImageDecode query and lifetime exports (Initialize, GetPixelFormat, GetSize, GetResolution, GetFrameCount, GetColorContext, GetDescriptiveMetadata, Release) on jxrlib's own PKImageDecode, through src/NativeGlue.c, following JXRGlue.c L799-L905. The six getters call the jxrlib functions directly. Initialize and Release are line-for-line copies of the jxrlib bodies in NativeGlue.c, so that the guest GetPos and Close callbacks can be called with the guest ABI.

Deliberate divergences from jxrlib: a null decoder, null output, null Release argument, a stream without GetPos, and an owned stream that is missing or has no Close throw std::invalid_argument, where jxrlib would dereference them. Initialize sets 96 DPI, one frame and GUID_PKPixelFormatDontCare, and leaves the metadata block alone when GetPos fails, as jxrlib does. GetColorContext and GetDescriptiveMetadata return WMP_errNotYetImplemented for every input, as jxrlib never reads their arguments. The console's decoder layout is unverified; see docs/dev/debt/libSceJxr.md.

Open PRs touching the same libSceJxr files: #16402, #16403, #16404, #16405, #16406 and #16408 overlap in Export.cpp, Api.hpp and the debt file, and some also in GuestJxr.cpp, GlueHelpers.cpp, NativeGlue.c and CMakeLists.txt. None of them implements these eight exports (I read #16403, which implements PKImageDecode_Create and installs callbacks to the same jxrlib functions while its exports stay stubs; the others I judged from their titles). The overlap check could not compare these 35 PRs against the base: #7645, #14212, #15148, #15232, #15626, #15645, #15646, #15689, #15771, #15772, #15774, #16225, #16227, #16228, #16229, #16230, #16232, #16233, #16273, #16275, #16276, #16277, #16278, #16279, #16282, #16297, #16298, #16299, #16300, #16402, #16403, #16404, #16405, #16406, #16408. #16403 adds a similar set of native decode helpers under other names, so whichever of the two merges second has to reconcile them. Shared insertions need reconciling in merge order.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, commit a0827f1c62.

$ ctest --test-dir build-full -R guest_jxr --output-on-failure
100% tests passed out of 13
$ python3 tools/check_conventions.py --base origin/main
All conventions checks passed.

I changed 13 conditions one at a time and the test failed on all 13.
Not covered by a test: nothing (0 survivors).
The full Linux suite also ran on the same code before the last rebase onto main, and every guest_jxr test passed; it was not re-run on the rebased commit.
Not verified: AddressSanitizer, any title or console behaviour.

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
  • 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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5148913158 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15684). Originally posted by [ashwin280802](https://github.com/ashwin280802) on 2026-11-04T04:33:24Z. --- ### What Implements the libSceJxr `PKImageDecode` query and lifetime exports (`Initialize`, `GetPixelFormat`, `GetSize`, `GetResolution`, `GetFrameCount`, `GetColorContext`, `GetDescriptiveMetadata`, `Release`) on jxrlib's own `PKImageDecode`, through `src/NativeGlue.c`, following [JXRGlue.c L799-L905](https://github.com/4creators/jxrlib/blob/f7521879862b9085318e814c6157490dd9dbbdb4/jxrgluelib/JXRGlue.c#L799-L905). The six getters call the jxrlib functions directly. `Initialize` and `Release` are line-for-line copies of the jxrlib bodies in `NativeGlue.c`, so that the guest `GetPos` and `Close` callbacks can be called with the guest ABI. Deliberate divergences from jxrlib: a null decoder, null output, null `Release` argument, a stream without `GetPos`, and an owned stream that is missing or has no `Close` throw `std::invalid_argument`, where jxrlib would dereference them. `Initialize` sets 96 DPI, one frame and `GUID_PKPixelFormatDontCare`, and leaves the metadata block alone when `GetPos` fails, as jxrlib does. `GetColorContext` and `GetDescriptiveMetadata` return `WMP_errNotYetImplemented` for every input, as jxrlib never reads their arguments. The console's decoder layout is unverified; see `docs/dev/debt/libSceJxr.md`. Open PRs touching the same libSceJxr files: #16402, #16403, #16404, #16405, #16406 and #16408 overlap in `Export.cpp`, `Api.hpp` and the debt file, and some also in `GuestJxr.cpp`, `GlueHelpers.cpp`, `NativeGlue.c` and `CMakeLists.txt`. None of them implements these eight exports (I read #16403, which implements `PKImageDecode_Create` and installs callbacks to the same jxrlib functions while its exports stay stubs; the others I judged from their titles). The overlap check could not compare these 35 PRs against the base: #7645, #14212, #15148, #15232, #15626, #15645, #15646, #15689, #15771, #15772, #15774, #16225, #16227, #16228, #16229, #16230, #16232, #16233, #16273, #16275, #16276, #16277, #16278, #16279, #16282, #16297, #16298, #16299, #16300, #16402, #16403, #16404, #16405, #16406, #16408. #16403 adds a similar set of native decode helpers under other names, so whichever of the two merges second has to reconcile them. Shared insertions need reconciling in merge order. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, commit a0827f1c62. ``` $ ctest --test-dir build-full -R guest_jxr --output-on-failure 100% tests passed out of 13 $ python3 tools/check_conventions.py --base origin/main All conventions checks passed. ``` I changed 13 conditions one at a time and the test failed on all 13. Not covered by a test: nothing (0 survivors). The full Linux suite also ran on the same code before the last rebase onto `main`, and every `guest_jxr` test passed; it was not re-run on the rebased commit. Not verified: AddressSanitizer, any title or console behaviour. ### Checklist - [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) - [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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!15684
No description provided.