Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTG committed Oct 11, 2023
1 parent ea86788 commit 2d86d5a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion melondsds_libretro.info
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ corename = "melonDS DS"
categories = "Emulator"
license = "GPLv3"
permissions = ""
display_version = "0.6.0"
display_version = "0.6.1"

# Hardware Information
manufacturer = "Nintendo"
Expand Down
18 changes: 1 addition & 17 deletions src/libretro/pcap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,7 @@ namespace melonds {
constexpr std::array<u8, 6> BAD_MAC = {0, 0, 0, 0, 0, 0};
constexpr std::array<u8, 6> BROADCAST_MAC = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

constexpr bool IsAdapterAcceptable(const LAN_PCap::AdapterData& adapter) noexcept {
const SPI_Firmware::MacAddress& mac = *reinterpret_cast<const SPI_Firmware::MacAddress*>(adapter.MAC);

if (mac == BAD_MAC || mac == BROADCAST_MAC)
return false;

const pcap_if_t* iface = static_cast<const pcap_if_t*>(adapter.Internal);
if (iface == nullptr)
return false;

if (iface->flags & PCAP_IF_LOOPBACK)
// If this is a loopback interface...
return false;

return true;
}

bool IsAdapterAcceptable(const LAN_PCap::AdapterData& adapter) noexcept;
}
#endif
#endif //MELONDS_DS_PCAP_HPP
17 changes: 17 additions & 0 deletions src/libretro/platform/lan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ namespace Config {
}

#ifdef HAVE_NETWORKING_DIRECT_MODE
bool melonds::IsAdapterAcceptable(const LAN_PCap::AdapterData& adapter) noexcept {
const SPI_Firmware::MacAddress& mac = *reinterpret_cast<const SPI_Firmware::MacAddress*>(adapter.MAC);

if (mac == BAD_MAC || mac == BROADCAST_MAC)
return false;

const pcap_if_t* iface = static_cast<const pcap_if_t*>(adapter.Internal);
if (iface == nullptr)
return false;

if (iface->flags & PCAP_IF_LOOPBACK)
// If this is a loopback interface...
return false;

return true;
}

static const LAN_PCap::AdapterData* SelectNetworkInterface(const LAN_PCap::AdapterData* adapters, int numAdapters) noexcept {
using namespace melonds;

Expand Down

0 comments on commit 2d86d5a

Please sign in to comment.