aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Nifm/StaticService
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-16 19:31:14 +0200
committerGitHub <noreply@github.com>2023-07-16 19:31:14 +0200
commit326749498bed4360e5a4b11fc67d5ec7cb9a3076 (patch)
treeae21fb26f99b401ca4e9efaab72b679a81c22369 /src/Ryujinx.HLE/HOS/Services/Nifm/StaticService
parentfec8291c17fa106c28f58b56419e90d49a41a1ea (diff)
[Ryujinx.HLE] Address dotnet-format issues (#5380)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address dotnet format CA2211 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address or silence dotnet format CA2211 warnings * Address review comments * Address dotnet format CA2208 warnings properly * Make ProcessResult readonly * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format style after rebase * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Fix a few disabled warnings * Fix naming rule violation, Convert shader properties to auto-property and convert values to const * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Use using declaration instead of block syntax * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Fix typo * Add trailing commas, use targeted new and use array initializer * Fix build issues * Fix remaining build issues * Remove SuppressMessage for CA1069 where possible * Address dotnet format issues * Address formatting issues Co-authored-by: Ac_K <acoustik666@gmail.com> * Add GetHashCode implementation for RenderingSurfaceInfo * Explicitly silence CA1822 for every affected method in Syscall * Address formatting issues in Demangler.cs * Address review feedback Co-authored-by: Ac_K <acoustik666@gmail.com> * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K <acoustik666@gmail.com>
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
+}