Skip to content

fix(libSceNet): stop Sackboy loading retries on peer sockets - #5836

Open
MichalSy wants to merge 1 commit into
boykopovar:mainfrom
MichalSy:codex/fix-sackboy-peer-sockets
Open

MichalSy wants to merge 1 commit into
boykopovar:mainfrom
MichalSy:codex/fix-sackboy-peer-sockets

Conversation

@MichalSy

Copy link
Copy Markdown

What

Sackboy: A Big Adventure (PPSA01288) repeatedly recreates its loading screen because sceNetSocket(..., family=2, type=6, protocol=0) returns EPROTONOSUPPORT (0x8041012b). After the shader preparation queues had drained, a 12-second runtime probe still observed 12 new SlateLoadingThread instances interleaved with the same failing socket request.

Translate PS5 peer socket types 6 and 10 to the existing host UDP and TCP transports, and accept the PS5 broadcast option 0x20000 alongside 0x20. The existing descriptor registry, socket lifetime and error handling stay in use. Technical debt records that this does not implement console peer negotiation or virtual-port routing.

The branch contains only this network fix, its loopback regression tests and the debt entry. No matching open PR was found for these socket types or the broadcast alias.

Tested

Arch Linux, GCC 16.2.1, Release.

  • Before the production fix, the new guest_sce_net_peer_transports test aborts at peer socket creation. The game probe independently records repeated 0x8041012b returns.
  • With the fix, guest_sce_net and guest_sce_net_peer_transports pass. The peer test sends and receives actual UDP datagrams and TCP stream data over loopback, checks both broadcast-option values, and closes all descriptors.
  • Sackboy launched through FrameRift on an NVIDIA RTX A3000 Laptop GPU, driver 615.71.09: the corresponding 12-second probe observes no repeated peer socket requests or loading-thread recreation, and the title advances into another loading phase. The runtime comparison uses the same local baseline, including fix(agc): copy a depth surface's plane through the texture's padded linear slices #4873, perf(shader): avoid redundancy traversal map copies #5511 and perf(shader): keep only evaluable branch conditions in resource plans #5181, with only this network change added. It subsequently stops on a separate renderer descriptor-range error; with fix(agc): bind a V# past the range limit by the memory behind it #5778 locally applied it reaches buffer specialization has an unsupported format. This PR does not claim that Sackboy reaches a playable menu or that the remaining graphics errors are fixed.
  • On the isolated PR branch based directly on upstream main, a fresh Release build of guest_sce_net_tests and guest_datagram_receive_tests passes all six tests: guest_sce_net, guest_sce_net_peer_transports, and the recv, recvfrom, sceNetRecv, sceNetRecvfrom datagram cases.
  • git diff --check, the conventions check including this title/body, and the open-PR overlap check pass. The branch merges cleanly into the current upstream main.
  • Windows was not tested.

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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA01288 (Sackboy: A Big Adventure loading-screen retry loop; no existing Game bring-up discussion found)
  • GPUs tested: n/a (network-only change; game-run hardware listed above)
  • AI-assisted: yes

@orishamir

Copy link
Copy Markdown
Contributor

Windows run, since the description says Windows wasn't tested. Windows 11, RTX 4080, WinLibs GCC 15.2.0 r7, Release, this head (4bb5b77) merged onto main caee23f.

  • guest_sce_net and guest_sce_net_peer_transports pass 5 of 5, and the full ctest has 0 failures out of 1185.
  • With only core/libs/prx/libSceNet/Export.cpp taken back to main, both tests abort (exit 0xC0000409), so the new checks fail without the change on Windows too.

No title run: I don't have PPSA01288.

AI-assisted: yes (Claude Code Opus 5.5)

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 7201 core/libs/prx/libSceNet/Export.cpp
PR 7490 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 9231 core/libs/prx/libSceNet/Export.cpp
PR 9515 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 9578 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 9932 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 9948 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 10502 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 10628 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 10629 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 11134 core/libs/prx/libSceNet/Export.cpp
PR 11155 docs/dev/debt/libSceNet.md
PR 11272 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 11341 core/libs/prx/libSceNet/Export.cpp
PR 11472 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
PR 11559 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
PR 11569 core/libs/tests/GuestSceNet.cpp
PR 11571 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md

@github-actions github-actions Bot mentioned this pull request Oct 15, 2026
11 tasks done
@adriadam10 adriadam10 self-assigned this Oct 15, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the Sackboy investigation and the loopback tests (the Windows run by @orishamir also confirms they fail without the change). Two points to fix before merging:

  • core/libs/prx/libSceNet/Export.cpp:92,1069: 0x20000 is not a broadcast option. In shadPS4's SDK-derived net_types.h the SOL_SOCKET options are SO_BROADCAST=0x20, SO_ONESBCAST=0x10000, SO_USECRYPTO=0x20000, SO_USESIGNATURE=0x40000. Mapping 0x20000 to the host SO_BROADCAST turns on a behaviour the title did not ask for. Please cite where the "PS5 broadcast alias" comes from (a call site in the title with the instruction offset, or a reference); otherwise accept 0x20000 as a no-op only if that is what the game needs (listed under Silent stubs/Functional in the debt file) or let it throw as before.
  • Export.cpp:683-689, docs/dev/debt/libSceNet.md:11: types 6/10 are the P2P socket types, whose addressing uses virtual ports (shadPS4 models them separately). Binding them to plain host UDP/TCP returns plausible but different results for any title that really uses vports. If the game only needs creation to succeed, please scope it to exactly what is modelled (e.g. reject a non-zero vport/SO_NAME-style P2P options and any sockaddr_in_p2p use with a clear exception) and state in the PR which game call sequence you observed after sceNetSocket returns.

