diff --git a/src/ARMeilleure/Translation/ControlFlowGraph.cs b/src/ARMeilleure/Translation/ControlFlowGraph.cs index 45b092ec5f..9974623ef0 100644 --- a/src/ARMeilleure/Translation/ControlFlowGraph.cs +++ b/src/ARMeilleure/Translation/ControlFlowGraph.cs @@ -47,7 +47,7 @@ public void Update() { RemoveUnreachableBlocks(Blocks); - var visited = new HashSet(); + HashSet visited = []; var blockStack = new Stack(); Array.Resize(ref _postOrderBlocks, Blocks.Count); @@ -88,7 +88,7 @@ public void Update() private void RemoveUnreachableBlocks(IntrusiveList blocks) { - var visited = new HashSet(); + HashSet visited = []; var workQueue = new Queue(); visited.Add(Entry); diff --git a/src/ARMeilleure/Translation/TranslatorStubs.cs b/src/ARMeilleure/Translation/TranslatorStubs.cs index bd9aed8d45..16625b3727 100644 --- a/src/ARMeilleure/Translation/TranslatorStubs.cs +++ b/src/ARMeilleure/Translation/TranslatorStubs.cs @@ -187,7 +187,7 @@ private nint GenerateDispatchStub() var cfg = context.GetControlFlowGraph(); var retType = OperandType.I64; - var argTypes = new[] { OperandType.I64 }; + OperandType[] argTypes = [OperandType.I64]; var func = Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map(); @@ -212,7 +212,7 @@ private nint GenerateSlowDispatchStub() var cfg = context.GetControlFlowGraph(); var retType = OperandType.I64; - var argTypes = new[] { OperandType.I64 }; + OperandType[] argTypes = [OperandType.I64]; var func = Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map(); @@ -281,7 +281,7 @@ private DispatcherFunction GenerateDispatchLoop() var cfg = context.GetControlFlowGraph(); var retType = OperandType.None; - var argTypes = new[] { OperandType.I64, OperandType.I64 }; + OperandType[] argTypes = [OperandType.I64, OperandType.I64]; return Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map(); } @@ -305,7 +305,7 @@ private WrapperFunction GenerateContextWrapper() var cfg = context.GetControlFlowGraph(); var retType = OperandType.I64; - var argTypes = new[] { OperandType.I64, OperandType.I64 }; + OperandType[] argTypes = [OperandType.I64, OperandType.I64]; return Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map(); } diff --git a/src/Ryujinx.Common/Logging/Logger.cs b/src/Ryujinx.Common/Logging/Logger.cs index 43b7b90a65..67313870c3 100644 --- a/src/Ryujinx.Common/Logging/Logger.cs +++ b/src/Ryujinx.Common/Logging/Logger.cs @@ -207,7 +207,7 @@ public static void Shutdown() public static IReadOnlyCollection GetEnabledLevels() { - var logs = new[] { Debug, Info, Warning, Error, Guest, AccessLog, Stub, Trace }; + Log?[] logs = [Debug, Info, Warning, Error, Guest, AccessLog, Stub, Trace]; List levels = new(logs.Length); foreach (var log in logs) { diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index afaac5996b..7972b8d767 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -1376,7 +1376,7 @@ SpvInstruction AssembleOffsetVector(int count) image = context.Image(declaration.ImageType, image); } - var operands = operandsList.ToArray(); + SpvInstruction[] operands = [.. operandsList]; SpvInstruction result; diff --git a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs index 32ad78f80c..8c69448a34 100644 --- a/src/Ryujinx.Graphics.Vulkan/HelperShader.cs +++ b/src/Ryujinx.Graphics.Vulkan/HelperShader.cs @@ -946,7 +946,7 @@ public unsafe void ConvertIndexBuffer(VulkanRenderer gd, bufferCopy.Add(new BufferCopy((ulong)(srcOffset + sequenceStart * indexSize), (ulong)outputOffset, (ulong)(indexSize * sequenceLength))); } - var bufferCopyArray = bufferCopy.ToArray(); + BufferCopy[] bufferCopyArray = [.. bufferCopy]; BufferHolder.InsertBufferBarrier( gd, diff --git a/src/Ryujinx.HLE/HOS/ModLoader.cs b/src/Ryujinx.HLE/HOS/ModLoader.cs index bfe2af223d..5a0d083cc9 100644 --- a/src/Ryujinx.HLE/HOS/ModLoader.cs +++ b/src/Ryujinx.HLE/HOS/ModLoader.cs @@ -469,7 +469,7 @@ internal IStorage ApplyRomFsMods(ulong applicationId, IStorage baseStorage) return baseStorage; } - var fileSet = new HashSet(); + HashSet fileSet = []; var builder = new RomFsBuilder(); int count = 0; diff --git a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/ServiceDispatchTableBase.cs b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/ServiceDispatchTableBase.cs index 2625a4c3e0..b4f8f14b7d 100644 --- a/src/Ryujinx.Horizon/Sdk/Sf/Cmif/ServiceDispatchTableBase.cs +++ b/src/Ryujinx.Horizon/Sdk/Sf/Cmif/ServiceDispatchTableBase.cs @@ -35,7 +35,7 @@ protected static Result ProcessMessageImpl(ref ServiceDispatchContext context, R ReadOnlySpan inMessageRawData = inRawData[Unsafe.SizeOf()..]; uint commandId = inHeader.CommandId; - var outHeader = Span.Empty; + Span outHeader = []; if (!entries.TryGetValue((int)commandId, out var commandHandler)) { diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs index 930cc53982..f9d72bfdc9 100644 --- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs +++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs @@ -962,8 +962,8 @@ public int AutoLoadTitleUpdates(List appDirs, out int numUpdatesRemoved) try { - var titleIdsToSave = new HashSet(); - var titleIdsToRefresh = new HashSet(); + HashSet titleIdsToSave = []; + HashSet titleIdsToRefresh = []; // Remove any updates which can no longer be located on disk Logger.Notice.Print(LogClass.Application, $"Removing non-existing Title Updates"); diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index 2ec60ac70a..8bee5e5ce6 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -228,7 +228,7 @@ private static void PrintSystemInfo() Logger.Notice.Print(LogClass.Application, $"{RyujinxApp.FullAppName} Version: {Version}"); SystemInfo.Gather().Print(); - var enabledLogLevels = Logger.GetEnabledLevels().ToArray(); + LogLevel[] enabledLogLevels = [.. Logger.GetEnabledLevels()]; Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {(enabledLogLevels.Length is 0 ? "" diff --git a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs index 2a63424036..d8e047603a 100644 --- a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs @@ -137,7 +137,7 @@ public void Sort() // NOTE(jpr): this works around a bug where calling _views.Clear also clears SelectedDownloadableContents for // some reason. so we save the items here and add them back after - var items = SelectedDownloadableContents.ToArray(); + DownloadableContentModel[] items = [.. SelectedDownloadableContents]; _views.Clear(); _views.AddRange(view); diff --git a/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs b/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs index c45de647ca..1b79e12e7c 100644 --- a/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs @@ -160,13 +160,13 @@ private void PerformOperation(ProcessingMode processingMode) Thread XCIFileTrimThread = new(() => { - var toProcess = Sort(SelectedXCIFiles + List toProcess = [.. Sort(SelectedXCIFiles .Where(xci => (processingMode == ProcessingMode.Untrimming && xci.Untrimmable) || (processingMode == ProcessingMode.Trimming && xci.Trimmable) - )).ToList(); + ))]; - var viewsSaved = DisplayedXCIFiles.ToList(); + List viewsSaved = [.. DisplayedXCIFiles]; Dispatcher.UIThread.Post(() => { diff --git a/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs b/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs index 69986c0148..dcbcc6216d 100644 --- a/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs +++ b/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs @@ -67,7 +67,7 @@ private void NavigatedTo(NavigationEventArgs arg) public void LoadSaves() { ViewModel.Saves.Clear(); - var saves = new ObservableCollection(); + ObservableCollection saves = []; var saveDataFilter = SaveDataFilter.Make( programId: default, saveType: SaveDataType.Account,