Skip to content

fix(libSceNetCtl): answer sceNetCtlGetInfo from the host IPv4 interface - #5056

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
0xRickx:fix/libscenetctl-get-info
Oct 14, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
0xRickx:fix/libscenetctl-get-info

Conversation

@0xRickx

@0xRickx 0xRickx commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNetCtlGetState reports IPOBTAINED when the host has an address, but sceNetCtlGetInfo returned SCE_NET_CTL_ERROR_NOT_CONNECTED for every code. A title that saw a connected console and then asked for its address, netmask or MTU got an error back.

Prospero Explorer (PPSA99109) shows this on main. Its System information > Network tab (DashboardScreen.cs) reads State connected, then - for Address, Subnet mask, Gateway, Primary name server and Hardware address, and 0 bytes for Largest packet (#5071).

PS5VR (PPSA99177) also builds the link under its QR code from code 14 (vr_sources.cpp), but it does not reach that screen yet.

sceNetCtlGetInfo now answers from the host interface that holds an IPv4 address, preferring the one that carries the default route:

  • On Windows, an up adapter with an IPv4 gateway and the lowest interface metric.
  • On Linux, the interface of the lowest-metric default route in /proc/net/route.
Code Answer
14 IP_ADDRESS, 15 NETMASK, 16 DEFAULT_ROUTE, 3 MTU the interface's
17 PRIMARY_DNS, 18 SECONDARY_DNS the interface's first two IPv4 DNS servers (Windows adapter list, Linux /etc/resolv.conf)
1 DEVICE, 4 LINK, 11 IP_CONFIG, 19 HTTP_PROXY_CONFIG wired, connected, DHCP, off
2 ETHER_ADDR 02:50:53:35:00:01, the address sceNetGetMacAddress already reports
5-10 (Wi-Fi), 12 (DHCP host name), 13 (PPPoE user name), 20-21 (proxy server and port) throw
  • Where the codes, layout and error codes come from:
    • Codes 1-21 and the 256-byte union: shadPS4 netctl.h and onionHEN's PS5 net_ctl.h.
    • Only the requested member, at offset 0, is written; the rest of the union is left as it was. SharpProspero NetCtl.cs documents this.
    • A null info returns SCE_NET_CTL_ERROR_INVALID_ADDR (0x80412107). A code outside 1..21 returns SCE_NET_CTL_ERROR_INVALID_CODE (0x80412106, from EA DirtySDK's PS4 error table dirtyerrps4.c), checked in the same order as KytyPS5.
    • With no IPv4 address it returns NOT_CONNECTED, as before.
  • Fixed answers for the guest's link: the guest has no radio, DHCP lease or proxy of its own, so its link is presented as wired, DHCP and without a proxy.
    • The codes that throw are the ones that only mean something on Wi-Fi, PPPoE or a proxy. What a console answers for them is not established.
    • Before this change they returned NOT_CONNECTED.
  • Codes middleware asks for: EA's DirtySDK asks for IP_CONFIG, DEVICE and IP_ADDRESS (netconnps4.cpp, dirtynetps4.c), so all three are answered rather than thrown.
  • Unchanged here: sceNetCtlGetState and sceNetCtlGetIfStat still count IPv6 addresses. On a host with only IPv6, GetState reports IPOBTAINED while GetInfo returns NOT_CONNECTED.

The fixed answers and the 0.0.0.0 used for a missing gateway or DNS server are listed in docs/dev/debt/libSceNetCtl.md.

Tested

Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, main bb9a4d8 (rebased onto 77b9f72 afterwards, no conflicts):

  • New guest_net_ctl test:

    • checks the argument errors;
    • checks the fixed answers, the Ethernet address and that only the member is written;
    • checks the MTU range, a contiguous netmask, and that the reported address binds a UDP socket on this host;
    • checks that the codes that are not answered throw.

    It aborts on main and passes with the change.

  • Both platforms report the same values as the host tools:

    • Windows reports the values ipconfig shows for the adapter with the default route, and skips a VirtualBox host-only adapter.
    • Linux reports eth0 from the default route and skips three docker bridges.
  • guest_sce_net and patched_libraries pass. Full ctest: 1052/1052 passed (8 skipped on this machine).

  • Prospero Explorer (PPSA99109, catalog 01.000.000), relinked, opened on System information > Network with APS5_PAD_INPUT_FILE (steps in Prospero Explorer (PPSA99109) #5071) and captured with APS5_DUMP_FRAMES:

    Row main ae244d5 with this change
    State, Link connected, wired connected, wired
    Address - 192.168.178.22
    Subnet mask - 255.255.255.0
    Gateway, Primary name server - 192.168.178.1
    Hardware address - 02:50:53:35:00:01
    Largest packet 0 bytes 1500 bytes

    The host's ipconfig shows the same address, mask, gateway and DNS server.

  • ProsperoLichess (PPSA99009, catalog 01.000.000), relinked with this main, logs [PCH] lan ip 192.168.178.22 with and without the change. When sceNetCtlGetInfo fails it falls back to a connected UDP socket's local address, so the answers agree.

  • tools/check_conventions.py --base upstream/main passes.

Rebased onto main ffa2a6e without conflicts (head 3065b89), then tested again on main c496fd5:

  • Windows (same toolchain), with my eight other open PRs merged as well: guest_net_ctl, guest_sce_net and patched_libraries pass. Full ctest: 1088/1088 passed (8 skipped on this machine).
  • Linux (Ubuntu 24.04 in WSL, GCC 13.3, Release, the CI's configure options, lavapipe):
    • this branch alone: guest_net_ctl, guest_sce_net and patched_libraries pass.
    • full ctest with my eight other open PRs merged as well: 1067/1070 passed. guest_math, agc_driver_depth_compare_copy and guest_socket_read_write fail the same way on main b868383 without any of them in this setup.

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
  • Unblocks: PPSA99109 Prospero Explorer (PPSA99109) #5071
  • AI-assisted: yes

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
@0xRickx
0xRickx force-pushed the fix/libscenetctl-get-info branch from 5e47ce3 to 3065b89 Compare October 13, 2026 14:47
@adriadam10 adriadam10 self-assigned this Oct 14, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the build and ctest (guest_net_ctl passes, and fails without the change), the argument errors and code ranges against KytyPS5 and shadPS4, and the test registration and debt entry; merging once the full Build is green.

@adriadam10
adriadam10 merged commit 9f373a4 into boykopovar:main Oct 14, 2026
8 of 9 checks passed
JJenkx pushed a commit to JJenkx/AnyPS5 that referenced this pull request Oct 16, 2026
…rver as empty strings

Since boykopovar#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 boykopovar#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.
oneandonlydean pushed a commit that referenced this pull request Oct 17, 2026
…rver as empty strings

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.
RINNECODER added a commit to RINNECODER/AnyPS5 that referenced this pull request Oct 17, 2026
…hroughput (#530)

* fix(libSceNet): read SO_RCVTIMEO and SO_SNDTIMEO as a timeval in sceNetSetsockopt

sceNetSetsockopt took the BSD timeout options, SO_SNDTIMEO (0x1005) and
SO_RCVTIMEO (0x1006), like Sony's 0x1105 and 0x1106: as an int of
microseconds read from the first four bytes. A caller passing a struct
timeval got tv_sec taken as microseconds, so {0, 100000} meant to wait
100 ms became 0 and disabled the timeout, and the receive blocked until
data came.

On the console 0x1006 takes a timeval, as FreeBSD 11.4's sosetopt does.
ProsperoLight (PPSA99002) gives it {0, 100000} through sceNetSetsockopt,
and its log from a console (firmware 12.20) shows Moonlight's receive
timing out every 100 ms before the first packet ("Received first video
packet after 400 ms"). Sony moved only these two timeval options to
0x1105 and 0x1106, as ints. On AnyPS5 the receive never times out, so
ProsperoLight's receive threads never wake when the PC stops sending and
LiStopConnection never returns: the stream screen freezes when a session
ends from the PC side. Steam Remote Play (PPSA99350) sets {0, 10000} the
same way and stays on "THE PC DID NOT ANSWER" when the PC doesn't reply.

0x1005 and 0x1006 now go through the timeval path that setsockopt() on a
libSceNet socket already uses (EINVAL for a value shorter than a timeval,
EDOM for a negative or out-of-range one). sceNetGetsockopt gives them
back as a timeval cut to the caller's length, as FreeBSD's sooptcopyout
does. 0x1105 and 0x1106 keep taking an int of microseconds.

* docs(debt): sync debt documentation structure with upstream

* fix(libSceNet): let a datagram receive on an unbound socket wait on Windows

sceNetRecv, sceNetRecvfrom and sceNetRecvmsg called Winsock's receive
straight away. Winsock fails a receive on a socket with no local address
with WSAEINVAL, so on Windows the call returned EINVAL at once. On the
console the receive waits: FreeBSD 11.4's soreceive_dgram sleeps on the
receive buffer whether or not the socket has an address, returns
EWOULDBLOCK for a non-blocking socket, and a send from another thread
binds the socket so the reply can arrive.

Steam Remote Play (PPSA99350) relies on that. Its stream library opens
its discovery socket, starts receiving on a worker thread, and binds the
socket only when another thread sends the discovery broadcast. On
Windows the worker got EINVAL, took it as fatal and closed the socket
before the broadcast went out, so the title never found a PC running
Steam.

On Windows a receive on a datagram socket with no local address now
waits until a bind, connect or send gives it one, checking every 10 ms.
A non-blocking socket fails with EAGAIN at once, and the receive timeout
ends the wait with EAGAIN. An abort or close ends the wait, and the host
receive then fails as before. Once the socket has an address it is noted
as bound, so later receives skip the check, and a later sceNetBind fails
with EINVAL as it does on the console.

* fix(shader): flush v_cvt_pknorm_*_f16 denormal inputs by FLOAT_MODE

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA

* refactor(libSceNet): wait for a local address after sceNetRecvmsg's socket type check

* feat(libSceAppContent): implement sceAppContentGetAddcontDownloadProgress

The signature (uint32_t service label, const NpUnifiedEntitlementLabel*,
progress*) follows SharpProspero Interop/AppContent/AppContent.cs.
dlc_emu dlc_content.cpp (fcf69b16) answers PARAMETER for a null label or
progress and NOT_FOUND for a label that is not installed additional
content. No additional content is ever installed here, as
sceAppContentAddcontMount, sceAppContentAddcontEnqueueDownload and
sceAppContentAddcontDelete already model, so every other call answers
NOT_FOUND and the progress, whose 16-byte layout SharpProspero gives,
is never written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(shader): intersect dominator sets as bitsets

Structurizing recomputes dominators after every CFG rewrite, and each block started from a vector of every block id. The same fixed point now runs on bitsets and still writes the sorted id lists.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(relinker): run the file writer's replacement test on a copy of itself

The running-executable replacement test copied /bin/sleep under the
names "running" and "leftover" and started the copy. On Ubuntu 26.04
/bin/sleep is the uutils multi-call coreutils binary, which picks the
utility from the file name of the path it was started through, not
from argv[0], so the copy printed "coreutils: unknown program
'running'" and exited, and file_writer_binary and file_writer_text
failed without ever replacing a running executable. The test now
copies its own executable and starts it with a "wait" argument that
sleeps, so it no longer depends on how a system binary reads its name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ajm): honor Opus gapless resets

* fix(ajm): preserve live decoder handles across ID wrap

* feat(libSceNpPartner001): answer sceNpHasEAAccessSubscription without an EA Access server

Co-authored-by: Cursor <cursoragent@cursor.com>

* perf(libSceSysmodule): cache the unwind region of loaded images on Windows

sceSysmoduleGetModuleInfoForUnwind called VirtualQuery and GetMappedFileNameA on every call. VirtualQuery on a large image section costs time proportional to the section (2 us for 16 KiB, 51 us for 8 MiB, 167 us for 32 MiB), and a title that unwinds exceptions while loading calls it for every frame of every throw.

The region and file name of an address inside an image of the Windows loader's module list are kept per region and used while the loader still reports the same image (base, time stamp and size). Other addresses are queried every time.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* feat(opus): decode at 8, 12, 16 and 24 kHz

Accept every creation rate listed by the public decoder research in
libSceOpusDec and libSceOpusCeltDec, resampling FFmpeg's 48 kHz output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(libc): raise logic_error::_Doraise and _Xruntime_error

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(relinker): preserve weak imports in Linux guest modules

* fix(libSceNetCtl): answer the DHCP host name, PPPoE name and proxy server as empty strings

Since boykopovar#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 boykopovar#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.

* feat(libSceAmpr): implement __cxa_call_unexpected

__cxa_call_unexpected takes the in-flight exception's unwind header and
never returns, as in libcxxabi. No std::set_unexpected is exported and
the exception header's unexpected handler is never set, so the handler
is always the default one, which calls std::terminate. It therefore
forwards to libc's __cxa_call_terminate, which begins the catch and runs
the current terminate handler; a null header terminates in libc's
__cxa_begin_catch. libcxxabi's std::terminate would instead run the
terminate handler saved in the exception header at throw time; the two
differ only if std::set_terminate was called in between, which the debt
entry records.

The test shares the forked-child helper of the std::_Pad test, which now
takes the terminate handler to install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(relinker): guard TLS instruction byte access at EOF

* feat(libSceLoginService): let PPSA34015 load without a missing module

FC 27 stops on Windows with Failed to load module / error 126 because this PRX is absent. Export Initialize and Terminate as no-ops and keep RequestDevices throwing until the buffer layout is known.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(libSceSysmodule): report the region of the queried page from a cached unwind region

VirtualQuery describes the pages from the queried address to the end of the run of equal pages, so the reported seg0 begins at the queried page. The cached entry returned the first lookup's page for every later address in the run. It now returns the queried page and the bytes up to the end of the cached run, which is what VirtualQuery returns.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(libSceSysmodule): look up an earlier page of a cached unwind region after a later one

The backward lookup added with the region fix compared the address with a page it could not reach and never ran. The test now queries an ntdll address three pages in, then the first page, then the pages between, and compares each with VirtualQuery. The lookups after the first fail on the cache before the region fix.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* docs(input): list the default keyboard and mouse bindings

INPUT_MAPPING.md names the actions and says that omitted actions keep their built-in bindings, but not what those bindings are. The table is read from InputMapping in core/libs/prx/libScePad/include/InputMapping.hpp.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(libc): keep intentional aborts away from the system crash handler

guest_host_standard_error and exception_runtime fork children that end in
SIGABRT on purpose. When kernel.core_pattern pipes cores to a handler, as
Ubuntu's apport and systemd-coredump do, the kernel starts it for every
dumpable crash even with RLIMIT_CORE at 0. apport takes about 1.1 s per
crash here, so guest_host_standard_error spent 2.3 s waiting and timed out
at its 10 s limit under parallel ctest load. Marking those children
non-dumpable on Linux skips the handler: 2.29 s to 0.01 s and
1.17 s to 0.01 s, with the same SIGABRT and message checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(libkernel): support EVFILT_READ on the read end of a pipe

kevent threw for any descriptor that is not a guest socket. The read end
of a pipe now gets the descriptor knote, following FreeBSD 11's
filt_piperead: data is the number of buffered bytes and EV_EOF is set
once the write end is closed. GuestSockets::Ready falls back to the new
PipeReadState for a descriptor that is not a socket, and WaitAny waits on
the pipe with ppoll on Linux or in 1 ms WSAPoll slices on Windows, only
when the queue holds a pipe. On Windows the equeue waker now starts
Winsock itself, since a queue can wait on a pipe before any socket exists.

* feat(libkernel): add sceCoredumpConfigDumpMode as a throwing stub

PPSA16833 imports it from libkernel, and its executable does not load
while no library exports the NID. The signature is unknown, so it throws
if called, like sceCoredumpWriteUserString.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(libkernel): share the Windows pipe query between poll and kevent

PipeReadiness and PipeReadState both opened the pipe handle and asked
NtQueryInformationFile for its access mask and local information. Both
now go through QueryPipe, which keeps each caller's error prefix.

* docs(build): describe the [gputime] line and its command classes

* fix(libkernel): fail connect on a listening socket with EOPNOTSUPP

FreeBSD's soconnectat refuses a socket with SO_ACCEPTCONN set with EOPNOTSUPP (45). The host answers EINVAL on Windows and EISCONN on Linux, so connect() on a listening stream socket returned the host's error. Answer EOPNOTSUPP for a listening stream socket before the address is read.

* test(agc): wait for preparation workers before linking

* fix(libkernel): reject invalid ftruncate descriptors safely

* fix(ngs2): stop stale rendering after waveform callbacks

* fix(libkernel): use precise waits for select and poll on pipes on Windows

On Windows, select over pipes polls readiness in HostPoll and sleeps
std::this_thread::sleep_for(1 ms) between rounds, and poll with pipes
but no native sockets sleeps sleep_for(slice). winpthreads ends these
sleeps on 15.6 ms timer ticks (boykopovar#1471), so a guest select or poll with a
short timeout on an idle pipe waits about 15 ms per call instead of its
timeout, and a longer wait checks the pipes only every 15.6 ms.

Both paths now sleep with PreciseSleepUntil. Each sleep requests at
most 1 ms and ends no later than the deadline; the old HostPoll sleep
could pass its deadline by a whole tick. poll on pipes also stops
spinning through the last partial millisecond before its deadline,
where the remaining time truncated to 0 ms and no sleep was made.
Infinite timeouts still sleep 1 ms per round.

The pipes are now checked about every 1.5 ms instead of every 15.6 ms:
a pipe that becomes ready is noticed sooner, and a thread blocked on an
idle pipe wakes about ten times as often. A 1 ms poll on an idle pipe
returns after about 1.5 ms instead of spinning for 1 ms.

guest_poll times 20 polls with a 2 ms timeout on an empty pipe read end
and guest_select times 20 selects with a 1 ms timeout on it; each set
must take less than 200 ms. A 1 ms poll does not reach the old sleep,
because the remaining time truncates to 0 ms and the old loop spins
until the deadline, so the poll check uses 2 ms. On Windows Server 2025
both sets took 312 ms before this change and about 50 ms and 30 ms
after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(shader): allow 32 sampler pairs per shader

A pixel shader of MXGP 26 (PPSA30839) uses 17 samplers, over the limit
of 16 sampler pairs. The sampler heap now holds 64 descriptors, ShaderData
grows by 32 sampler metadata records and the runtime ABI version moves
to 13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(agc): honor the GPU selector in recorder fixtures

* perf(agc): draw an indirect rect list from its records on the GPU

ClassifyIndirectDraw sent every indirect rect-list draw to the CPU path
(non-vertex path), which reads the records on the CPU. When the GPU writes
those records earlier in the frame, the read waits for every batch up to
the producer: in Kena (PPSA01802) each such DRAW_INDIRECT waited about
15 ms, about once per frame.

A rect list on the vertex path is drawn by its generated tessellation
stages from three-vertex patches, with no draw-dependent constants, so the
records can be consumed on the GPU like any vertex-path draw. The
classifier now keeps a rect list without mesh or tessellation stages on
the GPU path, and Graphics::Draw accepts it. APS5_NO_RECT_INDIRECT=1
restores the CPU path.

agc_driver_rect_list_indirect submits a direct rect-list draw and the
same rectangle from a DRAW_INDIRECT record and requires the same bytes,
and a record without vertices to draw nothing; it passes on either path.
agc_driver_draw_offset_indices requires an auto indirect rect-list record
whose packet names no offset registers to be classified to the GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(libSceNet): return 0 from an unbound datagram receive after shutdown or for zero bytes

On Windows a receive on a datagram socket with no local address waits
for one. A sceNetShutdown of the receive side now ends that wait, and
later receives return 0 at once; a zero-length receive returns 0 without
waiting. FreeBSD's soreceive_dgram returns 0 in both cases. Before, a
thread blocked in such a receive kept waiting after the socket was shut
down.

* test(libSceNet): receive on an unbound datagram socket that another thread binds or connects

The test covered a send that names the waiting socket. A bind and a
datagram connect from another thread name it too: each case now waits in
sceNetRecv on the unbound socket, binds or connects it, and checks that a
peer's datagram to the new address reaches the waiting receive.

* perf(libSceNet): end the wait for a local address when a bind, connect or send gives one

A receive on an unbound datagram socket checked the host socket every
10 ms, so it went on waiting up to 10 ms after another thread's bind,
connect or send had named the socket. sceNetBind now wakes the waiting
receives. On Windows a datagram connect or a send marks the socket bound
and wakes them once the host socket has its local address; a raw socket
that a send leaves without one stays unmarked and keeps waiting.

* fix(libSceNet): keep one receive timeout across the wait for a local address

When the address came during the wait, the host receive that followed
waited its whole SO_RCVTIMEO again, so a receive could take up to twice
the timeout. FreeBSD's soreceive_dgram sleeps once per timeout. Now the
receive waits for a datagram with WSAPoll only for what is left of the
timeout, and fails with EAGAIN when it runs out, as before. Nothing
changes when the socket already had an address or has no timeout.

* test(tools): add tool convention tests from upstream

* fix(tools): recognize markdown fences with CRLF endings

* fix(tools): keep duplicate export paths unquoted

* fix(tools): hide labels that do not fit treemap slivers

* docs(usage): state that the shader cache directory has no size limit

The Shader cache section says only that subdirectories of other versions are removed after 14 days. housekeeping() in ShaderDiskCache.cpp removes nothing from the current version, and no size or entry limit applies there.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(tools): read workflow job keys at the indentation the file uses

The ci-gate check read a job's needs and if only two spaces deeper
than the job name. In a workflow indented by four spaces those keys
were never found, so a job gated with needs: eligibility and an if on
its outputs was reported as ungated. Read the keys at the indentation
of the job's first child instead.

* test(agc): wait for the second-store image itself to be pending

* test(agc): wait for pending result on the tested surface

* test(agc): cover pending surface identity in the shared wait

* docs(usage): describe the texture cache budgets and APS5_TEXTURE_CACHE_MIB

* test(agc): shut libc down before agc_shader_helpers returns

On Windows, agc_shader_helpers returned from main with the driver's
threads still running. ExitProcess ends them first, then the DLLs'
static destructors run and wait on what those threads left locked:
the async log's queue mutex in Driver::stop, DeviceUseGate's condition
variable in ~Driver, and condition variables in libkernel's statics.
The test hung after printing its result in about one ctest run of
three on a Radeon 860M (boykopovar#6791).

Like the other driver tests, it now runs LibcRunShutdown_nid_postfix
before returning, which stops the driver while its threads are alive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(libkernel): validate the address before refusing connect on a listening socket

FreeBSD reads and checks the address (getsockaddr) before soconnect refuses a listening socket with EOPNOTSUPP, so a null or short address on a listener fails with the address error. Move the listener check after the address is read and keep it ahead of the family check.

* test(agc): require the GPU route for the indirect rect-list draws

agc_driver_rect_list_indirect compared the indirect draws' output with
the direct draws only, so it also passed when the records were read on
the CPU. Its records lived in a static array that is not guest memory,
so every indirect draw fell back to the CPU path as not imported.

The records now sit in a registered 64 KiB guest allocation, the test
turns on APS5_PROFILE_DRAW and reads the indirect-draw counters through
the new Graphics::IndirectDrawCounts, and it requires all four indirect
draws on the GPU path. It fails with APS5_NO_RECT_INDIRECT=1 and with
the IndirectDraw.cpp and Draw.cpp changes reverted (4 non-vertex path).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(libc): print the text that registers point at in Windows crash reports

Unreal titles end in their own libc fatal path with the UTF-16
LowLevelFatalError message in a register, and the crash report shows
only the first 64 bytes of it as hex words, so the message is lost
(boykopovar#4238: Demon Slayer PPSA03490, Stray PPSA02100).

For every general register that points at readable memory starting
with at least four printable ASCII characters, as UTF-16LE or as single
bytes, the report now prints the text up to a NUL, the first other
character, 512 characters or the end of readable memory (each page is
checked with VirtualQuery before it is read).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(libSceVdecsw): block on SyncDecodeInput/Output like TrySync

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(libSceNpManager): export two unknown NIDs so PPSA34015 can load

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(libkernel): serve the console CA list from the host trust store

Titles that bundle OpenSSL load the console's CA file from the sandbox
directory and fail every HTTPS request without it. ProsperoRadio
(PPSA99001, libcurl 8.18.0 + OpenSSL 3.5.2) on main + boykopovar#4796 + boykopovar#4525:

  [ProsperoRadio][http] https://all.api.radio-browser.info/json/servers: Problem with the SSL CA cert (path? access rights?) (error adding trust anchors from file: /gkbHtXc3Wq/common/cert/CA_LIST.cer)

SwanStation (PPSA98510) stops on the same file (boykopovar#5001).

The guest path resolver now accepts exact-path providers, and libkernel
registers one for /<sceKernelGetFsSandboxRandomWord()>/common/cert/CA_LIST.cer.
On first use it writes a PEM bundle once per process to
cert_cache/CA_LIST.cer in the run directory, read-only: on Windows the
current user's ROOT and CA system stores, elsewhere SSL_CERT_FILE or the
first distro bundle that exists. Without a certificate the path keeps
resolving under the guest root and does not exist, as before. Every other
path under the sandbox word is unchanged. The console file's format and
the rest of its common/cert directory are unverified and recorded in
docs/dev/debt/libkernel.md.

With this change, boykopovar#4796, boykopovar#4525 and boykopovar#5025 on Windows 11, 60 s each:

  [ProsperoRadio][http] 11846160 bytes in 1458 ms: 1161 passes, 803 waits (679 woken) for 1428 ms
  [ProsperoRadio][catalog] page offset=0 bytes=11846160 objects=10000 accepted=9549 total=9549
  ...
  [ProsperoRadio][catalog] page offset=60000 bytes=1712035 objects=1494 accepted=1436 total=59371

  [SwanStationPS5] update: latest 1.2.5, this 1.1.3, available
  [SwanStationPS5] gamedb: index written

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(libkernel): filter sandbox TLS roots and preserve path overrides

* test(agc): map GPU memory on fibers with and without a host stack

Since boykopovar#6003 a fiber with a context of 64 KiB or more runs on the
context itself, so the 64 KiB fiber of agc_driver_gpu_map_on_fiber
imports its mapping on a host thread on Windows too, and the test's
Windows-only expectation of no thread failed. The test now also maps
on a 16 KiB fiber, which keeps a host stack and imports on it on
Windows, and expects one import thread for the 64 KiB fiber on every
platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(recompiler): hold 32 samplers in the runtime sampler heap

A pixel shader of PPSA16833 binds more than 16 samplers outside the
sampler tables. Each takes two heap entries, one per descriptor variant,
so the 32-entry heap refused it with "shader sampler pairs exceed runtime
heap capacity" and the title aborted when a new game started.

The heap now holds 64 entries (32 samplers). Its metadata array is part
of ShaderData, which grows from 14528 to 16064 bytes, still within the
16 KiB uniform buffer every Vulkan device supports; the runtime ABI
version moves to 13 so shaders cached with the old layout are rebuilt.
The overflow message names the sampler count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(metal): optimize Civ 7 128-bit detile vectors and elide non-indexed draw snapshots

* fix(tools): sync nid_names and exempt missing debt doc-links for macOS fork

---------

Co-authored-by: Yunus Shaikh <75296019+EagleBearerYS@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: KernelPanicNT <76663133+KernelPanicNT@users.noreply.github.com>
Co-authored-by: wh1trope <noxerkrul@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Niko <nikobilger2000@gmail.com>
Co-authored-by: Ondra97 <47064087+Ondra97@users.noreply.github.com>
Co-authored-by: notaxeltv <notaxeltv@gmail.com>
Co-authored-by: JAB-dev <68183649+JAB-dev@users.noreply.github.com>
Co-authored-by: snipeTR <31975916+snipeTR@users.noreply.github.com>
Co-authored-by: Zinebyte <197974009+Zinebyte@users.noreply.github.com>
Co-authored-by: Celegans12 <53881228+Celegans12@users.noreply.github.com>
Co-authored-by: MarcZX100 <marczxrr@gmail.com>
Co-authored-by: xXPBSXx <20614131+xXPBSXx@users.noreply.github.com>
Co-authored-by: Hashaam Zafar <hashaam1217@gmail.com>
Co-authored-by: Felipe Arce <felipearce.2004@gmail.com>
Co-authored-by: Tamalero <11452991+Tamalero@users.noreply.github.com>
Co-authored-by: Josip Parlov <josipparlov@protonmail.com>
Co-authored-by: Hussein Kadhim <husseinkad.dev@gmail.com>
Co-authored-by: MarcZX100 <MarcZX100@users.noreply.github.com>
Co-authored-by: fdfawef324 <omarelfernani07@gmail.com>
Co-authored-by: Nahid Delic <nahe.delic84@gmail.com>
Co-authored-by: Romans Pokrovskis <motivated.it@gmail.com>
Co-authored-by: alfalfa-star <kosher-chive-take@duck.com>
Co-authored-by: Ishmam Ahmed <89687266+IshmamDC217@users.noreply.github.com>
Co-authored-by: LeandroLP23 <leandroplacidi@gmail.com>
Co-authored-by: screamm <davidrydgren@gmail.com>
Co-authored-by: Santhosh Kumar <santhosh-pc@outlook.com>
Co-authored-by: thuanquang <60096168+thuanquang@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants