Merge pull request #10918 from sepalani/bba-init-udp

BBA/BuiltIn: Ensure UDP ports are open
This commit is contained in:
JMC47 2022-07-29 16:27:21 -04:00 committed by GitHub
commit 68912c1a7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 16 deletions

View File

@ -464,23 +464,18 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleUDPFrame(const Common::UDPPacket&
ERROR_LOG_FMT(SP1, "Couldn't open UDP socket"); ERROR_LOG_FMT(SP1, "Couldn't open UDP socket");
return; return;
} }
if (ntohs(udp_header.destination_port) == 1900) if (ntohs(udp_header.destination_port) == 1900 && ntohs(udp_header.length) > 150)
{ {
InitUDPPort(26512); // MK DD and 1080 // Quick hack to unlock the connection, throw it back at him
InitUDPPort(26502); // Air Ride Common::UDPPacket reply = packet;
if (ntohs(udp_header.length) > 150) reply.eth_header.destination = hwdata.source;
{ reply.eth_header.source = hwdata.destination;
// Quick hack to unlock the connection, throw it back at him reply.ip_header.destination_addr = ip_header.source_addr;
Common::UDPPacket reply = packet; if (ip_header.destination_addr == Common::IP_ADDR_SSDP)
reply.eth_header.destination = hwdata.source; reply.ip_header.source_addr = Common::IP_ADDR_BROADCAST;
reply.eth_header.source = hwdata.destination; else
reply.ip_header.destination_addr = ip_header.source_addr; reply.ip_header.source_addr = Common::BitCast<Common::IPAddress>(destination_addr);
if (ip_header.destination_addr == Common::IP_ADDR_SSDP) WriteToQueue(reply.Build());
reply.ip_header.source_addr = Common::IP_ADDR_BROADCAST;
else
reply.ip_header.source_addr = Common::BitCast<Common::IPAddress>(destination_addr);
WriteToQueue(reply.Build());
}
} }
} }
} }
@ -670,6 +665,10 @@ bool CEXIETHERNET::BuiltInBBAInterface::RecvInit()
void CEXIETHERNET::BuiltInBBAInterface::RecvStart() void CEXIETHERNET::BuiltInBBAInterface::RecvStart()
{ {
if (m_read_enabled.IsSet())
return;
InitUDPPort(26502); // Kirby Air Ride
InitUDPPort(26512); // Mario Kart: Double Dash!! and 1080° Avalanche
m_read_enabled.Set(); m_read_enabled.Set();
} }