feat(libSceNetCtl): implement sceNetCtlRegisterCallbackV6 and sceNetCtlUnregisterCallbackV6 #5427

Merged
mariusyo07 merged 1 commit from upstream-pr/5427 into main 2026-10-14 09:39:10 +00:00
mariusyo07 commented 2026-10-13 19:27:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mariusyo07 on 2026-10-13T19:27:59Z.


What

Implements sceNetCtlRegisterCallbackV6 and sceNetCtlUnregisterCallbackV6 in libSceNetCtl.

METAL GEAR SOLID: Peace Walker - Master Collection Version (PPSA18216) stops on main when relinking mgspw.elf (#5268):

FAIL: unresolved ELF import 1NE9OWdBIww from libSceNetCtl.prx
FAIL: unresolved ELF import hIUVeUNxAwc from libSceNetCtl.prx
  • Adds an IPv6 callback array (g_callbacksV6) capped at MAX_CALLBACKS (8) matching the IPv4 callbacks.
  • Shared helper functions RegisterCallback and UnregisterCallback handle slot allocation, boundary checks, and thread synchronization under g_callbackLock.
  • Invalid pointers return SCE_NET_CTL_ERROR_INVALID_ADDR, reaching the capacity limit returns SCE_NET_CTL_ERROR_CALLBACK_MAX, and invalid callback IDs return SCE_NET_CTL_ERROR_INVALID_ID.

Tested

  • Linux (GCC 16.1.1): core/libs/prx/libSceNetCtl/Export.cpp and core/libs/tests/GuestSceNet.cpp compile cleanly.
  • guest_sce_net_tests in GuestSceNet.cpp tests sceNetCtlRegisterCallbackV6 and sceNetCtlUnregisterCallbackV6 (null parameter checks, registering up to 8 callbacks, failure when exceeding MAX_CALLBACKS, unregistering out-of-bounds IDs, slot reuse upon unregistering, and clean teardown). The test fails to link on main without the exports.
  • python3 tools/check_conventions.py --base upstream/main: all checks passed.
  • git diff --check: passes with no whitespace or style warnings.
  • python3 tools/pr_overlap.py --branch feat/netctl-v6-callbacks: no overlap with open pull requests.

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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA18216 #5268
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4848375446 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5427). Originally posted by [mariusyo07](https://github.com/mariusyo07) on 2026-10-13T19:27:59Z. --- ### What Implements `sceNetCtlRegisterCallbackV6` and `sceNetCtlUnregisterCallbackV6` in libSceNetCtl. METAL GEAR SOLID: Peace Walker - Master Collection Version (PPSA18216) stops on `main` when relinking `mgspw.elf` (#5268): ``` FAIL: unresolved ELF import 1NE9OWdBIww from libSceNetCtl.prx FAIL: unresolved ELF import hIUVeUNxAwc from libSceNetCtl.prx ``` - Adds an IPv6 callback array (`g_callbacksV6`) capped at `MAX_CALLBACKS` (8) matching the IPv4 callbacks. - Shared helper functions `RegisterCallback` and `UnregisterCallback` handle slot allocation, boundary checks, and thread synchronization under `g_callbackLock`. - Invalid pointers return `SCE_NET_CTL_ERROR_INVALID_ADDR`, reaching the capacity limit returns `SCE_NET_CTL_ERROR_CALLBACK_MAX`, and invalid callback IDs return `SCE_NET_CTL_ERROR_INVALID_ID`. ### Tested - Linux (GCC 16.1.1): `core/libs/prx/libSceNetCtl/Export.cpp` and `core/libs/tests/GuestSceNet.cpp` compile cleanly. - `guest_sce_net_tests` in `GuestSceNet.cpp` tests `sceNetCtlRegisterCallbackV6` and `sceNetCtlUnregisterCallbackV6` (null parameter checks, registering up to 8 callbacks, failure when exceeding `MAX_CALLBACKS`, unregistering out-of-bounds IDs, slot reuse upon unregistering, and clean teardown). The test fails to link on `main` without the exports. - `python3 tools/check_conventions.py --base upstream/main`: all checks passed. - `git diff --check`: passes with no whitespace or style warnings. - `python3 tools/pr_overlap.py --branch feat/netctl-v6-callbacks`: no overlap with open pull requests. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [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: PPSA18216 #5268 - [x] GPUs tested: n/a - [x] AI-assisted: yes
copilot-pull-request-reviewer[bot] commented 2026-10-13 19:28:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-13T19:28:05Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5508866614 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5427#pullrequestreview-5508866614). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-13T19:28:05Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
github-actions[bot] commented 2026-10-13 19:28:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T19:28:49Z.


Progress report (dacd785 → 742b7ba)

📈 System libraries: 88.16% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceNetCtl sceNetCtlRegisterCallbackV6
libSceNetCtl sceNetCtlUnregisterCallbackV6
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153478080 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5427#issuecomment-6153478080). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T19:28:49Z. --- <!-- progress-report --> ### Progress report (dacd785 → 742b7ba) 📈 **System libraries**: 88.16% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceNetCtl | `sceNetCtlRegisterCallbackV6` | | libSceNetCtl | `sceNetCtlUnregisterCallbackV6` | </details>
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!5427
No description provided.