feat(libSceAjm): implement sceAjmBatchJobDecodeSplit and sceAjmBatchJobSetResampleParametersEx #2843

Merged
MathiasDevelopes merged 1 commit from upstream-pr/2843 into main 2026-10-10 18:16:06 +00:00
MathiasDevelopes commented 2026-10-10 16:27:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MathiasDevelopes on 2026-10-10T16:27:22Z.


What

Implements two libSceAjm.native exports that were NotImplemented stubs:

  • sceAjmBatchJobDecodeSplit queues a split run job with the stream sideband, exactly as sceAjmBatchJobDecode does for one input/output pair (it goes through sceAjmBatchJobRunSplit, so its buffer-list validation applies).
  • sceAjmBatchJobSetResampleParametersEx(info, instance, ratio_start, ratio_change_per_sample, flags, result) with a zero change per sample sets the ratio as sceAjmBatchJobSetResampleParameters does (same invalid-ratio error). A non-zero change throws, because how the ratio ramps is unknown. The inferred signature and the unknown ramp are recorded in TechnicalDebt.

Title reaching them: Watch Dogs: Legion (PPSA01500). Before this change it aborts in the intro with:

what():  sceAjmBatchJobSetResampleParametersEx not implemented
what():  sceAjmBatchJobDecodeSplit not implemented

With both implemented it gets through the intro, menu and into the loading screen; the Ex calls it makes never hit the non-zero-ramp throw.

Earlier attempts (#867, #1541, #1045, #1554) were closed for lack of a title; this PR provides one.

Tested

  • Windows 11, MinGW GCC build: guest_ajm_tests passes with two new tests: TestDecodeSplit (an MP3 frame decoded into two output buffers matches a single-buffer decode byte for byte, with the same sideband) and TestResampleParametersEx (zero ramp gives the same PCM and resample info as sceAjmBatchJobSetResampleParameters; bad ratios return 0x80930005; a non-zero ramp throws and queues nothing).
  • PPSA01500 runs past both former aborts.
  • python3 tools/check_conventions.py --base origin/main passes.
  • Linux: not tested.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812719566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2843). Originally posted by [MathiasDevelopes](https://github.com/MathiasDevelopes) on 2026-10-10T16:27:22Z. --- ### What Implements two libSceAjm.native exports that were `NotImplemented` stubs: - `sceAjmBatchJobDecodeSplit` queues a split run job with the stream sideband, exactly as `sceAjmBatchJobDecode` does for one input/output pair (it goes through `sceAjmBatchJobRunSplit`, so its buffer-list validation applies). - `sceAjmBatchJobSetResampleParametersEx(info, instance, ratio_start, ratio_change_per_sample, flags, result)` with a zero change per sample sets the ratio as `sceAjmBatchJobSetResampleParameters` does (same invalid-ratio error). A non-zero change throws, because how the ratio ramps is unknown. The inferred signature and the unknown ramp are recorded in TechnicalDebt. Title reaching them: Watch Dogs: Legion (PPSA01500). Before this change it aborts in the intro with: ``` what(): sceAjmBatchJobSetResampleParametersEx not implemented what(): sceAjmBatchJobDecodeSplit not implemented ``` With both implemented it gets through the intro, menu and into the loading screen; the Ex calls it makes never hit the non-zero-ramp throw. Earlier attempts (#867, #1541, #1045, #1554) were closed for lack of a title; this PR provides one. ### Tested - Windows 11, MinGW GCC build: `guest_ajm_tests` passes with two new tests: `TestDecodeSplit` (an MP3 frame decoded into two output buffers matches a single-buffer decode byte for byte, with the same sideband) and `TestResampleParametersEx` (zero ramp gives the same PCM and resample info as `sceAjmBatchJobSetResampleParameters`; bad ratios return `0x80930005`; a non-zero ramp throws and queues nothing). - PPSA01500 runs past both former aborts. - `python3 tools/check_conventions.py --base origin/main` passes. - Linux: not tested. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
copilot-pull-request-reviewer[bot] commented 2026-10-10 16:27:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-10T16:27:27Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5479855529 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2843#pullrequestreview-5479855529). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-10T16:27:27Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
github-actions[bot] commented 2026-10-10 16:27:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T16:27:43Z.


Progress report (57f96fd → e820930)

📈 System libraries: 84.58% (+0.06%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceAjm.native sceAjmBatchJobDecodeSplit
libSceAjm.native sceAjmBatchJobSetResampleParametersEx
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099683939 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2843#issuecomment-6099683939). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T16:27:43Z. --- <!-- progress-report --> ### Progress report (57f96fd → e820930) 📈 **System libraries**: 84.58% (+0.06%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceAjm.native | `sceAjmBatchJobDecodeSplit` | | libSceAjm.native | `sceAjmBatchJobSetResampleParametersEx` | </details>
alfalfa-star commented 2026-10-10 17:43:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-10T17:43:48Z.


A second title that reaches sceAjmBatchJobSetResampleParametersEx, on Linux: LEGO Horizon Adventures (PPSA14632, Unreal Engine 5).

Setup: Arch Linux (kernel 7.2), AMD GPU on RADV, GCC, Release. The build is not plain main: it is my test branch (main db343a93 plus a few open PRs and two local workarounds for #2548 and failed draws). The game is driven by scripted Cross presses through the intro, save menu, New Game and difficulty select.

Without this PR, about 380 s in, right after the new save is written:

[ajm] unimplemented sceAjmBatchJobSetResampleParametersEx called
terminate called after throwing an instance of 'std::runtime_error'
  what():  sceAjmBatchJobSetResampleParametersEx not implemented

With this PR merged (head e8209307) and the same script:

  • No Ajm abort. The non-zero-ramp throw is never hit.
  • The game gets past that point to the first level's loading screen (gameplay tip shown).
  • About 30 s later it stops with a crash inside RADV. That is unrelated to Ajm and happens on the GPU side.

I did not check whether LEGO also calls sceAjmBatchJobDecodeSplit. Nothing in the log shows it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100390209 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2843#issuecomment-6100390209). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-10T17:43:48Z. --- A second title that reaches `sceAjmBatchJobSetResampleParametersEx`, on Linux: LEGO Horizon Adventures (PPSA14632, Unreal Engine 5). **Setup:** Arch Linux (kernel 7.2), AMD GPU on RADV, GCC, Release. The build is not plain `main`: it is my test branch (`main` db343a93 plus a few open PRs and two local workarounds for #2548 and failed draws). The game is driven by scripted Cross presses through the intro, save menu, New Game and difficulty select. **Without this PR**, about 380 s in, right after the new save is written: ``` [ajm] unimplemented sceAjmBatchJobSetResampleParametersEx called terminate called after throwing an instance of 'std::runtime_error' what(): sceAjmBatchJobSetResampleParametersEx not implemented ``` **With this PR merged** (head `e8209307`) and the same script: - No Ajm abort. The non-zero-ramp throw is never hit. - The game gets past that point to the first level's loading screen (gameplay tip shown). - About 30 s later it stops with a crash inside RADV. That is unrelated to Ajm and happens on the GPU side. I did not check whether LEGO also calls `sceAjmBatchJobDecodeSplit`. Nothing in the log shows it. 🤖 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!2843
No description provided.