From c34efa3e3e1bbbe2b15b97149c6d35f4c7fedd11 Mon Sep 17 00:00:00 2001 From: ANR2ME Date: Tue, 5 Oct 2021 23:07:05 +0700 Subject: [PATCH] Workaround to prevent some games from not retrying to connect on non-Windows system. This will also make a more cross-platform behavior on Windows/Linux/BSD --- Core/HLE/sceNetAdhoc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index ccc1abdf2a..558c5ff72b 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -3615,9 +3615,13 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) return hleLogDebug(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); } } - // No connection could be made because the target device actively refused it. + // No connection could be made because the target device actively refused it (on Windows/Linux/Android), or no one listening on the remote address (on Linux/Android). else if (errorcode == ECONNREFUSED) { - return hleLogError(SCENET, ERROR_NET_ADHOC_CONNECTION_REFUSED, "connection refused"); + // Workaround for ERROR_NET_ADHOC_CONNECTION_REFUSED to be more cross-platform, since there is no way to simulate ERROR_NET_ADHOC_CONNECTION_REFUSED properly on Windows + if (flag) + return hleLogError(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "connection refused workaround"); + else + return hleLogError(SCENET, ERROR_NET_ADHOC_TIMEOUT, "connection refused workaround"); } } }