From bfc2d11891e12494e7ec0e70bb4594bcfea30798 Mon Sep 17 00:00:00 2001 From: Sepalani Date: Sun, 31 Jul 2022 01:33:49 +0400 Subject: [PATCH] BBA/BuiltIn: Simplify HandleARP --- Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp index 9e790484a2..c02cb8585f 100644 --- a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp +++ b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp @@ -72,8 +72,10 @@ bool CEXIETHERNET::BuiltInBBAInterface::Activate() sf::IpAddress(m_local_ip).toInteger(); m_current_ip = htonl(ip); m_current_mac = Common::BitCastPtr(&m_eth_ref->mBbaMem[BBA_NAFR_PAR0]); + m_arp_table[m_current_ip] = m_current_mac; m_router_ip = (m_current_ip & 0xFFFFFF) | 0x01000000; m_router_mac = Common::GenerateMacAddress(Common::MACConsumer::BBA); + m_arp_table[m_router_ip] = m_router_mac; // clear all ref for (auto& ref : network_ref) @@ -128,19 +130,8 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleARP(const Common::ARPPacket& packe { const auto& [hwdata, arpdata] = packet; Common::ARPPacket response(m_current_mac, m_router_mac); - - if (arpdata.target_ip == m_current_ip) - { - // game asked for himself, reply with his mac address - response.arp_header = - Common::ARPHeader(arpdata.target_ip, m_current_mac, m_current_ip, m_current_mac); - } - else - { - response.arp_header = Common::ARPHeader(arpdata.target_ip, ResolveAddress(arpdata.target_ip), - m_current_ip, m_current_mac); - } - + response.arp_header = Common::ARPHeader(arpdata.target_ip, ResolveAddress(arpdata.target_ip), + m_current_ip, m_current_mac); WriteToQueue(response.Build()); }