aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/Nifm/StaticService')
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/GeneralServiceManager.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/Types/GeneralServiceDetail.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs30
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs14
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs8
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionState.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionType.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs10
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpSettingData.cs8
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs12
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/ProxySetting.cs18
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/WirelessSettingData.cs8
13 files changed, 66 insertions, 60 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/GeneralServiceManager.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/GeneralServiceManager.cs
index bbb218bb..5f26f211 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/GeneralServiceManager.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/GeneralServiceManager.cs
@@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.GeneralService
{
static class GeneralServiceManager
{
- private static List<GeneralServiceDetail> _generalServices = new List<GeneralServiceDetail>();
+ private static readonly List<GeneralServiceDetail> _generalServices = new();
public static int Count
{
@@ -27,4 +27,4 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.GeneralService
return _generalServices.First(item => item.ClientId == clientId);
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/Types/GeneralServiceDetail.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/Types/GeneralServiceDetail.cs
index 3cf55345..fab15851 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/Types/GeneralServiceDetail.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/GeneralService/Types/GeneralServiceDetail.cs
@@ -2,7 +2,7 @@
{
class GeneralServiceDetail
{
- public int ClientId;
+ public int ClientId;
public bool IsAnyInternetRequestAccepted;
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs
index e9712e92..581a2906 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs
@@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
{
class IGeneralService : DisposableIpcService
{
- private GeneralServiceDetail _generalServiceDetail;
+ private readonly GeneralServiceDetail _generalServiceDetail;
private IPInterfaceProperties _targetPropertiesCache = null;
private UnicastIPAddressInformation _targetAddressInfoCache = null;
@@ -21,11 +21,11 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
{
_generalServiceDetail = new GeneralServiceDetail
{
- ClientId = GeneralServiceManager.Count,
- IsAnyInternetRequestAccepted = true // NOTE: Why not accept any internet request?
+ ClientId = GeneralServiceManager.Count,
+ IsAnyInternetRequestAccepted = true, // NOTE: Why not accept any internet request?
};
- NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(LocalInterfaceCacheHandler);
+ NetworkChange.NetworkAddressChanged += LocalInterfaceCacheHandler;
GeneralServiceManager.Add(_generalServiceDetail);
}
@@ -76,13 +76,13 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize((uint)Unsafe.SizeOf<NetworkProfileData>());
- NetworkProfileData networkProfile = new NetworkProfileData
+ NetworkProfileData networkProfile = new()
{
- Uuid = UInt128Utils.CreateRandom()
+ Uuid = UInt128Utils.CreateRandom(),
};
networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress);
- networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties);
+ networkProfile.IpSettingData.DnsSetting = new DnsSetting(interfaceProperties);
"RyujinxNetwork"u8.CopyTo(networkProfile.Name.AsSpan());
@@ -137,11 +137,11 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
return ResultCode.NoInternetConnection;
}
- InternetConnectionStatus internetConnectionStatus = new InternetConnectionStatus
+ InternetConnectionStatus internetConnectionStatus = new()
{
- Type = InternetConnectionType.WiFi,
+ Type = InternetConnectionType.WiFi,
WifiStrength = 3,
- State = InternetConnectionState.Connected,
+ State = InternetConnectionState.Connected,
};
context.ResponseData.WriteStruct(internetConnectionStatus);
@@ -154,7 +154,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
public ResultCode IsAnyInternetRequestAccepted(ServiceCtx context)
{
ulong position = context.Request.PtrBuff[0].Position;
- ulong size = context.Request.PtrBuff[0].Size;
+#pragma warning disable IDE0059 // Remove unnecessary value assignment
+ ulong size = context.Request.PtrBuff[0].Size;
+#pragma warning restore IDE0059
int clientId = context.Memory.Read<int>(position);
@@ -184,9 +186,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
private void LocalInterfaceCacheHandler(object sender, EventArgs e)
{
- Logger.Info?.Print(LogClass.ServiceNifm, $"NetworkAddress changed, invalidating cached data.");
+ Logger.Info?.Print(LogClass.ServiceNifm, "NetworkAddress changed, invalidating cached data.");
- _targetPropertiesCache = null;
+ _targetPropertiesCache = null;
_targetAddressInfoCache = null;
}
@@ -200,4 +202,4 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs
index 87aad30b..577d0382 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IRequest.cs
@@ -12,16 +12,18 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
{
Error = 1,
OnHold = 2,
- Available = 3
+ Available = 3,
}
- private KEvent _event0;
- private KEvent _event1;
+ private readonly KEvent _event0;
+ private readonly KEvent _event1;
private int _event0Handle;
private int _event1Handle;
- private uint _version;
+#pragma warning disable IDE0052 // Remove unread private member
+ private readonly uint _version;
+#pragma warning restore IDE0052
public IRequest(Horizon system, uint version)
{
@@ -116,7 +118,9 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
// GetAppletInfo(u32) -> (u32, u32, u32, buffer<bytes, 6>)
public ResultCode GetAppletInfo(ServiceCtx context)
{
+#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint themeColor = context.RequestData.ReadUInt32();
+#pragma warning restore IDE0059
Logger.Stub?.PrintStub(LogClass.ServiceNifm);
@@ -139,4 +143,4 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
return ResultCode.Success;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs
index 374558ea..4a9d782d 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs
@@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
struct DnsSetting
{
[MarshalAs(UnmanagedType.U1)]
- public bool IsDynamicDnsEnabled;
+ public bool IsDynamicDnsEnabled;
public IpV4Address PrimaryDns;
public IpV4Address SecondaryDns;
@@ -18,14 +18,14 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
if (interfaceProperties.DnsAddresses.Count == 0)
{
- PrimaryDns = new IpV4Address();
+ PrimaryDns = new IpV4Address();
SecondaryDns = new IpV4Address();
}
else
{
- PrimaryDns = new IpV4Address(interfaceProperties.DnsAddresses[0]);
+ PrimaryDns = new IpV4Address(interfaceProperties.DnsAddresses[0]);
SecondaryDns = new IpV4Address(interfaceProperties.DnsAddresses[interfaceProperties.DnsAddresses.Count > 1 ? 1 : 0]);
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionState.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionState.cs
index dfb8f76c..8c9efa61 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionState.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionState.cs
@@ -6,6 +6,6 @@
ConnectingType1 = 1,
ConnectingType2 = 2,
ConnectingType3 = 3,
- Connected = 4,
+ Connected = 4,
}
}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs
index ff944eca..1bf41fc6 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionStatus.cs
@@ -5,8 +5,8 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
[StructLayout(LayoutKind.Sequential)]
struct InternetConnectionStatus
{
- public InternetConnectionType Type;
- public byte WifiStrength;
+ public InternetConnectionType Type;
+ public byte WifiStrength;
public InternetConnectionState State;
}
}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionType.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionType.cs
index af2bcfa1..ab03382d 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionType.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/InternetConnectionType.cs
@@ -2,8 +2,8 @@
{
enum InternetConnectionType : byte
{
- Invalid = 0,
- WiFi = 1,
+ Invalid = 0,
+ WiFi = 1,
Ethernet = 2,
}
}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs
index 59c1f6a7..5ea9d849 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs
@@ -8,17 +8,17 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
struct IpAddressSetting
{
[MarshalAs(UnmanagedType.U1)]
- public bool IsDhcpEnabled;
+ public bool IsDhcpEnabled;
public IpV4Address Address;
public IpV4Address IPv4Mask;
public IpV4Address GatewayAddress;
public IpAddressSetting(IPInterfaceProperties interfaceProperties, UnicastIPAddressInformation unicastIPAddressInformation)
{
- IsDhcpEnabled = OperatingSystem.IsMacOS() || interfaceProperties.DhcpServerAddresses.Count != 0;
- Address = new IpV4Address(unicastIPAddressInformation.Address);
- IPv4Mask = new IpV4Address(unicastIPAddressInformation.IPv4Mask);
+ IsDhcpEnabled = OperatingSystem.IsMacOS() || interfaceProperties.DhcpServerAddresses.Count != 0;
+ Address = new IpV4Address(unicastIPAddressInformation.Address);
+ IPv4Mask = new IpV4Address(unicastIPAddressInformation.IPv4Mask);
GatewayAddress = (interfaceProperties.GatewayAddresses.Count == 0) ? new IpV4Address() : new IpV4Address(interfaceProperties.GatewayAddresses[0].Address);
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpSettingData.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpSettingData.cs
index 8ffe824c..328dc7da 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpSettingData.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpSettingData.cs
@@ -6,8 +6,8 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
struct IpSettingData
{
public IpAddressSetting IpAddressSetting;
- public DnsSetting DnsSetting;
- public ProxySetting ProxySetting;
- public short Mtu;
+ public DnsSetting DnsSetting;
+ public ProxySetting ProxySetting;
+ public short Mtu;
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs
index e270c10a..12a1c30f 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs
@@ -7,11 +7,11 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x17C)]
struct NetworkProfileData
{
- public IpSettingData IpSettingData;
- public UInt128 Uuid;
- public Array64<byte> Name;
- public Array4<byte> Unknown;
+ public IpSettingData IpSettingData;
+ public UInt128 Uuid;
+ public Array64<byte> Name;
+ public Array4<byte> Unknown;
public WirelessSettingData WirelessSettingData;
- public byte Padding;
+ public byte Padding;
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/ProxySetting.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/ProxySetting.cs
index 6e534fe1..909138e8 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/ProxySetting.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/ProxySetting.cs
@@ -9,19 +9,19 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
public struct ProxySetting
{
[MarshalAs(UnmanagedType.I1)]
- public bool Enabled;
- private byte _padding;
- public short Port;
- private NameStruct _name;
+ public bool Enabled;
+ private readonly byte _padding;
+ public short Port;
+ private NameStruct _name;
[MarshalAs(UnmanagedType.I1)]
- public bool AutoAuthEnabled;
- public Array32<byte> User;
- public Array32<byte> Pass;
- private byte _padding2;
+ public bool AutoAuthEnabled;
+ public Array32<byte> User;
+ public Array32<byte> Pass;
+ private readonly byte _padding2;
[StructLayout(LayoutKind.Sequential, Size = 0x64)]
private struct NameStruct { }
public Span<byte> Name => SpanHelpers.AsSpan<NameStruct, byte>(ref _name);
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/WirelessSettingData.cs b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/WirelessSettingData.cs
index 8aa122c7..53855a4e 100644
--- a/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/WirelessSettingData.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/WirelessSettingData.cs
@@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x65)]
struct WirelessSettingData
{
- public byte SsidLength;
+ public byte SsidLength;
public Array32<byte> Ssid;
- public Array3<byte> Unknown;
+ public Array3<byte> Unknown;
public Array64<byte> Passphrase1;
- public byte Passphrase2;
+ public byte Passphrase2;
}
-} \ No newline at end of file
+}