feat(libSceAjmi): implement control and split-run batch aliases #21182

Merged
Noxy-HNR merged 6 commits from upstream-pr/21182 into main 2026-11-19 03:05:23 +00:00
Noxy-HNR commented 2026-11-15 22:44:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Noxy-HNR on 2026-11-15T22:44:34Z.


What

Follow-up to #16283. sceAjmiBatchJobControlBufferRa (J3UwQ5e6sNU) and sceAjmiBatchJobRunSplitBufferRa (r7NMFYcJi08) threw in libSceAjmi. They now forward to the module's own sceAjmBatchJobControlBufferRa and sceAjmBatchJobRunSplitBufferRa builders, the same way the inline and run aliases do. Those builders already match the 13.42 libSceAjmi.sprx routines at 0xb80 and 0xd20 byte for byte under an emulator (#12372 comment). The signatures follow those twins.

The debt entry already says 17 of the 18 NID-named exports share a sceAjm twin's 13.42 address. No published report gives these two symbols' own addresses, so the new debt line says the forwarding rests on that count. The counts and the table drop both names, and the new line notes the guest-range checks the aliases inherit from the twins.

Tested

Linux (Ubuntu 24.04, GCC 13.3, Release), merged with current main including the guest-range checks from cee955abb5: guest_ajmi_batch_*, 8/8 passing in 3 of 3 runs. The new control and split cases call each alias on the unpatched and NID-patched module and compare the bytes and returned pointer with the module's sceAjm* builder over fills, instances, flags, sizes, buffer counts 0 to 3 and with and without a return address. They also check the measured 0xCC layouts from GuestAjm.cpp. Dropping the return address in either alias makes all four new tests fail (mutation check). Windows: not run locally; the Windows CI job covers it.

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:5328021850 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21182). Originally posted by [Noxy-HNR](https://github.com/Noxy-HNR) on 2026-11-15T22:44:34Z. --- ### What Follow-up to #16283. `sceAjmiBatchJobControlBufferRa` (`J3UwQ5e6sNU`) and `sceAjmiBatchJobRunSplitBufferRa` (`r7NMFYcJi08`) threw in libSceAjmi. They now forward to the module's own `sceAjmBatchJobControlBufferRa` and `sceAjmBatchJobRunSplitBufferRa` builders, the same way the inline and run aliases do. Those builders already match the 13.42 `libSceAjmi.sprx` routines at 0xb80 and 0xd20 byte for byte under an emulator ([#12372 comment](https://github.com/boykopovar/AnyPS5/pull/12372#issuecomment-6482366782)). The signatures follow those twins. The debt entry already says 17 of the 18 NID-named exports share a `sceAjm` twin's 13.42 address. No published report gives these two symbols' own addresses, so the new debt line says the forwarding rests on that count. The counts and the table drop both names, and the new line notes the guest-range checks the aliases inherit from the twins. ### 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. --> Linux (Ubuntu 24.04, GCC 13.3, Release), merged with current `main` including the guest-range checks from cee955abb5: `guest_ajmi_batch_*`, 8/8 passing in 3 of 3 runs. The new `control` and `split` cases call each alias on the unpatched and NID-patched module and compare the bytes and returned pointer with the module's `sceAjm*` builder over fills, instances, flags, sizes, buffer counts 0 to 3 and with and without a return address. They also check the measured 0xCC layouts from `GuestAjm.cpp`. Dropping the return address in either alias makes all four new tests fail (mutation check). Windows: not run locally; the Windows CI job covers it. ### 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 00:47:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T00:47:33Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_ajmi_batch_aliases_tests built cleanly.
  • CTest (guest_ajmi_batch_inline_unpatched, guest_ajmi_batch_run_unpatched, guest_ajmi_batch_control_unpatched, guest_ajmi_batch_split_unpatched, guest_ajmi_batch_inline_nid, guest_ajmi_batch_run_nid, guest_ajmi_batch_control_nid, guest_ajmi_batch_split_nid):
    1/8 Test #3189: guest_ajmi_batch_inline_unpatched ....   Passed    0.03 sec
    2/8 Test #3190: guest_ajmi_batch_run_unpatched .......   Passed    0.04 sec
    3/8 Test #3191: guest_ajmi_batch_control_unpatched ...   Passed    0.04 sec
    4/8 Test #3192: guest_ajmi_batch_split_unpatched .....   Passed    0.06 sec
    5/8 Test #3193: guest_ajmi_batch_inline_nid ..........   Passed    0.04 sec
    6/8 Test #3194: guest_ajmi_batch_run_nid .............   Passed    0.03 sec
    7/8 Test #3195: guest_ajmi_batch_control_nid .........   Passed    0.05 sec
    8/8 Test #3196: guest_ajmi_batch_split_nid ...........   Passed    0.06 sec
    100% tests passed, 0 tests failed out of 8
    
  • Negative control: with core/libs/prx/libSceAjmi/Export.cpp, core/libs/prx/libSceAjmi/include/Api.hpp, 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 in core/libs/prx/libSceAjmi/Export.cpp and core/libs/prx/libSceAjmi/include/Api.hpp that sceAjmiBatchJobControlBufferRa_nid_no_patch and sceAjmiBatchJobRunSplitBufferRa_nid_no_patch match the exact parameter types, calling conventions (APS5_VABI), and forwarding order of sceAjmBatchJobControlBufferRa_nid_disambig1 and sceAjmBatchJobRunSplitBufferRa_nid_disambig1.
    • Verified that APS5_EXPORT macros bind J3UwQ5e6sNU to sceAjmiBatchJobControlBufferRa_nid_no_patch and r7NMFYcJi08 to sceAjmiBatchJobRunSplitBufferRa_nid_no_patch, and that placeholder declarations were removed from core/libs/prx/libSceAjmi/include/InventoryExports.hpp.
    • Checked LP64/LLP64 cross-platform type safety in core/libs/tests/GuestAjmiBatchAliases.cpp (std::size_t, std::uint64_t, std::uint32_t, and pointer arithmetic on std::uint8_t* buffers) confirming no narrowing or signed/unsigned mismatches.
    • Verified guest memory safety and range validation inherited from ValidateGuestRange, ReadGuest, WriteGuest, and ReadBufferList in core/libs/prx/libSceAjmi/Export.cpp.
    • Verified docs/dev/debt/libSceAjmi.md updates export counts (20->18 and 18->16), removes both implemented symbols from the unimplemented table, and documents the forwarding basis and boundary behavior under Batch builder aliases.
    • Verified CMakeLists.txt and GuestAjmiBatchAliases.cpp test both unpatched and nid-patched variants for control and split operations against the module's reference sceAjm* builders as well as exact expected byte layouts.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5913855597 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21182#pullrequestreview-5913855597). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-16T00:47:33Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `dd91bfaa2a`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_ajmi_batch_aliases_tests` built cleanly. - **CTest** (`guest_ajmi_batch_inline_unpatched`, `guest_ajmi_batch_run_unpatched`, `guest_ajmi_batch_control_unpatched`, `guest_ajmi_batch_split_unpatched`, `guest_ajmi_batch_inline_nid`, `guest_ajmi_batch_run_nid`, `guest_ajmi_batch_control_nid`, `guest_ajmi_batch_split_nid`): ``` 1/8 Test #3189: guest_ajmi_batch_inline_unpatched .... Passed 0.03 sec 2/8 Test #3190: guest_ajmi_batch_run_unpatched ....... Passed 0.04 sec 3/8 Test #3191: guest_ajmi_batch_control_unpatched ... Passed 0.04 sec 4/8 Test #3192: guest_ajmi_batch_split_unpatched ..... Passed 0.06 sec 5/8 Test #3193: guest_ajmi_batch_inline_nid .......... Passed 0.04 sec 6/8 Test #3194: guest_ajmi_batch_run_nid ............. Passed 0.03 sec 7/8 Test #3195: guest_ajmi_batch_control_nid ......... Passed 0.05 sec 8/8 Test #3196: guest_ajmi_batch_split_nid ........... Passed 0.06 sec 100% tests passed, 0 tests failed out of 8 ``` - **Negative control**: with `core/libs/prx/libSceAjmi/Export.cpp`, `core/libs/prx/libSceAjmi/include/Api.hpp`, `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 in core/libs/prx/libSceAjmi/Export.cpp and core/libs/prx/libSceAjmi/include/Api.hpp that sceAjmiBatchJobControlBufferRa_nid_no_patch and sceAjmiBatchJobRunSplitBufferRa_nid_no_patch match the exact parameter types, calling conventions (APS5_VABI), and forwarding order of sceAjmBatchJobControlBufferRa_nid_disambig1 and sceAjmBatchJobRunSplitBufferRa_nid_disambig1. - Verified that APS5_EXPORT macros bind J3UwQ5e6sNU to sceAjmiBatchJobControlBufferRa_nid_no_patch and r7NMFYcJi08 to sceAjmiBatchJobRunSplitBufferRa_nid_no_patch, and that placeholder declarations were removed from core/libs/prx/libSceAjmi/include/InventoryExports.hpp. - Checked LP64/LLP64 cross-platform type safety in core/libs/tests/GuestAjmiBatchAliases.cpp (std::size_t, std::uint64_t, std::uint32_t, and pointer arithmetic on std::uint8_t* buffers) confirming no narrowing or signed/unsigned mismatches. - Verified guest memory safety and range validation inherited from ValidateGuestRange, ReadGuest, WriteGuest, and ReadBufferList in core/libs/prx/libSceAjmi/Export.cpp. - Verified docs/dev/debt/libSceAjmi.md updates export counts (20->18 and 18->16), removes both implemented symbols from the unimplemented table, and documents the forwarding basis and boundary behavior under Batch builder aliases. - Verified CMakeLists.txt and GuestAjmiBatchAliases.cpp test both unpatched and nid-patched variants for control and split operations against the module's reference sceAjm* builders as well as exact expected byte layouts. Looks Good To Me
MarcZX10 commented 2026-11-16 05:09:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T05:09:33Z.

Review: APPROVED


Reviewed — looks good

The alias implementations forward to the corresponding builders, and the source and tests I inspected support the stated behavior; I did not run checks.

What I ran

Reviewed head dd91bfaa2a2c0541d1ba3c00cc710f025c39af90. No commands or tests were run; the author reports Linux tests and a mutation check in the PR description.

Results

Check Result Note
Source review passed All changed files read
Tests not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not run the reported tests, mutation check, or Windows CI, and did not verify console behavior or other firmware versions. Read: core/libs/prx/libSceAjmi/CMakeLists.txt, core/libs/prx/libSceAjmi/Export.cpp, core/libs/prx/libSceAjmi/include/Api.hpp, core/libs/prx/libSceAjmi/include/InventoryExports.hpp, core/libs/tests/GuestAjmiBatchAliases.cpp, and docs/dev/debt/libSceAjmi.md. No changed files were excluded; files.json was not available in the review bundle.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5915299624 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21182#pullrequestreview-5915299624). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-16T05:09:33Z. **Review:** APPROVED --- # Reviewed — looks good The alias implementations forward to the corresponding builders, and the source and tests I inspected support the stated behavior; I did not run checks. ## What I ran Reviewed head `dd91bfaa2a2c0541d1ba3c00cc710f025c39af90`. No commands or tests were run; the author reports Linux tests and a mutation check in the PR description. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | All changed files read | | Tests | not run | Author-reported results only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I did not run the reported tests, mutation check, or Windows CI, and did not verify console behavior or other firmware versions. Read: `core/libs/prx/libSceAjmi/CMakeLists.txt`, `core/libs/prx/libSceAjmi/Export.cpp`, `core/libs/prx/libSceAjmi/include/Api.hpp`, `core/libs/prx/libSceAjmi/include/InventoryExports.hpp`, `core/libs/tests/GuestAjmiBatchAliases.cpp`, and `docs/dev/debt/libSceAjmi.md`. No changed files were excluded; `files.json` was not available in the review bundle. ## To get this to a good state Nothing is required.
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!21182
No description provided.