mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #9191 from sepalani/net-interface
IP/Top: Add Android network interface
This commit is contained in:
@ -50,6 +50,10 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||
#endif
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
{
|
||||
enum SOResultCode : s32
|
||||
@ -217,7 +221,14 @@ static std::optional<DefaultInterface> GetSystemDefaultInterface()
|
||||
return DefaultInterface{entry.dwAddr, entry.dwMask, entry.dwBCastAddr};
|
||||
}
|
||||
}
|
||||
#elif !defined(__ANDROID__)
|
||||
#elif defined(__ANDROID__)
|
||||
const u32 addr = GetNetworkIpAddress();
|
||||
const u32 prefix_length = GetNetworkPrefixLength();
|
||||
const u32 netmask = (1 << prefix_length) - 1;
|
||||
const u32 gateway = GetNetworkGateway();
|
||||
if (addr || netmask || gateway)
|
||||
return DefaultInterface{addr, netmask, gateway};
|
||||
#else
|
||||
// Assume that the address that is used to access the Internet corresponds
|
||||
// to the default interface.
|
||||
auto get_default_address = []() -> std::optional<in_addr> {
|
||||
@ -261,7 +272,7 @@ static std::optional<DefaultInterface> GetSystemDefaultInterface()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static DefaultInterface GetSystemDefaultInterfaceOrFallback()
|
||||
|
Reference in New Issue
Block a user