diff --git a/src/Ryujinx.HLE/FileSystem/ContentManager.cs b/src/Ryujinx.HLE/FileSystem/ContentManager.cs index 08c4f4eb4..1c2a7351d 100644 --- a/src/Ryujinx.HLE/FileSystem/ContentManager.cs +++ b/src/Ryujinx.HLE/FileSystem/ContentManager.cs @@ -1072,7 +1072,7 @@ namespace Ryujinx.HLE.FileSystem public bool AreKeysAlredyPresent(string pathToCheck) { - string[] fileNames = { "prod.keys", "title.keys", "console.keys", "dev.keys" }; + string[] fileNames = ["prod.keys", "title.keys", "console.keys", "dev.keys"]; foreach (string file in fileNames) { if (File.Exists(Path.Combine(pathToCheck, file))) diff --git a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs index 249d3f8d7..067b7d4a8 100644 --- a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs +++ b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs @@ -439,7 +439,7 @@ namespace Ryujinx.HLE.FileSystem U8Span mountName = "system".ToU8Span(); DirectoryHandle handle = default; - List localList = new(); + List localList = []; try { diff --git a/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs b/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs index c5f13dab3..33d00cf34 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserApplet.cs @@ -39,10 +39,10 @@ namespace Ryujinx.HLE.HOS.Applets.Browser if ((_commonArguments.AppletVersion >= 0x80000 && _shimKind == ShimKind.Web) || (_commonArguments.AppletVersion >= 0x30000 && _shimKind == ShimKind.Share)) { - List result = new() - { - new BrowserOutput(BrowserOutputType.ExitReason, (uint)WebExitReason.ExitButton), - }; + List result = + [ + new BrowserOutput(BrowserOutputType.ExitReason, (uint)WebExitReason.ExitButton) + ]; _normalSession.Push(BuildResponseNew(result)); } diff --git a/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs b/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs index d2e1d55ca..24a043358 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserArgument.cs @@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Applets.Browser public static (ShimKind, List) ParseArguments(ReadOnlySpan data) { - List browserArguments = new(); + List browserArguments = []; WebArgHeader header = IApplet.ReadStruct(data[..8]); diff --git a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs index ad841c0df..54b5721c1 100644 --- a/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs +++ b/src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs @@ -184,7 +184,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error string messageText = Encoding.ASCII.GetString(messageTextBuffer.TakeWhile(b => !b.Equals(0)).ToArray()); string detailsText = Encoding.ASCII.GetString(detailsTextBuffer.TakeWhile(b => !b.Equals(0)).ToArray()); - List buttons = new(); + List buttons = []; // TODO: Handle the LanguageCode to return the translated "OK" and "Details". diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs index cc00a6392..4d4ef8996 100644 --- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs +++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs @@ -122,13 +122,14 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard { // Try a list of fonts in case any of them is not available in the system. - string[] availableFonts = { + string[] availableFonts = + [ uiThemeFontFamily, "Liberation Sans", "FreeSans", "DejaVu Sans", - "Lucida Grande", - }; + "Lucida Grande" + ]; foreach (string fontFamily in availableFonts) { diff --git a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs index 59ce69b73..9413ed9ff 100644 --- a/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs +++ b/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs @@ -9,10 +9,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler class Demangler { private const string Base36 = "0123456789abcdefghijklmnopqrstuvwxyz"; - private readonly List _substitutionList = new(); - private List _templateParamList = new(); + private readonly List _substitutionList = []; + private List _templateParamList = []; - private readonly List _forwardTemplateReferenceList = new(); + private readonly List _forwardTemplateReferenceList = []; public string Mangled { get; private set; } @@ -274,7 +274,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler } else if (ConsumeIf("Dw")) { - List types = new(); + List types = []; while (!ConsumeIf("E")) { @@ -308,7 +308,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler } Reference referenceQualifier = Reference.None; - List paramsList = new(); + List paramsList = []; while (true) { @@ -1588,7 +1588,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler return null; } - List expressions = new(); + List expressions = []; if (ConsumeIf("_")) { while (!ConsumeIf("E")) @@ -1730,8 +1730,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler return null; } - List expressions = new(); - List initializers = new(); + List expressions = []; + List initializers = []; while (!ConsumeIf("_")) { @@ -1899,7 +1899,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler return null; } - List names = new(); + List names = []; while (!ConsumeIf("E")) { expression = ParseExpression(); @@ -2048,7 +2048,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler case 'l': _position += 2; - List bracedExpressions = new(); + List bracedExpressions = []; while (!ConsumeIf("E")) { expression = ParseBracedExpression(); @@ -2327,7 +2327,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler return null; case 'P': _position += 2; - List arguments = new(); + List arguments = []; while (!ConsumeIf("E")) { BaseNode argument = ParseTemplateArgument(); @@ -2368,7 +2368,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler return null; } - List bracedExpressions = new(); + List bracedExpressions = []; while (!ConsumeIf("E")) { expression = ParseBracedExpression(); @@ -2600,7 +2600,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler _templateParamList.Clear(); } - List args = new(); + List args = []; while (!ConsumeIf("E")) { if (hasContext) @@ -2659,7 +2659,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler // J * E case 'J': _position++; - List templateArguments = new(); + List templateArguments = []; while (!ConsumeIf("E")) { BaseNode templateArgument = ParseTemplateArgument(); @@ -3298,7 +3298,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler return new EncodedFunction(name, null, context.Cv, context.Ref, null, returnType); } - List paramsList = new(); + List paramsList = []; // backup because that can be destroyed by parseType CvType cv = context.Cv; diff --git a/src/Ryujinx.HLE/HOS/Horizon.cs b/src/Ryujinx.HLE/HOS/Horizon.cs index 85f06ceba..7af8711c7 100644 --- a/src/Ryujinx.HLE/HOS/Horizon.cs +++ b/src/Ryujinx.HLE/HOS/Horizon.cs @@ -130,7 +130,7 @@ namespace Ryujinx.HLE.HOS PerformanceState = new PerformanceState(); - NfpDevices = new List(); + NfpDevices = []; // Note: This is not really correct, but with HLE of services, the only memory // region used that is used is Application, so we can use the other ones for anything. @@ -283,14 +283,15 @@ namespace Ryujinx.HLE.HOS ProcessCreationInfo creationInfo = new("Service", 1, 0, 0x8000000, 1, Flags, 0, 0); - uint[] defaultCapabilities = { + uint[] defaultCapabilities = + [ (((uint)KScheduler.CpuCoresCount - 1) << 24) + (((uint)KScheduler.CpuCoresCount - 1) << 16) + 0x63F7u, 0x1FFFFFCF, 0x207FFFEF, 0x47E0060F, 0x0048BFFF, - 0x01007FFF, - }; + 0x01007FFF + ]; // TODO: // - Pass enough information (capabilities, process creation info, etc) on ServiceEntry for proper initialization. @@ -341,7 +342,7 @@ namespace Ryujinx.HLE.HOS { if (VirtualAmiibo.ApplicationBytes.Length > 0) { - VirtualAmiibo.ApplicationBytes = Array.Empty(); + VirtualAmiibo.ApplicationBytes = []; VirtualAmiibo.InputBin = string.Empty; } if (NfpDevices[nfpDeviceId].State == NfpDeviceState.SearchingForTag) @@ -356,7 +357,7 @@ namespace Ryujinx.HLE.HOS VirtualAmiibo.InputBin = path; if (VirtualAmiibo.ApplicationBytes.Length > 0) { - VirtualAmiibo.ApplicationBytes = Array.Empty(); + VirtualAmiibo.ApplicationBytes = []; } byte[] encryptedData = File.ReadAllBytes(path); VirtualAmiiboFile newFile = AmiiboBinReader.ReadBinFile(encryptedData); diff --git a/src/Ryujinx.HLE/HOS/Ipc/IpcHandleDesc.cs b/src/Ryujinx.HLE/HOS/Ipc/IpcHandleDesc.cs index 887fe28e6..0ed5b74a2 100644 --- a/src/Ryujinx.HLE/HOS/Ipc/IpcHandleDesc.cs +++ b/src/Ryujinx.HLE/HOS/Ipc/IpcHandleDesc.cs @@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Ipc PId = HasPId ? reader.ReadUInt64() : 0; int toCopySize = (word >> 1) & 0xf; - int[] toCopy = toCopySize == 0 ? Array.Empty() : new int[toCopySize]; + int[] toCopy = toCopySize == 0 ? [] : new int[toCopySize]; for (int index = 0; index < toCopy.Length; index++) { @@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Ipc ToCopy = toCopy; int toMoveSize = (word >> 5) & 0xf; - int[] toMove = toMoveSize == 0 ? Array.Empty() : new int[toMoveSize]; + int[] toMove = toMoveSize == 0 ? [] : new int[toMoveSize]; for (int index = 0; index < toMove.Length; index++) { @@ -59,12 +59,12 @@ namespace Ryujinx.HLE.HOS.Ipc public static IpcHandleDesc MakeCopy(params int[] handles) { - return new IpcHandleDesc(handles, Array.Empty()); + return new IpcHandleDesc(handles, []); } public static IpcHandleDesc MakeMove(params int[] handles) { - return new IpcHandleDesc(Array.Empty(), handles); + return new IpcHandleDesc([], handles); } public RecyclableMemoryStream GetStream() diff --git a/src/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs b/src/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs index feba09fe3..7df2b778f 100644 --- a/src/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs +++ b/src/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs @@ -26,13 +26,13 @@ namespace Ryujinx.HLE.HOS.Ipc public IpcMessage() { - PtrBuff = new List(0); - SendBuff = new List(0); - ReceiveBuff = new List(0); - ExchangeBuff = new List(0); - RecvListBuff = new List(0); + PtrBuff = []; + SendBuff = []; + ReceiveBuff = []; + ExchangeBuff = []; + RecvListBuff = []; - ObjectIds = new List(0); + ObjectIds = []; } public IpcMessage(ReadOnlySpan data, long cmdPtr) @@ -122,7 +122,7 @@ namespace Ryujinx.HLE.HOS.Ipc RecvListBuff.Add(new IpcRecvListBuffDesc(reader.ReadUInt64())); } - ObjectIds = new List(0); + ObjectIds = []; } public RecyclableMemoryStream GetStream(long cmdPtr, ulong recvListAddr) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs b/src/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs index 1763edce2..e036f366b 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common _current2 = new long[(int)LimitableResource.Count]; _peak = new long[(int)LimitableResource.Count]; - _waitingThreads = new LinkedList(); + _waitingThreads = []; } public bool Reserve(LimitableResource resource, ulong amount) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs b/src/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs index 7e725e747..50fe01069 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs @@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common public KSynchronizationObject(KernelContext context) : base(context) { - WaitingThreads = new LinkedList(); + WaitingThreads = []; } public LinkedListNode AddWaitingThread(KThread thread) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs b/src/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs index 3c5fa067f..c24648c65 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs @@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common public KTimeManager(KernelContext context) { _context = context; - _waitingObjects = new List(); + _waitingObjects = []; _keepRunning = true; Thread work = new(WaitAndCheckScheduledObjects) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs b/src/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs index 8021d8da0..53ceb5b91 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs @@ -72,13 +72,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Common servicePool = new MemoryRegion(DramMemoryMap.SlabHeapEnd, servicePoolSize); - return new[] - { + return + [ GetMemoryRegion(applicationPool), GetMemoryRegion(appletPool), GetMemoryRegion(servicePool), - GetMemoryRegion(nvServicesPool), - }; + GetMemoryRegion(nvServicesPool) + ]; } private static KMemoryRegionManager GetMemoryRegion(MemoryRegion region) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs index 08efa8d94..d4e0dbfb5 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerPort.cs @@ -16,8 +16,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { _parent = parent; - _incomingConnections = new LinkedList(); - _lightIncomingConnections = new LinkedList(); + _incomingConnections = []; + _lightIncomingConnections = []; } public void EnqueueIncomingSession(KServerSession session) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs index 3b4280855..6c1586cb9 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs @@ -10,12 +10,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { class KServerSession : KSynchronizationObject { - private static readonly MemoryState[] _ipcMemoryStates = { + private static readonly MemoryState[] _ipcMemoryStates = + [ MemoryState.IpcBuffer3, MemoryState.IpcBuffer0, MemoryState.IpcBuffer1, - (MemoryState)0xfffce5d4, //This is invalid, shouldn't be accessed. - }; + (MemoryState)0xfffce5d4 //This is invalid, shouldn't be accessed. + ]; private readonly struct Message { @@ -176,7 +177,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc { _parent = parent; - _requests = new LinkedList(); + _requests = []; } public Result EnqueueRequest(KSessionRequest request) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs index ec2eda97d..58d79c31f 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageHeap.cs @@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory } } - private static readonly int[] _memoryBlockPageShifts = { 12, 16, 21, 22, 25, 29, 30 }; + private static readonly int[] _memoryBlockPageShifts = [12, 16, 21, 22, 25, 29, 30]; #pragma warning disable IDE0052 // Remove unread private member private readonly ulong _heapAddress; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageList.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageList.cs index 38e2b6f95..8255a38bf 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageList.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageList.cs @@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory public KPageList() { - Nodes = new LinkedList(); + Nodes = []; } public Result AddRange(ulong address, ulong pagesCount) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs index 122845725..db190e6a9 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs @@ -13,14 +13,15 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory { abstract class KPageTableBase { - private static readonly int[] _mappingUnitSizes = { + private static readonly int[] _mappingUnitSizes = + [ 0x1000, 0x10000, 0x200000, 0x400000, 0x2000000, - 0x40000000, - }; + 0x40000000 + ]; private const ulong RegionAlignment = 0x200000; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KSlabHeap.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KSlabHeap.cs index cd8c2e470..bdac2c1ce 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KSlabHeap.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KSlabHeap.cs @@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory public KSlabHeap(ulong pa, ulong itemSize, ulong size) { - _items = new LinkedList(); + _items = []; int itemsCount = (int)(size / itemSize); diff --git a/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs b/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs index a9f87f2ca..bb12bd384 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs @@ -41,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process { _owner = owner; - _images = new List(); + _images = []; } public string GetGuestStackTrace(KThread thread) @@ -414,7 +414,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process ulong strTblAddr = textOffset + strTab; ulong symTblAddr = textOffset + symTab; - List symbols = new(); + List symbols = []; while (symTblAddr < strTblAddr) { diff --git a/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs b/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs index 82c3d2e70..32dca1512 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs @@ -107,7 +107,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process // TODO: Remove once we no longer need to initialize it externally. HandleTable = new KHandleTable(); - _threads = new LinkedList(); + _threads = []; Debugger = new HleProcessDebugger(this); } diff --git a/src/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs b/src/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs index ca4aedb7a..62b57da04 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs @@ -21,8 +21,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading { _context = context; - _condVarThreads = new List(); - _arbiterThreads = new List(); + _condVarThreads = []; + _arbiterThreads = []; } public Result ArbitrateLock(int ownerHandle, ulong mutexAddress, int requesterHandle) diff --git a/src/Ryujinx.HLE/HOS/Kernel/Threading/KPriorityQueue.cs b/src/Ryujinx.HLE/HOS/Kernel/Threading/KPriorityQueue.cs index 7951fab5b..e4b4a370a 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Threading/KPriorityQueue.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Threading/KPriorityQueue.cs @@ -23,8 +23,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading for (int core = 0; core < KScheduler.CpuCoresCount; core++) { - _suggestedThreadsPerPrioPerCore[prio][core] = new LinkedList(); - _scheduledThreadsPerPrioPerCore[prio][core] = new LinkedList(); + _suggestedThreadsPerPrioPerCore[prio][core] = []; + _scheduledThreadsPerPrioPerCore[prio][core] = []; } } diff --git a/src/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs b/src/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs index 38599b5fa..f1745eb44 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs @@ -121,8 +121,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading SiblingsPerCore = new LinkedListNode[KScheduler.CpuCoresCount]; - _mutexWaiters = new LinkedList(); - _pinnedWaiters = new LinkedList(); + _mutexWaiters = []; + _pinnedWaiters = []; } public Result Initialize( diff --git a/src/Ryujinx.HLE/HOS/LibHacHorizonManager.cs b/src/Ryujinx.HLE/HOS/LibHacHorizonManager.cs index 46c27da40..41911183f 100644 --- a/src/Ryujinx.HLE/HOS/LibHacHorizonManager.cs +++ b/src/Ryujinx.HLE/HOS/LibHacHorizonManager.cs @@ -100,20 +100,20 @@ namespace Ryujinx.HLE.HOS AccessControlBits.Bits.MoveCacheStorage; // Sdb has save data access control info so we can't store just its access control bits - private static ReadOnlySpan SdbFacData => new byte[] - { + private static ReadOnlySpan SdbFacData => + [ 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x09, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - }; + 0x00, 0x00, 0x00, 0x01 + ]; - private static ReadOnlySpan SdbFacDescriptor => new byte[] - { + private static ReadOnlySpan SdbFacDescriptor => + [ 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }; + 0x01, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 + ]; } } diff --git a/src/Ryujinx.HLE/HOS/ModLoader.cs b/src/Ryujinx.HLE/HOS/ModLoader.cs index 289a493a2..ff691914c 100644 --- a/src/Ryujinx.HLE/HOS/ModLoader.cs +++ b/src/Ryujinx.HLE/HOS/ModLoader.cs @@ -87,11 +87,11 @@ namespace Ryujinx.HLE.HOS public ModCache() { - RomfsContainers = new List>(); - ExefsContainers = new List>(); - RomfsDirs = new List>(); - ExefsDirs = new List>(); - Cheats = new List(); + RomfsContainers = []; + ExefsContainers = []; + RomfsDirs = []; + ExefsDirs = []; + Cheats = []; } } @@ -106,9 +106,9 @@ namespace Ryujinx.HLE.HOS public PatchCache() { - NsoPatches = new List>(); - NroPatches = new List>(); - KipPatches = new List>(); + NsoPatches = []; + NroPatches = []; + KipPatches = []; Initialized = false; } @@ -357,7 +357,7 @@ namespace Ryujinx.HLE.HOS private static IEnumerable GetCheatsInFile(FileInfo cheatFile) { string cheatName = DefaultCheatName; - List instructions = new(); + List instructions = []; using StreamReader cheatData = cheatFile.OpenText(); while (cheatData.ReadLine() is { } line) @@ -384,7 +384,7 @@ namespace Ryujinx.HLE.HOS // Start a new cheat section. cheatName = line[1..^1]; - instructions = new List(); + instructions = []; } else if (line.Length > 0) { @@ -470,7 +470,7 @@ namespace Ryujinx.HLE.HOS return baseStorage; } - HashSet fileSet = new(); + HashSet fileSet = []; RomFsBuilder builder = new(); int count = 0; diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs index e97fb15a4..7364b2d40 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs @@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc _horizonClient = horizonClient; _profiles = new ConcurrentDictionary(); - _storedOpenedUsers = Array.Empty(); + _storedOpenedUsers = []; _accountSaveDataManager = new AccountSaveDataManager(_profiles); diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountSaveDataManager.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountSaveDataManager.cs index aa6fa57c4..87d275ef4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountSaveDataManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountSaveDataManager.cs @@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc { ProfilesJson profilesJson = new() { - Profiles = new List(), + Profiles = [], LastOpened = LastOpened.ToString(), }; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index c1856535b..21288429f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -872,8 +872,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // Initialize entries to avoid issues with some games. - List emptyGamepadInputs = new(); - List emptySixAxisInputs = new(); + List emptyGamepadInputs = []; + List emptySixAxisInputs = []; for (int player = 0; player < NpadDevices.MaxControllers; player++) { diff --git a/src/Ryujinx.HLE/HOS/Services/IpcService.cs b/src/Ryujinx.HLE/HOS/Services/IpcService.cs index cd3df4edf..1b95b6712 100644 --- a/src/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/src/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -123,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services { Logger.Trace?.Print(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Name}"); - result = (ResultCode)processRequest.Invoke(service, new object[] { context }); + result = (ResultCode)processRequest.Invoke(service, [context]); } else { @@ -176,7 +176,7 @@ namespace Ryujinx.HLE.HOS.Services { Logger.Debug?.Print(LogClass.KernelIpc, $"{GetType().Name}: {processRequest.Name}"); - result = (ResultCode)processRequest.Invoke(this, new object[] { context }); + result = (ResultCode)processRequest.Invoke(this, [context]); } else { diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/AccessPoint.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/AccessPoint.cs index bd00a3139..d416ef233 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/AccessPoint.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/AccessPoint.cs @@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator NetworkConfig = networkConfig, }; - bool success = _parent.NetworkClient.CreateNetwork(request, _advertiseData ?? Array.Empty()); + bool success = _parent.NetworkClient.CreateNetwork(request, _advertiseData ?? []); return success ? ResultCode.Success : ResultCode.InvalidState; } diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/IUserLocalCommunicationService.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/IUserLocalCommunicationService.cs index 438f532ee..5c6ee7732 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/IUserLocalCommunicationService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/IUserLocalCommunicationService.cs @@ -163,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator } else { - return Array.Empty(); + return []; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnDisabledClient.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnDisabledClient.cs index 2e8bb8d83..cb9f47359 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnDisabledClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnDisabledClient.cs @@ -56,7 +56,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator public NetworkInfo[] Scan(ushort channel, ScanFilter scanFilter) { Logger.Warning?.PrintMsg(LogClass.ServiceLdn, "Attempted to scan for networks, but Multiplayer is disabled!"); - return Array.Empty(); + return []; } public void SetAdvertiseData(byte[] data) { } diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs index 1f93cd1d9..b34772219 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs @@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm private readonly Ssid _fakeSsid; private ILdnTcpSocket _tcp; private LdnProxyUdpServer _udp, _udp2; - private readonly List _stations = new(); + private readonly List _stations = []; private readonly Lock _lock = new(); private readonly AutoResetEvent _apConnected = new(false); @@ -340,10 +340,10 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm if (_protocol.SendBroadcast(_udp, LanPacketType.Scan, DefaultPort) < 0) { - return Array.Empty(); + return []; } - List outNetworkInfo = new(); + List outNetworkInfo = []; foreach (KeyValuePair item in _udp.GetScanResults()) { diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanProtocol.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanProtocol.cs index b60b70d80..14142cc4e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanProtocol.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanProtocol.cs @@ -162,7 +162,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm public int SendBroadcast(ILdnSocket s, LanPacketType type, int port) { - return SendPacket(s, type, Array.Empty(), new IPEndPoint(_discovery.LocalBroadcastAddr, port)); + return SendPacket(s, type, [], new IPEndPoint(_discovery.LocalBroadcastAddr, port)); } public int SendPacket(ILdnSocket s, LanPacketType type, byte[] data, EndPoint endPoint = null) @@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm private int Compress(byte[] input, out byte[] output) { - List outputList = new(); + List outputList = []; int i = 0; int maxCount = 0xFF; @@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm private int Decompress(byte[] input, out byte[] output) { - List outputList = new(); + List outputList = []; int i = 0; while (i < input.Length && outputList.Count < BufferSize) diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/LdnMasterProxyClient.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/LdnMasterProxyClient.cs index 2277420f6..517359e70 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/LdnMasterProxyClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/LdnMasterProxyClient.cs @@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu private readonly RyuLdnProtocol _protocol; private readonly NetworkTimeout _timeout; - private readonly List _availableGames = new(); + private readonly List _availableGames = []; private DisconnectReason _disconnectReason; private P2pProxyServer _hostedProxy; @@ -109,7 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu ConnectAsync(); - int index = WaitHandle.WaitAny(new WaitHandle[] { _connected, _error }, FailureTimeout); + int index = WaitHandle.WaitAny([_connected, _error], FailureTimeout); if (IsConnected) { @@ -326,7 +326,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu SendAsync(_protocol.Encode(PacketId.Reject, new RejectRequest(disconnectReason, nodeId))); - int index = WaitHandle.WaitAny(new WaitHandle[] { _reject, _error }, InactiveTimeout); + int index = WaitHandle.WaitAny([_reject, _error], InactiveTimeout); if (index == 0) { @@ -566,13 +566,13 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu SendAsync(_protocol.Encode(PacketId.Scan, scanFilter)); - index = WaitHandle.WaitAny(new WaitHandle[] { _scan, _error }, ScanTimeout); + index = WaitHandle.WaitAny([_scan, _error], ScanTimeout); } if (index != 0) { // An error occurred or timeout. Write 0 games. - return Array.Empty(); + return []; } return _availableGames.ToArray(); diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/EphemeralPortPool.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/EphemeralPortPool.cs index 01579e78f..75cc15a98 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/EphemeralPortPool.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/EphemeralPortPool.cs @@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy { private const ushort EphemeralBase = 49152; - private readonly List _ephemeralPorts = new(); + private readonly List _ephemeralPorts = []; private readonly Lock _lock = new(); diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxy.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxy.cs index 540ef9104..fa9cbda67 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxy.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxy.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy public EndPoint LocalEndpoint { get; } public IPAddress LocalAddress { get; } - private readonly List _sockets = new(); + private readonly List _sockets = []; private readonly Dictionary _ephemeralPorts = new(); private readonly IProxyClient _parent; diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxySocket.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxySocket.cs index bb93bcb45..e792bb91e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxySocket.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/LdnProxySocket.cs @@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy private readonly LdnProxy _proxy; private bool _isListening; - private readonly List _listenSockets = new(); + private readonly List _listenSockets = []; private readonly Queue _connectRequests = new(); diff --git a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/P2pProxyServer.cs b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/P2pProxyServer.cs index 26aba483c..d2121c047 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/P2pProxyServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/P2pProxyServer.cs @@ -41,9 +41,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy private NatDevice _natDevice; private Mapping _portMapping; - private readonly List _players = new(); + private readonly List _players = []; - private readonly List _waitingTokens = new(); + private readonly List _waitingTokens = []; private readonly AutoResetEvent _tokenEvent = new(false); private uint _broadcastAddress; diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Helper.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Helper.cs index f4d288e9c..c1dd76800 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Helper.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Helper.cs @@ -40,11 +40,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii } #pragma warning disable IDE0055 // Disable formatting - public static ReadOnlySpan Ver3FacelineColorTable => new byte[] { 0, 1, 2, 3, 4, 5 }; - public static ReadOnlySpan Ver3HairColorTable => new byte[] { 8, 1, 2, 3, 4, 5, 6, 7 }; - public static ReadOnlySpan Ver3EyeColorTable => new byte[] { 8, 9, 10, 11, 12, 13 }; - public static ReadOnlySpan Ver3MouthColorTable => new byte[] { 19, 20, 21, 22, 23 }; - public static ReadOnlySpan Ver3GlassColorTable => new byte[] { 8, 14, 15, 16, 17, 18, 0 }; + public static ReadOnlySpan Ver3FacelineColorTable => [0, 1, 2, 3, 4, 5]; + public static ReadOnlySpan Ver3HairColorTable => [8, 1, 2, 3, 4, 5, 6, 7]; + public static ReadOnlySpan Ver3EyeColorTable => [8, 9, 10, 11, 12, 13]; + public static ReadOnlySpan Ver3MouthColorTable => [19, 20, 21, 22, 23]; + public static ReadOnlySpan Ver3GlassColorTable => [8, 14, 15, 16, 17, 18, 0]; #pragma warning restore IDE0055 } } diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs index bbef717ae..5053cd5ca 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/CoreData.cs @@ -830,8 +830,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types } #region "Element Info Array" - private readonly ReadOnlySpan ElementInfoArray => new byte[] - { + private readonly ReadOnlySpan ElementInfoArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -905,8 +905,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - }; + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 + ]; #endregion } } diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/DefaultMii.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/DefaultMii.cs index b7a63d16b..5ad7013e4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/DefaultMii.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/DefaultMii.cs @@ -73,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types // The first 2 Mii in the default table are used as base for Male/Female in editor but not exposed via IPC. public static int TableLength => _fromIndex.Length; - private static readonly int[] _fromIndex = { 2, 3, 4, 5, 6, 7 }; + private static readonly int[] _fromIndex = [2, 3, 4, 5, 6, 7]; public static DefaultMii GetDefaultMii(uint index) { @@ -81,8 +81,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types } #region "Raw Table Array" - private static ReadOnlySpan TableRawArray => new byte[] - { + private static ReadOnlySpan TableRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, @@ -190,8 +190,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x6f, 0x00, - 0x20, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x20, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; #endregion } } diff --git a/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs b/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs index 092733f7e..e465a80b2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs +++ b/src/Ryujinx.HLE/HOS/Services/Mii/Types/RandomMiiConstants.cs @@ -6,17 +6,19 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types { static class RandomMiiConstants { - public static readonly int[] EyeRotateTable = { + public static readonly int[] EyeRotateTable = + [ 0x03, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x04, 0x04, 0x03, 0x03, 0x03, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04, 0x04, - }; + 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04, 0x04 + ]; - public static readonly int[] EyebrowRotateTable = { + public static readonly int[] EyebrowRotateTable = + [ 0x06, 0x06, 0x05, 0x07, 0x06, 0x07, 0x06, 0x07, 0x04, 0x07, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, - 0x07, 0x07, 0x06, 0x06, 0x05, 0x06, 0x07, 0x05, - }; + 0x07, 0x07, 0x06, 0x06, 0x05, 0x06, 0x07, 0x05 + ]; [Flags] public enum BeardAndMustacheFlag @@ -89,8 +91,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types #region "Random Mii Data Arrays" - private static ReadOnlySpan RandomMiiFacelineRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiFacelineRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -320,11 +322,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiFacelineColorRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiFacelineColorRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -399,11 +401,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiFacelineWrinkleRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiFacelineWrinkleRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -633,11 +635,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiFacelineMakeRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiFacelineMakeRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -867,11 +869,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiHairTypeRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiHairTypeRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, @@ -1101,11 +1103,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiHairColorRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiHairColorRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1218,11 +1220,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiEyeTypeRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiEyeTypeRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, @@ -1452,11 +1454,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x2e, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiEyeColorRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiEyeColorRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -1493,11 +1495,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiEyebrowTypeRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiEyebrowTypeRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, @@ -1727,11 +1729,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiNoseTypeRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiNoseTypeRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, @@ -1961,11 +1963,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiMouthTypeRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiMouthTypeRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, @@ -2195,11 +2197,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; - private static ReadOnlySpan RandomMiiGlassTypeRawArray => new byte[] - { + private static ReadOnlySpan RandomMiiGlassTypeRawArray => + [ 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -2236,8 +2238,8 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; #endregion } } diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs index 2cb35472f..36a89070d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs @@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp static class VirtualAmiibo { public static uint OpenedApplicationAreaId; - public static byte[] ApplicationBytes = Array.Empty(); + public static byte[] ApplicationBytes = []; public static string InputBin = string.Empty; public static string NickName = string.Empty; private static readonly AmiiboJsonSerializerContext _serializerContext = AmiiboJsonSerializerContext.Default; @@ -137,7 +137,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp if (ApplicationBytes.Length > 0) { byte[] bytes = ApplicationBytes; - ApplicationBytes = Array.Empty(); + ApplicationBytes = []; return bytes; } VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId); @@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp } } - return Array.Empty(); + return []; } public static bool CreateApplicationArea(string amiiboId, uint applicationAreaId, byte[] applicationAreaData) @@ -219,12 +219,12 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp virtualAmiiboFile = new VirtualAmiiboFile() { FileVersion = 0, - TagUuid = Array.Empty(), + TagUuid = [], AmiiboId = amiiboId, FirstWriteDate = DateTime.Now, LastWriteDate = DateTime.Now, WriteCounter = 0, - ApplicationAreas = new List(), + ApplicationAreas = [], }; SaveAmiiboFile(virtualAmiiboFile); 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 16eefc87d..5ad241e0f 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 readonly List _generalServices = new(); + private static readonly List _generalServices = []; public static int Count { diff --git a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs index 083a83214..c77358803 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ns/Aoc/IAddOnContentManager.cs @@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc private ulong _addOnContentBaseId; - private readonly List _mountedAocTitleIds = new(); + private readonly List _mountedAocTitleIds = []; public IAddOnContentManager(ServiceCtx context) { diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index a0df66d00..fea09ef47 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -25,11 +25,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv [Service("nvdrv:t")] class INvDrvServices : IpcService { - private static readonly List _deviceFileDebugRegistry = new() - { + private static readonly List _deviceFileDebugRegistry = + [ "/dev/nvhost-dbg-gpu", - "/dev/nvhost-prof-gpu", - }; + "/dev/nvhost-prof-gpu" + ]; private static readonly Dictionary _deviceFileRegistry = new() { @@ -73,9 +73,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv if (_deviceFileRegistry.TryGetValue(path, out Type deviceFileClass)) { - ConstructorInfo constructor = deviceFileClass.GetConstructor(new[] { typeof(ServiceCtx), typeof(IVirtualMemoryManager), typeof(ulong) }); + ConstructorInfo constructor = deviceFileClass.GetConstructor([typeof(ServiceCtx), typeof(IVirtualMemoryManager), typeof(ulong) + ]); - NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke(new object[] { context, _clientMemory, _owner }); + NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke([context, _clientMemory, _owner]); deviceFile.Path = path; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs index 6ce45de88..9d0104a01 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/NvHostAsGpuDeviceFile.cs @@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu private const uint SmallPageSize = 0x1000; private const uint BigPageSize = 0x10000; - private static readonly uint[] _pageSizes = { SmallPageSize, BigPageSize }; + private static readonly uint[] _pageSizes = [SmallPageSize, BigPageSize]; private const ulong SmallRegionLimit = 0x400000000UL; // 16 GiB private const ulong DefaultUserSize = 1UL << 37; @@ -32,10 +32,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu } } - private static readonly VmRegion[] _vmRegions = { + private static readonly VmRegion[] _vmRegions = + [ new((ulong)BigPageSize << 16, SmallRegionLimit), - new(SmallRegionLimit, DefaultUserSize), - }; + new(SmallRegionLimit, DefaultUserSize) + ]; private readonly AddressSpaceContext _asContext; private readonly NvMemoryAllocator _memoryAllocator; diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs index 4e8193302..3b8840a3d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs @@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv private readonly TreeDictionary _tree = new(); private readonly Dictionary> _dictionary = new(); - private readonly LinkedList _list = new(); + private readonly LinkedList _list = []; public NvMemoryAllocator() { diff --git a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs index ddc4e5c7d..5d90fcbe2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs +++ b/src/Ryujinx.HLE/HOS/Services/Pcv/Clkrst/ClkrstManager/IClkrstSession.cs @@ -12,15 +12,16 @@ namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst.ClkrstManager #pragma warning restore IDE0052 private uint _clockRate; - private readonly DeviceCode[] _allowedDeviceCodeTable = { + private readonly DeviceCode[] _allowedDeviceCodeTable = + [ DeviceCode.Cpu, DeviceCode.Gpu, DeviceCode.Disp1, DeviceCode.Disp2, DeviceCode.Tsec, DeviceCode.Mselect, DeviceCode.Sor1, DeviceCode.Host1x, DeviceCode.Vic, DeviceCode.Nvenc, DeviceCode.Nvjpg, DeviceCode.Nvdec, DeviceCode.Ape, DeviceCode.AudioDsp, DeviceCode.Emc, DeviceCode.Dsi, DeviceCode.SysBus, DeviceCode.XusbSs, DeviceCode.XusbHost, DeviceCode.XusbDevice, DeviceCode.Gpuaux, DeviceCode.Pcie, DeviceCode.Apbdma, DeviceCode.Sdmmc1, - DeviceCode.Sdmmc2, DeviceCode.Sdmmc4, - }; + DeviceCode.Sdmmc2, DeviceCode.Sdmmc4 + ]; public IClkrstSession(DeviceCode deviceCode, uint unknown) { diff --git a/src/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs b/src/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs index 5b5b3bf84..17d0b96ef 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs @@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro return ResultCode.InvalidSize; } - List hashes = new(); + List hashes = []; for (int i = 0; i < header.HashesCount; i++) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs b/src/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs index 25666c2fd..701cdd94e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sdb/Pdm/QueryService/QueryPlayStatisticsManager.cs @@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pdm.QueryService PlayLogQueryCapability queryCapability = (PlayLogQueryCapability)context.Device.Processes.ActiveApplication.ApplicationControlProperties.PlayLogQueryCapability; - List titleIds = new(); + List titleIds = []; for (ulong i = 0; i < inputSize / sizeof(ulong); i++) { diff --git a/src/Ryujinx.HLE/HOS/Services/Settings/KeyCodeMaps.cs b/src/Ryujinx.HLE/HOS/Services/Settings/KeyCodeMaps.cs index 981fc18ea..870d226b5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Settings/KeyCodeMaps.cs +++ b/src/Ryujinx.HLE/HOS/Services/Settings/KeyCodeMaps.cs @@ -3,7 +3,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings static class KeyCodeMaps { public static byte[] Default = - { + [ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -345,11 +345,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] EnglishUsInternational = - { + [ 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -691,11 +691,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] EnglishUk = - { + [ 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1037,11 +1037,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] French = - { + [ 0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1383,11 +1383,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] FrenchCa = - { + [ 0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1729,11 +1729,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] Spanish = - { + [ 0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -2075,11 +2075,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] SpanishLatin = - { + [ 0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -2421,11 +2421,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] German = - { + [ 0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -2767,11 +2767,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] Italian = - { + [ 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -3113,11 +3113,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] Portuguese = - { + [ 0x01, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -3459,11 +3459,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] Russian = - { + [ 0x09, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -3805,11 +3805,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] Korean = - { + [ 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -4151,11 +4151,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] ChineseSimplified = - { + [ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -4497,11 +4497,11 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static byte[] ChineseTraditional = - { + [ 0x61, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -4843,7 +4843,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; }; } diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/BsdContext.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/BsdContext.cs index 9d5bb8d01..d3a88998f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/BsdContext.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/BsdContext.cs @@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd private BsdContext() { - _fds = new List(); + _fds = []; } public ISocket RetrieveSocket(int socketFd) @@ -47,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd public List RetrieveFileDescriptorsFromMask(ReadOnlySpan mask) { - List fds = new(); + List fds = []; for (int i = 0; i < mask.Length; i++) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs index 273f6c5ca..8475424ce 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs @@ -16,11 +16,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd [Service("bsd:u", false)] class IClient : IpcService { - private static readonly List _pollManagers = new() - { + private static readonly List _pollManagers = + [ EventFileDescriptorPollManager.Instance, - ManagedSocketPollManager.Instance, - }; + ManagedSocketPollManager.Instance + ]; private BsdContext _context; private readonly bool _isPrivileged; @@ -265,7 +265,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd for (int i = 0; i < eventsByPollManager.Length; i++) { - eventsByPollManager[i] = new List(); + eventsByPollManager[i] = []; foreach (PollEvent evnt in events) { @@ -361,12 +361,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd events[i] = new PollEvent(pollEventData, fileDescriptor); } - List discoveredEvents = new(); + List discoveredEvents = []; List[] eventsByPollManager = new List[_pollManagers.Count]; for (int i = 0; i < eventsByPollManager.Length; i++) { - eventsByPollManager[i] = new List(); + eventsByPollManager[i] = []; foreach (PollEvent evnt in events) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs index a29554c35..99e3abdf8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/EventFileDescriptorPollManager.cs @@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl { updatedCount = 0; - List waiters = new(); + List waiters = []; for (int i = 0; i < events.Count; i++) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocketPollManager.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocketPollManager.cs index e870e8aea..a1daa87c0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocketPollManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocketPollManager.cs @@ -27,9 +27,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl public LinuxError Poll(List events, int timeoutMilliseconds, out int updatedCount) { - List readEvents = new(); - List writeEvents = new(); - List errorEvents = new(); + List readEvents = []; + List writeEvents = []; + List errorEvents = []; updatedCount = 0; @@ -123,9 +123,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl public LinuxError Select(List events, int timeout, out int updatedCount) { - List readEvents = new(); - List writeEvents = new(); - List errorEvents = new(); + List readEvents = []; + List writeEvents = []; + List errorEvents = []; updatedCount = 0; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs index 5b2de13f0..80bdbec8a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs @@ -604,7 +604,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres private static List DeserializeAddrInfos(IVirtualMemoryManager memory, ulong address, ulong size) { - List result = new(); + List result = []; ReadOnlySpan data = memory.GetSpan(address, (int)size); diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsBlacklist.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsBlacklist.cs index 608ea2f51..78c6be164 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsBlacklist.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsBlacklist.cs @@ -19,14 +19,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy [GeneratedRegex(@"^accounts\.nintendo\.com$", RegexOpts)] private static partial Regex BlockedHost6(); - private static readonly Regex[] _blockedHosts = { + private static readonly Regex[] _blockedHosts = + [ BlockedHost1(), BlockedHost2(), BlockedHost3(), BlockedHost4(), BlockedHost5(), - BlockedHost6(), - }; + BlockedHost6() + ]; public static bool IsHostBlocked(string host) { diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsMitmResolver.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsMitmResolver.cs index b0e282031..820a4ab48 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsMitmResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Proxy/DnsMitmResolver.cs @@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy continue; } - string[] entry = line.Split(new[] { ' ', '\t' }, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); + string[] entry = line.Split([' ', '\t'], StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); // Hosts file example entry: // 127.0.0.1 localhost loopback @@ -92,9 +92,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy return new IPHostEntry { - AddressList = new[] { hostEntry.Value }, + AddressList = [hostEntry.Value], HostName = hostEntry.Key, - Aliases = Array.Empty(), + Aliases = [], }; } } diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs index 5dc02a07e..770149489 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs @@ -66,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger ConsumerListener = null; ConsumerUsageBits = 0; - Queue = new List(); + Queue = []; // TODO: CreateGraphicBufferAlloc? diff --git a/src/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockContextUpdateCallback.cs b/src/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockContextUpdateCallback.cs index 119096dcf..781f72ead 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockContextUpdateCallback.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockContextUpdateCallback.cs @@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock public SystemClockContextUpdateCallback() { - _operationEventList = new List(); + _operationEventList = []; Context = new SystemClockContext(); _hasContext = false; } diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs index cdd11b58d..819599171 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZone.cs @@ -32,11 +32,12 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone private const long AverageSecondsPerYear = 31556952; private const long SecondsPerRepeat = YearsPerRepeat * AverageSecondsPerYear; - private static readonly int[] _yearLengths = { DaysPerNYear, DaysPerLYear }; - private static readonly int[][] _monthsLengths = { - new[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - new[] { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - }; + private static readonly int[] _yearLengths = [DaysPerNYear, DaysPerLYear]; + private static readonly int[][] _monthsLengths = + [ + [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + ]; private static ReadOnlySpan TimeZoneDefaultRule => ",M4.1.0,M10.5.0"u8; diff --git a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs index e00af70f5..7ca367106 100644 --- a/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs @@ -100,7 +100,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone StreamReader reader = new(binaryListFile.Get.AsStream()); - List locationNameList = new(); + List locationNameList = []; string locationName; while ((locationName = reader.ReadLine()) != null) @@ -112,7 +112,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone } else { - LocationNameCache = new[] { "UTC" }; + LocationNameCache = ["UTC"]; Logger.Error?.Print(LogClass.ServiceTime, TimeZoneSystemTitleMissingErrorMessage); } @@ -124,10 +124,10 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone if (string.IsNullOrEmpty(tzBinaryContentPath)) { - return new[] { (0, "UTC", "UTC") }; + return [(0, "UTC", "UTC")]; } - List<(int Offset, string Location, string Abbr)> outList = new(); + List<(int Offset, string Location, string Abbr)> outList = []; long now = DateTimeOffset.Now.ToUnixTimeSeconds(); using (IStorage ncaStorage = new LocalStorage(VirtualFileSystem.SwitchPathToSystemPath(tzBinaryContentPath), FileAccess.Read, FileMode.Open)) using (IFileSystem romfs = new Nca(_virtualFileSystem.KeySet, ncaStorage).OpenFileSystem(NcaSectionType.Data, _fsIntegrityCheckLevel)) @@ -217,7 +217,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone public ResultCode LoadLocationNameList(uint index, out string[] outLocationNameArray, uint maxLength) { - List locationNameList = new(); + List locationNameList = []; for (int i = 0; i < LocationNameCache.Length && i < maxLength; i++) { @@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone // If the location name is too long, error out. if (locationName.Length > 0x24) { - outLocationNameArray = Array.Empty(); + outLocationNameArray = []; return ResultCode.LocationNameTooLong; } diff --git a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index edb441a0a..9fe247e8a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs @@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService public IApplicationDisplayService(ViServiceType serviceType) { _serviceType = serviceType; - _displayInfo = new List(); + _displayInfo = []; _openDisplays = new Dictionary(); void AddDisplayInfo(string name, bool layerLimitEnabled, ulong layerLimitMax, ulong width, ulong height) diff --git a/src/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs b/src/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs index c650fe036..91277232c 100644 --- a/src/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs +++ b/src/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs @@ -4,7 +4,8 @@ namespace Ryujinx.HLE.HOS.SystemState { public class SystemStateMgr { - internal static string[] LanguageCodes = { + internal static string[] LanguageCodes = + [ "ja", "en-US", "fr", @@ -22,8 +23,8 @@ namespace Ryujinx.HLE.HOS.SystemState "es-419", "zh-Hans", "zh-Hant", - "pt-BR", - }; + "pt-BR" + ]; internal long DesiredKeyboardLayout { get; private set; } diff --git a/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs b/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs index e25ba7a55..c5b228fc8 100644 --- a/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs +++ b/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs @@ -26,12 +26,13 @@ namespace Ryujinx.HLE.HOS.Tamper public ITamperProgram Compile(string name, IEnumerable rawInstructions) { - string[] addresses = { + string[] addresses = + [ $" Executable address: 0x{_exeAddress:X16}", $" Heap address : 0x{_heapAddress:X16}", $" Alias address : 0x{_aliasAddress:X16}", - $" Aslr address : 0x{_aslrAddress:X16}", - }; + $" Aslr address : 0x{_aslrAddress:X16}" + ]; Logger.Debug?.Print(LogClass.TamperMachine, $"Compiling Atmosphere cheat {name}...\n{string.Join('\n', addresses)}"); diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs index 5b296def0..ce1b91cec 100644 --- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs +++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs @@ -73,11 +73,11 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters void Emit(Type operationType, IOperand rhs = null) { - List operandList = new() - { + List operandList = + [ destinationRegister, - leftHandSideRegister, - }; + leftHandSideRegister + ]; if (rhs != null) { diff --git a/src/Ryujinx.HLE/HOS/Tamper/OperationBlock.cs b/src/Ryujinx.HLE/HOS/Tamper/OperationBlock.cs index 5a0bccc5d..1e856294a 100644 --- a/src/Ryujinx.HLE/HOS/Tamper/OperationBlock.cs +++ b/src/Ryujinx.HLE/HOS/Tamper/OperationBlock.cs @@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Tamper public OperationBlock(byte[] baseInstruction) { BaseInstruction = baseInstruction; - Operations = new List(); + Operations = []; } } } diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessConst.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessConst.cs index 778f9ce68..6fc6ece0a 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessConst.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessConst.cs @@ -4,7 +4,7 @@ namespace Ryujinx.HLE.Loaders.Processes { // Binaries from exefs are loaded into mem in this order. Do not change. public static readonly string[] ExeFsPrefixes = - { + [ "rtld", "main", "subsdk0", @@ -17,8 +17,8 @@ namespace Ryujinx.HLE.Loaders.Processes "subsdk7", "subsdk8", "subsdk9", - "sdk", - }; + "sdk" + ]; public const string MainNpdmPath = "/main.npdm";