misc: chore: Use string.Empty in more places where it's snuck back

This commit is contained in:
Evan Husted 2025-01-28 22:17:11 -06:00
parent 191e158289
commit 2acc43e968
10 changed files with 24 additions and 21 deletions

View file

@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Metal
return model; return model;
} }
return ""; return string.Empty;
} }
} }
} }

View file

@ -218,7 +218,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
foreach (MemoryDefinition memory in memories) foreach (MemoryDefinition memory in memories)
{ {
string arraySize = ""; string arraySize = string.Empty;
if ((memory.Type & AggregateType.Array) != 0) if ((memory.Type & AggregateType.Array) != 0)
{ {
arraySize = $"[{memory.ArrayLength}]"; arraySize = $"[{memory.ArrayLength}]";
@ -240,7 +240,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
BufferDefinition buffer = buffers[i]; BufferDefinition buffer = buffers[i];
bool needsPadding = buffer.Layout == BufferLayout.Std140; 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};"; bufferDec[i] = $"{addressSpace} {Defaults.StructPrefix}_{buffer.Name}* {buffer.Name}{fsiSuffix};";
@ -257,7 +257,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
type &= ~AggregateType.Array; type &= ~AggregateType.Array;
string typeName = GetVarTypeName(type); string typeName = GetVarTypeName(type);
string arraySuffix = ""; string arraySuffix = string.Empty;
if (field.Type.HasFlag(AggregateType.Array)) if (field.Type.HasFlag(AggregateType.Array))
{ {
@ -353,7 +353,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
imageTypeName = $"array<{imageTypeName}, {image.ArrayLength}>"; 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};"; imageDec[i] = $"{imageTypeName} {image.Name}{fsiSuffix};";
} }
@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
IoVariable.VertexIndex => "[[vertex_id]]", IoVariable.VertexIndex => "[[vertex_id]]",
// IoVariable.PointCoord => "[[point_coord]]", // IoVariable.PointCoord => "[[point_coord]]",
IoVariable.UserDefined => context.Definitions.Stage == ShaderStage.Fragment ? $"[[user(loc{ioDefinition.Location})]]" : $"[[attribute({ioDefinition.Location})]]", IoVariable.UserDefined => context.Definitions.Stage == ShaderStage.Fragment ? $"[[user(loc{ioDefinition.Location})]]" : $"[[attribute({ioDefinition.Location})]]",
_ => "" _ => string.Empty
}; };
context.AppendLine($"{type} {name} {iq}{suffix};"); context.AppendLine($"{type} {name} {iq}{suffix};");
@ -545,7 +545,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
IoVariable.FragmentOutputColor => $"[[color({ioDefinition.Location})]]", IoVariable.FragmentOutputColor => $"[[color({ioDefinition.Location})]]",
IoVariable.FragmentOutputDepth => "[[depth(any)]]", IoVariable.FragmentOutputDepth => "[[depth(any)]]",
IoVariable.ClipDistance => $"[[clip_distance]][{Defaults.TotalClipDistances}]", IoVariable.ClipDistance => $"[[clip_distance]][{Defaults.TotalClipDistances}]",
_ => "" _ => string.Empty
}; };
context.AppendLine($"{type} {name} {suffix};"); context.AppendLine($"{type} {name} {suffix};");

View file

@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
inputsCount--; inputsCount--;
} }
string fieldName = ""; string fieldName = string.Empty;
switch (storageKind) switch (storageKind)
{ {
case StorageKind.ConstantBuffer: case StorageKind.ConstantBuffer:
@ -140,7 +140,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
} }
} }
varName += fieldName; varName += fieldName;
varName += fieldHasPadding ? ".x" : ""; varName += fieldHasPadding ? ".x" : string.Empty;
if (isStore) if (isStore)
{ {
@ -434,7 +434,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
string prefix = intCoords ? "uint" : "float"; string prefix = intCoords ? "uint" : "float";
return prefix + (count > 1 ? count : "") + "(" + coords + ")"; return prefix + (count > 1 ? count : string.Empty) + "(" + coords + ")";
} }
Append(AssemblePVector(pCount)); Append(AssemblePVector(pCount));
@ -504,7 +504,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
} }
texCallBuilder.Append(')'); texCallBuilder.Append(')');
texCallBuilder.Append(colorIsVector ? GetMaskMultiDest(texOp.Index) : ""); texCallBuilder.Append(colorIsVector ? GetMaskMultiDest(texOp.Index) : string.Empty);
return texCallBuilder.ToString(); return texCallBuilder.ToString();
} }
@ -558,7 +558,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
{ {
if (mask == 0x0) if (mask == 0x0)
{ {
return ""; return string.Empty;
} }
string swizzle = "."; string swizzle = ".";

View file

@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
if (parameters.Definitions.Stage is not (ShaderStage.Vertex or ShaderStage.Fragment or ShaderStage.Compute)) 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}!"); Logger.Warning?.Print(LogClass.Gpu, $"Attempted to generate unsupported shader type {parameters.Definitions.Stage}!");
return ""; return string.Empty;
} }
CodeGenContext context = new(info, parameters); CodeGenContext context = new(info, parameters);

