fix(netctl): start the library initialized, as titles find it #9459

Merged
hugodearaujo merged 1 commit from upstream-pr/9459 into main 2026-10-22 01:52:03 +00:00
hugodearaujo commented 2026-10-21 22:37:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-21T22:37:54Z.


What

Since ea086b2374 (#9137), every NetCtl call answers SCE_NET_CTL_ERROR_NOT_INITIALIZED (0x80412101) until the title calls sceNetCtlInit. Titles don't call it.

  • Five titles register and check NetCtl callbacks without importing sceNetCtlInit, counting the main executable and the bundled modules: 007 First Light (PPSA11386), EA SPORTS FC 25 (PPSA20049), PRAGMATA (PPSA02530), LEGO Horizon Adventures (PPSA14632) and Propagation VR (PPSA15878).
  • libSceNetCtl is the internal sysmodule 0x80000009, which the system has started before the title runs.
  • 007 First Light traps on it 6 s into boot. Its int 0x42 at app.elf+0x60295 runs when sceNetCtlRegisterCallback doesn't return 0 (#9458).

The change:

  • g_initialized starts true. sceNetCtlInit still returns 0, and sceNetCtlTerm stays a no-op as in the supplied module, so the NOT_INITIALIZED answers are no longer reachable.
  • guest_net_ctl now makes the calls before any sceNetCtlInit, as the titles do. The argument errors are as before. CheckCallbacks registers, checks and unregisters without sceNetCtlInit.
  • A debt entry records the five titles. Whether the console's process start or the module's start sets the state is not measured.

#8398 adds its NpToolkit functions to the same not-initialized block of guest_net_ctl. Whichever lands second updates those three lines.

Tested

  • Linux 7.2.11 (Arch), GCC 16.2.1, Release, RX 9070 XT, RADV Mesa 26.2.5.
  • 007 First Light (PPSA11386 01.018.000):
    • On main a6dcea9279 it traps at 6 s.
    • With this change it gets past that point. It then stops at 7 s on sceSystemServiceParamGetInt with parameter 100, the second stop in #9458, which this PR doesn't change.
  • guest_net_ctl and guest_sce_net pass.
  • Negative control: with main's g_initialized{false}, the new guest_net_ctl aborts at its first check.
  • tools/check_conventions.py --base origin/main passes.
  • tools/pr_overlap.py lists #8398 on the same test lines. It couldn't compare #7201, #8658 (macOS ports), #6044, #9120 and #6039, which touch the same files; none of them changes the initialization.

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 (the first of the two stops in #9458)
  • Unblocks: none (PPSA11386 then stops on sceSystemServiceParamGetInt parameter 100)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4959299888 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9459). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-10-21T22:37:54Z. --- ### What Since ea086b2374 (#9137), every NetCtl call answers `SCE_NET_CTL_ERROR_NOT_INITIALIZED` (`0x80412101`) until the title calls `sceNetCtlInit`. Titles don't call it. - Five titles register and check NetCtl callbacks without importing `sceNetCtlInit`, counting the main executable and the bundled modules: 007 First Light (PPSA11386), EA SPORTS FC 25 (PPSA20049), PRAGMATA (PPSA02530), LEGO Horizon Adventures (PPSA14632) and Propagation VR (PPSA15878). - libSceNetCtl is the internal sysmodule `0x80000009`, which the system has started before the title runs. - 007 First Light traps on it 6 s into boot. Its `int 0x42` at `app.elf+0x60295` runs when `sceNetCtlRegisterCallback` doesn't return 0 (#9458). The change: - `g_initialized` starts true. `sceNetCtlInit` still returns 0, and `sceNetCtlTerm` stays a no-op as in the supplied module, so the NOT_INITIALIZED answers are no longer reachable. - `guest_net_ctl` now makes the calls before any `sceNetCtlInit`, as the titles do. The argument errors are as before. `CheckCallbacks` registers, checks and unregisters without `sceNetCtlInit`. - A debt entry records the five titles. Whether the console's process start or the module's start sets the state is not measured. #8398 adds its NpToolkit functions to the same not-initialized block of `guest_net_ctl`. Whichever lands second updates those three lines. ### Tested - Linux 7.2.11 (Arch), GCC 16.2.1, Release, RX 9070 XT, RADV Mesa 26.2.5. - 007 First Light (PPSA11386 01.018.000): - On `main` a6dcea9279 it traps at 6 s. - With this change it gets past that point. It then stops at 7 s on `sceSystemServiceParamGetInt` with parameter 100, the second stop in #9458, which this PR doesn't change. - `guest_net_ctl` and `guest_sce_net` pass. - Negative control: with `main`'s `g_initialized{false}`, the new `guest_net_ctl` aborts at its first check. - `tools/check_conventions.py --base origin/main` passes. - `tools/pr_overlap.py` lists #8398 on the same test lines. It couldn't compare #7201, #8658 (macOS ports), #6044, #9120 and #6039, which touch the same files; none of them changes the initialization. ### 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 (the first of the two stops in #9458) - [x] Unblocks: none (PPSA11386 then stops on `sceSystemServiceParamGetInt` parameter 100) - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-21 22:40:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T22:40:54Z.

Review: APPROVED


Reviewed the current diff. The behavior change is limited to the initial NetCtl state, preserves validation of null arguments and callback IDs, and adds pre-init coverage for those paths; the test still exercises callback registration and dispatch. The debt entry records the title evidence and makes the remaining uncertainty about the console lifecycle explicit. I found no blocking issue in this change.

Local validation: compiled Export.cpp with GuestNetCtl.cpp and ran the focused executable successfully on Linux (using a temporary test-only NotImplemented_nid_no_patch implementation for the standalone link). git diff --check is clean. Hosted eligibility, intake, conventions, labels, and report checks pass; build jobs were skipped by path rules.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5607106376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9459#pullrequestreview-5607106376). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T22:40:54Z. **Review:** APPROVED --- Reviewed the current diff. The behavior change is limited to the initial NetCtl state, preserves validation of null arguments and callback IDs, and adds pre-init coverage for those paths; the test still exercises callback registration and dispatch. The debt entry records the title evidence and makes the remaining uncertainty about the console lifecycle explicit. I found no blocking issue in this change. Local validation: compiled `Export.cpp` with `GuestNetCtl.cpp` and ran the focused executable successfully on Linux (using a temporary test-only `NotImplemented_nid_no_patch` implementation for the standalone link). `git diff --check` is clean. Hosted eligibility, intake, conventions, labels, and report checks pass; build jobs were skipped by path rules.
github-actions[bot] commented 2026-10-21 23:44:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T23:44:25Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8398 core/libs/tests/GuestNetCtl.cpp L275-288

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6039 docs/dev/debt/libSceNetCtl.md
PR 6044 core/libs/tests/GuestNetCtl.cpp
PR 7201 core/libs/prx/libSceNetCtl/Export.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329075408 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9459#issuecomment-6329075408). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T23:44:25Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 8398](https://www.github.com/boykopovar/AnyPS5/pull/8398) | `core/libs/tests/GuestNetCtl.cpp` [L275-288](https://github.com/boykopovar/AnyPS5/blob/a6dcea9279b53b3a39c13695eac66f7c8b5b503c/core/libs/tests/GuestNetCtl.cpp#L275-L288) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6039](https://www.github.com/boykopovar/AnyPS5/pull/6039) | `docs/dev/debt/libSceNetCtl.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestNetCtl.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceNetCtl/Export.cpp` |
oneandonlydean commented 2026-10-22 01:52:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T01:52:14Z.


@boykopovar, merging this as the fix for the boot trap in #9458. A note on why the initialization check from #9137 stays in the code but can no longer be reached:

I checked the imports of PPSA11386. None of its 5 executables (eboot.bin and the 4 bundled modules) imports sceNetCtlInit or sceNetCtlTerm. The eboot imports sceNetCtlRegisterCallback, sceNetCtlCheckCallback and sceNetCtlGetState, and it traps when the register call doesn't return 0. A title like that only runs if the library is already initialized when it starts, so starting initialized matches what titles see. The other argument checks from #9137 are unchanged.

If you'd rather remove the now-unused flag, or keep it for a future sceNetCtlTerm, that's your call.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330764665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9459#issuecomment-6330764665). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T01:52:14Z. --- @boykopovar, merging this as the fix for the boot trap in #9458. A note on why the initialization check from #9137 stays in the code but can no longer be reached: I checked the imports of PPSA11386. None of its 5 executables (eboot.bin and the 4 bundled modules) imports `sceNetCtlInit` or `sceNetCtlTerm`. The eboot imports `sceNetCtlRegisterCallback`, `sceNetCtlCheckCallback` and `sceNetCtlGetState`, and it traps when the register call doesn't return 0. A title like that only runs if the library is already initialized when it starts, so starting initialized matches what titles see. The other argument checks from #9137 are unchanged. If you'd rather remove the now-unused flag, or keep it for a future `sceNetCtlTerm`, that's your call.
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!9459
No description provided.