refactor(libSceAjmi): name 18 of the exports declared by NID only #15495

Merged
BunnyFl merged 2 commits from upstream-pr/15495 into main 2026-11-07 07:10:07 +00:00
BunnyFl commented 2026-11-03 15:37:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T15:37:30Z.


What

libSceAjmi declared 20 of its exports only by NID (libSceAjmiUnknown_<NID>_nid_no_patch plus an APS5_EXPORT alias), and its debt table listed them as Unknown. Each of the 20 NIDs is the hash of a sceAjmi* name. This change gives 18 of the stubs those names, drops their 18 literal-NID aliases, and names their debt table rows. The stubs keep their NIDs and still throw. 4MsUK9kAnKg (sceAjmiBatchJobInlineBuffer) and m0xisYC6U2w (sceAjmiBatchJobRunBufferRa) keep their NID-only declarations and aren't changed here. No behaviour changes.

Why these names:

  • Each name hashes to its NID (SHA-1 with the NID suffix, as core/libs/nid/src/NidCompute.cpp computes it).
  • Firmware 13.42 system/common/lib/libSceAjmi.sprx (sha256 ff0dc985c1f7a6b25a766904e3a535b55e44d0d4b8872329d2bd6c019491df0b) defines all 20 in its dynamic symbol table (objdump -T; bodies not run).
  • 19 of them sit at the same address as the sceAjm* export of the same function, for example sceAjmiInitialize (QhA7rTjJbro) and sceAjmInitialize (dl+4eHSzUu4) both at 0xd0. The module exports each function under both prefixes.
  • sceAjmiInstanceCodecType (Uqtj4RSP-JQ) is the one without a sceAjm* twin in that module.
  • Four of the names (sceAjmiBatchStartBuffer, sceAjmiBatchJobControlBufferRa, sceAjmiInstanceCreate, sceAjmiInstanceDestroy), and sceAjmiBatchJobRunBufferRa, which stays NID-only here, already appear in docs/dev/debt/libSceOpusCeltEnc.md and libSceOpusSilkEnc.md, which describe those encoders' calls into this library.
NID Name
6fY-ci3au2U sceAjmiModuleUnregister
9zA4YMlkR9M sceAjmiBatchStartBuffer
BD002VBfhuE sceAjmiFinalize
EYIibEpcHuw sceAjmiStrError
J3UwQ5e6sNU sceAjmiBatchJobControlBufferRa
LESEGgm133w sceAjmiInstanceSwitch
MTdd8ApwO50 sceAjmiDecAt9ParseConfigData
QhA7rTjJbro sceAjmiInitialize
RbLGSlJB6dc sceAjmiBatchErrorDump
Uqtj4RSP-JQ sceAjmiInstanceCodecType
X8sT-xi-dVE sceAjmiMemoryUnregister
YtubBgSeNH0 sceAjmiInstanceDestroy
cWZnCK7na5Y sceAjmiDecMp3ParseFrame
dTsNpEt1AqQ sceAjmiMemoryRegister
dmwcwCeItmE sceAjmiModuleRegister
ofRX8Vq0ss0 sceAjmiInstanceCreate
pfPwiigOE3A sceAjmiInstanceExtend
r7NMFYcJi08 sceAjmiBatchJobRunSplitBufferRa

The debt entry now says how the 18 were named and that 2 keep NID aliases (996 characters, under the length warning).

