summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-08-21 17:07:01 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-08-27 08:10:58 +0200
commit878d0225c5605465b077a26793f6d631e0a93c16 (patch)
tree577313dd58f47ec445162bc4ec19c8daefaa1583 /src/core
parentnetwork_interface: Cleanup code (diff)
downloadyuzu-878d0225c5605465b077a26793f6d631e0a93c16.tar
yuzu-878d0225c5605465b077a26793f6d631e0a93c16.tar.gz
yuzu-878d0225c5605465b077a26793f6d631e0a93c16.tar.bz2
yuzu-878d0225c5605465b077a26793f6d631e0a93c16.tar.lz
yuzu-878d0225c5605465b077a26793f6d631e0a93c16.tar.xz
yuzu-878d0225c5605465b077a26793f6d631e0a93c16.tar.zst
yuzu-878d0225c5605465b077a26793f6d631e0a93c16.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/nifm/nifm.cpp47
1 files changed, 21 insertions, 26 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index 0a53c0c81..183bd48ce 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -352,38 +352,33 @@ private:
LOG_WARNING(Service_NIFM, "(STUBBED) called");
struct IpConfigInfo {
- IpAddressSetting ip_address_setting;
- DnsSetting dns_setting;
+ IpAddressSetting ip_address_setting{};
+ DnsSetting dns_setting{};
};
static_assert(sizeof(IpConfigInfo) == sizeof(IpAddressSetting) + sizeof(DnsSetting),
"IpConfigInfo has incorrect size.");
- IpConfigInfo ip_config_info{
- .ip_address_setting{
- .is_automatic{true},
- .current_address{0, 0, 0, 0},
- .subnet_mask{255, 255, 255, 0},
- .gateway{192, 168, 1, 1},
- },
- .dns_setting{
- .is_automatic{true},
- .primary_dns{1, 1, 1, 1},
- .secondary_dns{1, 0, 0, 1},
- },
- };
+ const auto net_iface = Network::GetSelectedNetworkInterface();
- 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)}};
+ const IpConfigInfo ip_config_info = [&net_iface] {
+ if (!net_iface) {
+ return IpConfigInfo{};
+ }
- } else {
- LOG_ERROR(Service_NIFM,
- "Couldn't get host network configuration info, using default values");
- }
+ return IpConfigInfo{
+ .ip_address_setting{
+ .is_automatic{true},
+ .current_address{Network::TranslateIPv4(net_iface->ip_address)},
+ .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)},
+ .gateway{Network::TranslateIPv4(net_iface->gateway)},
+ },
+ .dns_setting{
+ .is_automatic{true},
+ .primary_dns{1, 1, 1, 1},
+ .secondary_dns{1, 0, 0, 1},
+ },
+ };
+ }();
IPC::ResponseBuilder rb{ctx, 2 + (sizeof(IpConfigInfo) + 3) / sizeof(u32)};
rb.Push(ResultSuccess);