Compare commits

...

13 Commits

Author SHA1 Message Date
VolcaEM
74c210c85c Remove unused error codes 2020-05-01 22:07:45 +02:00
VolcaEM
adb058acce Use better names for variables 2020-04-29 15:04:39 +02:00
VolcaEM
935f08fd54 Correct assert in CreateTemporaryNetworkProfile
NetworkProfileData is 0x18E and SfNetworkProfileData is 0x17C
2020-04-29 14:48:48 +02:00
VolcaEM
90051fcaa5 Remove faulty GetCurrentIpAddress stub 2020-04-29 14:46:42 +02:00
VolcaEM
4bc62f529c Use a more accurate name for IPv4 addresses 2020-04-28 17:17:39 +02:00
VolcaEM
b6589854cb Address review comments (again)
Use decimal instead of hexadecimal for result codes
2020-04-28 16:57:48 +02:00
VolcaEM
4ce2eaf1b3 Address review comments (2/2) 2020-04-27 02:51:28 +02:00
VolcaEM
4aa2845240 Address review comments (1/2) 2020-04-27 02:50:42 +02:00
VolcaEM
b698cb8d04 Fix typo 2020-04-27 02:25:29 +02:00
VolcaEM
672bde43b0 Clang-format (2/2) 2020-04-26 22:10:11 +02:00
VolcaEM
0f059b4b16 Clang-format (1/2) 2020-04-26 22:09:34 +02:00
VolcaEM
1fab85cd57 Check if the IP is zero and add error codes
Error codes taken from Ryujinx (https://github.com/Ryujinx/Ryujinx)
2020-04-26 21:48:35 +02:00
VolcaEM
fb93a74cb5 Add nifm structs and implement GetCurrentIpAddress (#2)
The structs are taken from: https://switchbrew.org/wiki/Network_Interface_services
2020-04-26 21:04:58 +02:00
2 changed files with 125 additions and 1 deletions

View File

@@ -177,7 +177,8 @@ private:
void CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_NIFM, "called");
ASSERT_MSG(ctx.GetReadBufferSize() == 0x17c, "NetworkProfileData is not the correct size");
ASSERT_MSG(ctx.GetReadBufferSize() == 0x17c,
"SfNetworkProfileData is not the correct size");
u128 uuid{};
auto buffer = ctx.ReadBuffer();
std::memcpy(&uuid, buffer.data() + 8, sizeof(u128));
@@ -218,6 +219,7 @@ private:
}
}
Core::System& system;
Service::NIFM::NetworkProfileData network_profile_data{};
};
IGeneralService::IGeneralService(Core::System& system)

View File

@@ -4,6 +4,10 @@
#pragma once
#include <array>
#include "common/common_funcs.h"
#include "common/common_types.h"
namespace Service::SM {
class ServiceManager;
}
@@ -14,6 +18,124 @@ class System;
namespace Service::NIFM {
struct ClientId {
u32 client_id{};
};
static_assert(sizeof(ClientId) == 0x4, "ClientId has incorrect size.");
struct Uuid {
u128 uuid{};
};
static_assert(sizeof(Uuid) == 0x10, "Uuid has incorrect size.");
struct WirelessSettingData {
u8 ssid_length{};
std::array<u8, 0x21> ssid{};
u8 unk1{};
INSERT_PADDING_BYTES(0x1);
u32 unk2{};
u32 unk3{};
std::array<u8, 0x41> passphrase{};
INSERT_PADDING_BYTES(0x3);
};
static_assert(sizeof(WirelessSettingData) == 0x70, "WirelessSettingData has incorrect size.");
struct SfWirelessSettingData {
u8 ssid_length{};
std::array<u8, 0x20> ssid{};
u8 unk1{};
u8 unk2{};
u8 unk3{};
std::array<u8, 0x41> passphrase{};
};
static_assert(sizeof(SfWirelessSettingData) == 0x65, "SfWirelessSettingData has incorrect size.");
struct IpV4Address {
u32 address{};
};
static_assert(sizeof(IpV4Address) == 0x4, "IpV4Address has incorrect size.");
struct SubnetMask {
u32 mask{};
};
static_assert(sizeof(SubnetMask) == 0x4, "SubnetMask has incorrect size.");
struct Gateway {
u32 gateway{};
};
static_assert(sizeof(Gateway) == 0x4, "Gateway has incorrect size.");
#pragma pack(1)
struct IpAddressSetting {
// Ryujinx (https://github.com/Ryujinx/Ryujinx/) calls this "IsDhcpEnabled"
u8 is_automatic{};
IpV4Address ip_address{};
SubnetMask subnet_mask{};
Gateway gateway_address{};
};
#pragma pack()
static_assert(sizeof(IpAddressSetting) == 0xD, "IpAddressSetting has incorrect size.");
#pragma pack(1)
struct DNSSetting {
// Ryujinx (https://github.com/Ryujinx/Ryujinx/) calls this "IsDynamicDnsEnabled"
u8 is_automatic{};
u32 primary_dns{};
u32 secondary_dns{};
};
#pragma pack()
static_assert(sizeof(DNSSetting) == 0x9, "DNSSetting has incorrect size.");
struct ProxySetting {
u8 use_proxy{};
INSERT_PADDING_BYTES(0x1);
u16 port{};
std::array<u8, 0x64> server{};
u8 use_auto_authentication{};
std::array<u8, 0x20> user_string{};
std::array<u8, 0x20> password{};
INSERT_PADDING_BYTES(0x1);
};
static_assert(sizeof(ProxySetting) == 0xAA, "ProxySetting has incorrect size.");
struct IpSettingData {
IpAddressSetting address_settings{};
DNSSetting dns_settings{};
ProxySetting proxy_settings{};
u16 mtu{};
};
static_assert(sizeof(IpSettingData) == 0xC2, "IpSettingData has incorrect size.");
#pragma pack(1)
struct NetworkProfileData {
Uuid uuid{};
std::array<u8, 0x40> network_name{};
u32 unk1{};
u32 unk2{};
u8 unk3{};
u8 unk4{};
INSERT_PADDING_BYTES(0x2);
WirelessSettingData wireless_data{};
IpSettingData ip_data{};
};
#pragma pack()
static_assert(sizeof(NetworkProfileData) == 0x18E, "NetworkProfileData has incorrect size.");
#pragma pack(1)
struct SfNetworkProfileData {
IpSettingData ip_data{};
Uuid uuid{};
std::array<u8, 0x40> network_name{};
u8 unk1{};
u8 unk2{};
u8 unk3{};
u8 unk4{};
SfWirelessSettingData sf_wireless_data{};
INSERT_PADDING_BYTES(0x1);
};
#pragma pack()
static_assert(sizeof(SfNetworkProfileData) == 0x17C, "SfNetworkProfileData has incorrect size.");
/// Registers all NIFM services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);