Each GCN instruction is re-encoded to its RDNA form and decoded by the
existing RDNA decoder, so the PS4 path shares the recompiler. Covers the
legacy VS stage (program at the VS slot, user SGPRs from s0, vertex and
instance index in v0-v3), fetch shaders linked as user-data calls, MIMG
(image_sample and friends), PS4 buffer descriptors (GCN DATA_FORMAT /
NUM_FORMAT, 44-bit base) and T# image descriptors (GCN tiling in word 7).
The GCN switch is keyed into the shader disk cache. PS5 behaviour is
unchanged: every PS4-only rule is gated on GcnGuestShaders().
sceNetConfigGetDefaultRoute threw. It now writes the IPv4 gateway of the
host interface that libSceNetCtl's sceNetCtlGetInfo already describes as
DEFAULT_ROUTE, in network byte order, the order sceNetInetPton writes an
AF_INET address in, and returns 0. libSceNetCtl exports
NetCtlHostIpv4Gateway_nid_no_patch for it, next to the DNS helper
sceNetGetDnsInfo uses. Without a gateway, or for a null pointer, it
still throws: the console's answer for a missing route is not measured.
Tested: guest_sce_net_tests, after sceNetCtlInit, prints the gateway
with sceNetInetNtop and compares it with sceNetCtlGetInfo's
DEFAULT_ROUTE text (192.0.2.1 on this host); a null pointer throws.
On a host without a default route the case checks that the call
throws and leaves the output untouched.
sceNetInetNtopWithScopeId and sceNetInetPtonWithScopeId threw. They now
handle AF_INET6 text with an RFC 4007 numeric zone (fe80::1%2): the
address part goes through sceNetInetNtop and sceNetInetPton, so it
follows the FreeBSD inet text rules, and the zone is printed and parsed
as FreeBSD 11.4's getnameinfo (NI_NUMERICSCOPE) and getaddrinfo do. A
zero scope ID prints the address alone and text without a zone parses
to scope ID 0. An empty zone, one above 2^32 - 1, or an invalid address
part returns 0 and leaves both outputs untouched; a buffer too small
for the scoped text gives ENOSPC.
A zone given as an interface name, and AF_INET, still throw: the tree
has no mapping from interface names to the console's interface indexes
and no answer for an IPv4 zone. The debt file says so.
Tested: guest_sce_net_tests round-trips fe80::1%2 (same address bytes
as fe80::1, scope ID 2) and ff02::1%4294967295, checks the exact
buffer size and ENOSPC one byte short, the unscoped forms, four
rejected texts with untouched outputs, EINVAL for null pointers, and
that an interface-name zone and AF_INET throw.
sceNetSysctl threw. Its restored argument list is FreeBSD's sysctl(3)
(name, name length, old value and size, new value and size), so it now
calls libkernel's sysctl. It answers exactly the MIBs libkernel models,
and a failure is returned as the library's other calls return one
(0x80410100 | errno, with the errno set).
Tested: guest_sce_net_tests reads hw.pagesize (6.7) through both
sysctl and sceNetSysctl and gets the same value and size, including a
size-only query. A one-level name gives EINVAL, a null name EFAULT, a
write EPERM and a one-byte buffer ENOMEM, each as 0x804101xx with the
errno set.
sceNetSocketInternal, sceNetGetsockoptEx and sceNetSetsockoptEx threw.
Their argument lists, restored with the rest of the firmware exports in
4d6942f1e, are the same as sceNetSocket, sceNetGetsockopt and
sceNetSetsockopt, so they now call those. Nothing in the tree records
how the console tells the entry points apart (for example by the
calling process); the debt file says so.
Tested: guest_sce_net_tests creates a datagram socket through
sceNetSocketInternal, sets SO_REUSEADDR and SO_RCVTIMEO through
sceNetSetsockoptEx and reads them back through sceNetGetsockoptEx and
sceNetGetsockopt with the same values. On a closed socket and on -1,
and for an unsupported family and type, each Ex/Internal call returns
the same error and errno as its public twin.
Base for the libSceNet Ex/Internal forwards: upstream main 94fbb8cea with fix/libscenet-inet-text-rules (ef49574f5) and fix/libkernel-getsockopt-net-sockets (aea804d9f).
setsockopt reaches a socket created with sceNetSocket through the option setter libSceNet registers, but getsockopt looked the descriptor up only among libkernel's own sockets and failed, so a title could set an option on such a socket through the BSD call and not read it back. libSceNet now registers an option getter with libkernel next to its setter, which answers through sceNetGetsockopt, so SO_RCVTIMEO and SO_SNDTIMEO come back as a struct timeval.
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.
NpTrophy reads the trophy count and icons from the title's trophy
package (names are encrypted and stay not implemented), PS4 v1 save data
calls wrap the native v2/v3 ones, and NpWebApi library contexts, handles
and push event filters work offline (service filters fail without a
signed-in user). libSceAjm is built from the libSceAjm.native sources
for PS4 titles. Limbo's (CUSA01664) remaining PS4 imports, including the
synchronous PS4 TUS calls and the Facebook dialog calls next to the
existing libraries, are exported as not implemented.