feat(libSceJxr): implement the PKFactory and PKCodecFactory constructors #15232

Merged
simnJS merged 7 commits from upstream-pr/15232 into main 2026-11-07 11:50:36 +00:00
simnJS commented 2026-11-02 21:26:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simnJS on 2026-11-02T21:26:13Z.


What

Implements seven libSceJxr factory exports on the pinned jxrlib: PKCreateFactory, PKCreateFactory_CreateStream, PKCreateFactory_Release, PKCreateCodecFactory, PKCreateCodecFactory_Release, PKCodecFactory_CreateCodec (an unknown IID returns WMP_errUnsupportedFormat) and PKCodecFactory_CreateFormatConverter. The function slots hold guest-ABI pointers.

PKCreateFactory_CreateStream allocates sizeof(PKStream), 24 bytes, as jxrgluelib/JXRGlue.c does: PKStream (JXRGlue.h) is a separate structure from the 88-byte WMPStream that CreateWS_File and CreateWS_Memory create. CreateStreamFromFilename, PKCodecFactory_CreateDecoderFromFile and the PKFormatConverter_* and PKImageDecode_* functions reached through the slots stay NotImplemented_nid_no_patch; the debt file records it.

Tested

Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release: guest_jxr_factory passes (creation and release, slots called, unknown IID -106, allocation failure -101, null pointers). Only this test was run, not the full suite. Not run on Linux or on a title.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5127681516 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15232). Originally posted by [simnJS](https://github.com/simnJS) on 2026-11-02T21:26:13Z. --- ### What Implements seven libSceJxr factory exports on the pinned jxrlib: `PKCreateFactory`, `PKCreateFactory_CreateStream`, `PKCreateFactory_Release`, `PKCreateCodecFactory`, `PKCreateCodecFactory_Release`, `PKCodecFactory_CreateCodec` (an unknown IID returns `WMP_errUnsupportedFormat`) and `PKCodecFactory_CreateFormatConverter`. The function slots hold guest-ABI pointers. `PKCreateFactory_CreateStream` allocates `sizeof(PKStream)`, 24 bytes, as `jxrgluelib/JXRGlue.c` does: `PKStream` (`JXRGlue.h`) is a separate structure from the 88-byte `WMPStream` that `CreateWS_File` and `CreateWS_Memory` create. `CreateStreamFromFilename`, `PKCodecFactory_CreateDecoderFromFile` and the `PKFormatConverter_*` and `PKImageDecode_*` functions reached through the slots stay `NotImplemented_nid_no_patch`; the debt file records it. ### Tested Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release: `guest_jxr_factory` passes (creation and release, slots called, unknown IID -106, allocation failure -101, null pointers). Only this test was run, not the full suite. Not run on Linux or on a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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
BunnyFl commented 2026-11-04 00:08:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T00:08:27Z.

Review: CHANGES_REQUESTED


@simnJS thanks for this. The stream and format converter layouts match the console module, but the codec factory doesn't, and a guest calling its Release would read past the allocation.

PKCodecFactory is 40 bytes on the console, with Release at +0x20. In firmware 13.42 system/common/lib/libSceJxr.sprx (sha256 73c51baf72937450751e8437e2744fcbe23a58844625f28375f7c423fbe50362), PKCreateCodecFactory (we4rPX+-zNg, 0x378d0) is, read from disassembly and not run:

378e0: mov    $0x1,%edi
378e5: mov    $0x28,%esi
378ea: call   *(%rax)                ; allocator at 0x60138, (1, 0x28)
378f4: lea    -0x23b(%rip),%rcx      # 0x376c0  PKCodecFactory_CreateCodec
378fb: lea    -0x212(%rip),%rdx      # 0x376f0  PKCodecFactory_CreateDecoderFromFile
37902: lea    -0x109(%rip),%rsi      # 0x37800  PKCodecFactory_CreateFormatConverter
37909: mov    %rcx,(%rax)
3790c: mov    %rdx,0x8(%rax)
37910: lea    -0x77(%rip),%rdx       # 0x378a0  PKCreateCodecFactory_Release
37917: mov    %rsi,0x10(%rax)
3791b: mov    %rdx,0x20(%rax)

Nothing is stored at +0x18 (378f4–3791b above). The allocator gets (1, size), presumably jxrlib's calloc, so that slot is presumably zero. I named the four slot targets by matching their addresses against the module's export table (G+lqj7diiFM, nSR7deGcfPw, -sUOc+vW9iw, xTVG4ZQMwVk).

In this PR Jxr::CodecFactory is 32 bytes (Factory.hpp, static_assert(sizeof(CodecFactory) == 32)), and release sits at +0x18. A title or SDK module built against Sony's header calls pCodecFactory->Release(&pCodecFactory) through +0x20. Here that reads the 8 bytes right after the 32-byte calloc block and calls them. On the console it's PKCreateCodecFactory_Release.

Suggested fix: add an 8-byte field at +0x18 before release and make the struct 40 bytes, with static_assert(offsetof(CodecFactory, release) == 0x20). Then have the test check that +0x18 stays zero. I don't know what Sony's fourth slot is, and the constructor above doesn't set it. A void* the code leaves null would match what I read.

What matches (same module, same reading):

  • PKCreateFactory (0x37650) allocates 0x20 and stores PKCreateFactory_CreateStream (0x375e0) at +0, an unexported function at +8, CreateWS_Memory (0x34f80) at +0x10 and PKCreateFactory_Release (0x37620) at +0x18. That is your Factory. The +8 target is presumably CreateWS_File; I didn't read it, and your throwing CreateStreamFromFilename there is fine.
  • PKCreateFactory_CreateStream (0x375e0) allocates 0x18, which matches your 24-byte PlainStream. It returns -101 (0xffffffffffffff9b) when the allocation fails, as all four constructors do.
  • PKCodecFactory_CreateFormatConverter (0x37800) allocates 0x60 and fills the slots in your order: Initialize, InitializeConvert, GetPixelFormat, GetSourcePixelFormat, GetSize, GetResolution, Copy, Convert (0x4b740), and then Release (0x4b750) at +0x40.

What I ran: this head merged onto main (merge d19ea27c68), Windows 11, WinLibs GCC, Release. guest_jxr_factory and public_headers pass (2 of 2). The test reads release through the PR's own struct (tests/JxrFactory.cpp:121 and :150), which can't show the console's offset.

Small note: my #15626 gives PKFormatConverter_Convert_nid_postfix its jxrlib signature. Your Slot<decltype(value->convert)>(&PKFormatConverter_Convert_nid_postfix) is a reinterpret_cast (Export.cpp, Slot), and I expect it to build against either signature. Whichever of us lands second should rebuild to confirm.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5761290825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15232#pullrequestreview-5761290825). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-04T00:08:27Z. **Review:** CHANGES_REQUESTED --- @simnJS thanks for this. The stream and format converter layouts match the console module, but the codec factory doesn't, and a guest calling its `Release` would read past the allocation. **`PKCodecFactory` is 40 bytes on the console, with `Release` at `+0x20`.** In firmware 13.42 `system/common/lib/libSceJxr.sprx` (sha256 `73c51baf72937450751e8437e2744fcbe23a58844625f28375f7c423fbe50362`), `PKCreateCodecFactory` (`we4rPX+-zNg`, `0x378d0`) is, read from disassembly and not run: ``` 378e0: mov $0x1,%edi 378e5: mov $0x28,%esi 378ea: call *(%rax) ; allocator at 0x60138, (1, 0x28) 378f4: lea -0x23b(%rip),%rcx # 0x376c0 PKCodecFactory_CreateCodec 378fb: lea -0x212(%rip),%rdx # 0x376f0 PKCodecFactory_CreateDecoderFromFile 37902: lea -0x109(%rip),%rsi # 0x37800 PKCodecFactory_CreateFormatConverter 37909: mov %rcx,(%rax) 3790c: mov %rdx,0x8(%rax) 37910: lea -0x77(%rip),%rdx # 0x378a0 PKCreateCodecFactory_Release 37917: mov %rsi,0x10(%rax) 3791b: mov %rdx,0x20(%rax) ``` Nothing is stored at `+0x18` (`378f4`–`3791b` above). The allocator gets `(1, size)`, presumably jxrlib's `calloc`, so that slot is presumably zero. I named the four slot targets by matching their addresses against the module's export table (`G+lqj7diiFM`, `nSR7deGcfPw`, `-sUOc+vW9iw`, `xTVG4ZQMwVk`). In this PR `Jxr::CodecFactory` is 32 bytes (`Factory.hpp`, `static_assert(sizeof(CodecFactory) == 32)`), and `release` sits at `+0x18`. A title or SDK module built against Sony's header calls `pCodecFactory->Release(&pCodecFactory)` through `+0x20`. Here that reads the 8 bytes right after the 32-byte `calloc` block and calls them. On the console it's `PKCreateCodecFactory_Release`. Suggested fix: add an 8-byte field at `+0x18` before `release` and make the struct 40 bytes, with `static_assert(offsetof(CodecFactory, release) == 0x20)`. Then have the test check that `+0x18` stays zero. I don't know what Sony's fourth slot is, and the constructor above doesn't set it. A `void*` the code leaves null would match what I read. **What matches** (same module, same reading): - `PKCreateFactory` (`0x37650`) allocates `0x20` and stores `PKCreateFactory_CreateStream` (`0x375e0`) at `+0`, an unexported function at `+8`, `CreateWS_Memory` (`0x34f80`) at `+0x10` and `PKCreateFactory_Release` (`0x37620`) at `+0x18`. That is your `Factory`. The `+8` target is presumably `CreateWS_File`; I didn't read it, and your throwing `CreateStreamFromFilename` there is fine. - `PKCreateFactory_CreateStream` (`0x375e0`) allocates `0x18`, which matches your 24-byte `PlainStream`. It returns `-101` (`0xffffffffffffff9b`) when the allocation fails, as all four constructors do. - `PKCodecFactory_CreateFormatConverter` (`0x37800`) allocates `0x60` and fills the slots in your order: `Initialize`, `InitializeConvert`, `GetPixelFormat`, `GetSourcePixelFormat`, `GetSize`, `GetResolution`, `Copy`, `Convert` (`0x4b740`), and then `Release` (`0x4b750`) at `+0x40`. **What I ran:** this head merged onto `main` (merge `d19ea27c68`), Windows 11, WinLibs GCC, Release. `guest_jxr_factory` and `public_headers` pass (2 of 2). The test reads `release` through the PR's own struct (`tests/JxrFactory.cpp:121` and `:150`), which can't show the console's offset. Small note: my #15626 gives `PKFormatConverter_Convert_nid_postfix` its jxrlib signature. Your `Slot<decltype(value->convert)>(&PKFormatConverter_Convert_nid_postfix)` is a `reinterpret_cast` (`Export.cpp`, `Slot`), and I expect it to build against either signature. Whichever of us lands second should rebuild to confirm.
XairRrR commented 2026-11-04 00:18:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-04T00:18:52Z.

Review: COMMENTED


Reviewed — comments

The seven factory exports follow jxrlib's JXRGlue.c exactly, and the test passes and fails when allocation-failure handling is broken; the open question is the console layout of PKCodecFactory that BunnyFl raised, which I could not verify.

What I ran

Head 0d783107d35b4240a248eff9db145726f4b272d0 merged into main 1c8c0efc8c41314402e6966da5bef6ea3d639d10 (merged tree 0156b3beef9b31462b656c7cbb8731b60793d37d), Debian 13 VM, GCC 14.2.0, Release, Ninja.

git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...0d783107d35b4240a248eff9db145726f4b272d0
python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10
ctest --test-dir build --output-on-failure -R "^guest_jxr"
# negative control 1: Export.cpp and include/Api.hpp from main, Factory.hpp kept
ninja -C build -j32 -l32 guest_jxr_factory_tests
# negative control 2: merged files, AllocateZeroed made to always return WmpErrSuccess
ninja -C build -j32 -l32 guest_jxr_factory_tests
ctest --test-dir build --output-on-failure -R "^guest_jxr_factory$"
# restore merged files
ninja -C build -j32 -l32 guest_jxr_factory_tests libSceJxr
ctest --test-dir build -R "^guest_jxr_factory$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Build (script) configure, build and libs OK
Script test run 822 ran, no new failures or timeouts; unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group also fails on main (known)
guest_jxr* (10 tests incl. guest_jxr_factory) 10/10 pass, guest_jxr_factory 0.01 s
Negative control fails in both forms (see below)
Worktree after restore git status --porcelain empty
Validation layer not applicable (no AGC/shader/VideoOut change)

Negative control

  • With only Export.cpp and include/Api.hpp taken from main, the test doesn't compile. main declares these exports as parameterless int placeholders:

    excerpt
    JxrFactory.cpp:91:40: error: too many arguments to function 'int PKCreateFactory_nid_postfix()'
    JxrFactory.cpp:105:73: error: too many arguments to function 'int PKCreateFactory_CreateStream_nid_postfix()'
    JxrFactory.cpp:117:45: error: too many arguments to function 'int PKCreateCodecFactory_nid_postfix()'
    
  • That only shows the signatures changed, so I also ran a behavioural mutation. In the merged Export.cpp, I changed AllocateZeroed to return WmpErrSuccess even when calloc fails. guest_jxr_factory then failed (SEGFAULT on the allocation-failure path).

  • After restoring the merged files and rebuilding, the test passes again and the worktree is clean.

Findings

Blocking

None of my own. BunnyFl's change request (PKCodecFactory is 40 bytes on the console, with Release at +0x20) has no reply yet; see Non-blocking for what I could add.

Non-blocking

  1. BunnyFl's PKCodecFactory layout finding: more evidence, still open. core/libs/prx/libSceJxr/Factory.hpp:29-34 and :51 match the pinned jxrlib (3rdparty/jxrlib at f7521879862b9085318e814c6157490dd9dbbdb4) exactly. In its JXRGlue.h (lines 351-361), tagPKCodecFactory has four function pointers: CreateCodec, CreateDecoderFromFile, CreateFormatConverter, Release. That is 32 bytes. PKFactory, PKStream (24 bytes) and PKFormatConverter (96 bytes, pDecoder at 72) also match the header.
    • So the PR is faithful to the reference. If the firmware disassembly in that review is right, Sony's header has a fifth slot at +0x18, and the reference cannot show it.
    • The test reads release through the PR's own struct (tests/JxrFactory.cpp:121, :150), so it cannot tell the two layouts apart.
    • I have no firmware module here, so I can neither confirm nor refute the disassembly. As described, a guest built against Sony's header would call 8 bytes past the 32-byte block. The author should answer that review, or adopt the 40-byte layout, before merge.
  2. Wrong line range in the debt entry link. docs/dev/debt/libSceJxr.md:17 links JXRGlue.c#L334-L480. At that commit, PKCreateFactory_CreateStream starts at line 333 and PKCreateCodecFactory ends at line 482. Suggest #L333-L482.
  3. The known-IID paths are only checked by compiling. core/libs/prx/libSceJxr/Export.cpp:151-156 call PKImageEncode_Create_WMP_nid_postfix / PKImageDecode_Create_WMP_nid_postfix through a cast to int64_t(*)(void**). Both are still parameterless int placeholders that throw, so IIDs 101 and 201 currently end in NotImplemented.
    • The test only covers unknown IIDs. It's acceptable while those exports throw.
    • When they get their real signatures, drop the casts so the compiler checks the call. Also add a test that IID 101/201 dispatches.
  4. Two if(BUILD_TESTING) blocks. core/libs/prx/libSceJxr/CMakeLists.txt:73-84 opens a second if(BUILD_TESTING) block right after the existing one. The registration could go inside the existing block. Cosmetic.

Not verified

  • The console layouts and slot order: no firmware module or PS5 was available. BunnyFl's disassembly is unconfirmed by me.
  • Windows/MinGW build of the new test executable; only Linux GCC was built here.
  • I reran the guest_jxr and public_headers tests in the background; all 75 passed. That run overlapped the negative-control edits, so I don't count it. I rely on the script's full run of the merged tree, which reported no new failures.
  • No title was run.

To get this to a good state

  • Answer BunnyFl's layout review. If you accept the console disassembly, make Jxr::CodecFactory 40 bytes with release at 0x20 and assert it with offsetof. Have the test check that the +0x18 slot is zero. Update the debt entry to say which layout follows the console and which follows jxrlib.
  • Fix the line range of the JXRGlue.c link in the debt entry.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5761381361 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15232#pullrequestreview-5761381361). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-04T00:18:52Z. **Review:** COMMENTED --- # Reviewed — comments The seven factory exports follow jxrlib's `JXRGlue.c` exactly, and the test passes and fails when allocation-failure handling is broken; the open question is the console layout of `PKCodecFactory` that BunnyFl raised, which I could not verify. ## What I ran Head `0d783107d35b4240a248eff9db145726f4b272d0` merged into `main` `1c8c0efc8c41314402e6966da5bef6ea3d639d10` (merged tree `0156b3beef9b31462b656c7cbb8731b60793d37d`), Debian 13 VM, GCC 14.2.0, Release, Ninja. ``` git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...0d783107d35b4240a248eff9db145726f4b272d0 python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10 ctest --test-dir build --output-on-failure -R "^guest_jxr" # negative control 1: Export.cpp and include/Api.hpp from main, Factory.hpp kept ninja -C build -j32 -l32 guest_jxr_factory_tests # negative control 2: merged files, AllocateZeroed made to always return WmpErrSuccess ninja -C build -j32 -l32 guest_jxr_factory_tests ctest --test-dir build --output-on-failure -R "^guest_jxr_factory$" # restore merged files ninja -C build -j32 -l32 guest_jxr_factory_tests libSceJxr ctest --test-dir build -R "^guest_jxr_factory$" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Build (script) | configure, build and `libs` OK | | Script test run | 822 ran, no new failures or timeouts; `unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group` also fails on `main` (known) | | `guest_jxr*` (10 tests incl. `guest_jxr_factory`) | 10/10 pass, `guest_jxr_factory` 0.01 s | | Negative control | fails in both forms (see below) | | Worktree after restore | `git status --porcelain` empty | | Validation layer | not applicable (no AGC/shader/VideoOut change) | ## Negative control - With only `Export.cpp` and `include/Api.hpp` taken from `main`, the test doesn't compile. `main` declares these exports as parameterless `int` placeholders: <details><summary>excerpt</summary> ``` JxrFactory.cpp:91:40: error: too many arguments to function 'int PKCreateFactory_nid_postfix()' JxrFactory.cpp:105:73: error: too many arguments to function 'int PKCreateFactory_CreateStream_nid_postfix()' JxrFactory.cpp:117:45: error: too many arguments to function 'int PKCreateCodecFactory_nid_postfix()' ``` </details> - That only shows the signatures changed, so I also ran a behavioural mutation. In the merged `Export.cpp`, I changed `AllocateZeroed` to return `WmpErrSuccess` even when `calloc` fails. `guest_jxr_factory` then failed (SEGFAULT on the allocation-failure path). - After restoring the merged files and rebuilding, the test passes again and the worktree is clean. ## Findings ### Blocking None of my own. BunnyFl's change request (`PKCodecFactory` is 40 bytes on the console, with `Release` at `+0x20`) has no reply yet; see Non-blocking for what I could add. ### Non-blocking 1. **BunnyFl's `PKCodecFactory` layout finding: more evidence, still open.** `core/libs/prx/libSceJxr/Factory.hpp:29-34` and `:51` match the pinned jxrlib (`3rdparty/jxrlib` at `f7521879862b9085318e814c6157490dd9dbbdb4`) exactly. In its `JXRGlue.h` (lines 351-361), `tagPKCodecFactory` has four function pointers: `CreateCodec`, `CreateDecoderFromFile`, `CreateFormatConverter`, `Release`. That is 32 bytes. `PKFactory`, `PKStream` (24 bytes) and `PKFormatConverter` (96 bytes, `pDecoder` at 72) also match the header. - So the PR is faithful to the reference. If the firmware disassembly in that review is right, Sony's header has a fifth slot at `+0x18`, and the reference cannot show it. - The test reads `release` through the PR's own struct (`tests/JxrFactory.cpp:121`, `:150`), so it cannot tell the two layouts apart. - I have no firmware module here, so I can neither confirm nor refute the disassembly. As described, a guest built against Sony's header would call 8 bytes past the 32-byte block. The author should answer that review, or adopt the 40-byte layout, before merge. 2. **Wrong line range in the debt entry link.** `docs/dev/debt/libSceJxr.md:17` links `JXRGlue.c#L334-L480`. At that commit, `PKCreateFactory_CreateStream` starts at line 333 and `PKCreateCodecFactory` ends at line 482. Suggest `#L333-L482`. 3. **The known-IID paths are only checked by compiling.** `core/libs/prx/libSceJxr/Export.cpp:151-156` call `PKImageEncode_Create_WMP_nid_postfix` / `PKImageDecode_Create_WMP_nid_postfix` through a cast to `int64_t(*)(void**)`. Both are still parameterless `int` placeholders that throw, so IIDs 101 and 201 currently end in `NotImplemented`. - The test only covers unknown IIDs. It's acceptable while those exports throw. - When they get their real signatures, drop the casts so the compiler checks the call. Also add a test that IID 101/201 dispatches. 4. **Two `if(BUILD_TESTING)` blocks.** `core/libs/prx/libSceJxr/CMakeLists.txt:73-84` opens a second `if(BUILD_TESTING)` block right after the existing one. The registration could go inside the existing block. Cosmetic. ## Not verified - The console layouts and slot order: no firmware module or PS5 was available. BunnyFl's disassembly is unconfirmed by me. - Windows/MinGW build of the new test executable; only Linux GCC was built here. - I reran the `guest_jxr` and `public_headers` tests in the background; all 75 passed. That run overlapped the negative-control edits, so I don't count it. I rely on the script's full run of the merged tree, which reported no new failures. - No title was run. ## To get this to a good state - Answer BunnyFl's layout review. If you accept the console disassembly, make `Jxr::CodecFactory` 40 bytes with `release` at `0x20` and assert it with `offsetof`. Have the test check that the `+0x18` slot is zero. Update the debt entry to say which layout follows the console and which follows jxrlib. - Fix the line range of the `JXRGlue.c` link in the debt entry. <!-- anyps5-bots job=2553 head=0d783107d35b4240a248eff9db145726f4b272d0 -->
BunnyFl commented 2026-11-06 18:34:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-06T18:34:31Z.

Review: APPROVED


@simnJS re-checked at bfc31e1c4e, and my change request is resolved (cc @oneandonlydean, thanks for pushing the fix in 25f5019918).

The codec factory now matches what PKCreateCodecFactory allocates in firmware 13.42. Jxr::CodecFactory has an empty void* reserved at +0x18, and release sits at +0x20 in a 40-byte struct. core/libs/prx/libSceJxr/Factory.hpp:79 asserts both (sizeof == 40, offsetof(release) == 0x20). The test now reads the raw slots, so it no longer depends on the PR's own struct: tests/JxrFactory.cpp:122 requires slot 3 to be null and slot 4 to be Release. That is the layout from my disassembly at 0d783107d3.

I didn't check the other change, initializeConvert taking the GUID by value, against JXRGlue.h myself.

What I ran

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release, this head merged onto current main (merge 22edf6e602):

  • guest_jxr_factory and public_headers: 2 of 2 pass.
  • Mutation, on the same kind of merge (43cadd451b): PKCreateCodecFactory also writes Release into the reserved slot. guest_jxr_factory then aborts (0xc0000409), 0 of 1 pass. So the new check catches a factory that fills +0x18.
  • tools/check_conventions.py --base upstream/main --head on this head: all checks pass.
  • tools/pr_overlap.py --branch: the confirmed line conflicts are libSceJxr/CMakeLists.txt L121 (#15148, #15479, #15689), the debt entry list at L38-39 of docs/dev/debt/libSceJxr.md, and include/Api.hpp L68-74 with my #15626. That last one is the PKFormatConverter_Convert signature I mentioned at 0d783107d3; whichever of us lands second rebuilds. Its "same exports" rows (Allocate, Align, Calloc and so on) are the test's local heap callbacks, not exports.

Still open from XairRrR's earlier review, non-blocking. At bfc31e1c4e, the debt entry's JXRGlue.c link still reads #L334-L480 (docs/dev/debt/libSceJxr.md:39).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5805096227 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15232#pullrequestreview-5805096227). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-06T18:34:31Z. **Review:** APPROVED --- @simnJS re-checked at `bfc31e1c4e`, and my change request is resolved (cc @oneandonlydean, thanks for pushing the fix in `25f5019918`). **The codec factory now matches what `PKCreateCodecFactory` allocates in firmware 13.42.** `Jxr::CodecFactory` has an empty `void* reserved` at `+0x18`, and `release` sits at `+0x20` in a 40-byte struct. `core/libs/prx/libSceJxr/Factory.hpp:79` asserts both (`sizeof == 40`, `offsetof(release) == 0x20`). The test now reads the raw slots, so it no longer depends on the PR's own struct: `tests/JxrFactory.cpp:122` requires slot 3 to be null and slot 4 to be `Release`. That is the layout from my disassembly at `0d783107d3`. I didn't check the other change, `initializeConvert` taking the GUID by value, against `JXRGlue.h` myself. ## What I ran Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release, this head merged onto current `main` (merge `22edf6e602`): - `guest_jxr_factory` and `public_headers`: 2 of 2 pass. - **Mutation**, on the same kind of merge (`43cadd451b`): `PKCreateCodecFactory` also writes `Release` into the reserved slot. `guest_jxr_factory` then aborts (`0xc0000409`), 0 of 1 pass. So the new check catches a factory that fills `+0x18`. - `tools/check_conventions.py --base upstream/main --head` on this head: all checks pass. - `tools/pr_overlap.py --branch`: the confirmed line conflicts are `libSceJxr/CMakeLists.txt` L121 (#15148, #15479, #15689), the debt entry list at L38-39 of `docs/dev/debt/libSceJxr.md`, and `include/Api.hpp` L68-74 with my #15626. That last one is the `PKFormatConverter_Convert` signature I mentioned at `0d783107d3`; whichever of us lands second rebuilds. Its "same exports" rows (`Allocate`, `Align`, `Calloc` and so on) are the test's local heap callbacks, not exports. Still open from XairRrR's earlier review, non-blocking. At `bfc31e1c4e`, the debt entry's `JXRGlue.c` link still reads `#L334-L480` (`docs/dev/debt/libSceJxr.md:39`). AI-assisted: yes (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!15232
No description provided.