service: nifm: Populate fields in GetCurrentNetworkProfile

Populates the current_address, subnet_mask, and gateway fields from the selected network interface.
pull/8/head
Morph 4 years ago
parent 878d0225c5
commit c1e2063c0d

@ -277,37 +277,45 @@ private:
void GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { void GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_NIFM, "(STUBBED) called"); LOG_WARNING(Service_NIFM, "(STUBBED) called");
const SfNetworkProfileData network_profile_data{ const auto net_iface = Network::GetSelectedNetworkInterface();
.ip_setting_data{
.ip_address_setting{ const SfNetworkProfileData network_profile_data = [&net_iface] {
.is_automatic{true}, if (!net_iface) {
.current_address{192, 168, 1, 100}, return SfNetworkProfileData{};
.subnet_mask{255, 255, 255, 0}, }
.gateway{192, 168, 1, 1},
}, return SfNetworkProfileData{
.dns_setting{ .ip_setting_data{
.is_automatic{true}, .ip_address_setting{
.primary_dns{1, 1, 1, 1}, .is_automatic{true},
.secondary_dns{1, 0, 0, 1}, .current_address{Network::TranslateIPv4(net_iface->ip_address)},
.subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)},
.gateway{Network::TranslateIPv4(net_iface->gateway)},
},
.dns_setting{
.is_automatic{true},
.primary_dns{1, 1, 1, 1},
.secondary_dns{1, 0, 0, 1},
},
.proxy_setting{
.enabled{false},
.port{},
.proxy_server{},
.automatic_auth_enabled{},
.user{},
.password{},
},
.mtu{1500},
}, },
.proxy_setting{ .uuid{0xdeadbeef, 0xdeadbeef},
.enabled{false}, .network_name{"yuzu Network"},
.port{}, .wireless_setting_data{
.proxy_server{}, .ssid_length{12},
.automatic_auth_enabled{}, .ssid{"yuzu Network"},
.user{}, .passphrase{"yuzupassword"},
.password{},
}, },
.mtu{1500}, };
}, }();
.uuid{0xdeadbeef, 0xdeadbeef},
.network_name{"yuzu Network"},
.wireless_setting_data{
.ssid_length{12},
.ssid{"yuzu Network"},
.passphrase{"yuzupassword"},
},
};
ctx.WriteBuffer(network_profile_data); ctx.WriteBuffer(network_profile_data);

Loading…
Cancel
Save