From 326749498bed4360e5a4b11fc67d5ec7cb9a3076 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Sun, 16 Jul 2023 19:31:14 +0200 Subject: [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 * 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 * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K --- .../HOS/Services/Ns/Aoc/IAddOnContentManager.cs | 28 +++++++++++++++++----- .../HOS/Services/Ns/Aoc/IContentsServiceManager.cs | 2 +- .../HOS/Services/Ns/Aoc/IPurchaseEventManager.cs | 8 +++---- src/Ryujinx.HLE/HOS/Services/Ns/Aoc/ResultCode.cs | 6 ++--- .../Services/Ns/IApplicationManagerInterface.cs | 7 +++--- .../HOS/Services/Ns/IDevelopInterface.cs | 2 +- .../Ns/IReadOnlyApplicationControlDataInterface.cs | 2 ++ .../HOS/Services/Ns/IServiceGetterInterface.cs | 2 +- .../HOS/Services/Ns/ISystemUpdateInterface.cs | 2 +- .../Services/Ns/IVulnerabilityManagerInterface.cs | 2 +- 10 files changed, 40 insertions(+), 21 deletions(-) (limited to 'src/Ryujinx.HLE/HOS/Services/Ns') diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs index b4b5bb1f..083a8321 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs @@ -11,11 +11,11 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc class IAddOnContentManager : IpcService { private readonly KEvent _addOnContentListChangedEvent; - private int _addOnContentListChangedEventHandle; + private int _addOnContentListChangedEventHandle; private ulong _addOnContentBaseId; - private List _mountedAocTitleIds = new List(); + private readonly List _mountedAocTitleIds = new(); public IAddOnContentManager(ServiceCtx context) { @@ -44,7 +44,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CountAddOnContent(pid) -> u32 public ResultCode CountAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. @@ -55,7 +57,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // ListAddOnContent(u32 start_index, u32 buffer_size, pid) -> (u32 count, buffer) public ResultCode ListAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. @@ -75,7 +79,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentBaseId(pid) -> u64 public ResultCode GetAddOnContentBaseId(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. @@ -95,7 +101,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // PrepareAddOnContent(u32 index, pid) public ResultCode PrepareAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. @@ -123,7 +131,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // GetAddOnContentListChangedEventWithProcessId(pid) -> handle public ResultCode GetAddOnContentListChangedEventWithProcessId(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. @@ -142,7 +152,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyMountAddOnContent(pid, u64 title_id) public ResultCode NotifyMountAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. @@ -160,7 +172,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NotifyUnmountAddOnContent(pid, u64 title_id) public ResultCode NotifyUnmountAddOnContent(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. @@ -175,7 +189,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // CheckAddOnContentMountStatus(pid) public ResultCode CheckAddOnContentMountStatus(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 // NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId. // Then it does some internal checks and returns InvalidBufferSize if they fail. @@ -239,10 +255,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // NOTE: Service call sys:set GetQuestFlag and store it internally. // If QuestFlag is true, counts some extra titles. - uint startIndex = context.RequestData.ReadUInt32(); - uint indexNumber = context.RequestData.ReadUInt32(); + uint startIndex = context.RequestData.ReadUInt32(); + uint indexNumber = context.RequestData.ReadUInt32(); ulong bufferPosition = context.Request.ReceiveBuff[0].Position; - ulong bufferSize = context.Request.ReceiveBuff[0].Size; + ulong bufferSize = context.Request.ReceiveBuff[0].Size; // TODO: This should use _addOnContentBaseId; uint aocTotalCount = (uint)context.Device.System.ContentManager.GetAocCount(); @@ -343,4 +359,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc return ((ulong)errorCode & 0x1FF | ((((ulong)errorCode >> 9) & 0x1FFF) << 32)) + 2000; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IContentsServiceManager.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IContentsServiceManager.cs index cb8903d4..40b0b2a8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IContentsServiceManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IContentsServiceManager.cs @@ -4,4 +4,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc { public IContentsServiceManager() { } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IPurchaseEventManager.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IPurchaseEventManager.cs index 1673fafc..c92a10d6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IPurchaseEventManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IPurchaseEventManager.cs @@ -19,9 +19,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc // SetDefaultDeliveryTarget(pid, buffer unknown) public ResultCode SetDefaultDeliveryTarget(ServiceCtx context) { - ulong inBufferPosition = context.Request.SendBuff[0].Position; - ulong inBufferSize = context.Request.SendBuff[0].Size; - byte[] buffer = new byte[inBufferSize]; + ulong inBufferPosition = context.Request.SendBuff[0].Position; + ulong inBufferSize = context.Request.SendBuff[0].Size; + byte[] buffer = new byte[inBufferSize]; context.Memory.Read(inBufferPosition, buffer); @@ -65,4 +65,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc return ResultCode.Success; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/ResultCode.cs index 7602ecb3..b795a756 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/ResultCode.cs @@ -2,12 +2,12 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc { enum ResultCode { - ModuleId = 166, + ModuleId = 166, ErrorCodeShift = 9, Success = 0, InvalidBufferSize = (200 << ErrorCodeShift) | ModuleId, - InvalidPid = (300 << ErrorCodeShift) | ModuleId + InvalidPid = (300 << ErrorCodeShift) | ModuleId, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index 06e911f8..a8a2a8e0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -1,6 +1,5 @@ using LibHac.Ns; using Ryujinx.Common.Utilities; -using System; namespace Ryujinx.HLE.HOS.Services.Ns { @@ -13,8 +12,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { - byte source = (byte)context.RequestData.ReadInt64(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + byte source = (byte)context.RequestData.ReadInt64(); ulong titleId = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 ulong position = context.Request.ReceiveBuff[0].Position; @@ -25,4 +26,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns return ResultCode.Success; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IDevelopInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IDevelopInterface.cs index c74ebd69..8f0f6cbe 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IDevelopInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IDevelopInterface.cs @@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns { public IDevelopInterface(ServiceCtx context) { } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs index aa37a1e7..8327d619 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IReadOnlyApplicationControlDataInterface.cs @@ -11,8 +11,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns // GetApplicationControlData(u8, u64) -> (unknown<4>, buffer) public ResultCode GetApplicationControlData(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment byte source = (byte)context.RequestData.ReadInt64(); ulong titleId = context.RequestData.ReadUInt64(); +#pragma warning restore IDE0059 ulong position = context.Request.ReceiveBuff[0].Position; diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs index 886bffdd..e45c6750 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IServiceGetterInterface.cs @@ -27,4 +27,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns return ResultCode.Success; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs index 84ed3d0f..1108778c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs @@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns { public ISystemUpdateInterface(ServiceCtx context) { } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs index 0b640992..c1ec50bc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs @@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns { public IVulnerabilityManagerInterface(ServiceCtx context) { } } -} \ No newline at end of file +} -- cgit v1.2.3