Build and ctest pass on Linux here (guest_sce_net, guest_sce_net_peer_transports).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 17, 2026
@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@xXPBSXx

xXPBSXx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@MichalSy this PR now conflicts with main in core/libs/prx/libSceNet/Export.cpp (the constants block, where main gained NET_SO_ONESBCAST) and in docs/dev/debt/libSceNet.md.

In case it helps: I rebased your commit onto current main without changing its content, keeping you as its author, and resolved only those two conflicts by keeping both sides (your NET_SO_BROADCAST_PS5 next to main's NET_SO_ONESBCAST, and both debt entries): branch xXPBSXx:carry/5836-sce-net-peer-transports, head 85076d5f65. You can take it with git fetch https://github.com/xXPBSXx/AnyPS5 carry/5836-sce-net-peer-transports and git reset --hard FETCH_HEAD, or rebase yourself; I will not open a second PR for it.

Windows 10 19045, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, on that head:

  • ctest -R '^(guest_sce_net|guest_sce_net_peer_transports)$' passes 3 of 3 runs.
  • With core/libs/prx/libSceNet/Export.cpp restored to main (your tests kept), both fail (exit code 0xc0000409).
  • The other net and socket tests pass, including guest_ssl_transport_net once built.
  • python tools/check_conventions.py --base upstream/main passes; git merge-tree against current main is clean.
    Not tested: Linux/macOS, a title run (PPSA01288).

AI-assisted (Claude Code).

@MarcZX10

Copy link
Copy Markdown
Contributor

I am reviewing #9506, which adds sceNetSetDnsInfo, sceNetSetDns6Info and sceNetGetDns6Info plus a new registered test and debt entry. The overlap bot could not compare some of these branches because of base conflicts, and this PR author has not yet recorded an agreed merge order. Please confirm whether your current changes overlap these exact exports, CMake/test insertion, or debt section, and whether #9506 can land before your PR or should depend on yours. The #9506 author is being asked to record the agreed order in Depends on and the overlap note.

@Queuse

Queuse commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@MichalSy I checked your broadcast alias changes while refreshing #9523, #9525, #9542, #9543 and #9544. #9542 adds readback of the existing broadcast/reuse flags; #9544 rejects nonpositive send/receive buffer sizes in the same setter option group that your alias edit changes.

Would landing these focused socket-option PRs before this PR work for you? The alias change would need to preserve the buffer guard and native option readback. If yours needs to land first, I can adapt my branches after it merges. I will record the order once we agree; #9523 before #9542 and #9525 before #9543 remain the existing prerequisites.

@ntamas94

Copy link
Copy Markdown
Contributor

Console data point for the two socket types, measured on a PS4 Pro (firmware 10.71, 10.710.001) with a user-mode homebrew PRX loaded by a small watcher app after sceNetInit. Each socket is only created, read back with sceNetGetSockInfo and closed: nothing is bound, connected or sent. One line per call as function[label] | arguments | return | sceNetErrnoLoc:

sceNetSocket[dgram-p2p] | "survey-p2p-dgram", 2, 6, 0 | 0x0000000f | 0 |
sceNetSocketClose[dgram-p2p] | (int32_t)$p2pd | 0x00000000 | 0 |
sceNetSocket[stream-p2p] | "survey-p2p-stream", 2, 10, 0 | 0x0000000f | 0 |
sceNetSocketClose[stream-p2p] | (int32_t)$p2ps | 0x00000000 | 0 |
sceNetSocket[dgram-p2p-proto17] | "survey-p2p", 2, 6, 17 | 0x8041012b | 43 |
sceNetSocket[stream-p2p-proto6] | "survey-p2p", 2, 10, 6 | 0x0000000f | 0 |
sceNetSocket[type7] | "survey", 2, 7, 0 | 0x0000000f | 0 |
sceNetSocket[type11] | "survey", 2, 11, 0 | 0x8041012b | 43 |

sceNetGetSockInfo on the two sockets (offsets of the 0xa0-byte record): type 6 reports socket_type 6, state 2, receive and send buffers 0xa460 and 0x2400; type 10 reports socket_type 10, state 1, buffers 0x10000 and 0x8000.

So on PS4 both type 6 with protocol 0 and type 10 with protocol 0 or 6 are created, as this PR does. Type 6 with protocol 17 is refused with EPROTONOSUPPORT, type 7 is also accepted and type 11 is refused; I did not check how the PR answers those three. The record keeps the P2P type rather than reporting 1 or 2.

@Queuse

Queuse commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@MichalSy I refreshed the four remaining option PRs: #9523 → #9542 and #9525 → #9543. #9544, #9930 and #9931 are now in main.

Would landing those four before this PR still work for you? Your main update needs to preserve the buffer guard and all option readbacks, and reconcile the guest type/protocol readbacks with the peer-to-host transport mapping. I am keeping the order as a proposal until you confirm it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants