feat(libSceJxr): return success from four jxrlib defaults as firmware 13.42 does #15626

Merged
BunnyFl merged 5 commits from upstream-pr/15626 into main 2026-11-10 09:55:05 +00:00
BunnyFl commented 2026-11-03 22:18:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T22:18:04Z.


What

Four libSceJxr exports threw. In firmware 13.42 each one returns 0 at once, reading none of its arguments, and this change does the same:

Export NID Prototype (jxrlib) Returns
PKFormatConverter_Convert CTlB5wK20Qk ERR (PKFormatConverter*, const PKRect*, U8*, U32), jxrgluelib/JXRGluePFC.c:2319 WMP_errSuccess (0)
PKImageDecode_SelectFrame 4+P+wYw54HU ERR (PKImageDecode*, U32), jxrgluelib/JXRGlue.c:887 0
PKImageEncode_CreateNewFrame 8QSygiUqxzQ ERR (PKImageEncode*, void*, size_t), jxrgluelib/JXRGlue.c:744 0
PKImageEncode_Terminate 0H5MsNx2XC4 ERR (PKImageEncode*), jxrgluelib/JXRGlue.c:512 0

The prototypes and bodies come from the jxrlib revision the debt file already pins, f752187986, which is the 3rdparty/jxrlib submodule. In it each of the four ignores its arguments and returns WMP_errSuccess. ERR is a 64-bit long, as for PKFree. The pointer types are void* in core/libs/prx/libSceJxr/include/Api.hpp.

In docs/dev/debt/libSceJxr.md, the entry for the remaining additional stubs goes from 51 to 47 on current main 8e34d2642d, counted from the merged Export.cpp (47 NotImplemented_nid_no_patch calls, against 51 on main). A new entry says it is unverified that the console module is built from jxrlib, and that the bodies were read from disassembly, not measured on a console.

The survey also listed IDPEmpty, with the same xor %eax,%eax; ret body at 0x34d10. It is left out: #14905 (Noxy-HNR) already implements it. #15232 (simnJS, since merged) takes the address of PKFormatConverter_Convert_nid_postfix for a PKFormatConverter slot (core/libs/prx/libSceJxr/Export.cpp:190 at 865e11df14, a Slot<decltype(...)> cast that builds with the typed signature), and #15774 (alvaroelpob) takes the addresses of PKImageEncode_Terminate_nid_postfix and PKImageEncode_CreateNewFrame_nid_postfix for PKImageEncode slots; neither calls or implements them. Whichever lands second may need to adjust those slots' casts to the typed signatures.

Source

Firmware 13.42 system/common/lib/libSceJxr.sprx (sha256 73c51baf72937450751e8437e2744fcbe23a58844625f28375f7c423fbe50362), read from disassembly, not run on a console. Export addresses come from the module's dynamic symbol table. Each body, to its return:

4b740: xor %eax,%eax ; ret   ; PKFormatConverter_Convert
381e0: xor %eax,%eax ; ret   ; PKImageDecode_SelectFrame
37fb0: xor %eax,%eax ; ret   ; PKImageEncode_CreateNewFrame
37990: xor %eax,%eax ; ret   ; PKImageEncode_Terminate

A 32-bit xor %eax,%eax zero-extends into rax (Intel SDM Vol. 1, 3.4.1.1), which makes the 64-bit ERR exactly 0. None of the four bodies above reads an argument or stores anything. A null or invalid pointer is never dereferenced, here or in firmware.

Tested

  • Merged main 8e34d2642d into the branch; the head is now 375b98998c. The only conflict was docs/dev/debt/libSceJxr.md, the count line again: main had lowered it to 51 while this branch read 58. The count line now reads 47, counted from the merged Export.cpp: 47 NotImplemented_nid_no_patch calls, against 51 on main and 62 at the merge base. Export.cpp and include/Api.hpp merged without a conflict, and git merge-tree against upstream/main is clean.
    • On 375b98998c, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: ctest -R '^(guest_jxr|public_headers$)' 19 of 19 pass, none Not Run (100% tests passed, 0 tests failed out of 19), with all 12 guest_jxr* test executables rebuilt, and libSceJxr builds.
    • sig_users.py HEAD --build: the four changed declarations are named in 3 files, none outside this branch's own changes; guest_jxr_tests and libSceJxr build (exit 0).
    • tools/check_conventions.py --base upstream/main on the committed head 375b98998c: all checks pass.
    • tools/pr_overlap.py --branch feat/libscejxr-glue-defaults --jobs 8 at this head: no line conflict with any open pull request it could compare. It failed closed for 9 that conflict with main themselves (#14212, #15645, #15646, #15772, #15774, #17400, #17401, #17402, #17403). I grepped the added and removed lines of all 9 for the four export names: #15774 takes the addresses of PKImageEncode_Terminate_nid_postfix and PKImageEncode_CreateNewFrame_nid_postfix as described above, and #17402 (MarrasFederico) calls jxrlib's own C PKImageDecode_SelectFrame from a native helper in src/NativeGlue.c, not this branch's PKImageDecode_SelectFrame_nid_postfix export. The other seven share only the debt count line.
  • Merged main 66db234b2d into the branch; the head is now 865e11df14. The only conflict was docs/dev/debt/libSceJxr.md, where main had added its list-stream entry (WriteWS_List to CreateWS_List) before the count line and lowered the count to 62. Both entries are kept, and the count line now reads 58, counted from the merged Export.cpp: 58 NotImplemented_nid_no_patch calls, against 62 on main. Apart from the count line, the branch's added and removed lines against main are the same as at ba5f5dca6f.
    • On 865e11df14, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: ctest -R '^guest_jxr' 16 of 16 pass, none Not Run, with libSceJxr and all 10 guest_jxr* test executables rebuilt; public_headers passes.
    • sig_users.py HEAD --build: the four changed declarations are named only in this branch's files; guest_jxr_tests and libSceJxr build.
    • tools/check_conventions.py --base upstream/main on the committed head 865e11df14: all checks pass.
  • Merged main 502288c2cf into the branch; the head is now a6b2857050. The only conflict was docs/dev/debt/libSceJxr.md, where main had added its Predict and SimpleBitIO entries next to this PR's entry and lowered the count line. All three entries are kept, and the count line in docs/dev/debt/libSceJxr.md at a6b2857050 now reads 78, counted from the merged Export.cpp: 78 of its 97 APS5_VABI definitions throw through NotImplemented_nid_no_patch, against 82 of 97 on main 502288c2cf. Export.cpp merged without a conflict.
  • Merged main d4060ca168 into the branch; the head is now ba5f5dca6f. main had implemented eight PKImageDecode exports in src/GlueHelpers.cpp and removed their stubs from Export.cpp; the merge takes main's removals and declarations and keeps this branch's four. Counted from the merged Export.cpp, 64 stubs remain (76 at the merge base 5062ba1fa4, 68 on main, 72 at this branch's previous head, which is what each states), and the debt entry says 64. ctest -R '^guest_jxr': 15 of 15 passed; sig_users.py HEAD --build: the changed declarations are named only in this branch's files.
    • On a6b2857050, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: 15 of 15 pass, none Not Run. That is public_headers and the 14 guest_jxr* tests registered at this head, with their 8 test executables rebuilt; the build linked both the unpatched and the patched libSceJxr.prx.
    • The branch's added and removed lines against main are the same as at 25a501effe apart from the count line, so the negative control below was not repeated.
    • tools/check_conventions.py --base upstream/main on the committed head a6b2857050: all checks pass.
  • Windows 11 Pro 10.0.26300, WinLibs GCC, Release, head 25a501effe (main c9f43dfa1d merged in): 77 of 77 pass, none Not Run. That is the twelve guest_jxr* tests registered at this head, public_headers and the 64 public_headers_compile_* batches.
  • core/libs/tests/GuestJxr.cpp (guest_jxr) now calls the four, with buffers and with null pointers.
    • It checks each result is 0.
    • It checks that the object, rectangle and pixel buffers are unchanged.
    • It checks that no extra free happened.
  • Negative control (run at the earlier head 027db07ef4; the branch's diff against main differs between that head and 25a501effe only in the count at docs/dev/debt/libSceJxr.md:43): I put NotImplemented_nid_no_patch(__func__) back at the top of the four bodies, which is main's behaviour, and kept this branch's signatures and test. guest_jxr then aborts with PKFormatConverter_Convert_nid_postfix not implemented (1 of 1 failed).
  • tools/check_conventions.py --base upstream/main on the committed head 25a501effe: all checks pass.
  • tools/pr_overlap.py --branch feat/libscejxr-glue-defaults --jobs 8 at head 865e11df14: no line conflict with any open pull request it could compare. It failed closed for 33 that conflict with main themselves (#14212 and 32 libSceJxr pull requests) and lists them in its "Some comparisons could not be completed" table, which it does not compare line by line. I grepped the added and removed lines of all 33 diffs for the four names: #15774 takes the addresses of PKImageEncode_Terminate_nid_postfix and PKImageEncode_CreateNewFrame_nid_postfix as described above, and #16729 (MarrasFederico)'s src/NativeGlue.c calls jxrlib's own C PKImageDecode_SelectFrame from a native helper, not this branch's PKImageDecode_SelectFrame_nid_postfix export. #15148, which edited the same count line, has been merged.
  • Linux and macOS were not built or run. No title was run.

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:5145364249 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15626). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T22:18:04Z. --- ### What Four libSceJxr exports threw. In firmware 13.42 each one returns 0 at once, reading none of its arguments, and this change does the same: | Export | NID | Prototype (jxrlib) | Returns | |---|---|---|---| | `PKFormatConverter_Convert` | `CTlB5wK20Qk` | `ERR (PKFormatConverter*, const PKRect*, U8*, U32)`, `jxrgluelib/JXRGluePFC.c:2319` | `WMP_errSuccess` (0) | | `PKImageDecode_SelectFrame` | `4+P+wYw54HU` | `ERR (PKImageDecode*, U32)`, `jxrgluelib/JXRGlue.c:887` | 0 | | `PKImageEncode_CreateNewFrame` | `8QSygiUqxzQ` | `ERR (PKImageEncode*, void*, size_t)`, `jxrgluelib/JXRGlue.c:744` | 0 | | `PKImageEncode_Terminate` | `0H5MsNx2XC4` | `ERR (PKImageEncode*)`, `jxrgluelib/JXRGlue.c:512` | 0 | The prototypes and bodies come from the jxrlib revision the debt file already pins, [`f752187986`](https://github.com/4creators/jxrlib/tree/f7521879862b9085318e814c6157490dd9dbbdb4), which is the `3rdparty/jxrlib` submodule. In it each of the four ignores its arguments and returns `WMP_errSuccess`. `ERR` is a 64-bit `long`, as for `PKFree`. The pointer types are `void*` in `core/libs/prx/libSceJxr/include/Api.hpp`. In `docs/dev/debt/libSceJxr.md`, the entry for the remaining additional stubs goes from 51 to 47 on current `main` `8e34d2642d`, counted from the merged `Export.cpp` (47 `NotImplemented_nid_no_patch` calls, against 51 on `main`). A new entry says it is unverified that the console module is built from jxrlib, and that the bodies were read from disassembly, not measured on a console. The survey also listed `IDPEmpty`, with the same `xor %eax,%eax; ret` body at `0x34d10`. It is left out: [#14905](https://github.com/boykopovar/AnyPS5/pull/14905) (Noxy-HNR) already implements it. #15232 (simnJS, since merged) takes the address of `PKFormatConverter_Convert_nid_postfix` for a `PKFormatConverter` slot (`core/libs/prx/libSceJxr/Export.cpp:190` at `865e11df14`, a `Slot<decltype(...)>` cast that builds with the typed signature), and #15774 (alvaroelpob) takes the addresses of `PKImageEncode_Terminate_nid_postfix` and `PKImageEncode_CreateNewFrame_nid_postfix` for `PKImageEncode` slots; neither calls or implements them. Whichever lands second may need to adjust those slots' casts to the typed signatures. ### Source Firmware 13.42 `system/common/lib/libSceJxr.sprx` (sha256 `73c51baf72937450751e8437e2744fcbe23a58844625f28375f7c423fbe50362`), read from disassembly, not run on a console. Export addresses come from the module's dynamic symbol table. Each body, to its return: ``` 4b740: xor %eax,%eax ; ret ; PKFormatConverter_Convert 381e0: xor %eax,%eax ; ret ; PKImageDecode_SelectFrame 37fb0: xor %eax,%eax ; ret ; PKImageEncode_CreateNewFrame 37990: xor %eax,%eax ; ret ; PKImageEncode_Terminate ``` A 32-bit `xor %eax,%eax` zero-extends into `rax` (Intel SDM Vol. 1, 3.4.1.1), which makes the 64-bit `ERR` exactly 0. None of the four bodies above reads an argument or stores anything. A null or invalid pointer is never dereferenced, here or in firmware. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Merged `main` `8e34d2642d` into the branch; the head is now `375b98998c`. The only conflict was `docs/dev/debt/libSceJxr.md`, the count line again: `main` had lowered it to 51 while this branch read 58. The count line now reads 47, counted from the merged `Export.cpp`: 47 `NotImplemented_nid_no_patch` calls, against 51 on `main` and 62 at the merge base. `Export.cpp` and `include/Api.hpp` merged without a conflict, and `git merge-tree` against `upstream/main` is clean. - On `375b98998c`, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: `ctest -R '^(guest_jxr|public_headers$)'` **19 of 19 pass, none Not Run** (100% tests passed, 0 tests failed out of 19), with all 12 `guest_jxr*` test executables rebuilt, and `libSceJxr` builds. - `sig_users.py HEAD --build`: the four changed declarations are named in 3 files, none outside this branch's own changes; `guest_jxr_tests` and `libSceJxr` build (exit 0). - `tools/check_conventions.py --base upstream/main` on the committed head `375b98998c`: all checks pass. - `tools/pr_overlap.py --branch feat/libscejxr-glue-defaults --jobs 8` at this head: no line conflict with any open pull request it could compare. It failed closed for 9 that conflict with `main` themselves (#14212, #15645, #15646, #15772, #15774, #17400, #17401, #17402, #17403). I grepped the added and removed lines of all 9 for the four export names: #15774 takes the addresses of `PKImageEncode_Terminate_nid_postfix` and `PKImageEncode_CreateNewFrame_nid_postfix` as described above, and #17402 (MarrasFederico) calls jxrlib's own C `PKImageDecode_SelectFrame` from a native helper in `src/NativeGlue.c`, not this branch's `PKImageDecode_SelectFrame_nid_postfix` export. The other seven share only the debt count line. - Merged `main` `66db234b2d` into the branch; the head is now `865e11df14`. The only conflict was `docs/dev/debt/libSceJxr.md`, where `main` had added its list-stream entry (`WriteWS_List` to `CreateWS_List`) before the count line and lowered the count to 62. Both entries are kept, and the count line now reads 58, counted from the merged `Export.cpp`: 58 `NotImplemented_nid_no_patch` calls, against 62 on `main`. Apart from the count line, the branch's added and removed lines against `main` are the same as at `ba5f5dca6f`. - On `865e11df14`, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: `ctest -R '^guest_jxr'` **16 of 16 pass, none Not Run**, with `libSceJxr` and all 10 `guest_jxr*` test executables rebuilt; `public_headers` passes. - `sig_users.py HEAD --build`: the four changed declarations are named only in this branch's files; `guest_jxr_tests` and `libSceJxr` build. - `tools/check_conventions.py --base upstream/main` on the committed head `865e11df14`: all checks pass. - Merged `main` `502288c2cf` into the branch; the head is now `a6b2857050`. The only conflict was `docs/dev/debt/libSceJxr.md`, where `main` had added its Predict and SimpleBitIO entries next to this PR's entry and lowered the count line. All three entries are kept, and the count line in `docs/dev/debt/libSceJxr.md` at `a6b2857050` now reads 78, counted from the merged `Export.cpp`: 78 of its 97 `APS5_VABI` definitions throw through `NotImplemented_nid_no_patch`, against 82 of 97 on `main` `502288c2cf`. `Export.cpp` merged without a conflict. - Merged `main` `d4060ca168` into the branch; the head is now `ba5f5dca6f`. `main` had implemented eight `PKImageDecode` exports in `src/GlueHelpers.cpp` and removed their stubs from `Export.cpp`; the merge takes `main`'s removals and declarations and keeps this branch's four. Counted from the merged `Export.cpp`, 64 stubs remain (76 at the merge base `5062ba1fa4`, 68 on `main`, 72 at this branch's previous head, which is what each states), and the debt entry says 64. `ctest -R '^guest_jxr'`: 15 of 15 passed; `sig_users.py HEAD --build`: the changed declarations are named only in this branch's files. - On `a6b2857050`, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: **15 of 15 pass, none Not Run**. That is `public_headers` and the 14 `guest_jxr*` tests registered at this head, with their 8 test executables rebuilt; the build linked both the unpatched and the patched `libSceJxr.prx`. - The branch's added and removed lines against `main` are the same as at `25a501effe` apart from the count line, so the negative control below was not repeated. - `tools/check_conventions.py --base upstream/main` on the committed head `a6b2857050`: all checks pass. - Windows 11 Pro 10.0.26300, WinLibs GCC, Release, head `25a501effe` (`main` `c9f43dfa1d` merged in): 77 of 77 pass, none Not Run. That is the twelve `guest_jxr*` tests registered at this head, `public_headers` and the 64 `public_headers_compile_*` batches. - `core/libs/tests/GuestJxr.cpp` (`guest_jxr`) now calls the four, with buffers and with null pointers. - It checks each result is 0. - It checks that the object, rectangle and pixel buffers are unchanged. - It checks that no extra `free` happened. - **Negative control** (run at the earlier head `027db07ef4`; the branch's diff against `main` differs between that head and `25a501effe` only in the count at `docs/dev/debt/libSceJxr.md:43`): I put `NotImplemented_nid_no_patch(__func__)` back at the top of the four bodies, which is `main`'s behaviour, and kept this branch's signatures and test. `guest_jxr` then aborts with `PKFormatConverter_Convert_nid_postfix not implemented` (1 of 1 failed). - `tools/check_conventions.py --base upstream/main` on the committed head `25a501effe`: all checks pass. - `tools/pr_overlap.py --branch feat/libscejxr-glue-defaults --jobs 8` at head `865e11df14`: no line conflict with any open pull request it could compare. It failed closed for 33 that conflict with `main` themselves (#14212 and 32 libSceJxr pull requests) and lists them in its "Some comparisons could not be completed" table, which it does not compare line by line. I grepped the added and removed lines of all 33 diffs for the four names: #15774 takes the addresses of `PKImageEncode_Terminate_nid_postfix` and `PKImageEncode_CreateNewFrame_nid_postfix` as described above, and #16729 (MarrasFederico)'s `src/NativeGlue.c` calls jxrlib's own C `PKImageDecode_SelectFrame` from a native helper, not this branch's `PKImageDecode_SelectFrame_nid_postfix` export. #15148, which edited the same count line, has been merged. - Linux and macOS were not built or run. No title was run. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gabichuuuuu commented 2026-11-08 21:44:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T21:44:01Z.

Review: COMMENTED


Windows run of head 865e11df14, merged onto main 095ff72367 in one tree with other open PRs that touch different files (each PR's test is its own file, so they don't interact). Setup: Windows 11, WinLibs GCC 15.2 r7 (x86_64-ucrt-posix-seh, the CI toolchain), Release, BUILD_TESTING=ON.

  • guest_jxr with --repeat until-fail:5: 5 / 5 pass.
  • No runnable negative control: with main's Export.cpp and header, the test doesn't compile (too many arguments to function 'int PKFormatConverter_Convert_nid_postfix()').

The four functions match jxrlib: each ignores its arguments and returns WMP_errSuccess. One fix in the debt entry: the line numbers are in a different order from the names. At the pinned jxrlib, JXRGlue.c:512 is PKImageEncode_Terminate, :744 is PKImageEncode_CreateNewFrame and :887 is PKImageDecode_SelectFrame, while the entry lists SelectFrame, CreateNewFrame and Terminate against :512, :744 and :887.

This PR conflicts with each of the consolidated libSceJxr PRs #17400, #17401, #17402 and #17403. It also fixes the gap I noted on #17400: PKFormatConverter_Initialize installs PKFormatConverter_Convert as the default, and that one now succeeds as in jxrlib.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5819793600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15626#pullrequestreview-5819793600). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T21:44:01Z. **Review:** COMMENTED --- Windows run of head `865e11df14`, merged onto `main` `095ff72367` in one tree with other open PRs that touch different files (each PR's test is its own file, so they don't interact). Setup: Windows 11, WinLibs GCC 15.2 r7 (`x86_64-ucrt-posix-seh`, the CI toolchain), Release, `BUILD_TESTING=ON`. - `guest_jxr` with `--repeat until-fail:5`: 5 / 5 pass. - No runnable negative control: with `main`'s `Export.cpp` and header, the test doesn't compile (`too many arguments to function 'int PKFormatConverter_Convert_nid_postfix()'`). The four functions match jxrlib: each ignores its arguments and returns `WMP_errSuccess`. One fix in the debt entry: the line numbers are in a different order from the names. At the pinned jxrlib, `JXRGlue.c:512` is `PKImageEncode_Terminate`, `:744` is `PKImageEncode_CreateNewFrame` and `:887` is `PKImageDecode_SelectFrame`, while the entry lists `SelectFrame, CreateNewFrame and Terminate` against `:512, :744 and :887`. This PR conflicts with each of the consolidated libSceJxr PRs #17400, #17401, #17402 and #17403. It also fixes the gap I noted on #17400: `PKFormatConverter_Initialize` installs `PKFormatConverter_Convert` as the default, and that one now succeeds as in jxrlib.
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!15626
No description provided.