misc: chore: Use explicit types in HLE project

This commit is contained in:
Evan Husted 2025-01-25 14:13:18 -06:00
parent 58c1ab7989
commit 5eba42fa06
80 changed files with 410 additions and 397 deletions

View file

@ -25,7 +25,7 @@ namespace Ryujinx.HLE.Loaders.Mods
ReadOnlySpan<byte> ips32TailMagic = "EEOF"u8;
MemPatch patches = new();
var header = reader.ReadBytes(ipsHeaderMagic.Length).AsSpan();
Span<byte> header = reader.ReadBytes(ipsHeaderMagic.Length).AsSpan();
if (header.Length != ipsHeaderMagic.Length)
{
@ -94,7 +94,7 @@ namespace Ryujinx.HLE.Loaders.Mods
}
else // Copy mode
{
var patch = reader.ReadBytes(patchSize);
byte[] patch = reader.ReadBytes(patchSize);
if (patch.Length != patchSize)
{

View file

@ -200,7 +200,7 @@ namespace Ryujinx.HLE.Loaders.Mods
}
else if (line.StartsWith("@flag"))
{
var tokens = line.Split(' ', 3, StringSplitOptions.RemoveEmptyEntries);
string[] tokens = line.Split(' ', 3, StringSplitOptions.RemoveEmptyEntries);
if (tokens.Length < 2)
{
@ -234,7 +234,7 @@ namespace Ryujinx.HLE.Loaders.Mods
continue;
}
var tokens = line.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
string[] tokens = line.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
if (tokens.Length < 2)
{
@ -259,12 +259,12 @@ namespace Ryujinx.HLE.Loaders.Mods
if (tokens[1][0] == '"')
{
var patch = Encoding.ASCII.GetBytes(tokens[1].Trim('"') + "\0");
byte[] patch = Encoding.ASCII.GetBytes(tokens[1].Trim('"') + "\0");
patches.Add((uint)offset, patch);
}
else
{
var patch = Hex2ByteArrayBE(tokens[1]);
byte[] patch = Hex2ByteArrayBE(tokens[1]);
patches.Add((uint)offset, patch);
}
}

View file

@ -46,7 +46,7 @@ namespace Ryujinx.HLE.Loaders.Mods
return;
}
foreach (var (patchOffset, patch) in patches._patches)
foreach ((uint patchOffset, byte[] patch) in patches._patches)
{
_patches[patchOffset] = patch;
}
@ -66,7 +66,7 @@ namespace Ryujinx.HLE.Loaders.Mods
public int Patch(Span<byte> memory, int protectedOffset = 0)
{
int count = 0;
foreach (var (offset, patch) in _patches.OrderBy(item => item.Key))
foreach ((uint offset, byte[] patch) in _patches.OrderBy(item => item.Key))
{
int patchOffset = (int)offset;
int patchSize = patch.Length;