Merge pull request #19836 from ANR2MERefork/inet_bind

An attempt to fix UNO single player.
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2025-01-09 13:41:03 +01:00
commit 17f64ce61f
1 file changed
+4 -2
+4 -2
View File
@@ -588,8 +588,10 @@ static int sceNetInetBind(int socket, u32 namePtr, int namelen) {
}
// FIXME: On non-Windows broadcast to INADDR_BROADCAST(255.255.255.255) might not be received by the sender itself when binded to specific IP (ie. 192.168.0.2) or INADDR_BROADCAST.
// Meanwhile, it might be received by itself when binded to subnet (ie. 192.168.0.255) or INADDR_ANY(0.0.0.0).
if (saddr.in.sin_addr.s_addr == INADDR_ANY || saddr.in.sin_addr.s_addr == INADDR_BROADCAST) {
// Replace INADDR_ANY with a specific IP in order not to send data through the wrong interface (especially during broadcast)
//
// Replace INADDR_ANY (and INADDR_BROADCAST too) with a specific IP (using AdhocServer IP address as reference) in order not to send data through the wrong interface (especially during broadcast),
// But let's do this only when using built-in Adhoc Server, otherwise UNO won't works
if (g_Config.bEnableAdhocServer && (saddr.in.sin_addr.s_addr == INADDR_ANY || saddr.in.sin_addr.s_addr == INADDR_BROADCAST)) {
// Get Local IP Address
sockaddr_in sockAddr{};
getLocalIp(&sockAddr);