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
Contributor

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 12682 core/libs/prx/libSceNet/Export.cpp
PR 12688 core/libs/prx/libSceNet/Export.cpp
PR 12700 core/libs/prx/libSceNet/Export.cpp
PR 12965 core/libs/prx/libSceNet/Export.cpp
PR 16826 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 18108 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 23975 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
PR 24065 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 25451 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
PR 26089 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 26090 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 27131 core/libs/prx/libSceNet/Export.cpp
PR 27134 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 27539 core/libs/tests/GuestSceNet.cpp
PR 28322 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
PR 28330 core/libs/prx/libSceNet/Export.cpp
PR 28535 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp

@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
This was referenced Dec 2, 2026

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new peer transports are indistinguishable from raw host TCP and UDP after sceNetSocket returns. The implementation and loopback tests establish that ordinary socket I/O works, while the debt entry identifies virtual-port routing and negotiation as unknown. Can the implementation preserve the peer type and refuse peer operations outside the supported subset explicitly? Otherwise the caller can receive success even though its peer-specific address or routing information had no effect.

I also checked the merge result against main at 9fcd37e4ea. It conflicts in the Net export, its CMake registration, and the shared guest fixture, so the existing PR test report predates those changes.

AI-assisted: yes.

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.