sceNetAdhoc, adhocctl: Check arguments like the PSP

From the net/adhoc pspautotests (pdp, ptp, poll, limits, adhocctl,
gamemode), recorded on PSPs:

- PDP and PTP: NULL pointers and nonzero flags give INVALID_ARG, before
  the socket ID is checked. Zero and multicast addresses give
  INVALID_ADDR, ports 0 and 65535 INVALID_PORT, and send lengths over
  65523 or NULL data INVALID_DATALEN. A length of 0 sends nothing and
  succeeds. Zero buffer sizes, retransmit settings and backlogs are
  accepted. PdpRecv takes a NULL sender address or port. Running out of
  socket IDs gives SOCKET_ID_NOT_AVAIL, and out-of-range IDs on
  delete/close INVALID_SOCKET_ID. PollSocket rejects flags other than
  NONBLOCK.
- adhocctl: Init checks its stack size, priority and ad hoc ID;
  AddHandler needs Init, allows the same function twice and takes at most
  4 handlers; DelHandler on an unknown ID gives ID_NOT_FOUND; bad group
  names give adhocctl's INVALID_ARG; GetParameter and GetPeerList fail
  outside a group.
- Game mode: a NULL group name and a bad minimum are rejected,
  GetGameModeInfo fails outside game mode, and the entry timeout reports
  adhocctl's TIMEOUT.

The DBZ Shin Budokai 2 workaround that replaces the game's local MAC with
ours stays, so another console's MAC is still accepted when creating a
socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-28 09:52:22 +01:00
1 parent be9c244938
commit 58d73cbbc6
3 files changed
+187 -28

No files matched your search

+2 -1
View File
@@ -1570,7 +1570,8 @@ int friendFinder() {
// Calculate EnterGameMode Timeout to prevent waiting forever for disconnected players
if (isAdhocctlBusy && adhocctlState == ADHOCCTL_STATE_DISCONNECTED && adhocctlCurrentMode == ADHOCCTL_MODE_GAMEMODE && netAdhocGameModeEntered && static_cast<s64>(now - adhocctlStartTime) > netAdhocEnterGameModeTimeout) {
netAdhocGameModeEntered = false;
notifyAdhocctlHandlers(ADHOCCTL_EVENT_ERROR, SCE_NET_ADHOC_ERROR_TIMEOUT);
// adhocctl's own TIMEOUT (pspautotests net/adhoc/gamemode).
notifyAdhocctlHandlers(ADHOCCTL_EVENT_ERROR, SCE_NET_ADHOCCTL_ERROR_TIMEOUT);
}
auto friend_finder_wait = [] {