feat(libSceNpPartner001): implement sceNpEAAccessInitialize and sceNpEAAccessTerminate #1517

Closed
arvindfroi wants to merge 1 commit from upstream-pr/1517 into main
arvindfroi commented 2026-10-08 10:52:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by arvindfroi on 2026-10-08T10:52:04Z.


What

The two libSceNpPartner001 imports of PPSA23566 were declared as unknown NIDs. shadPS4 names them, and the names match the NIDs (compute_nid in tools/nid_names.py and Nid::ComputeNid in core/libs/nid/src/NidCompute.cpp):

NID Name
7CxI50-xlCk sceNpEAAccessInitialize
pMxXhNozUX8 sceNpEAAccessTerminate

Both are implemented as in shadPS4: they take no parameters, sceNpEAAccessInitialize marks the library initialized without a network request, and sceNpEAAccessTerminate returns 0x819D0001 (not initialized) when the library is not initialized. A second initialization is not covered by that source, so it throws, as sceContentDeleteInitialize does. The TechnicalDebt entry records what follows shadPS4 and that the console's result while signed out is unknown.

The library gets a CMakeLists.txt in the layout of libScePsml_debug so that guest_np_partner can link against it. The test checks terminate before initialize, initialize and terminate, terminate twice, and a second cycle.

Tested

tools/check_conventions.py --base origin/main passes. tools/progress.py reports libSceNpPartner001 at 2/2. Export.cpp and GuestNpPartner.cpp built natively on macOS (Apple clang, arm64) and the test passes there. No x86-64 toolchain on this machine, so the Linux and Windows builds and the ctest run are left to CI. PPSA23566 not tested.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude Code, Claude Opus 5.5)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4785635291 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1517). Originally posted by [arvindfroi](https://github.com/arvindfroi) on 2026-10-08T10:52:04Z. --- ### What The two libSceNpPartner001 imports of PPSA23566 were declared as unknown NIDs. [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_partner.cpp) names them, and the names match the NIDs (`compute_nid` in `tools/nid_names.py` and `Nid::ComputeNid` in `core/libs/nid/src/NidCompute.cpp`): | NID | Name | |---|---| | `7CxI50-xlCk` | `sceNpEAAccessInitialize` | | `pMxXhNozUX8` | `sceNpEAAccessTerminate` | Both are implemented as in shadPS4: they take no parameters, `sceNpEAAccessInitialize` marks the library initialized without a network request, and `sceNpEAAccessTerminate` returns `0x819D0001` (not initialized) when the library is not initialized. A second initialization is not covered by that source, so it throws, as `sceContentDeleteInitialize` does. The TechnicalDebt entry records what follows shadPS4 and that the console's result while signed out is unknown. The library gets a `CMakeLists.txt` in the layout of `libScePsml_debug` so that `guest_np_partner` can link against it. The test checks terminate before initialize, initialize and terminate, terminate twice, and a second cycle. ### Tested `tools/check_conventions.py --base origin/main` passes. `tools/progress.py` reports libSceNpPartner001 at 2/2. `Export.cpp` and `GuestNpPartner.cpp` built natively on macOS (Apple clang, arm64) and the test passes there. No x86-64 toolchain on this machine, so the Linux and Windows builds and the ctest run are left to CI. PPSA23566 not tested. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes (Claude Code, Claude Opus 5.5) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
klosixgaming-arch commented 2026-10-08 10:53:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T10:53:44Z.

Review: COMMENTED


Clean implementation of two previously unknown NIDs following the shadPS4 pattern. The atomic initialization tracking is appropriate for this use case, and the test coverage looks good (terminate before init, double terminate, re-initialization cycle).

One minor note: the PR description mentions "AI-assisted: yes" but doesn't specify which AI tool was used - other PRs in this repo typically name their tools (Claude Code, OpenAI Codex, etc.). Otherwise this looks ready to merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5455461642 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1517#pullrequestreview-5455461642). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-08T10:53:44Z. **Review:** COMMENTED --- Clean implementation of two previously unknown NIDs following the shadPS4 pattern. The atomic initialization tracking is appropriate for this use case, and the test coverage looks good (terminate before init, double terminate, re-initialization cycle). One minor note: the PR description mentions "AI-assisted: yes" but doesn't specify which AI tool was used - other PRs in this repo typically name their tools (Claude Code, OpenAI Codex, etc.). Otherwise this looks ready to merge.
klosixgaming-arch commented 2026-10-08 11:23:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T11:23:44Z.

Review: APPROVED


Good implementation of the two libSceNpPartner001 functions. This follows established patterns in the project and provides proper thread-safe state management.

Strengths:

  • Clean, minimal implementation following shadPS4's approach
  • Proper use of atomic boolean for thread-safe initialization tracking
  • Correct error handling with appropriate error codes (not-initialized)
  • Comprehensive test coverage including edge cases (terminate before init, double init, etc.)
  • Good documentation in TechnicalDebt.md about limitations and unknowns

Technical notes:

  • The approach of throwing on second initialization is consistent with other library patterns in the project
  • Proper use of compare_exchange_strong for atomic state transitions
  • Test cases properly verify all error conditions

This will improve compatibility with titles like PPSA23566 that import these functions. Ready to merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5455795625 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1517#pullrequestreview-5455795625). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-08T11:23:44Z. **Review:** APPROVED --- Good implementation of the two libSceNpPartner001 functions. This follows established patterns in the project and provides proper thread-safe state management. **Strengths:** - Clean, minimal implementation following shadPS4's approach - Proper use of atomic boolean for thread-safe initialization tracking - Correct error handling with appropriate error codes (not-initialized) - Comprehensive test coverage including edge cases (terminate before init, double init, etc.) - Good documentation in TechnicalDebt.md about limitations and unknowns **Technical notes:** - The approach of throwing on second initialization is consistent with other library patterns in the project - Proper use of `compare_exchange_strong` for atomic state transitions - Test cases properly verify all error conditions This will improve compatibility with titles like PPSA23566 that import these functions. Ready to merge.
oneandonlydean commented 2026-10-09 09:29:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:29:22Z.


Closing: no title is shown stopping at sceNpEAAccessInitialize or sceNpEAAccessTerminate on main (PPSA23566 imports them), and the change was only built on macOS. Reopen when one is a title's next stop on main, with the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078225665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1517#issuecomment-6078225665). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T09:29:22Z. --- Closing: no title is shown stopping at `sceNpEAAccessInitialize` or `sceNpEAAccessTerminate` on main (PPSA23566 imports them), and the change was only built on macOS. Reopen when one is a title's next stop on main, with the log line.

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