From 3d99869c0c91635eaf24f39866d0494e6d3fd1d1 Mon Sep 17 00:00:00 2001 From: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> Date: Sun, 18 Feb 2024 17:00:27 +0100 Subject: [PATCH] Implement support for userbuffers on Wii U The Wii U socket implementation has limited memory available. To support larger receive buffers, application memory needs to be provided. To make sockets use this user memory the `SO_RUSRBUF` option needs to be set on the socket. --- src/PlatformSockets.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/PlatformSockets.c b/src/PlatformSockets.c index 3ba3bb1..cb2eab7 100644 --- a/src/PlatformSockets.c +++ b/src/PlatformSockets.c @@ -344,6 +344,12 @@ SOCKET bindUdpSocket(int addressFamily, struct sockaddr_storage* localAddr, SOCK Limelog("WSAIoctl(SIO_UDP_CONNRESET) failed: %d\n", LastSocketError()); } } +#elif defined(__WIIU__) + { + // Enable usage of userbuffers on Wii U + int val = 1; + setsockopt(s, SOL_SOCKET, SO_RUSRBUF, &val, sizeof(val)); + } #endif // Enable QOS for the socket (best effort)