feat(libSceAjmi): consolidate native backend aliases #21533

Merged
Mcm190 merged 5 commits from upstream-pr/21533 into main 2026-11-19 14:21:19 +00:00
Mcm190 commented 2026-11-16 10:58:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mcm190 on 2026-11-16T10:58:50Z.


What

The nine libSceAjmi aliases from #21529, #21533 and #21535 are consolidated here, following https://github.com/boykopovar/AnyPS5/pull/21533#issuecomment-6918411898. They forward to the existing libSceAjm.native backend and share its contexts, instances and batches.

The branch is based on current main (7c444b77ad) with one commit per group:

  1. 38cdb99869 — ATRAC9/MP3 parsers and error strings: sceAjmiDecAt9ParseConfigData, sceAjmiDecMp3ParseFrame and sceAjmiStrError. Includes the explicit parser-module-path correction from #21529.
  2. 9b0289cc70 — lifecycle, wait and cancel: sceAjmiInitialize, sceAjmiInstanceCreate, sceAjmiInstanceDestroy, sceAjmiBatchWait and sceAjmiBatchCancel.
  3. 7b345db548 — packed submission: sceAjmiBatchStartBuffer.

The common native link and named/NID module fixture are defined once. One debt fragment, ajmi-native-aliases.md, reconciles the pending-export entry, removes the nine implemented names from its table and records the remaining limits. libSceAjmi goes from 6/26 to 15/26 implemented exports. #21529 and #21535 are superseded by this PR.

The firmware 13.42 symbol-table report in #15495 identifies each alias at its sceAjm twin's entry address in libSceAjmi.sprx (SHA-256 ff0dc985c1f7a6b25a766904e3a535b55e44d0d4b8872329d2bd6c019491df0b). Signatures and behavior follow the existing native implementations. The original PR investigations remain linked above. PPSA01341 call-site inspection corroborated native initialization, instance and wait argument widths only; it does not establish callee behavior or the cancellation ABI. No new console evidence, codec support or title-startup improvement is claimed.

Native limits remain: synchronous jobs, ignored wait timeouts and initialization reserved values, cancellation that does not interrupt execution, incompletely validated packed-submission and wait-result pointers, unverified MP3/original-file-length layouts, and native exceptions for unsupported flags, chunks and codec operations. Finalization and memory/module registration remain unimplemented in AJMI.

#21182 belongs to another author and remains separate: it implements control/split builders, with no shared exports. Its neighboring InventoryExports.hpp hunk still overlaps; there are now only two AJMI branches to reconcile instead of four. This combined PR builds independently of #21182 and does not include its changes.

Tested

Fedora 45, x86-64 AMD Ryzen 7 5800X, GCC 16.2.1, Release, bundled dependencies, combined head 7b345db548.

  • Built guest_ajmi_parser_aliases_tests, guest_ajmi_lifecycle_aliases_tests, guest_ajmi_submission_tests, existing AJMI batch/guest-pointer tests, guest_ajm_tests and guest_ajm_vibration_tests.
  • 26/26 focused CTest cases pass: all 18 parser/lifecycle/submission named and NID-patched cases, five existing AJMI cases, native AJM/vibration and public_headers. Command: ctest --test-dir /tmp/anyps5-ajmi-review-build -R '^(guest_ajmi_.*|guest_ajm|guest_ajm_vibration|public_headers)$' --output-on-failure. Guest-memory tests ran outside the sandbox, which blocks process_vm_readv/writev.
  • Parser records, invalid inputs, output guards and error strings; shared context/instance/batch ownership, wrong/stale handles and unsupported 64-bit flags; PCM submission samples across 1/2/4/8 channels, bounds, malformed batches and unsupported chunks retain the original PR coverage. The three test sources and their CMake fragments are unchanged from their original PR heads.
  • python3 tools/check_conventions.py --base origin/main, python3 tools/check_test_registration.py /tmp/anyps5-ajmi-review-build and git diff --check origin/main...HEAD pass.
  • All operations in the single AJMI debt fragment apply successfully. Whole-tree debt_fold.py --check remains blocked by the pre-existing docs-nkwebkit-drop-readded-count-lines.md fragment, whose target matches no libSceNKWebKit entry; no unrelated debt files were changed.
  • No Windows runtime, console or title execution.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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:5335723661 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21533). Originally posted by [Mcm190](https://github.com/Mcm190) on 2026-11-16T10:58:50Z. --- ### What The nine libSceAjmi aliases from #21529, #21533 and #21535 are consolidated here, following https://github.com/boykopovar/AnyPS5/pull/21533#issuecomment-6918411898. They forward to the existing libSceAjm.native backend and share its contexts, instances and batches. The branch is based on current main (7c444b77ad) with one commit per group: 1. `38cdb99869` — ATRAC9/MP3 parsers and error strings: sceAjmiDecAt9ParseConfigData, sceAjmiDecMp3ParseFrame and sceAjmiStrError. Includes the explicit parser-module-path correction from #21529. 2. `9b0289cc70` — lifecycle, wait and cancel: sceAjmiInitialize, sceAjmiInstanceCreate, sceAjmiInstanceDestroy, sceAjmiBatchWait and sceAjmiBatchCancel. 3. `7b345db548` — packed submission: sceAjmiBatchStartBuffer. The common native link and named/NID module fixture are defined once. One debt fragment, `ajmi-native-aliases.md`, reconciles the pending-export entry, removes the nine implemented names from its table and records the remaining limits. libSceAjmi goes from 6/26 to 15/26 implemented exports. #21529 and #21535 are superseded by this PR. The firmware 13.42 symbol-table report in #15495 identifies each alias at its sceAjm twin's entry address in libSceAjmi.sprx (SHA-256 ff0dc985c1f7a6b25a766904e3a535b55e44d0d4b8872329d2bd6c019491df0b). Signatures and behavior follow the existing native implementations. The original PR investigations remain linked above. PPSA01341 call-site inspection corroborated native initialization, instance and wait argument widths only; it does not establish callee behavior or the cancellation ABI. No new console evidence, codec support or title-startup improvement is claimed. Native limits remain: synchronous jobs, ignored wait timeouts and initialization reserved values, cancellation that does not interrupt execution, incompletely validated packed-submission and wait-result pointers, unverified MP3/original-file-length layouts, and native exceptions for unsupported flags, chunks and codec operations. Finalization and memory/module registration remain unimplemented in AJMI. #21182 belongs to another author and remains separate: it implements control/split builders, with no shared exports. Its neighboring InventoryExports.hpp hunk still overlaps; there are now only two AJMI branches to reconcile instead of four. This combined PR builds independently of #21182 and does not include its changes. ### Tested Fedora 45, x86-64 AMD Ryzen 7 5800X, GCC 16.2.1, Release, bundled dependencies, combined head 7b345db548. - Built guest_ajmi_parser_aliases_tests, guest_ajmi_lifecycle_aliases_tests, guest_ajmi_submission_tests, existing AJMI batch/guest-pointer tests, guest_ajm_tests and guest_ajm_vibration_tests. - 26/26 focused CTest cases pass: all 18 parser/lifecycle/submission named and NID-patched cases, five existing AJMI cases, native AJM/vibration and public_headers. Command: `ctest --test-dir /tmp/anyps5-ajmi-review-build -R '^(guest_ajmi_.*|guest_ajm|guest_ajm_vibration|public_headers)$' --output-on-failure`. Guest-memory tests ran outside the sandbox, which blocks process_vm_readv/writev. - Parser records, invalid inputs, output guards and error strings; shared context/instance/batch ownership, wrong/stale handles and unsupported 64-bit flags; PCM submission samples across 1/2/4/8 channels, bounds, malformed batches and unsupported chunks retain the original PR coverage. The three test sources and their CMake fragments are unchanged from their original PR heads. - `python3 tools/check_conventions.py --base origin/main`, `python3 tools/check_test_registration.py /tmp/anyps5-ajmi-review-build` and `git diff --check origin/main...HEAD` pass. - All operations in the single AJMI debt fragment apply successfully. Whole-tree `debt_fold.py --check` remains blocked by the pre-existing `docs-nkwebkit-drop-readded-count-lines.md` fragment, whose target matches no libSceNKWebKit entry; no unrelated debt files were changed. - No Windows runtime, console or title execution. <!-- 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. --> ### 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) and the licence notice of code adapted from upstream (see AGENTS.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
PrivacyOnion commented 2026-11-16 11:01:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T11:01:05Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against c9713b644c:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_ajmi_lifecycle_aliases_tests built cleanly.
  • CTest (guest_ajmi_lifecycle_contexts_unpatched, guest_ajmi_lifecycle_instances_unpatched, guest_ajmi_lifecycle_batches_unpatched, guest_ajmi_lifecycle_contexts_nid, guest_ajmi_lifecycle_instances_nid, guest_ajmi_lifecycle_batches_nid):
    1/6 Test #3270: guest_ajmi_lifecycle_contexts_unpatched ....   Passed    0.01 sec
    2/6 Test #3271: guest_ajmi_lifecycle_instances_unpatched ...   Passed    0.02 sec
    3/6 Test #3272: guest_ajmi_lifecycle_batches_unpatched .....   Passed    0.01 sec
    4/6 Test #3273: guest_ajmi_lifecycle_contexts_nid ..........   Passed    0.01 sec
    5/6 Test #3274: guest_ajmi_lifecycle_instances_nid .........   Passed    0.01 sec
    6/6 Test #3275: guest_ajmi_lifecycle_batches_nid ...........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 6
    
  • Negative control: with core/libs/prx/libSceAjmi/Export.cpp, core/libs/prx/libSceAjmi/include/InventoryExports.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceAjmi/Export.cpp and core/libs/prx/libSceAjmi/include/InventoryExports.hpp signatures for sceAjmiInitialize, sceAjmiInstanceCreate, sceAjmiInstanceDestroy, sceAjmiBatchWait, and sceAjmiBatchCancel match the libSceAjm.native exports and forward arguments cleanly without truncation or ABI mismatch.
    • Verified core/libs/prx/libSceAjmi/CMakeLists.txt and core/libs/prx/libSceAjmi/LifecycleAliases.cmake properly link libSceAjm.native, copy and NID-patch libSceAjm.native.prx for test fixtures, and configure cross-platform runtime library search paths (WIN32, APPLE, Linux).
    • Verified docs/dev/debt/changes/ajmi-batch-lifecycle-aliases.md documents the five lifecycle/batch alias exports and their inherited libSceAjm.native gaps in compliance with AGENTS.md.
    • Verified core/libs/tests/GuestAjmiLifecycleAliases.cpp exercises context, instance, and batch lifecycle operations across both unpatched and NID-patched modules, and all 6 CTest targets pass.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5918897523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21533#pullrequestreview-5918897523). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-16T11:01:05Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `c9713b644c`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_ajmi_lifecycle_aliases_tests` built cleanly. - **CTest** (`guest_ajmi_lifecycle_contexts_unpatched`, `guest_ajmi_lifecycle_instances_unpatched`, `guest_ajmi_lifecycle_batches_unpatched`, `guest_ajmi_lifecycle_contexts_nid`, `guest_ajmi_lifecycle_instances_nid`, `guest_ajmi_lifecycle_batches_nid`): ``` 1/6 Test #3270: guest_ajmi_lifecycle_contexts_unpatched .... Passed 0.01 sec 2/6 Test #3271: guest_ajmi_lifecycle_instances_unpatched ... Passed 0.02 sec 3/6 Test #3272: guest_ajmi_lifecycle_batches_unpatched ..... Passed 0.01 sec 4/6 Test #3273: guest_ajmi_lifecycle_contexts_nid .......... Passed 0.01 sec 5/6 Test #3274: guest_ajmi_lifecycle_instances_nid ......... Passed 0.01 sec 6/6 Test #3275: guest_ajmi_lifecycle_batches_nid ........... Passed 0.01 sec 100% tests passed, 0 tests failed out of 6 ``` - **Negative control**: with `core/libs/prx/libSceAjmi/Export.cpp`, `core/libs/prx/libSceAjmi/include/InventoryExports.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceAjmi/Export.cpp and core/libs/prx/libSceAjmi/include/InventoryExports.hpp signatures for sceAjmiInitialize, sceAjmiInstanceCreate, sceAjmiInstanceDestroy, sceAjmiBatchWait, and sceAjmiBatchCancel match the libSceAjm.native exports and forward arguments cleanly without truncation or ABI mismatch. - Verified core/libs/prx/libSceAjmi/CMakeLists.txt and core/libs/prx/libSceAjmi/LifecycleAliases.cmake properly link libSceAjm.native, copy and NID-patch libSceAjm.native.prx for test fixtures, and configure cross-platform runtime library search paths (WIN32, APPLE, Linux). - Verified docs/dev/debt/changes/ajmi-batch-lifecycle-aliases.md documents the five lifecycle/batch alias exports and their inherited libSceAjm.native gaps in compliance with AGENTS.md. - Verified core/libs/tests/GuestAjmiLifecycleAliases.cpp exercises context, instance, and batch lifecycle operations across both unpatched and NID-patched modules, and all 6 CTest targets pass. Looks Good To Me
MarcZX10 commented 2026-11-19 11:43:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T11:43:36Z.

Review: COMMENTED


Reviewed — comments

The alias implementations forward to the shared native backend, but I did not independently run the reported checks or read every changed file, so a formal approval is not justified.

What I ran

Reviewed head 9b7dc3af8eac565235798576a42887014268602b using the prepared review bundle and pinned repository reader. No build or tests were run. The author reports a Fedora 45 build and focused checks in description.md; these were not independently verified.

Results

Check Result Note
Diff and selected changed files passed Core aliases and build setup inspected
Build and tests not run Only author-reported results available
Full changed-file review not run Several test sources were not read in full

Findings

Blocking

None verified.

Non-blocking

  • The reported 26/26 focused CTest cases and convention/debt checks are useful evidence, but were not run in this review. The change adds new aliases and test registration, so independently reproducing those checks would strengthen confidence before approval.

Not verified

I read description.md, commits.md, manifest.json, diff.patch, core/libs/prx/libSceAjmi/CMakeLists.txt, core/libs/prx/libSceAjmi/Export.cpp, core/libs/prx/libSceAjmi/include/InventoryExports.hpp, and docs/dev/debt/changes/ajmi-native-aliases.md. I did not read the full contents of LifecycleAliases.cmake, Parsers.cmake, Submission.cmake, or all changed test sources; therefore their behavior and the complete changed-file set are not fully verified. No Windows runtime, console, or title execution was performed.

To get this to a good state

Nothing is required. Optional: run the author-listed build and checks on this head and include the results in the review record.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5974357426 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21533#pullrequestreview-5974357426). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T11:43:36Z. **Review:** COMMENTED --- # Reviewed — comments The alias implementations forward to the shared native backend, but I did not independently run the reported checks or read every changed file, so a formal approval is not justified. ## What I ran Reviewed head `9b7dc3af8eac565235798576a42887014268602b` using the prepared review bundle and pinned repository reader. No build or tests were run. The author reports a Fedora 45 build and focused checks in `description.md`; these were not independently verified. ## Results | Check | Result | Note | |---|---|---| | Diff and selected changed files | passed | Core aliases and build setup inspected | | Build and tests | not run | Only author-reported results available | | Full changed-file review | not run | Several test sources were not read in full | ## Findings ### Blocking None verified. ### Non-blocking - The reported 26/26 focused CTest cases and convention/debt checks are useful evidence, but were not run in this review. The change adds new aliases and test registration, so independently reproducing those checks would strengthen confidence before approval. ## Not verified I read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, `core/libs/prx/libSceAjmi/CMakeLists.txt`, `core/libs/prx/libSceAjmi/Export.cpp`, `core/libs/prx/libSceAjmi/include/InventoryExports.hpp`, and `docs/dev/debt/changes/ajmi-native-aliases.md`. I did not read the full contents of `LifecycleAliases.cmake`, `Parsers.cmake`, `Submission.cmake`, or all changed test sources; therefore their behavior and the complete changed-file set are not fully verified. No Windows runtime, console, or title execution was performed. ## To get this to a good state Nothing is required. Optional: run the author-listed build and checks on this head and include the results in the review record.
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!21533
No description provided.