fixes airplane mode for local files and specific nifm call

This commit is contained in:
Maufeat
2025-06-27 09:01:52 +02:00
parent e7ddc647f3
commit 8ae0888594
2 changed files with 9 additions and 8 deletions

View File

@@ -428,7 +428,8 @@ private:
LOG_WARNING(Service_NIFM, "(STUBBED) called");
const auto result = [this] {
const auto has_connection = Network::GetHostIPv4Address().has_value();
const auto has_connection = Network::GetHostIPv4Address().has_value() &&
!Settings::values.airplane_mode.GetValue();
switch (state) {
case RequestState::NotSubmitted:
return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled;
@@ -947,7 +948,7 @@ void IGeneralService::IsEthernetCommunicationEnabled(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
if (Network::GetHostIPv4Address().has_value()) {
if (Network::GetHostIPv4Address().has_value() && !Settings::values.airplane_mode.GetValue()) {
rb.Push<u8>(1);
} else {
rb.Push<u8>(0);
@@ -959,7 +960,7 @@ void IGeneralService::IsAnyInternetRequestAccepted(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
if (Network::GetHostIPv4Address().has_value()) {
if (Network::GetHostIPv4Address().has_value() && !Settings::values.airplane_mode.GetValue()) {
rb.Push<u8>(1);
} else {
rb.Push<u8>(0);

View File

@@ -491,11 +491,6 @@ void BSD::ExecuteWork(HLERequestContext& ctx, Work work) {
std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protocol) {
if (Settings::values.airplane_mode.GetValue()) {
LOG_ERROR(Service, "Airplane mode is enabled, cannot create socket");
return {-1, Errno::NOTCONN};
}
if (type == Type::SEQPACKET) {
UNIMPLEMENTED_MSG("SOCK_SEQPACKET errno management");
} else if (type == Type::RAW && (domain != Domain::INET || protocol != Protocol::ICMP)) {
@@ -528,6 +523,11 @@ std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protoco
descriptor.socket->Initialize(Translate(domain), Translate(type), Translate(protocol));
descriptor.is_connection_based = IsConnectionBased(type);
if (Settings::values.airplane_mode.GetValue() && descriptor.is_connection_based) {
LOG_ERROR(Service, "Airplane mode is enabled, cannot create socket");
return {-1, Errno::NOTCONN};
}
return {fd, Errno::SUCCESS};
}