Compare commits

..

1 Commits

Author SHA1 Message Date
lizzie 95f88b6bf4 2026-09-28 19:16:24
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-28 19:16:24 +00:00
5 changed files with 19 additions and 14 deletions
+6 -6
View File
@@ -430,8 +430,8 @@ private:
LOG_DEBUG(Service_NIFM, "(STUBBED) called"); LOG_DEBUG(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(); && (Network::IsConnectedToAnyRoom() || !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;
@@ -925,10 +925,10 @@ void IGeneralService::SetWirelessCommunicationEnabled(HLERequestContext& ctx) {
} }
void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) { void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) {
const bool en = !Settings::values.airplane_mode.GetValue(); bool const enabled = (!Settings::values.airplane_mode.GetValue() || Network::IsConnectedToAnyRoom());
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.Push<u8>(en); rb.Push<u8>(enabled);
} }
void IGeneralService::GetInternetConnectionStatus(HLERequestContext& ctx) { void IGeneralService::GetInternetConnectionStatus(HLERequestContext& ctx) {
@@ -972,7 +972,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() && !Settings::values.airplane_mode.GetValue()) { if (Network::GetHostIPv4Address().has_value() && (!Settings::values.airplane_mode.GetValue() || Network::IsConnectedToAnyRoom())) {
rb.Push<u8>(1); rb.Push<u8>(1);
} else { } else {
rb.Push<u8>(0); rb.Push<u8>(0);
@@ -984,7 +984,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() && !Settings::values.airplane_mode.GetValue()) { if (Network::GetHostIPv4Address().has_value() && (!Settings::values.airplane_mode.GetValue() || Network::IsConnectedToAnyRoom())) {
rb.Push<u8>(1); rb.Push<u8>(1);
} else { } else {
rb.Push<u8>(0); rb.Push<u8>(0);
+5 -7
View File
@@ -547,21 +547,19 @@ std::pair<s32, Errno> BSD_USA::SocketImpl(Domain domain, Type type, Protocol pro
LOG_INFO(Service, "New socket fd={}", fd); LOG_INFO(Service, "New socket fd={}", fd);
auto room_member = Network::GetRoomMember().lock(); if (Network::IsConnectedToAnyRoom()) {
if (room_member && room_member->IsConnected()) {
descriptor.socket = std::make_shared<Network::ProxySocket>(); descriptor.socket = std::make_shared<Network::ProxySocket>();
} else { } else {
descriptor.socket = std::make_shared<Network::Socket>(); descriptor.socket = std::make_shared<Network::Socket>();
if (Settings::values.airplane_mode.GetValue() && descriptor.is_connection_based) {
LOG_ERROR(Service, "Airplane mode is enabled, cannot create socket");
return {-1, Errno::NOTCONN};
}
} }
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};
} }
+1 -1
View File
@@ -53,7 +53,7 @@ void RefreshFromHost() {
return; return;
} }
st.wifi_enabled = !Settings::values.airplane_mode.GetValue(); st.wifi_enabled = (!Settings::values.airplane_mode.GetValue() || Network::IsConnectedToAnyRoom());
st.ethernet_enabled = sel->kind == HostAdapterKind::Ethernet; st.ethernet_enabled = sel->kind == HostAdapterKind::Ethernet;
st.connected = true; st.connected = true;
+5
View File
@@ -32,6 +32,11 @@ std::weak_ptr<RoomMember> GetRoomMember() {
return g_room_member; return g_room_member;
} }
bool IsConnectedToAnyRoom() {
auto const room_member = GetRoomMember().lock();
return room_member && room_member->IsConnected();
}
void Shutdown() { void Shutdown() {
if (g_room_member) { if (g_room_member) {
if (g_room_member->IsConnected()) if (g_room_member->IsConnected())
+2
View File
@@ -20,6 +20,8 @@ std::weak_ptr<Room> GetRoom();
/// Returns a pointer to the room member handle /// Returns a pointer to the room member handle
std::weak_ptr<RoomMember> GetRoomMember(); std::weak_ptr<RoomMember> GetRoomMember();
bool IsConnectedToAnyRoom();
/// Unregisters the network device, the room, and the room member and shut them down. /// Unregisters the network device, the room, and the room member and shut them down.
void Shutdown(); void Shutdown();