forked from eden-emu/eden
[nifm] Readd room check to fix LAN on MK8D (#166)
Co-authored-by: Maufeat <sahyno1996@gmail.com> Reviewed-on: eden-emu/eden#166 Co-authored-by: Maufeat <maufeat@eden-emu.dev> Co-committed-by: Maufeat <maufeat@eden-emu.dev>
This commit is contained in:
parent
2d81cf5b26
commit
6f9216c20d
1 changed files with 27 additions and 3 deletions
|
@ -542,6 +542,7 @@ void IGeneralService::CreateRequest(HLERequestContext& ctx) {
|
|||
void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) {
|
||||
|
||||
Network::RefreshFromHost();
|
||||
const auto net_iface = Network::GetSelectedNetworkInterface();
|
||||
const auto& st = Network::EmuNetState::Get();
|
||||
|
||||
SfNetworkProfileData profile{};
|
||||
|
@ -555,7 +556,7 @@ void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) {
|
|||
|
||||
profile.ip_setting_data.dns_setting.is_automatic = true;
|
||||
profile.ip_setting_data.dns_setting.primary_dns = {1, 1, 1, 1};
|
||||
profile.ip_setting_data.dns_setting.secondary_dns = {8, 8, 8, 8};
|
||||
profile.ip_setting_data.dns_setting.secondary_dns = {1, 0, 0, 1},
|
||||
|
||||
profile.uuid = MakeUuidFromName(st.ssid);
|
||||
profile.profile_type = static_cast<u8>(NetworkProfileType::User);
|
||||
|
@ -564,6 +565,14 @@ void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) {
|
|||
|
||||
std::strncpy(profile.network_name.data(), st.ssid, sizeof(profile.network_name) - 1);
|
||||
|
||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||
if (room_member->IsConnected()) {
|
||||
profile.ip_setting_data.ip_address_setting.ip_address =
|
||||
room_member->GetFakeIpAddress();
|
||||
}
|
||||
profile.ip_setting_data.dns_setting.secondary_dns = {8, 8, 8, 8};
|
||||
}
|
||||
|
||||
if (st.via_wifi) {
|
||||
profile.wireless_setting_data.ssid_length = static_cast<u8>(std::strlen(st.ssid));
|
||||
std::memcpy(profile.wireless_setting_data.ssid.data(), st.ssid,
|
||||
|
@ -696,9 +705,15 @@ void IGeneralService::GetNetworkProfile(HLERequestContext& ctx) {
|
|||
.wireless_setting_data{wifi}};
|
||||
}();
|
||||
|
||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||
if (room_member->IsConnected()) {
|
||||
profile.ip_setting_data.ip_address_setting.ip_address = room_member->GetFakeIpAddress();
|
||||
}
|
||||
}
|
||||
|
||||
ctx.WriteBuffer(profile);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushIpcInterface<INetworkProfile>(system);
|
||||
}
|
||||
|
@ -880,7 +895,16 @@ void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) {
|
|||
info.dns.secondary_dns = {8, 8, 8, 8};
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2 + (sizeof(IpConfigInfo) + 3) / 4};
|
||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||
if (room_member->IsConnected()) {
|
||||
info.ip.ip_address = room_member->GetFakeIpAddress();
|
||||
}
|
||||
info.dns.is_automatic = true;
|
||||
info.dns.primary_dns = {1, 1, 1, 1};
|
||||
info.dns.secondary_dns = {8, 8, 8, 8};
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2 + (sizeof(IpConfigInfo) + 3) / sizeof(u32)};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(info);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue