feat(libSceAjm.native): return AJM from sceAjmStrError #5000

Closed
ducloc080202 wants to merge 2 commits from upstream-pr/5000 into main
ducloc080202 commented 2026-10-13 07:43:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ducloc080202 on 2026-10-13T07:43:18Z.


What

Implements sceAjmStrError as a silent stub: it returns a static AJM string for every error code instead of throwing unimplemented and returning null. The console carries a different message per code, but those strings live in the firmware module, which title dumps do not ship, so the mapping cannot be derived here (checked shadPS4, which stubs it, and KytyPS5/prosper, which both return a constant). The result is only used as a log-format argument, and a static non-null string keeps a guest %s formatter alive where a null would fault. The divergence is recorded under Silent stubs in the libSceAjm.native technical debt file.

Tested

Windows 11, MinGW 15.2.0: guest_ajm ctest passes, including a new TestStrError case covering known AJM error codes (0x80930002-0x80930008, 0x80930012), 0 and -1. Linux/macOS rely on CI.

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
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4840027850 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5000). Originally posted by [ducloc080202](https://github.com/ducloc080202) on 2026-10-13T07:43:18Z. --- ### What Implements `sceAjmStrError` as a silent stub: it returns a static `AJM` string for every error code instead of throwing unimplemented and returning null. The console carries a different message per code, but those strings live in the firmware module, which title dumps do not ship, so the mapping cannot be derived here (checked shadPS4, which stubs it, and KytyPS5/prosper, which both return a constant). The result is only used as a log-format argument, and a static non-null string keeps a guest `%s` formatter alive where a null would fault. The divergence is recorded under Silent stubs in the libSceAjm.native technical debt file. ### Tested Windows 11, MinGW 15.2.0: `guest_ajm` ctest passes, including a new `TestStrError` case covering known AJM error codes (`0x80930002`-`0x80930008`, `0x80930012`), `0` and `-1`. Linux/macOS rely on CI. ### 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 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] Unblocks: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-13 07:46:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T07:46:08Z.


Progress report (cac4e96 → 36bc8bd)

📈 System libraries: 88.32% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceAjm.native sceAjmStrError
⚪ 1 behaviourally empty (constant return or throw)
Library Name
libSceAjm.native sceAjmStrError
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140839306 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5000#issuecomment-6140839306). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T07:46:08Z. --- <!-- progress-report --> ### Progress report (cac4e96 → 36bc8bd) 📈 **System libraries**: 88.32% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceAjm.native | `sceAjmStrError` | </details> <details> <summary>⚪ 1 behaviourally empty (constant return or throw)</summary> | Library | Name | | - | - | | libSceAjm.native | `sceAjmStrError` | </details>
adriadam10 commented 2026-10-13 08:33:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T08:33:55Z.

Review: CHANGES_REQUESTED


Thanks for the PR. Two points:

  • core/libs/prx/libSceAjm.native/Export.cpp:31 returns "AJM" for every code. KytyPS5 does that, but it is hand-written and has no evidence behind it, and prosper (src/hle/audio/hle_audio.cpp, ajm_str_error) notes that the real libSceAjm carries a different message per error code. So the result is known to differ from the console, and main throws instead (exact-or-throw, see CONTRIBUTING). Either keep the throw, or derive the real code-to-string table (e.g. from a title's libSceAjm module) and test those strings.
  • If a constant stays for some reason, the entry in docs/dev/debt/libSceAjm.native.md:19 belongs under "Silent stubs", not "Functional".

The test and build are fine (guest_ajm passes here on top of current main); happy to look again once this is addressed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5500855015 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5000#pullrequestreview-5500855015). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T08:33:55Z. **Review:** CHANGES_REQUESTED --- Thanks for the PR. Two points: - `core/libs/prx/libSceAjm.native/Export.cpp:31` returns `"AJM"` for every code. KytyPS5 does that, but it is hand-written and has no evidence behind it, and prosper (`src/hle/audio/hle_audio.cpp`, `ajm_str_error`) notes that the real libSceAjm carries a different message per error code. So the result is known to differ from the console, and `main` throws instead (exact-or-throw, see CONTRIBUTING). Either keep the throw, or derive the real code-to-string table (e.g. from a title's `libSceAjm` module) and test those strings. - If a constant stays for some reason, the entry in `docs/dev/debt/libSceAjm.native.md:19` belongs under "Silent stubs", not "Functional". The test and build are fine (`guest_ajm` passes here on top of current `main`); happy to look again once this is addressed.
ducloc080202 commented 2026-10-13 08:44:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ducloc080202 on 2026-10-13T08:44:20Z.


Thanks for the review. Addressed as follows:

  • Real table: I tried to derive it but could not — the per-code strings live in the firmware libSceAjm module, which title dumps do not ship (checked the dumps on hand: only right.sprx plus the app modules). shadPS4 stubs sceAjmStrError, and both KytyPS5 and prosper return a constant, so there is no public derived table to take. Deriving it needs a decrypted firmware module, which I do not have; noted in the debt entry.
  • Kept the constant on the never-null rationale: the result is only used as a log-format argument, and a static non-null string keeps a guest %s formatter alive where the old null return would fault (prosper documents the same call in hle_audio.cpp, ajm_str_error).
  • Debt entry moved from Functional to Silent stubs, expanded with the above reasoning.

Rebased state re-verified: conventions pass, guest_ajm passes. Happy to revert to the throw instead if you would rather keep exact-or-throw here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141781756 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5000#issuecomment-6141781756). Originally posted by [ducloc080202](https://github.com/ducloc080202) on 2026-10-13T08:44:20Z. --- Thanks for the review. Addressed as follows: - Real table: I tried to derive it but could not — the per-code strings live in the firmware `libSceAjm` module, which title dumps do not ship (checked the dumps on hand: only `right.sprx` plus the app modules). shadPS4 stubs `sceAjmStrError`, and both KytyPS5 and prosper return a constant, so there is no public derived table to take. Deriving it needs a decrypted firmware module, which I do not have; noted in the debt entry. - Kept the constant on the never-null rationale: the result is only used as a log-format argument, and a static non-null string keeps a guest `%s` formatter alive where the old null return would fault (prosper documents the same call in `hle_audio.cpp`, `ajm_str_error`). - Debt entry moved from Functional to Silent stubs, expanded with the above reasoning. Rebased state re-verified: conventions pass, `guest_ajm` passes. Happy to revert to the throw instead if you would rather keep exact-or-throw here.
adriadam10 commented 2026-10-13 08:53:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T08:53:57Z.


Thanks for the quick follow-up and for checking the sources.

Closing this one:

  • sceAjmStrError returns "AJM" for every code, which we know differs from the console (per-code messages). CONTRIBUTING allows a silent stub only when it unblocks a title and affects only the UI; the PR names no title that calls it, so main's throw (exact-or-throw) stays the right behaviour.
  • TestStrError pins "AJM", a value with no hardware or reference evidence behind it, so it only tests the stub itself.
  • Reverting to the throw, as you offer, leaves nothing to merge.

Welcome to reopen if a title is shown to call sceAjmStrError and fail on the throw (title/PPSA and log), or once the real per-code table is derived from a firmware module.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141943418 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5000#issuecomment-6141943418). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T08:53:57Z. --- Thanks for the quick follow-up and for checking the sources. Closing this one: - `sceAjmStrError` returns `"AJM"` for every code, which we know differs from the console (per-code messages). CONTRIBUTING allows a silent stub only when it unblocks a title and affects only the UI; the PR names no title that calls it, so `main`'s throw (exact-or-throw) stays the right behaviour. - `TestStrError` pins `"AJM"`, a value with no hardware or reference evidence behind it, so it only tests the stub itself. - Reverting to the throw, as you offer, leaves nothing to merge. Welcome to reopen if a title is shown to call `sceAjmStrError` and fail on the throw (title/PPSA and log), or once the real per-code table is derived from a firmware module.

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