mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-06 00:02:44 +02:00
fixes airplane mode for local files and specific nifm call
This commit is contained in:
@@ -428,7 +428,8 @@ private:
|
|||||||
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
LOG_WARNING(Service_NIFM, "(STUBBED) called");
|
||||||
|
|
||||||
const auto result = [this] {
|
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) {
|
switch (state) {
|
||||||
case RequestState::NotSubmitted:
|
case RequestState::NotSubmitted:
|
||||||
return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled;
|
return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled;
|
||||||
@@ -947,7 +948,7 @@ void IGeneralService::IsEthernetCommunicationEnabled(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
if (Network::GetHostIPv4Address().has_value()) {
|
if (Network::GetHostIPv4Address().has_value() && !Settings::values.airplane_mode.GetValue()) {
|
||||||
rb.Push<u8>(1);
|
rb.Push<u8>(1);
|
||||||
} else {
|
} else {
|
||||||
rb.Push<u8>(0);
|
rb.Push<u8>(0);
|
||||||
@@ -959,7 +960,7 @@ void IGeneralService::IsAnyInternetRequestAccepted(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
if (Network::GetHostIPv4Address().has_value()) {
|
if (Network::GetHostIPv4Address().has_value() && !Settings::values.airplane_mode.GetValue()) {
|
||||||
rb.Push<u8>(1);
|
rb.Push<u8>(1);
|
||||||
} else {
|
} else {
|
||||||
rb.Push<u8>(0);
|
rb.Push<u8>(0);
|
||||||
|
@@ -491,11 +491,6 @@ void BSD::ExecuteWork(HLERequestContext& ctx, Work work) {
|
|||||||
|
|
||||||
std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protocol) {
|
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) {
|
if (type == Type::SEQPACKET) {
|
||||||
UNIMPLEMENTED_MSG("SOCK_SEQPACKET errno management");
|
UNIMPLEMENTED_MSG("SOCK_SEQPACKET errno management");
|
||||||
} else if (type == Type::RAW && (domain != Domain::INET || protocol != Protocol::ICMP)) {
|
} 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.socket->Initialize(Translate(domain), Translate(type), Translate(protocol));
|
||||||
descriptor.is_connection_based = IsConnectionBased(type);
|
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};
|
return {fd, Errno::SUCCESS};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user