feat(libSceNetCtlAp): implement the access-point service that never starts #8038

Merged
MarrasFederico merged 1 commit from upstream-pr/8038 into main 2026-10-20 04:55:40 +00:00
MarrasFederico commented 2026-10-19 18:26:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarrasFederico on 2026-10-19T18:26:29Z.


What

All eleven libSceNetCtlAp exports threw not implemented. SharpProspero NetCtlAp.cs documents the access-point control service:

  • its signatures and states (0 Stopped to 4 Started);
  • the 152-byte SceNetCtlApInfo and 184-byte SceNetCtlApConnectInfo, each with a size field the caller fills;
  • the 8-callback limit, the event types 1 to 4, and the error codes.

A title starts the access point through libSceNetCtlApDialog, which here always reports the user as having cancelled, so the access point never starts. The service now behaves as a service whose access point is stopped:

  • Before sceNetCtlApInit and after sceNetCtlApTerm, every call returns NOT_INITIALIZED (0x80412994). sceNetCtlApTerm also drops the registered callbacks.
  • sceNetCtlApGetState writes Stopped (0). A null pointer returns INVALID_ADDR (0x80412991).
  • sceNetCtlApGetInfo and sceNetCtlApGetConnectInfo:
    • a null structure returns INVALID_ADDR;
    • a size field other than 152 or 184 returns INVALID_SIZE (0x80412998);
    • otherwise they return NOT_STARTED (0x8041298F) without writing.
  • sceNetCtlApStop returns NOT_STARTED.
  • Callbacks:
    • sceNetCtlApRegisterCallback gives the lowest free of eight slots. A ninth registration returns CALLBACK_MAX (0x80412995), and a null function or id returns INVALID_ADDR.
    • sceNetCtlApUnregisterCallback returns INVALID_ID (0x80412996) outside 0 to 7 and ID_NOT_FOUND (0x80412997) for a free slot.
    • sceNetCtlApCheckCallback returns 0 and calls nothing, since the state never changes.
  • sceNetCtlApClearEvent and sceNetCtlApGetResult accept event types 1 to 4 and return INVALID_TYPE (0x80412990) for others. sceNetCtlApGetResult writes 0, since no event has occurred.
  • Second sceNetCtlApInit: throws, as no error for it is documented.

The new docs/dev/debt/libSceNetCtlAp.md records what is unverified on a console:

  • the order of the checks;
  • sceNetCtlApStop on a stopped access point;
  • the result written before the first event;
  • the callback id assignment;
  • the accepted option strings, which are not read.

