diff options
author | spholz <44805808+spholz@users.noreply.github.com> | 2021-08-12 21:32:53 +0200 |
---|---|---|
committer | spholz <44805808+spholz@users.noreply.github.com> | 2021-08-12 21:32:53 +0200 |
commit | 1e98e738283ccb81303d29305188ac825ecfcba9 (patch) | |
tree | 3e82e0ce341efd5aad25584d381235365260dd1a /src/core/hle/service/nifm/nifm.cpp | |
parent | Merge branch 'yuzu-emu:master' into fix-lan-play (diff) | |
download | yuzu-1e98e738283ccb81303d29305188ac825ecfcba9.tar yuzu-1e98e738283ccb81303d29305188ac825ecfcba9.tar.gz yuzu-1e98e738283ccb81303d29305188ac825ecfcba9.tar.bz2 yuzu-1e98e738283ccb81303d29305188ac825ecfcba9.tar.lz yuzu-1e98e738283ccb81303d29305188ac825ecfcba9.tar.xz yuzu-1e98e738283ccb81303d29305188ac825ecfcba9.tar.zst yuzu-1e98e738283ccb81303d29305188ac825ecfcba9.zip |
Diffstat (limited to 'src/core/hle/service/nifm/nifm.cpp')
-rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 5ef574d20..168053d80 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -179,10 +179,10 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - if (Settings::values.bcat_backend.GetValue() == "none") { - rb.PushEnum(RequestState::NotSubmitted); - } else { + if (Network::GetHostIPv4Address().has_value()) { rb.PushEnum(RequestState::Connected); + } else { + rb.PushEnum(RequestState::NotSubmitted); } } @@ -322,12 +322,15 @@ private: void GetCurrentIpAddress(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); - const auto [ipv4, error] = Network::GetHostIPv4Address(); - UNIMPLEMENTED_IF(error != Network::Errno::SUCCESS); + auto ipv4 = Network::GetHostIPv4Address(); + if (!ipv4) { + LOG_CRITICAL(Service_NIFM, "Couldn't get host IPv4 address, defaulting to 0.0.0.0"); + ipv4.emplace(Network::IPv4Address{0, 0, 0, 0}); + } IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.PushRaw(ipv4); + rb.PushRaw(ipv4.value()); } void CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NIFM, "called"); @@ -354,13 +357,16 @@ private: static_assert(sizeof(IpConfigInfo) == sizeof(IpAddressSetting) + sizeof(DnsSetting), "IpConfigInfo has incorrect size."); - const auto [ipv4, error] = Network::GetHostIPv4Address(); - ASSERT_MSG(error == Network::Errno::SUCCESS, "Couldn't get host IPv4 address"); + auto ipv4 = Network::GetHostIPv4Address(); + if (!ipv4) { + LOG_CRITICAL(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{ .ip_address_setting{ .is_automatic{true}, - .current_address{ipv4}, + .current_address{ipv4.value()}, .subnet_mask{255, 255, 255, 0}, .gateway{192, 168, 1, 1}, }, @@ -387,10 +393,10 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - if (Settings::values.bcat_backend.GetValue() == "none") { - rb.Push<u8>(0); - } else { + if (Network::GetHostIPv4Address().has_value()) { rb.Push<u8>(1); + } else { + rb.Push<u8>(0); } } void IsAnyInternetRequestAccepted(Kernel::HLERequestContext& ctx) { @@ -398,10 +404,10 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - if (Settings::values.bcat_backend.GetValue() == "none") { - rb.Push<u8>(0); - } else { + if (Network::GetHostIPv4Address().has_value()) { rb.Push<u8>(1); + } else { + rb.Push<u8>(0); } } }; |