View file

@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Shader
_ => "float" _ => "float"
}; };
return $"{typeName}<{format}{(image ? ", access::read_write" : "")}>"; return $"{typeName}<{format}{(image ? ", access::read_write" : string.Empty)}>";
} }
} }
} }

View file

@ -679,7 +679,7 @@ namespace Ryujinx.HLE.HOS
{ {
using (MD5 md5 = MD5.Create()) 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();
} }
} }

View file

@ -121,7 +121,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
private void UpdatePassphraseIfNeeded() private void UpdatePassphraseIfNeeded()
{ {
string passphrase = _config.MultiplayerLdnPassphrase ?? ""; string passphrase = _config.MultiplayerLdnPassphrase ?? string.Empty;
if (passphrase != _passphrase) if (passphrase != _passphrase)
{ {
_passphrase = passphrase; _passphrase = passphrase;

View file

@ -88,7 +88,7 @@ namespace Ryujinx.HLE.Loaders.Processes
bool isFirmwareApplication = ProgramId <= 0x0100000000007FFF; bool isFirmwareApplication = ProgramId <= 0x0100000000007FFF;
string name = !isFirmware string name = !isFirmware
? (isFirmwareApplication ? "Firmware Application " : "") + (!string.IsNullOrWhiteSpace(Name) ? Name : "<Unknown Name>") ? (isFirmwareApplication ? "Firmware Application " : string.Empty) + (!string.IsNullOrWhiteSpace(Name) ? Name : "<Unknown Name>")
: "Firmware"; : "Firmware";
// TODO: LibHac npdm currently doesn't support version field. // TODO: LibHac npdm currently doesn't support version field.

View file

@ -7,23 +7,26 @@ namespace Ryujinx.Ava.UI.Views.Settings
{ {
public partial class SettingsNetworkView : UserControl public partial class SettingsNetworkView : UserControl
{ {
private readonly Random _random;
public SettingsViewModel ViewModel; public SettingsViewModel ViewModel;
public SettingsNetworkView() public SettingsNetworkView()
{ {
_random = new Random();
InitializeComponent(); InitializeComponent();
} }
private void GenLdnPassButton_OnClick(object sender, RoutedEventArgs e) private void GenLdnPassButton_OnClick(object sender, RoutedEventArgs e)
{ {
byte[] code = new byte[4]; byte[] code = new byte[4];
new Random().NextBytes(code); _random.NextBytes(code);
ViewModel.LdnPassphrase = $"Ryujinx-{BitConverter.ToUInt32(code):x8}"; ViewModel.LdnPassphrase = $"Ryujinx-{BitConverter.ToUInt32(code):x8}";
} }
private void ClearLdnPassButton_OnClick(object sender, RoutedEventArgs e) private void ClearLdnPassButton_OnClick(object sender, RoutedEventArgs e)
{ {
ViewModel.LdnPassphrase = ""; ViewModel.LdnPassphrase = string.Empty;
} }
} }
} }

View file

@ -204,8 +204,8 @@ namespace Ryujinx.Ava.Utilities.Configuration
Multiplayer.LanInterfaceId.Value = "0"; Multiplayer.LanInterfaceId.Value = "0";
Multiplayer.Mode.Value = MultiplayerMode.Disabled; Multiplayer.Mode.Value = MultiplayerMode.Disabled;
Multiplayer.DisableP2p.Value = false; Multiplayer.DisableP2p.Value = false;
Multiplayer.LdnPassphrase.Value = ""; Multiplayer.LdnPassphrase.Value = string.Empty;
Multiplayer.LdnServer.Value = ""; Multiplayer.LdnServer.Value = string.Empty;
UI.GuiColumns.FavColumn.Value = true; UI.GuiColumns.FavColumn.Value = true;
UI.GuiColumns.IconColumn.Value = true; UI.GuiColumns.IconColumn.Value = true;
UI.GuiColumns.AppColumn.Value = true; UI.GuiColumns.AppColumn.Value = true;