From cc1ff5b94c1040d0b95699ec6aeaa82f5be72e97 Mon Sep 17 00:00:00 2001 From: ANR2ME Date: Thu, 15 Oct 2020 23:56:08 +0700 Subject: [PATCH] 2nd or more instance of PPSSPP should only bind it's own localhost IP for Adhoc Server. Fixes Capcom Classics Collection Remix multiplayer on multiple-instance. --- Core/HLE/proAdhocServer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Core/HLE/proAdhocServer.cpp b/Core/HLE/proAdhocServer.cpp index d9ea077054..02dd1ee323 100644 --- a/Core/HLE/proAdhocServer.cpp +++ b/Core/HLE/proAdhocServer.cpp @@ -55,6 +55,7 @@ #include "Common/File/FileUtil.h" #include "Common/TimeUtil.h" #include "Core/Util/PortManager.h" +#include "Core/Instance.h" #include "Core/Core.h" #include "Core/Host.h" #include "Core/HLE/proAdhocServer.h" @@ -1808,6 +1809,9 @@ int create_listen_socket(uint16_t port) // Created Socket if(fd != -1) { + // Ignore SIGPIPE when supported (ie. BSD/MacOS) + setSockNoSIGPIPE(fd, 1); + // Enable KeepAlive enable_keepalive(fd); @@ -1827,12 +1831,10 @@ int create_listen_socket(uint16_t port) local.sin_addr.s_addr = INADDR_ANY; local.sin_port = htons(port); - //Should only bind to specific IP for the 2nd or more instance of PPSSPP to prevent communication interference issue when sharing the same port. Doesn't work well when PPSSPP_ID reseted everytime emulation restarted. - /* + // Should only bind to specific IP for the 2nd or more instance of PPSSPP to prevent communication interference issue when sharing the same port. (ie. Capcom Classics Collection Remixed) if (PPSSPP_ID > 1) { local.sin_addr = g_localhostIP.in.sin_addr; } - */ // Bind Local Address to Socket int bindresult = bind(fd, (struct sockaddr *)&local, sizeof(local));