BBA/BuiltIn: Ensure UDP ports are open

This commit is contained in:
Sepalani 2022-07-29 12:00:49 +04:00
parent a81f3a95db
commit 18b8f147ab
1 changed files with 15 additions and 16 deletions

View File

@ -464,11 +464,7 @@ 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
InitUDPPort(26502); // Air Ride
if (ntohs(udp_header.length) > 150)
{ {
// Quick hack to unlock the connection, throw it back at him // Quick hack to unlock the connection, throw it back at him
Common::UDPPacket reply = packet; Common::UDPPacket reply = packet;
@ -483,7 +479,6 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleUDPFrame(const Common::UDPPacket&
} }
} }
} }
}
if (ntohs(udp_header.destination_port) == 53) if (ntohs(udp_header.destination_port) == 53)
target = sf::IpAddress(m_dns_ip.c_str()); // dns server ip target = sf::IpAddress(m_dns_ip.c_str()); // dns server ip
else if (ip_header.destination_addr == Common::IP_ADDR_SSDP) else if (ip_header.destination_addr == Common::IP_ADDR_SSDP)
@ -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();
} }