Tested

  • Windows 11, WinLibs GCC 15.2.0, Release.
  • Export table: the patched libSceAjmi.prx exports the same 24 NID-shaped names before and after the change. At head 61b1eca537 it still exports 24 (objdump -p). The only names that disappear are 18 host-only libSceAjmiUnknown_*_nid_no_patch helper names; nothing in the repo refers to them (git grep).
  • guest_ajm, which loads libSceAjmi: 1 of 1 passes.
  • public_headers and its 64 compile shards: 65 of 65 pass.
  • tools/check_conventions.py --base upstream/main: all checks pass.
  • tools/pr_overlap.py --branch at 61b1eca537: no other open PR changes the same exports. One changes neighbouring lines of include/InventoryExports.hpp and the debt table, which whichever merges second will need to resolve. #13486 couldn't be compared automatically; its own file list on GitHub has no libSceAjmi file, and the libSceAjmi commits in its branch (6a7a2c7ccf, 53608ab573, 8065d65f01) are already in main.
  • 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:5140042968 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15495). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T15:37:30Z. --- ### What libSceAjmi declared 20 of its exports only by NID (`libSceAjmiUnknown_<NID>_nid_no_patch` plus an `APS5_EXPORT` alias), and its debt table listed them as `Unknown`. Each of the 20 NIDs is the hash of a `sceAjmi*` name. This change gives 18 of the stubs those names, drops their 18 literal-NID aliases, and names their debt table rows. The stubs keep their NIDs and still throw. `4MsUK9kAnKg` (`sceAjmiBatchJobInlineBuffer`) and `m0xisYC6U2w` (`sceAjmiBatchJobRunBufferRa`) keep their NID-only declarations and aren't changed here. No behaviour changes. **Why these names:** - Each name hashes to its NID (SHA-1 with the NID suffix, as `core/libs/nid/src/NidCompute.cpp` computes it). - Firmware 13.42 `system/common/lib/libSceAjmi.sprx` (sha256 `ff0dc985c1f7a6b25a766904e3a535b55e44d0d4b8872329d2bd6c019491df0b`) defines all 20 in its dynamic symbol table (`objdump -T`; bodies not run). - 19 of them sit at the same address as the `sceAjm*` export of the same function, for example `sceAjmiInitialize` (`QhA7rTjJbro`) and `sceAjmInitialize` (`dl+4eHSzUu4`) both at `0xd0`. The module exports each function under both prefixes. - `sceAjmiInstanceCodecType` (`Uqtj4RSP-JQ`) is the one without a `sceAjm*` twin in that module. - Four of the names (`sceAjmiBatchStartBuffer`, `sceAjmiBatchJobControlBufferRa`, `sceAjmiInstanceCreate`, `sceAjmiInstanceDestroy`), and `sceAjmiBatchJobRunBufferRa`, which stays NID-only here, already appear in `docs/dev/debt/libSceOpusCeltEnc.md` and `libSceOpusSilkEnc.md`, which describe those encoders' calls into this library. | NID | Name | | --- | --- | | `6fY-ci3au2U` | `sceAjmiModuleUnregister` | | `9zA4YMlkR9M` | `sceAjmiBatchStartBuffer` | | `BD002VBfhuE` | `sceAjmiFinalize` | | `EYIibEpcHuw` | `sceAjmiStrError` | | `J3UwQ5e6sNU` | `sceAjmiBatchJobControlBufferRa` | | `LESEGgm133w` | `sceAjmiInstanceSwitch` | | `MTdd8ApwO50` | `sceAjmiDecAt9ParseConfigData` | | `QhA7rTjJbro` | `sceAjmiInitialize` | | `RbLGSlJB6dc` | `sceAjmiBatchErrorDump` | | `Uqtj4RSP-JQ` | `sceAjmiInstanceCodecType` | | `X8sT-xi-dVE` | `sceAjmiMemoryUnregister` | | `YtubBgSeNH0` | `sceAjmiInstanceDestroy` | | `cWZnCK7na5Y` | `sceAjmiDecMp3ParseFrame` | | `dTsNpEt1AqQ` | `sceAjmiMemoryRegister` | | `dmwcwCeItmE` | `sceAjmiModuleRegister` | | `ofRX8Vq0ss0` | `sceAjmiInstanceCreate` | | `pfPwiigOE3A` | `sceAjmiInstanceExtend` | | `r7NMFYcJi08` | `sceAjmiBatchJobRunSplitBufferRa` | The debt entry now says how the 18 were named and that 2 keep NID aliases (996 characters, under the length warning). ### 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. --> - Windows 11, WinLibs GCC 15.2.0, Release. - **Export table:** the patched `libSceAjmi.prx` exports the same 24 NID-shaped names before and after the change. At head `61b1eca537` it still exports 24 (`objdump -p`). The only names that disappear are 18 host-only `libSceAjmiUnknown_*_nid_no_patch` helper names; nothing in the repo refers to them (`git grep`). - `guest_ajm`, which loads `libSceAjmi`: 1 of 1 passes. - `public_headers` and its 64 compile shards: 65 of 65 pass. - `tools/check_conventions.py --base upstream/main`: all checks pass. - `tools/pr_overlap.py --branch` at `61b1eca537`: no other open PR changes the same exports. One changes neighbouring lines of `include/InventoryExports.hpp` and the debt table, which whichever merges second will need to resolve. #13486 couldn't be compared automatically; its own file list on GitHub has no libSceAjmi file, and the libSceAjmi commits in its branch (`6a7a2c7ccf`, `53608ab573`, `8065d65f01`) are already in `main`. - 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)
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!15495
No description provided.