sceNetCtlGetResult threw for every event after its initialization and
address checks, and Worms Armageddon: Anniversary Edition (PPSA20052)
and Monster Hunter Wilds (PPSA24191) stop on it at boot; MHW's first
call asks about event 1, a disconnection.
It now answers as sceNetCtlGetResultV6 does: for event types 1 to 3,
disconnected to IP obtained (the numbers sceNetCtlCheckCallback
delivers), it writes 0 to the result and returns 0. Other event types
throw, naming the type. The initialization and null checks come first,
as before. The error code a console reports per event is unconfirmed,
which the library's debt page now records.
The guest NetCtl test covers each supported event, three unsupported
ones with the new message and the result left untouched, and a null
result answered before the event is looked at.
main now starts libSceNetCtl initialized, so GuestNetCtl's checks before
sceNetCtlInit expect argument errors; the NpToolkit register, unregister
and check join them with the errors and result their IPv4 counterparts give.
PPSA34501 calls sceNetCtlGetInfo often enough that GetAdaptersAddresses and its
RPC took about a fifth of a game thread at the Kino der Toten spawn. The
answers are now kept per address family and for the IPv4 interface, and
dropped when an address, interface or route change notification arrives.
Titles register and check NetCtl callbacks without importing
sceNetCtlInit: libSceNetCtl is an internal sysmodule the system has
started before the title runs. 007 First Light traps at start-up when
sceNetCtlRegisterCallback answers NOT_INITIALIZED.
Resolve the conflicts with main's libSceNetCtl initialization and
callback validation: the shared check now returns NOT_INITIALIZED before
sceNetCtlInit, as sceNetCtlCheckCallback does on main, so the NpToolkit
check does too; sceNetCtlTerm stays the no-op main measured; the NpToolkit
register and unregister keep their implementations with main's parameter
names. The NpToolkit entry joins main's rewritten debt file, and
GuestNetCtl checks the three before initialization.
sceNetCtlRegisterCallbackForNpToolkit, sceNetCtlUnregisterCallbackForNpToolkit
and sceNetCtlCheckCallbackForNpToolkit keep their own table of eight
callbacks next to the IPv4 and IPv6 ones and share the existing register,
unregister and event delivery, which sceNetCtlCheckCallback now also goes
through. sceNetCtlTerm clears the new table. The register signature and the
separate table follow shadPS4; the rest follows the IPv4 functions and is
recorded as unverified in the libSceNetCtl technical debt.
Titles import sceNetCtlGetInfoV6, and a missing import stops them at
load. The checks that need no answer layout are implemented; every code
throws when the host has IPv6, since the layout of the answer is not
verified.
libSceNetCtl exports sceNetCtlGetStateV6, sceNetCtlRegisterCallbackV6
and sceNetCtlUnregisterCallbackV6 but not sceNetCtlGetInfoV6 (NID
Jy1EO5GdlcM). Dragon Ball Xenoverse 2 (PPSA08587) imports it, and an
import that no system library exports stops a title before its entry
point: on Linux ld.so refuses the relinked executable with "undefined
symbol: Jy1EO5GdlcM", and on Windows the entry stub prints "FAIL:
unresolved ELF import Jy1EO5GdlcM from libSceNetCtl.prx" and raises
0xC0000139. The title's tester reports that it does not call the
function before its loading screen.
It is a Sony network-control call with no FreeBSD counterpart, and
neither its parameters nor the IPv6 info layout are known, so it is
declared without parameters and throws through
NotImplemented_nid_no_patch, as CONTRIBUTING.md asks of exports that
cannot be implemented. The gap is recorded in
docs/dev/debt/libSceNetCtl.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 <[email protected]>
Since #5056, sceNetCtlGetInfo throws for every info code it does not
model. Ghost of Yotei (PPSA26344) asks for code 12, the DHCP host name,
during boot and now aborts one second in.
The configuration #5056 reports (wired, DHCP, HTTP proxy off) sets no
DHCP host name, no PPPoE user name and no proxy server, so codes 12, 13
and 20 now return 0 with an empty string. The Wi-Fi codes (5-10) and
the proxy port (21) still throw. GuestNetCtl checks the three empty
answers and keeps the throw check for the rest; the libSceNetCtl debt
line says the same.
sceNetCtlGetState reports IPOBTAINED from the host's addresses, but
sceNetCtlGetInfo returned NOT_CONNECTED for every code. It now answers
from the host interface that holds an IPv4 address, preferring the one
with the default route: its address, netmask, gateway, MTU and DNS
servers. The link is presented as wired, connected, configured by DHCP
and without a proxy, with the Ethernet address sceNetGetMacAddress
reports. A null info returns INVALID_ADDR and a code outside 1..21
INVALID_CODE; the Wi-Fi, DHCP host name, PPPoE and proxy server codes
throw.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>