diff --git a/src/Ryujinx.Graphics.Metal/HardwareInfo.cs b/src/Ryujinx.Graphics.Metal/HardwareInfo.cs index 413fabf09..f6a132f09 100644 --- a/src/Ryujinx.Graphics.Metal/HardwareInfo.cs +++ b/src/Ryujinx.Graphics.Metal/HardwareInfo.cs @@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Metal return model; } - return ""; + return string.Empty; } } } diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs index c779f5e8d..081dd516b 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs @@ -218,7 +218,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl foreach (MemoryDefinition memory in memories) { - string arraySize = ""; + string arraySize = string.Empty; if ((memory.Type & AggregateType.Array) != 0) { arraySize = $"[{memory.ArrayLength}]"; @@ -240,7 +240,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl BufferDefinition buffer = buffers[i]; bool needsPadding = buffer.Layout == BufferLayout.Std140; - string fsiSuffix = !constant && fsi ? " [[raster_order_group(0)]]" : ""; + string fsiSuffix = !constant && fsi ? " [[raster_order_group(0)]]" : string.Empty; bufferDec[i] = $"{addressSpace} {Defaults.StructPrefix}_{buffer.Name}* {buffer.Name}{fsiSuffix};"; @@ -257,7 +257,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl type &= ~AggregateType.Array; string typeName = GetVarTypeName(type); - string arraySuffix = ""; + string arraySuffix = string.Empty; if (field.Type.HasFlag(AggregateType.Array)) { @@ -353,7 +353,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl imageTypeName = $"array<{imageTypeName}, {image.ArrayLength}>"; } - string fsiSuffix = fsi ? " [[raster_order_group(0)]]" : ""; + string fsiSuffix = fsi ? " [[raster_order_group(0)]]" : string.Empty; imageDec[i] = $"{imageTypeName} {image.Name}{fsiSuffix};"; } @@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl IoVariable.VertexIndex => "[[vertex_id]]", // IoVariable.PointCoord => "[[point_coord]]", IoVariable.UserDefined => context.Definitions.Stage == ShaderStage.Fragment ? $"[[user(loc{ioDefinition.Location})]]" : $"[[attribute({ioDefinition.Location})]]", - _ => "" + _ => string.Empty }; context.AppendLine($"{type} {name} {iq}{suffix};"); @@ -545,7 +545,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl IoVariable.FragmentOutputColor => $"[[color({ioDefinition.Location})]]", IoVariable.FragmentOutputDepth => "[[depth(any)]]", IoVariable.ClipDistance => $"[[clip_distance]][{Defaults.TotalClipDistances}]", - _ => "" + _ => string.Empty }; context.AppendLine($"{type} {name} {suffix};"); diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs index b3a995c6a..a84a75e4f 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs @@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions inputsCount--; } - string fieldName = ""; + string fieldName = string.Empty; switch (storageKind) { case StorageKind.ConstantBuffer: @@ -140,7 +140,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions } } varName += fieldName; - varName += fieldHasPadding ? ".x" : ""; + varName += fieldHasPadding ? ".x" : string.Empty; if (isStore) { @@ -434,7 +434,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions string prefix = intCoords ? "uint" : "float"; - return prefix + (count > 1 ? count : "") + "(" + coords + ")"; + return prefix + (count > 1 ? count : string.Empty) + "(" + coords + ")"; } Append(AssemblePVector(pCount)); @@ -504,7 +504,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions } texCallBuilder.Append(')'); - texCallBuilder.Append(colorIsVector ? GetMaskMultiDest(texOp.Index) : ""); + texCallBuilder.Append(colorIsVector ? GetMaskMultiDest(texOp.Index) : string.Empty); return texCallBuilder.ToString(); } @@ -558,7 +558,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions { if (mask == 0x0) { - return ""; + return string.Empty; } string swizzle = "."; diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs index bc38ea26b..8ca24fcd3 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl if (parameters.Definitions.Stage is not (ShaderStage.Vertex or ShaderStage.Fragment or ShaderStage.Compute)) { Logger.Warning?.Print(LogClass.Gpu, $"Attempted to generate unsupported shader type {parameters.Definitions.Stage}!"); - return ""; + return string.Empty; } CodeGenContext context = new(info, parameters); diff --git a/src/Ryujinx.Graphics.Shader/SamplerType.cs b/src/Ryujinx.Graphics.Shader/SamplerType.cs index 20352d13e..f81d512fa 100644 --- a/src/Ryujinx.Graphics.Shader/SamplerType.cs +++ b/src/Ryujinx.Graphics.Shader/SamplerType.cs @@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Shader _ => "float" }; - return $"{typeName}<{format}{(image ? ", access::read_write" : "")}>"; + return $"{typeName}<{format}{(image ? ", access::read_write" : string.Empty)}>"; } } } diff --git a/src/Ryujinx.HLE/HOS/ModLoader.cs b/src/Ryujinx.HLE/HOS/ModLoader.cs index 6c97e6fed..0f2e09da6 100644 --- a/src/Ryujinx.HLE/HOS/ModLoader.cs +++ b/src/Ryujinx.HLE/HOS/ModLoader.cs @@ -679,7 +679,7 @@ namespace Ryujinx.HLE.HOS { using (MD5 md5 = MD5.Create()) { - modLoadResult.Hash += BitConverter.ToString(md5.ComputeHash(tempHash.ToBytes())).Replace("-", "").ToLowerInvariant(); + modLoadResult.Hash += BitConverter.ToString(md5.ComputeHash(tempHash.ToBytes())).Replace("-", string.Empty).ToLowerInvariant(); } } 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 517359e70..712967180 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/LdnMasterProxyClient.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/LdnMasterProxyClient.cs @@ -121,7 +121,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu private void UpdatePassphraseIfNeeded() { - string passphrase = _config.MultiplayerLdnPassphrase ?? ""; + string passphrase = _config.MultiplayerLdnPassphrase ?? string.Empty; if (passphrase != _passphrase) { _passphrase = passphrase; diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index 3a7042670..6fd9408ed 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -88,7 +88,7 @@ namespace Ryujinx.HLE.Loaders.Processes bool isFirmwareApplication = ProgramId <= 0x0100000000007FFF; string name = !isFirmware - ? (isFirmwareApplication ? "Firmware Application " : "") + (!string.IsNullOrWhiteSpace(Name) ? Name : "") + ? (isFirmwareApplication ? "Firmware Application " : string.Empty) + (!string.IsNullOrWhiteSpace(Name) ? Name : "") : "Firmware"; // TODO: LibHac npdm currently doesn't support version field. diff --git a/src/Ryujinx/UI/Views/Settings/SettingsNetworkView.axaml.cs b/src/Ryujinx/UI/Views/Settings/SettingsNetworkView.axaml.cs index c69307522..c4987702c 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsNetworkView.axaml.cs +++ b/src/Ryujinx/UI/Views/Settings/SettingsNetworkView.axaml.cs @@ -7,23 +7,26 @@ namespace Ryujinx.Ava.UI.Views.Settings { public partial class SettingsNetworkView : UserControl { + private readonly Random _random; + public SettingsViewModel ViewModel; public SettingsNetworkView() { + _random = new Random(); InitializeComponent(); } private void GenLdnPassButton_OnClick(object sender, RoutedEventArgs e) { byte[] code = new byte[4]; - new Random().NextBytes(code); + _random.NextBytes(code); ViewModel.LdnPassphrase = $"Ryujinx-{BitConverter.ToUInt32(code):x8}"; } private void ClearLdnPassButton_OnClick(object sender, RoutedEventArgs e) { - ViewModel.LdnPassphrase = ""; + ViewModel.LdnPassphrase = string.Empty; } } } diff --git a/src/Ryujinx/Utilities/Configuration/ConfigurationState.cs b/src/Ryujinx/Utilities/Configuration/ConfigurationState.cs index 80b3e5c03..b80a0c101 100644 --- a/src/Ryujinx/Utilities/Configuration/ConfigurationState.cs +++ b/src/Ryujinx/Utilities/Configuration/ConfigurationState.cs @@ -204,8 +204,8 @@ namespace Ryujinx.Ava.Utilities.Configuration Multiplayer.LanInterfaceId.Value = "0"; Multiplayer.Mode.Value = MultiplayerMode.Disabled; Multiplayer.DisableP2p.Value = false; - Multiplayer.LdnPassphrase.Value = ""; - Multiplayer.LdnServer.Value = ""; + Multiplayer.LdnPassphrase.Value = string.Empty; + Multiplayer.LdnServer.Value = string.Empty; UI.GuiColumns.FavColumn.Value = true; UI.GuiColumns.IconColumn.Value = true; UI.GuiColumns.AppColumn.Value = true;