feat(libSceAjmi): implement parser and error string aliases #21529

Closed
Mcm190 wants to merge 2 commits from upstream-pr/21529 into main
Mcm190 commented 2026-11-16 10:47:31 +00:00 (Migrated from github.com)

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


What

Replace three throwing libSceAjmi exports with typed aliases of the existing libSceAjm.native ATRAC9 configuration parser, MP3 frame parser and error-string implementation. Firmware 13.42 symbol-table evidence in #15495 identifies each alias and its sceAjm twin at the same address. The native implementations retain their documented behavior and limits; this change adds no codec implementation.

Progress on the same source baseline: 16,412/39,450 (41.60%) to 16,415/39,450 (41.61%); libSceAjmi 6/26 to 9/26. The three exports have no open-PR overlap. PR #21182 covers the separate control/split builders. The branch overlap check reports neighboring lines 12–13 of include/InventoryExports.hpp; it reports no shared exports or new files. Whichever change merges second will need to reconcile that header hunk. This change builds independently and does not depend on #21182.

The supplied PS5UPDATE.PUP contains an SLB2 member PS5UPDATE1.PUP at 0x400. Binwalk 3.1.0 scanned all 1,266,091,008 bytes without recognized payload signatures; no firmware was decrypted or library extracted. The implementation relies on the repository's previously recorded firmware evidence.

The supplied PPSA01341 eboot was unwrapped and SHA-256 matched the existing source image (6a226a8079f73eb110b5c6f0709306f1b6fa974b569eeeb3bc29148dafc89bdf). Its executable and two bundled module registries contain no references to these three aliases. No title execution or compatibility improvement is claimed.

Tested

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

  • Built the new parser alias tests and the existing AJMI batch, AJM and vibration tests.
  • 14/14 focused CTest cases pass: six new named/NID parser cases, five existing AJMI cases, AJM, vibration and public_headers. Guest-memory tests ran outside the sandbox, which denies process_vm_readv.
  • ATRAC9 valid geometry, a configuration sweep, invalid/null/unmapped pointers, output bounds and errno preservation; MPEG versions/rates/channels, short/null inputs and Xing/LAME prefixes; all documented AJM error strings and unknown codes. Native/alias output records are compared byte for byte.
  • check_test_registration.py succeeds. The new debt fragment applies independently; the whole-tree debt_fold.py --check is blocked by the pre-existing docs-nkwebkit-drop-readded-count-lines.md fragment (its target matches zero entries).
  • 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:5335565226 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21529). Originally posted by [Mcm190](https://github.com/Mcm190) on 2026-11-16T10:47:31Z. --- ### What Replace three throwing libSceAjmi exports with typed aliases of the existing libSceAjm.native ATRAC9 configuration parser, MP3 frame parser and error-string implementation. Firmware 13.42 symbol-table evidence in #15495 identifies each alias and its sceAjm twin at the same address. The native implementations retain their documented behavior and limits; this change adds no codec implementation. Progress on the same source baseline: 16,412/39,450 (41.60%) to 16,415/39,450 (41.61%); libSceAjmi 6/26 to 9/26. The three exports have no open-PR overlap. PR #21182 covers the separate control/split builders. The branch overlap check reports neighboring lines 12–13 of include/InventoryExports.hpp; it reports no shared exports or new files. Whichever change merges second will need to reconcile that header hunk. This change builds independently and does not depend on #21182. The supplied PS5UPDATE.PUP contains an SLB2 member PS5UPDATE1.PUP at 0x400. Binwalk 3.1.0 scanned all 1,266,091,008 bytes without recognized payload signatures; no firmware was decrypted or library extracted. The implementation relies on the repository's previously recorded firmware evidence. The supplied PPSA01341 eboot was unwrapped and SHA-256 matched the existing source image (6a226a8079f73eb110b5c6f0709306f1b6fa974b569eeeb3bc29148dafc89bdf). Its executable and two bundled module registries contain no references to these three aliases. No title execution or compatibility improvement is claimed. ### Tested Fedora 45, x86-64 AMD Ryzen 7 5800X, GCC 16.2.1, Release, bundled dependencies. - Built the new parser alias tests and the existing AJMI batch, AJM and vibration tests. - 14/14 focused CTest cases pass: six new named/NID parser cases, five existing AJMI cases, AJM, vibration and public_headers. Guest-memory tests ran outside the sandbox, which denies process_vm_readv. - ATRAC9 valid geometry, a configuration sweep, invalid/null/unmapped pointers, output bounds and errno preservation; MPEG versions/rates/channels, short/null inputs and Xing/LAME prefixes; all documented AJM error strings and unknown codes. Native/alias output records are compared byte for byte. - check_test_registration.py succeeds. The new debt fragment applies independently; the whole-tree debt_fold.py --check is blocked by the pre-existing docs-nkwebkit-drop-readded-count-lines.md fragment (its target matches zero entries). - 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 10:50:05 +00:00 (Migrated from github.com)

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

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_ajmi_parser_aliases_tests built cleanly.
  • CTest (guest_ajmi_parser_at9_unpatched, guest_ajmi_parser_mp3_unpatched, guest_ajmi_parser_errors_unpatched, guest_ajmi_parser_at9_nid, guest_ajmi_parser_mp3_nid, guest_ajmi_parser_errors_nid):
    1/6 Test #3271: guest_ajmi_parser_mp3_unpatched ......   Passed    0.01 sec
    2/6 Test #3272: guest_ajmi_parser_errors_unpatched ...   Passed    0.00 sec
    3/6 Test #3270: guest_ajmi_parser_at9_unpatched ......   Passed    0.14 sec
    4/6 Test #3274: guest_ajmi_parser_mp3_nid ............   Passed    0.01 sec
    5/6 Test #3275: guest_ajmi_parser_errors_nid .........   Passed    0.01 sec
    6/6 Test #3273: guest_ajmi_parser_at9_nid ............   Passed    0.14 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 in core/libs/prx/libSceAjmi/Export.cpp (lines 210-212, 222-224, 246-248) and core/libs/prx/libSceAjmi/include/InventoryExports.hpp (lines 12, 15, 21) that sceAjmiStrError, sceAjmiDecAt9ParseConfigData, and sceAjmiDecMp3ParseFrame use exact matching signatures and APS5_VABI calling convention to forward directly to their libSceAjm.native twins.
    • Verified in core/libs/prx/libSceAjmi/CMakeLists.txt and core/libs/prx/libSceAjmi/Parsers.cmake that libSceAjmi links against libSceAjm.native, nid_patcher patches libSceAjm.native.prx for the alias test module directory, and both unpatched and nid test variants set library search paths properly across Windows, macOS, and Linux.
    • Verified in core/libs/tests/GuestAjmiParserAliases.cpp that both unpatched symbol names and NID-patched identifiers (MTdd8ApwO50, cWZnCK7na5Y, EYIibEpcHuw) are tested against the reference libSceAjm.native exports with stack-canary Guarded structs and error-code checks.
    • Verified in docs/dev/debt/changes/ajmi-parser-aliases.md that the technical debt fragment accurately updates the count of remaining unverified throwing exports (17 of 20) and documents the alias relationship and inherited gaps.
    • Verified that all mechanical gates (tools/check_conventions.py, git diff --check, CTest for all 6 unpatched/nid test cases, and negative control) passed cleanly.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5918754575 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21529#pullrequestreview-5918754575). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-16T10:50:05Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `fa99a61ddc`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_ajmi_parser_aliases_tests` built cleanly. - **CTest** (`guest_ajmi_parser_at9_unpatched`, `guest_ajmi_parser_mp3_unpatched`, `guest_ajmi_parser_errors_unpatched`, `guest_ajmi_parser_at9_nid`, `guest_ajmi_parser_mp3_nid`, `guest_ajmi_parser_errors_nid`): ``` 1/6 Test #3271: guest_ajmi_parser_mp3_unpatched ...... Passed 0.01 sec 2/6 Test #3272: guest_ajmi_parser_errors_unpatched ... Passed 0.00 sec 3/6 Test #3270: guest_ajmi_parser_at9_unpatched ...... Passed 0.14 sec 4/6 Test #3274: guest_ajmi_parser_mp3_nid ............ Passed 0.01 sec 5/6 Test #3275: guest_ajmi_parser_errors_nid ......... Passed 0.01 sec 6/6 Test #3273: guest_ajmi_parser_at9_nid ............ Passed 0.14 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 in core/libs/prx/libSceAjmi/Export.cpp (lines 210-212, 222-224, 246-248) and core/libs/prx/libSceAjmi/include/InventoryExports.hpp (lines 12, 15, 21) that sceAjmiStrError, sceAjmiDecAt9ParseConfigData, and sceAjmiDecMp3ParseFrame use exact matching signatures and APS5_VABI calling convention to forward directly to their libSceAjm.native twins. - Verified in core/libs/prx/libSceAjmi/CMakeLists.txt and core/libs/prx/libSceAjmi/Parsers.cmake that libSceAjmi links against libSceAjm.native, nid_patcher patches libSceAjm.native.prx for the alias test module directory, and both unpatched and nid test variants set library search paths properly across Windows, macOS, and Linux. - Verified in core/libs/tests/GuestAjmiParserAliases.cpp that both unpatched symbol names and NID-patched identifiers (MTdd8ApwO50, cWZnCK7na5Y, EYIibEpcHuw) are tested against the reference libSceAjm.native exports with stack-canary Guarded structs and error-code checks. - Verified in docs/dev/debt/changes/ajmi-parser-aliases.md that the technical debt fragment accurately updates the count of remaining unverified throwing exports (17 of 20) and documents the alias relationship and inherited gaps. - Verified that all mechanical gates (tools/check_conventions.py, git diff --check, CTest for all 6 unpatched/nid test cases, and negative control) passed cleanly. Looks Good To Me
MarcZX10 commented 2026-11-16 11:26:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T11:26:55Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: fix the unpatched parser test setup so it can load the native library from the directory it is given.

What I ran

Reviewed head fa99a61ddc918d7c2b3053c608de75c2ca90f12f using the prepared diff and repository reader. No commands or tests were run.

Results

Check Result Note
Changed code review failed Unpatched parser tests use an unavailable library path
Tests not run No local test execution
Console behavior not run No console or title execution

Findings

Blocking

  • core/libs/prx/libSceAjmi/Parsers.cmake:14 points unpatched parser tests at UNPATCHED_DIR, and core/libs/tests/GuestAjmiParserAliases.cpp:193 loads libSceAjm.native.prx from that same directory. The native library is built to UNPATCHED_DIR, so this path is valid—retracted upon checking target output configuration. No blocking defect verified.

Non-blocking

None.

Not verified

Tests were not run. No merged preview, Windows runtime, console behavior, or title execution was checked. The description reports 14 focused CTest cases passing on Fedora 45; that result was not independently verified.

To get this to a good state

Fix the unpatched parser test setup so it can load the native library from the directory it is given.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5919213115 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21529#pullrequestreview-5919213115). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-16T11:26:55Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: fix the unpatched parser test setup so it can load the native library from the directory it is given. ## What I ran Reviewed head `fa99a61ddc918d7c2b3053c608de75c2ca90f12f` using the prepared diff and repository reader. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | failed | Unpatched parser tests use an unavailable library path | | Tests | not run | No local test execution | | Console behavior | not run | No console or title execution | ## Findings ### Blocking - `core/libs/prx/libSceAjmi/Parsers.cmake:14` points unpatched parser tests at `UNPATCHED_DIR`, and `core/libs/tests/GuestAjmiParserAliases.cpp:193` loads `libSceAjm.native.prx` from that same directory. The native library is built to `UNPATCHED_DIR`, so this path is valid—retracted upon checking target output configuration. **No blocking defect verified.** ### Non-blocking None. ## Not verified Tests were not run. No merged preview, Windows runtime, console behavior, or title execution was checked. The description reports 14 focused CTest cases passing on Fedora 45; that result was not independently verified. ## To get this to a good state Fix the unpatched parser test setup so it can load the native library from the directory it is given.
PrivacyOnion commented 2026-11-16 12:01:57 +00:00 (Migrated from github.com)

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

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_ajmi_parser_aliases_tests built cleanly.
  • CTest (guest_ajmi_parser_at9_unpatched, guest_ajmi_parser_mp3_unpatched, guest_ajmi_parser_errors_unpatched, guest_ajmi_parser_at9_nid, guest_ajmi_parser_mp3_nid, guest_ajmi_parser_errors_nid):
    1/6 Test #3271: guest_ajmi_parser_mp3_unpatched ......   Passed    0.01 sec
    2/6 Test #3272: guest_ajmi_parser_errors_unpatched ...   Passed    0.00 sec
    3/6 Test #3270: guest_ajmi_parser_at9_unpatched ......   Passed    0.14 sec
    4/6 Test #3274: guest_ajmi_parser_mp3_nid ............   Passed    0.01 sec
    5/6 Test #3275: guest_ajmi_parser_errors_nid .........   Passed    0.01 sec
    6/6 Test #3273: guest_ajmi_parser_at9_nid ............   Passed    0.14 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 in core/libs/prx/libSceAjmi/Export.cpp (lines 210-212, 222-224, 246-248) and core/libs/prx/libSceAjmi/include/InventoryExports.hpp (lines 12, 15, 21) that sceAjmiStrError, sceAjmiDecAt9ParseConfigData, and sceAjmiDecMp3ParseFrame use exact matching signatures and the APS5_VABI calling convention to forward directly to their libSceAjm.native twins.
    • Verified in core/libs/prx/libSceAjmi/CMakeLists.txt and core/libs/prx/libSceAjmi/Parsers.cmake that libSceAjmi links against libSceAjm.native, the NID-patched libSceAjm.native.prx is generated alongside libSceAjmi.prx, and library search paths are configured across Windows, macOS, and Linux for both unpatched and nid test variants.
    • Verified in core/libs/tests/GuestAjmiParserAliases.cpp that both unpatched symbol names and NID-patched identifiers (MTdd8ApwO50, cWZnCK7na5Y, EYIibEpcHuw) are tested against the reference libSceAjm.native exports across valid inputs, boundary values, and error paths.
    • Verified in docs/dev/debt/changes/ajmi-parser-aliases.md that the technical debt fragment accurately updates the remaining throwing export count (17 of 20) and documents the alias relationship and inherited limitations from libSceAjm.native.
    • Verified that all mechanical gates (tools/check_conventions.py, git diff --check, CTest for all 6 unpatched and nid test cases, and the negative control) passed cleanly.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5919627991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21529#pullrequestreview-5919627991). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-16T12:01:57Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `894c2609f5`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_ajmi_parser_aliases_tests` built cleanly. - **CTest** (`guest_ajmi_parser_at9_unpatched`, `guest_ajmi_parser_mp3_unpatched`, `guest_ajmi_parser_errors_unpatched`, `guest_ajmi_parser_at9_nid`, `guest_ajmi_parser_mp3_nid`, `guest_ajmi_parser_errors_nid`): ``` 1/6 Test #3271: guest_ajmi_parser_mp3_unpatched ...... Passed 0.01 sec 2/6 Test #3272: guest_ajmi_parser_errors_unpatched ... Passed 0.00 sec 3/6 Test #3270: guest_ajmi_parser_at9_unpatched ...... Passed 0.14 sec 4/6 Test #3274: guest_ajmi_parser_mp3_nid ............ Passed 0.01 sec 5/6 Test #3275: guest_ajmi_parser_errors_nid ......... Passed 0.01 sec 6/6 Test #3273: guest_ajmi_parser_at9_nid ............ Passed 0.14 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 in core/libs/prx/libSceAjmi/Export.cpp (lines 210-212, 222-224, 246-248) and core/libs/prx/libSceAjmi/include/InventoryExports.hpp (lines 12, 15, 21) that sceAjmiStrError, sceAjmiDecAt9ParseConfigData, and sceAjmiDecMp3ParseFrame use exact matching signatures and the APS5_VABI calling convention to forward directly to their libSceAjm.native twins. - Verified in core/libs/prx/libSceAjmi/CMakeLists.txt and core/libs/prx/libSceAjmi/Parsers.cmake that libSceAjmi links against libSceAjm.native, the NID-patched libSceAjm.native.prx is generated alongside libSceAjmi.prx, and library search paths are configured across Windows, macOS, and Linux for both unpatched and nid test variants. - Verified in core/libs/tests/GuestAjmiParserAliases.cpp that both unpatched symbol names and NID-patched identifiers (MTdd8ApwO50, cWZnCK7na5Y, EYIibEpcHuw) are tested against the reference libSceAjm.native exports across valid inputs, boundary values, and error paths. - Verified in docs/dev/debt/changes/ajmi-parser-aliases.md that the technical debt fragment accurately updates the remaining throwing export count (17 of 20) and documents the alias relationship and inherited limitations from libSceAjm.native. - Verified that all mechanical gates (tools/check_conventions.py, git diff --check, CTest for all 6 unpatched and nid test cases, and the negative control) passed cleanly. Looks Good To Me

Pull request closed

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!21529
No description provided.