From 19013d360a4339dbd06aa105190ac906d639bf4d Mon Sep 17 00:00:00 2001 From: KeatonTheBot Date: Sun, 30 Mar 2025 00:29:59 -0500 Subject: [PATCH] misc: chore: Remove redundant qualifiers --- src/ARMeilleure/Optimizations.cs | 4 +- .../Utilities/XCIFileTrimmer.cs | 28 +++---- .../Engine/MME/MacroHLE.cs | 2 +- .../Types/Vp9Decoder.cs | 4 +- .../FormatCapabilities.cs | 76 +++++++++---------- src/Ryujinx/App.axaml.cs | 2 +- .../UI/ViewModels/MainWindowViewModel.cs | 12 +-- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 4 +- 8 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/ARMeilleure/Optimizations.cs b/src/ARMeilleure/Optimizations.cs index 0536302e8..ac6510143 100644 --- a/src/ARMeilleure/Optimizations.cs +++ b/src/ARMeilleure/Optimizations.cs @@ -1,7 +1,7 @@ namespace ARMeilleure { - using Arm64HardwareCapabilities = ARMeilleure.CodeGen.Arm64.HardwareCapabilities; - using X86HardwareCapabilities = ARMeilleure.CodeGen.X86.HardwareCapabilities; + using Arm64HardwareCapabilities = CodeGen.Arm64.HardwareCapabilities; + using X86HardwareCapabilities = CodeGen.X86.HardwareCapabilities; public static class Optimizations { diff --git a/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs b/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs index 4399ea39d..15b8daf1c 100644 --- a/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs +++ b/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs @@ -191,7 +191,7 @@ namespace Ryujinx.Common.Utilities if (timedSw.Elapsed.TotalSeconds > 0) { - Log?.Write(LogType.Info, $"Checked at {readSizeB / (double)XCIFileTrimmer.BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec"); + Log?.Write(LogType.Info, $"Checked at {readSizeB / (double)BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec"); } if (freeSpaceValid) @@ -219,7 +219,7 @@ namespace Ryujinx.Common.Utilities private bool CheckPadding(long readSizeB, CancellationToken? cancelToken = null) { - long maxReads = readSizeB / XCIFileTrimmer.BufferSize; + long maxReads = readSizeB / BufferSize; long read = 0; var buffer = new byte[BufferSize]; @@ -230,12 +230,12 @@ namespace Ryujinx.Common.Utilities return false; } - int bytes = _fileStream.Read(buffer, 0, XCIFileTrimmer.BufferSize); + int bytes = _fileStream.Read(buffer, 0, BufferSize); if (bytes == 0) break; Log?.Progress(read, maxReads, "Verifying file can be trimmed", false); - if (buffer.Take(bytes).AsParallel().Any(b => b != XCIFileTrimmer.PaddingByte)) + if (buffer.Take(bytes).AsParallel().Any(b => b != PaddingByte)) { Log?.Write(LogType.Warn, "Free space is NOT valid"); return false; @@ -380,7 +380,7 @@ namespace Ryujinx.Common.Utilities if (timedSw.Elapsed.TotalSeconds > 0) { - Log?.Write(LogType.Info, $"Wrote at {bytesToWriteB / (double)XCIFileTrimmer.BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec"); + Log?.Write(LogType.Info, $"Wrote at {bytesToWriteB / (double)BytesInAMegabyte / timedSw.Elapsed.TotalSeconds:N} Mb/sec"); } if (cancelToken.HasValue && cancelToken.Value.IsCancellationRequested) @@ -408,13 +408,13 @@ namespace Ryujinx.Common.Utilities private void WritePadding(FileStream outfileStream, long bytesToWriteB, CancellationToken? cancelToken = null) { long bytesLeftToWriteB = bytesToWriteB; - long writes = bytesLeftToWriteB / XCIFileTrimmer.BufferSize; + long writes = bytesLeftToWriteB / BufferSize; int write = 0; try { var buffer = new byte[BufferSize]; - Array.Fill(buffer, XCIFileTrimmer.PaddingByte); + Array.Fill(buffer, PaddingByte); while (bytesLeftToWriteB > 0) { @@ -423,7 +423,7 @@ namespace Ryujinx.Common.Utilities return; } - long bytesToWrite = Math.Min(XCIFileTrimmer.BufferSize, bytesLeftToWriteB); + long bytesToWrite = Math.Min(BufferSize, bytesLeftToWriteB); #if !XCI_TRIMMER_READ_ONLY_MODE outfileStream.Write(buffer, 0, (int)bytesToWrite); @@ -504,12 +504,12 @@ namespace Ryujinx.Common.Utilities } // Setup offset - _offsetB = (long)(assumeKeyArea ? XCIFileTrimmer.CartKeyAreaSize : 0); + _offsetB = (long)(assumeKeyArea ? CartKeyAreaSize : 0); // Check header - Pos = _offsetB + XCIFileTrimmer.HeaderFilePos; + Pos = _offsetB + HeaderFilePos; string head = System.Text.Encoding.ASCII.GetString(_binaryReader.ReadBytes(4)); - if (head != XCIFileTrimmer.HeaderMagicValue) + if (head != HeaderMagicValue) { if (!assumeKeyArea) { @@ -524,17 +524,17 @@ namespace Ryujinx.Common.Utilities } // Read Cart Size - Pos = _offsetB + XCIFileTrimmer.CartSizeFilePos; + Pos = _offsetB + CartSizeFilePos; byte cartSizeId = _binaryReader.ReadByte(); if (!_cartSizesGB.TryGetValue(cartSizeId, out long cartSizeNGB)) { Log?.Write(LogType.Error, $"The source file doesn't look like an XCI file as the Cartridge Size is incorrect (0x{cartSizeId:X2})"); return false; } - _cartSizeB = cartSizeNGB * XCIFileTrimmer.CartSizeMBinFormattedGB * XCIFileTrimmer.BytesInAMegabyte; + _cartSizeB = cartSizeNGB * CartSizeMBinFormattedGB * BytesInAMegabyte; // Read data size - Pos = _offsetB + XCIFileTrimmer.DataSizeFilePos; + Pos = _offsetB + DataSizeFilePos; long records = (long)BitConverter.ToUInt32(_binaryReader.ReadBytes(4), 0); _dataSizeB = RecordsToByte(records); diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs index 475d1ee4e..802035ff4 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs @@ -506,7 +506,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME maxDrawCount, stride, indexCount, - Threed.IndirectDrawType.DrawIndexedIndirectCount); + IndirectDrawType.DrawIndexedIndirectCount); } /// diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/Vp9Decoder.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/Vp9Decoder.cs index e107992c7..e0ed45cf8 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/Types/Vp9Decoder.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Types/Vp9Decoder.cs @@ -280,7 +280,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types Array8 frameSizes = new(); int frameCount = 0; - CodecErr res = Types.Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount); + CodecErr res = Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount); if (res != CodecErr.Ok) { return res; @@ -321,7 +321,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types // Account for suboptimal termination by the encoder. while (dataStart.Length != 0) { - byte marker = Types.Decoder.ReadMarker(dataStart); + byte marker = Decoder.ReadMarker(dataStart); if (marker != 0) { break; diff --git a/src/Ryujinx.Graphics.Vulkan/FormatCapabilities.cs b/src/Ryujinx.Graphics.Vulkan/FormatCapabilities.cs index 2362902e1..d4f3def3b 100644 --- a/src/Ryujinx.Graphics.Vulkan/FormatCapabilities.cs +++ b/src/Ryujinx.Graphics.Vulkan/FormatCapabilities.cs @@ -9,48 +9,48 @@ namespace Ryujinx.Graphics.Vulkan { class FormatCapabilities { - private static readonly GAL.Format[] _scaledFormats = + private static readonly Format[] _scaledFormats = [ - GAL.Format.R8Uscaled, - GAL.Format.R8Sscaled, - GAL.Format.R16Uscaled, - GAL.Format.R16Sscaled, - GAL.Format.R8G8Uscaled, - GAL.Format.R8G8Sscaled, - GAL.Format.R16G16Uscaled, - GAL.Format.R16G16Sscaled, - GAL.Format.R8G8B8Uscaled, - GAL.Format.R8G8B8Sscaled, - GAL.Format.R16G16B16Uscaled, - GAL.Format.R16G16B16Sscaled, - GAL.Format.R8G8B8A8Uscaled, - GAL.Format.R8G8B8A8Sscaled, - GAL.Format.R16G16B16A16Uscaled, - GAL.Format.R16G16B16A16Sscaled, - GAL.Format.R10G10B10A2Uscaled, - GAL.Format.R10G10B10A2Sscaled + Format.R8Uscaled, + Format.R8Sscaled, + Format.R16Uscaled, + Format.R16Sscaled, + Format.R8G8Uscaled, + Format.R8G8Sscaled, + Format.R16G16Uscaled, + Format.R16G16Sscaled, + Format.R8G8B8Uscaled, + Format.R8G8B8Sscaled, + Format.R16G16B16Uscaled, + Format.R16G16B16Sscaled, + Format.R8G8B8A8Uscaled, + Format.R8G8B8A8Sscaled, + Format.R16G16B16A16Uscaled, + Format.R16G16B16A16Sscaled, + Format.R10G10B10A2Uscaled, + Format.R10G10B10A2Sscaled ]; - private static readonly GAL.Format[] _intFormats = + private static readonly Format[] _intFormats = [ - GAL.Format.R8Uint, - GAL.Format.R8Sint, - GAL.Format.R16Uint, - GAL.Format.R16Sint, - GAL.Format.R8G8Uint, - GAL.Format.R8G8Sint, - GAL.Format.R16G16Uint, - GAL.Format.R16G16Sint, - GAL.Format.R8G8B8Uint, - GAL.Format.R8G8B8Sint, - GAL.Format.R16G16B16Uint, - GAL.Format.R16G16B16Sint, - GAL.Format.R8G8B8A8Uint, - GAL.Format.R8G8B8A8Sint, - GAL.Format.R16G16B16A16Uint, - GAL.Format.R16G16B16A16Sint, - GAL.Format.R10G10B10A2Uint, - GAL.Format.R10G10B10A2Sint + Format.R8Uint, + Format.R8Sint, + Format.R16Uint, + Format.R16Sint, + Format.R8G8Uint, + Format.R8G8Sint, + Format.R16G16Uint, + Format.R16G16Sint, + Format.R8G8B8Uint, + Format.R8G8B8Sint, + Format.R16G16B16Uint, + Format.R16G16B16Sint, + Format.R8G8B8A8Uint, + Format.R8G8B8A8Sint, + Format.R16G16B16A16Uint, + Format.R16G16B16A16Sint, + Format.R10G10B10A2Uint, + Format.R10G10B10A2Sint ]; private readonly FormatFeatureFlags[] _bufferTable; diff --git a/src/Ryujinx/App.axaml.cs b/src/Ryujinx/App.axaml.cs index 22c8d59de..cd4416aa1 100644 --- a/src/Ryujinx/App.axaml.cs +++ b/src/Ryujinx/App.axaml.cs @@ -144,7 +144,7 @@ namespace Ryujinx.Ava public static ThemeVariant DetectSystemTheme() { - if (Application.Current is App app) + if (Current is App app) { var colorValues = app.PlatformSettings.GetColorValues(); diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index a502afd82..b9a5509a6 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -465,7 +465,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool OpenDeviceSaveDirectoryEnabled => !SelectedApplication.ControlHolder.ByteSpan.IsZeros() && SelectedApplication.ControlHolder.Value.DeviceSaveDataSize > 0; - public bool TrimXCIEnabled => Ryujinx.Common.Utilities.XCIFileTrimmer.CanTrim(SelectedApplication.Path, new Common.XCIFileTrimmerMainWindowLog(this)); + public bool TrimXCIEnabled => XCIFileTrimmer.CanTrim(SelectedApplication.Path, new XCIFileTrimmerMainWindowLog(this)); public bool OpenBcatSaveDirectoryEnabled => !SelectedApplication.ControlHolder.ByteSpan.IsZeros() && SelectedApplication.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0; @@ -1554,7 +1554,7 @@ namespace Ryujinx.Ava.UI.ViewModels Dispatcher.UIThread.InvokeAsync(() => { Application.Current.Styles.TryGetResource(args.VSyncMode, - Avalonia.Application.Current.ActualThemeVariant, + Application.Current.ActualThemeVariant, out object color); if (color is not null) @@ -2235,7 +2235,7 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public async void ProcessTrimResult(String filename, Ryujinx.Common.Utilities.XCIFileTrimmer.OperationOutcome operationOutcome) + public async void ProcessTrimResult(String filename, XCIFileTrimmer.OperationOutcome operationOutcome) { string notifyUser = operationOutcome.ToLocalisedText(); @@ -2250,8 +2250,8 @@ namespace Ryujinx.Ava.UI.ViewModels { switch (operationOutcome) { - case Ryujinx.Common.Utilities.XCIFileTrimmer.OperationOutcome.Successful: - if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + case XCIFileTrimmer.OperationOutcome.Successful: + if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { if (desktop.MainWindow is MainWindow mainWindow) mainWindow.LoadApplications(); @@ -2268,7 +2268,7 @@ namespace Ryujinx.Ava.UI.ViewModels return; } - var trimmer = new XCIFileTrimmer(filename, new Common.XCIFileTrimmerMainWindowLog(this)); + var trimmer = new XCIFileTrimmer(filename, new XCIFileTrimmerMainWindowLog(this)); if (trimmer.CanBeTrimmed) { diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 639085b63..cfaca7818 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -231,7 +231,7 @@ namespace Ryujinx.Ava.UI.Windows ViewModel.ShowContent = true; ViewModel.IsLoadingIndeterminate = false; - if (startFullscreen && ViewModel.WindowState != MainWindow.FullScreenWindowState) + if (startFullscreen && ViewModel.WindowState != FullScreenWindowState) { ViewModel.ToggleFullscreen(); } @@ -243,7 +243,7 @@ namespace Ryujinx.Ava.UI.Windows ViewModel.ShowLoadProgress = true; ViewModel.IsLoadingIndeterminate = true; - if (startFullscreen && ViewModel.WindowState != MainWindow.FullScreenWindowState) + if (startFullscreen && ViewModel.WindowState != FullScreenWindowState) { ViewModel.ToggleFullscreen(); }