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 <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> --- .../HOS/Kernel/Process/HleProcessDebugger.cs | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs') diff --git a/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs b/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs index 8fee5c0d..cbfef588 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs @@ -14,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process { private const int Mod0 = 'M' << 0 | 'O' << 8 | 'D' << 16 | '0' << 24; - private KProcess _owner; + private readonly KProcess _owner; private class Image { @@ -27,12 +27,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Process public Image(ulong baseAddress, ulong size, ElfSymbol[] symbols) { BaseAddress = baseAddress; - Size = size; - Symbols = symbols; + Size = size; + Symbols = symbols; } } - private List<Image> _images; + private readonly List<Image> _images; private int _loaded; @@ -49,7 +49,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process var context = thread.Context; - StringBuilder trace = new StringBuilder(); + StringBuilder trace = new(); trace.AppendLine($"Process: {_owner.Name}, PID: {_owner.Pid}"); @@ -111,7 +111,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process var context = thread.Context; - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new(); string GetReg(int x) { @@ -145,11 +145,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Process return sb.ToString(); } - private bool TryGetSubName(Image image, ulong address, out ElfSymbol symbol) + private static bool TryGetSubName(Image image, ulong address, out ElfSymbol symbol) { address -= image.BaseAddress; - int left = 0; + int left = 0; int right = image.Symbols.Length - 1; while (left <= right) @@ -190,9 +190,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Process public ulong Offset; public ulong SubOffset; - public string ImageDisplay => $"{ImageName}:0x{Offset:x4}"; - public string SubDisplay => SubOffset == 0 ? SubName : $"{SubName}:0x{SubOffset:x4}"; - public string SpDisplay => SubOffset == 0 ? "SP" : $"SP:-0x{SubOffset:x4}"; + public readonly string ImageDisplay => $"{ImageName}:0x{Offset:x4}"; + public readonly string SubDisplay => SubOffset == 0 ? SubName : $"{SubName}:0x{SubOffset:x4}"; + public readonly string SpDisplay => SubOffset == 0 ? "SP" : $"SP:-0x{SubOffset:x4}"; } private bool AnalyzePointer(out PointerInfo info, ulong address, KThread thread) @@ -324,7 +324,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process private void ScanMemoryForTextSegments() { ulong oldAddress = 0; - ulong address = 0; + ulong address = 0; while (address >= oldAddress) { @@ -355,7 +355,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process return; } - Dictionary<ElfDynamicTag, ulong> dynamic = new Dictionary<ElfDynamicTag, ulong>(); + Dictionary<ElfDynamicTag, ulong> dynamic = new(); int mod0Magic = memory.Read<int>(mod0Offset + 0x0); @@ -364,12 +364,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Process return; } - ulong dynamicOffset = memory.Read<uint>(mod0Offset + 0x4) + mod0Offset; - ulong bssStartOffset = memory.Read<uint>(mod0Offset + 0x8) + mod0Offset; - ulong bssEndOffset = memory.Read<uint>(mod0Offset + 0xc) + mod0Offset; + ulong dynamicOffset = memory.Read<uint>(mod0Offset + 0x4) + mod0Offset; + ulong bssStartOffset = memory.Read<uint>(mod0Offset + 0x8) + mod0Offset; + ulong bssEndOffset = memory.Read<uint>(mod0Offset + 0xc) + mod0Offset; ulong ehHdrStartOffset = memory.Read<uint>(mod0Offset + 0x10) + mod0Offset; - ulong ehHdrEndOffset = memory.Read<uint>(mod0Offset + 0x14) + mod0Offset; - ulong modObjOffset = memory.Read<uint>(mod0Offset + 0x18) + mod0Offset; + ulong ehHdrEndOffset = memory.Read<uint>(mod0Offset + 0x14) + mod0Offset; + ulong modObjOffset = memory.Read<uint>(mod0Offset + 0x18) + mod0Offset; bool isAArch32 = memory.Read<ulong>(dynamicOffset) > 0xFFFFFFFF || memory.Read<ulong>(dynamicOffset + 0x10) > 0xFFFFFFFF; @@ -381,14 +381,14 @@ namespace Ryujinx.HLE.HOS.Kernel.Process if (isAArch32) { tagVal = memory.Read<uint>(dynamicOffset + 0); - value = memory.Read<uint>(dynamicOffset + 4); + value = memory.Read<uint>(dynamicOffset + 4); dynamicOffset += 0x8; } else { tagVal = memory.Read<ulong>(dynamicOffset + 0); - value = memory.Read<ulong>(dynamicOffset + 8); + value = memory.Read<ulong>(dynamicOffset + 8); dynamicOffset += 0x10; } @@ -413,7 +413,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process ulong strTblAddr = textOffset + strTab; ulong symTblAddr = textOffset + symTab; - List<ElfSymbol> symbols = new List<ElfSymbol>(); + List<ElfSymbol> symbols = new(); while (symTblAddr < strTblAddr) { @@ -430,7 +430,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process } } - private ElfSymbol GetSymbol64(IVirtualMemoryManager memory, ulong address, ulong strTblAddr) + private static ElfSymbol GetSymbol64(IVirtualMemoryManager memory, ulong address, ulong strTblAddr) { ElfSymbol64 sym = memory.Read<ElfSymbol64>(address); @@ -446,7 +446,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process return new ElfSymbol(name, sym.Info, sym.Other, sym.SectionIndex, sym.ValueAddress, sym.Size); } - private ElfSymbol GetSymbol32(IVirtualMemoryManager memory, ulong address, ulong strTblAddr) + private static ElfSymbol GetSymbol32(IVirtualMemoryManager memory, ulong address, ulong strTblAddr) { ElfSymbol32 sym = memory.Read<ElfSymbol32>(address); -- cgit v1.2.3-70-g09d2