[Ryujinx.Tests.Unicorn] Address dotnet-format issues (#5391)
* dotnet format style --severity info Some changes were manually reverted. * Restore a few unused methods and variables * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add comments to disabled warnings * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * Final dotnet format pass and fix naming rule violations
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
{
|
||||
public class UnicornAArch32 : IDisposable
|
||||
{
|
||||
internal readonly UnicornEngine.Unicorn uc;
|
||||
internal readonly UnicornEngine.Unicorn Uc;
|
||||
private bool _isDisposed;
|
||||
|
||||
public IndexedProperty<int, uint> R => new(GetX, SetX);
|
||||
@@ -84,7 +84,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
|
||||
public UnicornAArch32()
|
||||
{
|
||||
uc = new UnicornEngine.Unicorn(Common.UC_ARCH_ARM, Common.UC_MODE_LITTLE_ENDIAN);
|
||||
Uc = new UnicornEngine.Unicorn(Common.UC_ARCH_ARM, Common.UC_MODE_LITTLE_ENDIAN);
|
||||
|
||||
SetRegister(Arm.UC_ARM_REG_C1_C0_2, GetRegister(Arm.UC_ARM_REG_C1_C0_2) | 0xf00000);
|
||||
SetRegister(Arm.UC_ARM_REG_FPEXC, 0x40000000);
|
||||
@@ -105,7 +105,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
uc.Close();
|
||||
Uc.Close();
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
public void RunForCount(ulong count)
|
||||
{
|
||||
// FIXME: untilAddr should be 0xFFFFFFFFFFFFFFFFu
|
||||
uc.EmuStart(this.PC, -1, 0, (long)count);
|
||||
Uc.EmuStart(this.PC, -1, 0, (long)count);
|
||||
}
|
||||
|
||||
public void Step()
|
||||
@@ -121,7 +121,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
RunForCount(1);
|
||||
}
|
||||
|
||||
private static int[] XRegisters =
|
||||
private static readonly int[] _xRegisters =
|
||||
{
|
||||
Arm.UC_ARM_REG_R0,
|
||||
Arm.UC_ARM_REG_R1,
|
||||
@@ -141,7 +141,8 @@ namespace Ryujinx.Tests.Unicorn
|
||||
Arm.UC_ARM_REG_R15,
|
||||
};
|
||||
|
||||
private static int[] QRegisters =
|
||||
#pragma warning disable IDE0051, IDE0052 // Remove unused private member
|
||||
private static readonly int[] _qRegisters =
|
||||
{
|
||||
Arm.UC_ARM_REG_Q0,
|
||||
Arm.UC_ARM_REG_Q1,
|
||||
@@ -160,6 +161,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
Arm.UC_ARM_REG_Q14,
|
||||
Arm.UC_ARM_REG_Q15
|
||||
};
|
||||
#pragma warning restore IDE0051, IDE0052
|
||||
|
||||
public uint GetX(int index)
|
||||
{
|
||||
@@ -168,7 +170,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
}
|
||||
|
||||
return GetRegister(XRegisters[index]);
|
||||
return GetRegister(_xRegisters[index]);
|
||||
}
|
||||
|
||||
public void SetX(int index, uint value)
|
||||
@@ -178,7 +180,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
}
|
||||
|
||||
SetRegister(XRegisters[index], value);
|
||||
SetRegister(_xRegisters[index], value);
|
||||
}
|
||||
|
||||
public SimdValue GetQ(int index)
|
||||
@@ -206,7 +208,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
{
|
||||
byte[] data = new byte[4];
|
||||
|
||||
uc.RegRead(register, data);
|
||||
Uc.RegRead(register, data);
|
||||
|
||||
return BitConverter.ToUInt32(data, 0);
|
||||
}
|
||||
@@ -215,16 +217,16 @@ namespace Ryujinx.Tests.Unicorn
|
||||
{
|
||||
byte[] data = BitConverter.GetBytes(value);
|
||||
|
||||
uc.RegWrite(register, data);
|
||||
Uc.RegWrite(register, data);
|
||||
}
|
||||
|
||||
public SimdValue GetVector(int register)
|
||||
{
|
||||
byte[] data = new byte[8];
|
||||
|
||||
uc.RegRead(register, data);
|
||||
Uc.RegRead(register, data);
|
||||
ulong lo = BitConverter.ToUInt64(data, 0);
|
||||
uc.RegRead(register + 1, data);
|
||||
Uc.RegRead(register + 1, data);
|
||||
ulong hi = BitConverter.ToUInt64(data, 0);
|
||||
|
||||
return new SimdValue(lo, hi);
|
||||
@@ -233,16 +235,16 @@ namespace Ryujinx.Tests.Unicorn
|
||||
private void SetVector(int register, SimdValue value)
|
||||
{
|
||||
byte[] data = BitConverter.GetBytes(value.GetUInt64(0));
|
||||
uc.RegWrite(register, data);
|
||||
Uc.RegWrite(register, data);
|
||||
data = BitConverter.GetBytes(value.GetUInt64(1));
|
||||
uc.RegWrite(register + 1, data);
|
||||
Uc.RegWrite(register + 1, data);
|
||||
}
|
||||
|
||||
public byte[] MemoryRead(ulong address, ulong size)
|
||||
{
|
||||
byte[] value = new byte[size];
|
||||
|
||||
uc.MemRead((long)address, value);
|
||||
Uc.MemRead((long)address, value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -254,7 +256,7 @@ namespace Ryujinx.Tests.Unicorn
|
||||
|
||||
public void MemoryWrite(ulong address, byte[] value)
|
||||
{
|
||||
uc.MemWrite((long)address, value);
|
||||
Uc.MemWrite((long)address, value);
|
||||
}
|
||||
|
||||
public void MemoryWrite8(ulong address, byte value) => MemoryWrite(address, new[] { value });
|
||||
@@ -267,17 +269,17 @@ namespace Ryujinx.Tests.Unicorn
|
||||
|
||||
public void MemoryMap(ulong address, ulong size, MemoryPermission permissions)
|
||||
{
|
||||
uc.MemMap((long)address, (long)size, (int)permissions);
|
||||
Uc.MemMap((long)address, (long)size, (int)permissions);
|
||||
}
|
||||
|
||||
public void MemoryUnmap(ulong address, ulong size)
|
||||
{
|
||||
uc.MemUnmap((long)address, (long)size);
|
||||
Uc.MemUnmap((long)address, (long)size);
|
||||
}
|
||||
|
||||
public void MemoryProtect(ulong address, ulong size, MemoryPermission permissions)
|
||||
{
|
||||
uc.MemProtect((long)address, (long)size, (int)permissions);
|
||||
Uc.MemProtect((long)address, (long)size, (int)permissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user