diff options
author | Sönke Holz <sholz8530@gmail.com> | 2021-08-16 10:32:25 +0200 |
---|---|---|
committer | Sönke Holz <sholz8530@gmail.com> | 2021-08-16 10:32:25 +0200 |
commit | 70419f7a17880fd1e7834e7fe6e1aad14b0565bb (patch) | |
tree | e1eb243069df47057ba98c77dcce4588bf34ae31 /src/core/hle/service | |
parent | configuration: fix mingw-w64 build (diff) | |
download | yuzu-70419f7a17880fd1e7834e7fe6e1aad14b0565bb.tar yuzu-70419f7a17880fd1e7834e7fe6e1aad14b0565bb.tar.gz yuzu-70419f7a17880fd1e7834e7fe6e1aad14b0565bb.tar.bz2 yuzu-70419f7a17880fd1e7834e7fe6e1aad14b0565bb.tar.lz yuzu-70419f7a17880fd1e7834e7fe6e1aad14b0565bb.tar.xz yuzu-70419f7a17880fd1e7834e7fe6e1aad14b0565bb.tar.zst yuzu-70419f7a17880fd1e7834e7fe6e1aad14b0565bb.zip |
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 796c89d47..0a53c0c81 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -11,6 +11,7 @@ #include "core/hle/service/nifm/nifm.h" #include "core/hle/service/service.h" #include "core/network/network.h" +#include "core/network/network_interface.h" namespace Service::NIFM { @@ -357,16 +358,10 @@ private: static_assert(sizeof(IpConfigInfo) == sizeof(IpAddressSetting) + sizeof(DnsSetting), "IpConfigInfo has incorrect size."); - auto ipv4 = Network::GetHostIPv4Address(); - if (!ipv4) { - LOG_ERROR(Service_NIFM, "Couldn't get host IPv4 address, defaulting to 0.0.0.0"); - ipv4.emplace(Network::IPv4Address{0, 0, 0, 0}); - } - - const IpConfigInfo ip_config_info{ + IpConfigInfo ip_config_info{ .ip_address_setting{ .is_automatic{true}, - .current_address{*ipv4}, + .current_address{0, 0, 0, 0}, .subnet_mask{255, 255, 255, 0}, .gateway{192, 168, 1, 1}, }, @@ -377,6 +372,19 @@ private: }, }; + const auto iface = Network::GetSelectedNetworkInterface(); + if (iface) { + ip_config_info.ip_address_setting = + IpAddressSetting{.is_automatic{true}, + .current_address{Network::TranslateIPv4(iface->ip_address)}, + .subnet_mask{Network::TranslateIPv4(iface->subnet_mask)}, + .gateway{Network::TranslateIPv4(iface->gateway)}}; + + } else { + LOG_ERROR(Service_NIFM, + "Couldn't get host network configuration info, using default values"); + } + IPC::ResponseBuilder rb{ctx, 2 + (sizeof(IpConfigInfo) + 3) / sizeof(u32)}; rb.Push(ResultSuccess); rb.PushRaw<IpConfigInfo>(ip_config_info); |