Tested

Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with BUILD_TESTING=ON. Windows was not compiled. No title was run.

  • New guest_netctl_ap:
    • Every call returns NOT_INITIALIZED without writing before init, after term and after a second term.
    • The state is Stopped.
    • Info and connect info return NOT_STARTED and leave everything after the size field untouched; this holds with and without an option string. Null pointers and wrong sizes give the errors above.
    • Stop returns NOT_STARTED.
    • Event types 1 to 4 clear and read 0; types 0, 5 and -1 return INVALID_TYPE without writing.
    • Eight callbacks register as ids 0 to 7, a ninth returns CALLBACK_MAX, and null arguments return INVALID_ADDR. Checking callbacks calls none of them.
    • Unregistering twice returns ID_NOT_FOUND, ids -1 and 8 return INVALID_ID, and the freed id 3 is reused.
    • A second init throws, and init after term works again.
  • The test fails on main, where every call throws. Removing the ID_NOT_FOUND check or the info size check makes it fail.
  • guest_netctl_ap_dialog still passes.
  • tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py finds no conflicting lines. It could not compare #5021, #6044, #7201, #7332 and #7495, which conflict with main; none of them changes the netctl test entries in core/libs/CMakeLists.txt.

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
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4925498328 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8038). Originally posted by [MarrasFederico](https://github.com/MarrasFederico) on 2026-10-19T18:26:29Z. --- ### What All eleven `libSceNetCtlAp` exports threw `not implemented`. [SharpProspero `NetCtlAp.cs`](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Net/NetCtlAp.cs) documents the access-point control service: - its signatures and states (0 Stopped to 4 Started); - the 152-byte `SceNetCtlApInfo` and 184-byte `SceNetCtlApConnectInfo`, each with a size field the caller fills; - the 8-callback limit, the event types 1 to 4, and the error codes. A title starts the access point through `libSceNetCtlApDialog`, which here always reports the user as having cancelled, so the access point never starts. The service now behaves as a service whose access point is stopped: - **Before `sceNetCtlApInit` and after `sceNetCtlApTerm`**, every call returns `NOT_INITIALIZED` (`0x80412994`). `sceNetCtlApTerm` also drops the registered callbacks. - **`sceNetCtlApGetState`** writes Stopped (0). A null pointer returns `INVALID_ADDR` (`0x80412991`). - **`sceNetCtlApGetInfo` and `sceNetCtlApGetConnectInfo`**: - a null structure returns `INVALID_ADDR`; - a size field other than 152 or 184 returns `INVALID_SIZE` (`0x80412998`); - otherwise they return `NOT_STARTED` (`0x8041298F`) without writing. - **`sceNetCtlApStop`** returns `NOT_STARTED`. - **Callbacks:** - `sceNetCtlApRegisterCallback` gives the lowest free of eight slots. A ninth registration returns `CALLBACK_MAX` (`0x80412995`), and a null function or id returns `INVALID_ADDR`. - `sceNetCtlApUnregisterCallback` returns `INVALID_ID` (`0x80412996`) outside 0 to 7 and `ID_NOT_FOUND` (`0x80412997`) for a free slot. - `sceNetCtlApCheckCallback` returns 0 and calls nothing, since the state never changes. - **`sceNetCtlApClearEvent` and `sceNetCtlApGetResult`** accept event types 1 to 4 and return `INVALID_TYPE` (`0x80412990`) for others. `sceNetCtlApGetResult` writes 0, since no event has occurred. - **Second `sceNetCtlApInit`**: throws, as no error for it is documented. The new `docs/dev/debt/libSceNetCtlAp.md` records what is unverified on a console: - the order of the checks; - `sceNetCtlApStop` on a stopped access point; - the result written before the first event; - the callback id assignment; - the accepted option strings, which are not read. ### Tested <!-- 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. --> Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with `BUILD_TESTING=ON`. Windows was not compiled. No title was run. - New `guest_netctl_ap`: - Every call returns `NOT_INITIALIZED` without writing before init, after term and after a second term. - The state is Stopped. - Info and connect info return `NOT_STARTED` and leave everything after the size field untouched; this holds with and without an option string. Null pointers and wrong sizes give the errors above. - Stop returns `NOT_STARTED`. - Event types 1 to 4 clear and read 0; types 0, 5 and -1 return `INVALID_TYPE` without writing. - Eight callbacks register as ids 0 to 7, a ninth returns `CALLBACK_MAX`, and null arguments return `INVALID_ADDR`. Checking callbacks calls none of them. - Unregistering twice returns `ID_NOT_FOUND`, ids -1 and 8 return `INVALID_ID`, and the freed id 3 is reused. - A second init throws, and init after term works again. - The test fails on `main`, where every call throws. Removing the `ID_NOT_FOUND` check or the info size check makes it fail. - `guest_netctl_ap_dialog` still passes. - `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` finds no conflicting lines. It could not compare #5021, #6044, #7201, #7332 and #7495, which conflict with `main`; none of them changes the netctl test entries in `core/libs/CMakeLists.txt`. ### 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
github-actions[bot] commented 2026-10-19 18:30:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T18:30:49Z.


Progress report (1e774a3 → d8b425f)

📈 System libraries: 80.15% (+0.21%, +11 implemented functions)

✅ 11 implemented
Library Name
libSceNetCtlAp sceNetCtlApCheckCallback
libSceNetCtlAp sceNetCtlApClearEvent
libSceNetCtlAp sceNetCtlApGetConnectInfo
libSceNetCtlAp sceNetCtlApGetInfo
libSceNetCtlAp sceNetCtlApGetResult
libSceNetCtlAp sceNetCtlApGetState
libSceNetCtlAp sceNetCtlApInit
libSceNetCtlAp sceNetCtlApRegisterCallback
libSceNetCtlAp sceNetCtlApStop
libSceNetCtlAp sceNetCtlApTerm
libSceNetCtlAp sceNetCtlApUnregisterCallback
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274366846 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8038#issuecomment-6274366846). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T18:30:49Z. --- <!-- progress-report --> ### Progress report (1e774a3 → d8b425f) 📈 **System libraries**: 80.15% (+0.21%, +11 implemented functions) <details> <summary>✅ 11 implemented</summary> | Library | Name | | - | - | | libSceNetCtlAp | `sceNetCtlApCheckCallback` | | libSceNetCtlAp | `sceNetCtlApClearEvent` | | libSceNetCtlAp | `sceNetCtlApGetConnectInfo` | | libSceNetCtlAp | `sceNetCtlApGetInfo` | | libSceNetCtlAp | `sceNetCtlApGetResult` | | libSceNetCtlAp | `sceNetCtlApGetState` | | libSceNetCtlAp | `sceNetCtlApInit` | | libSceNetCtlAp | `sceNetCtlApRegisterCallback` | | libSceNetCtlAp | `sceNetCtlApStop` | | libSceNetCtlAp | `sceNetCtlApTerm` | | libSceNetCtlAp | `sceNetCtlApUnregisterCallback` | </details>
github-actions[bot] commented 2026-10-19 18:39:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T18:39:35Z.


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 5021 core/libs/CMakeLists.txt
PR 6044 core/libs/CMakeLists.txt
PR 7201 core/libs/CMakeLists.txt
PR 7332 core/libs/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274539024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8038#issuecomment-6274539024). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T18:39:35Z. --- <!-- pr-overlap --> 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 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/CMakeLists.txt` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/CMakeLists.txt` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/CMakeLists.txt` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/CMakeLists.txt` |
wachi35676 commented 2026-10-20 00:17:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-20T00:17:17Z.


Windows 11, Ryzen 5 9600X, WinLibs GCC 15.2.0 (UCRT), Release, BUILD_TESTING=ON. Head d8b425f1b merged onto main eb7500680. The description says Windows was not compiled.

  • On Windows it builds without warnings, and guest_netctl_ap and guest_netctl_ap_dialog pass.
  • Negative control: with libSceNetCtlAp/Export.cpp put back to main, guest_netctl_ap aborts with sceNetCtlApCheckCallback not implemented.
  • I compared the constants with SharpProspero NetCtlAp.cs at 5dfdb4b. All eight error codes, the 152- and 184-byte sizes with a nuint size field at offset 0, CallbackMax = 8 and event types 1 to 4 match.
    • That file names the codes, but it does not say which function returns which. The mapping (for example NOT_STARTED from GetInfo, GetConnectInfo and Stop, and INVALID_TYPE checked before a null errorCode) is the PR's choice. The debt covers the check order and Stop, but not the choice of NOT_STARTED for GetInfo/GetConnectInfo.
  • Two SharpProspero details the PR does not use and the debt does not mention:
    • InvalidCid = -1: "The value the runtime writes into a callback id that has not been claimed". The PR leaves *cid untouched when it returns CALLBACK_MAX (the test checks extra == -1 only because it sets -1 first).
    • OptStrLen = 8 and ErrorInvalidOptStr = 0x80412901, which suggest the console validates the option string. The debt says it is not read.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6280265427 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8038#issuecomment-6280265427). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-20T00:17:17Z. --- Windows 11, Ryzen 5 9600X, WinLibs GCC 15.2.0 (UCRT), Release, `BUILD_TESTING=ON`. Head `d8b425f1b` merged onto `main` eb7500680. The description says Windows was not compiled. - On Windows it builds without warnings, and `guest_netctl_ap` and `guest_netctl_ap_dialog` pass. - Negative control: with `libSceNetCtlAp/Export.cpp` put back to `main`, `guest_netctl_ap` aborts with `sceNetCtlApCheckCallback not implemented`. - I compared the constants with [SharpProspero `NetCtlAp.cs` at 5dfdb4b](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Net/NetCtlAp.cs). All eight error codes, the 152- and 184-byte sizes with a `nuint` size field at offset 0, `CallbackMax = 8` and event types 1 to 4 match. - That file names the codes, but it does not say which function returns which. The mapping (for example `NOT_STARTED` from `GetInfo`, `GetConnectInfo` and `Stop`, and `INVALID_TYPE` checked before a null `errorCode`) is the PR's choice. The debt covers the check order and `Stop`, but not the choice of `NOT_STARTED` for `GetInfo`/`GetConnectInfo`. - Two SharpProspero details the PR does not use and the debt does not mention: - `InvalidCid = -1`: "The value the runtime writes into a callback id that has not been claimed". The PR leaves `*cid` untouched when it returns `CALLBACK_MAX` (the test checks `extra == -1` only because it sets -1 first). - `OptStrLen = 8` and `ErrorInvalidOptStr = 0x80412901`, which suggest the console validates the option string. The debt says it is not read. AI-assisted: yes (Claude Code); results above were run on this machine.
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!8038
No description provided.