feat(ajm): implement sceAjmBatchJobControl #884

Merged
Celegans12 merged 1 commit from upstream-pr/884 into main 2026-10-06 21:07:30 +00:00
Celegans12 commented 2026-10-06 12:51:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T12:51:57Z.


What

On main, sceAjmBatchJobControl throws not implemented; PPSA26344 v1.008 reaches it when its menu music starts.

  • The job keeps the sideband input pointer and runs at sceAjmBatchStart: RESET (bit 13) clears the context as sceAjmBatchJobClearContext does, INITIALIZE (bit 14) initializes the codec, then SIDEBAND_GAPLESS_DECODE (bit 45) overwrites the total and skip counts as RPCSX's ajm.cpp does (shadPS4's ajm_instance.cpp ignores a zero count when the other is nonzero).
  • The input is the gapless decode, then the initialize parameters (ATRAC9 8 bytes, Opus 12, MP3 none); the output is the 8-byte result. Bits and order follow shadPS4's ajm.h and ajm_batch.cpp (PS4 references).
  • Still throws: other flags, SIDEBAND_GAPLESS_DECODE without RESET (both references keep zero counts there, and shadPS4 checks progress), INITIALIZE for other codecs, other input or output sizes (TechnicalDebt), and a null input of nonzero size.
  • PPSA26344 eboot 0x2e1cfc passes flags 0x200000006000, an 8-byte output and 8 bytes of gapless decode plus 8 (ATRAC9, M4AAC), 12 (Opus) or none.
  • #867 removes the next stub in libSceAjm.native/Export.cpp, so the second to merge needs a small rebase. #734 appends to that file without a conflict here.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 5895ea72: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 357/357 tests pass (ctest --output-on-failure)
  • Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, VK_DRIVER_FILES): 356/356 pass; agc_driver_flat_store is left out there because it takes several minutes on Windows llvmpipe
  • guest_ajm: new TestControlAt9, TestControlMp3 and TestControlOpus (codec info and gapless counts, RESET on MP3 counts, Opus decode, refusals) fail on main with sceAjmBatchJobControl not implemented.
  • PPSA26344 v1.008 (open GPU PRs applied, failing dispatches skipped): five control calls return 0, about 950 ATRAC9 decodes follow, and it later stops at an unrelated AGC driver: null or misaligned address check.
  • Not tested: Linux (CI), 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 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4758978784 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/884). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T12:51:57Z. --- ### What On `main`, `sceAjmBatchJobControl` throws `not implemented`; PPSA26344 v1.008 reaches it when its menu music starts. - The job keeps the sideband input pointer and runs at `sceAjmBatchStart`: RESET (bit 13) clears the context as `sceAjmBatchJobClearContext` does, INITIALIZE (bit 14) initializes the codec, then SIDEBAND_GAPLESS_DECODE (bit 45) overwrites the total and skip counts as RPCSX's [`ajm.cpp`](https://github.com/RPCSX/rpcsx/blob/e8ae1481ab7ba04d5c6bef89dd852aabba2c88ff/rpcsx/iodev/ajm.cpp#L432-L449) does (shadPS4's [`ajm_instance.cpp`](https://github.com/shadps4-emu/shadPS4/blob/235dcabf94bfeab23fe47879b4ca288e83da74f4/src/core/libraries/ajm/ajm_instance.cpp#L75-L106) ignores a zero count when the other is nonzero). - The input is the gapless decode, then the initialize parameters (ATRAC9 8 bytes, Opus 12, MP3 none); the output is the 8-byte result. Bits and order follow shadPS4's [`ajm.h`](https://github.com/shadps4-emu/shadPS4/blob/235dcabf94bfeab23fe47879b4ca288e83da74f4/src/core/libraries/ajm/ajm.h#L45-L75) and [`ajm_batch.cpp`](https://github.com/shadps4-emu/shadPS4/blob/235dcabf94bfeab23fe47879b4ca288e83da74f4/src/core/libraries/ajm/ajm_batch.cpp#L267-L285) (PS4 references). - **Still throws:** other flags, SIDEBAND_GAPLESS_DECODE without RESET (both references keep zero counts there, and shadPS4 checks progress), INITIALIZE for other codecs, other input or output sizes (TechnicalDebt), and a null input of nonzero size. - PPSA26344 eboot 0x2e1cfc passes flags 0x200000006000, an 8-byte output and 8 bytes of gapless decode plus 8 (ATRAC9, M4AAC), 12 (Opus) or none. - #867 removes the next stub in `libSceAjm.native/Export.cpp`, so the second to merge needs a small rebase. #734 appends to that file without a conflict here. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` 5895ea72: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 357/357 tests pass (`ctest --output-on-failure`) - Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, `VK_DRIVER_FILES`): 356/356 pass; `agc_driver_flat_store` is left out there because it takes several minutes on Windows llvmpipe - `guest_ajm`: new `TestControlAt9`, `TestControlMp3` and `TestControlOpus` (codec info and gapless counts, RESET on MP3 counts, Opus decode, refusals) fail on `main` with `sceAjmBatchJobControl not implemented`. - PPSA26344 v1.008 (open GPU PRs applied, failing dispatches skipped): five control calls return 0, about 950 ATRAC9 decodes follow, and it later stops at an unrelated `AGC driver: null or misaligned address` check. - Not tested: Linux (CI), 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 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
github-actions[bot] commented 2026-10-06 15:14:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T15:14:07Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#867 core/libs/prx/libSceAjm.native/Export.cpp L17-40
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6019333435 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/884#issuecomment-6019333435). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-06T15:14:07Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #867 | `core/libs/prx/libSceAjm.native/Export.cpp` [L17-40](https://github.com/boykopovar/AnyPS5/blob/5b359092d850a496ae50e4e60b8c674cb4f921c1/core/libs/prx/libSceAjm.native/Export.cpp#L17-L40) | | |
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!884
No description provided.