Files
AnyPS5/docs/dev/debt/libSceNetCtl.md
T
fdfawef324andClaude Opus 5.5 2ae7896b6d fix(libSceNetCtl): keep the callback argument and deliver the state from sceNetCtlCheckCallback
sceNetCtlRegisterCallback and sceNetCtlRegisterCallbackV6 stored only
the function and dropped its argument, and sceNetCtlCheckCallback
returned 0 without calling anything, so a title that polls
sceNetCtlCheckCallback until its callback reports IPOBTAINED never
got the event.

Each callback slot now keeps the function, its argument and the last
event it received; unregistration clears the slot. With no IPv4
callback registered, sceNetCtlCheckCallback returns 0 without querying
the host. Otherwise it takes the state from the same host-interface
predicate as sceNetCtlGetState, IPOBTAINED (3) or DISCONNECTED (1)
(shadPS4 src/core/libraries/network/net_ctl_codes.h L27-29
@15abf68c9b52), marks the IPv4 slots whose last event differs and
calls them on the calling thread with their argument after the lock is
released, so a callback can unregister itself. Delivery once per state
change and slot follows KytyPS5 src/libs/network.cpp @9e41d8320a27
(NetCtlCallbackSlot L3447-3451, NetCtlCheckCallback L3648-3661,
NetCtlRegisterCallback L3687-3707); shadPS4 net_ctl_obj.cpp L47-57
delivers on every check instead, and the debt entry records the
difference and that KytyPS5 calls the callbacks under its lock.
sceNetCtlTerm clears both tables, as KytyPS5 NetCtlTerm (L3625-3633)
does. V6 slots keep their argument but get no event, since no source
says which call delivers them.

NetCtlCallback is now an APS5_VABI pointer, so the Windows build calls
the guest function with the System V ABI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 18:31:00 +02:00

2.6 KiB

libSceNetCtl technical debt

Silent stubs

  • sceNetCtlGetNatInfo (libSceNetCtl) - sceNetCtlGetNatInfo validates null pointers and returns SCE_NET_CTL_ERROR_NOT_CONNECTED (0x80412108) without performing NAT discovery.

Unknown function info

  • sceNetCtlGetInfo (libSceNetCtl) - answers from the host interface that holds an IPv4 address, preferring the one that carries the default route: its address, netmask, gateway, MTU and first two IPv4 DNS servers. The device is reported as wired, the link as connected, the IP configuration as DHCP and the HTTP proxy as off, whatever the host uses, and the Ethernet address is the one sceNetGetMacAddress reports. A gateway or DNS server the interface does not have is reported as 0.0.0.0; what a console reports then is unknown. The DHCP host name (12), the PPPoE user name (13) and the HTTP proxy server (20) are empty strings, as that configuration sets none of them; the HTTP proxy port (21) is 0; the Wi-Fi codes (5-10) throw

Functional

  • sceNetCtlCheckCallback (libSceNetCtl) - the state comes from the host interfaces, as in sceNetCtlGetState: IPOBTAINED (3) while the host has a non-loopback IPv4 or IPv6 address, DISCONNECTED (1) otherwise; the event values follow shadPS4, and no other event is delivered. Each callback registered with sceNetCtlRegisterCallback is called on the checking thread with its registration argument when the state differs from the last one it received, so a new registration receives the current state at the next check. This edge-triggered model follows KytyPS5; shadPS4 delivers the state on every check instead, and neither is measured on hardware. KytyPS5 calls the callbacks under its lock; here they are called after the lock is released, from a copy of their slots, so a sceNetCtlUnregisterCallback or sceNetCtlTerm on another thread that returns while a check is in flight does not stop that check from calling the callback once more with its old argument. Callbacks registered with sceNetCtlRegisterCallbackV6 keep their argument but receive no event, because no source says which call delivers them