AnyPS5/docs/dev/debt/libSceRudp.md

3.5 KiB

libSceRudp technical debt

Silent stubs

  • sceRudpProcessEvents and sceRudpNetFlush (libSceRudp) - there is no reliable-UDP stack on the host, and every sceRudpWrite, sceRudpRead and sceRudpGetStatus call here reports a reset or idle context without queueing data, so no context ever holds pending data to process or send; both calls return success after sceRudpInit and RUDP_ERROR_NOT_INITIALIZED before it, as shadPS4 returns OK from its stubs. PPSA03490 calls sceRudpProcessEvents(0) followed by sceRudpNetFlush() from its P2P service thread and ignores the first result; whether the real calls take parameters is unknown
  • sceRudpActivate (libSceRudp) - there is no reliable-UDP stack on the host to activate, so it returns success without doing anything, as shadPS4 does for its own sceRudpActivate. PPSA01325 calls it with no arguments during start-up; what the console activates, and whether it reports an error before sceRudpInit, is unverified

Unknown function info

  • sceRudpGetStatus - PPSA01521 passes an output pointer and byte count 0xF8. Measured on a PS5 (firmware 13.60): the status is 0xF8 bytes; before sceRudpInit every call returns RUDP_ERROR_NOT_INITIALIZED, and after it a null pointer or a byte count of 0 or above 0xF8 returns RUDP_ERROR_INVALID_ARGUMENT. The layout matches SceRudpStatus in Vita3K with currentContexts at 0x64 and allocs, frees, memCurrent and memPeak at 0xC8 to 0xD4. Only currentContexts is reported: the traffic counters stay 0 because nothing is sent, and the allocator counters stay 0 because the library does not allocate from the title's pool (the console reports 6 allocations and 0x1260 bytes right after sceRudpInit, and 4 more allocations and 0x3F0 bytes per context). The console also writes currentContexts and the allocator counters when the byte count is smaller than their offset; only the requested bytes are written here.
  • sceRudpGetMaxSegmentSize (libSceRudp) - measured on a PS5 (firmware 13.60) in #3073: before sceRudpInit it returns RUDP_ERROR_NOT_INITIALIZED and leaves the value untouched, also for a null pointer; after it a null pointer returns RUDP_ERROR_INVALID_ARGUMENT and a valid one gets 1410 with result 0. The library keeps no configurable segment size (there is no sceRudpSetMaxSegmentSize), so 1410 is always reported. The uint16_t* parameter is inferred: the measurement does not show how many bytes the console writes, PPSA03490 passes a pointer to a 16-bit value and RPCS3 declares the PS3 cellRudpSetMaxSegmentSize(u16 mss), so only 16 bits are written
  • PPSA06888 imports declared without parameters, signatures unknown: sceRudpEnableInternalIOThread2, sceRudpGetOption, sceRudpGetRemoteInfo (libSceRudp), imported by its bundled Media/Plugins/SceRudp.prx and not called during start-up. Names from the NID table of shadPS4, which declares them without parameters too