0
0
Fork 0

Misc cleanup (#708)

* Fix typos

* Remove unneeded using statements

* Enforce var style more

* Remove redundant qualifiers

* Fix some indentation

* Disable naming warnings on files with external enum names

* Fix build

* Mass find & replace for comments with no spacing

* Standardize todo capitalization and for/if spacing
This commit is contained in:
Alex Barney 2019-07-01 21:39:22 -05:00 committed by Ac_K
parent 10c74182ba
commit b2b736abc2
205 changed files with 1020 additions and 1041 deletions

View file

@ -10,7 +10,7 @@ namespace ChocolArm64.Decoders
{
uint pc = GetPc();
//When the codition is never, the instruction is BLX to Thumb mode.
// When the condition is never, the instruction is BLX to Thumb mode.
if (Cond != Condition.Nv)
{
pc &= ~3u;

View file

@ -24,7 +24,7 @@ namespace ChocolArm64.Instructions
}
else
{
context.EmitLdint(InstEmit32Helper.GetRegisterAlias(context.Mode, register));
context.EmitLdint(GetRegisterAlias(context.Mode, register));
}
}

View file

@ -229,7 +229,7 @@ namespace ChocolArm64.Instructions
context.Emit(OpCodes.Br, lblEnd);
//Address check passsed.
// Address check passed.
context.MarkLabel(lblEx);
context.EmitLdarg(TranslatedSub.MemoryArgIdx);

View file

@ -30,22 +30,22 @@ namespace ChocolArm64.Memory
return ptr;
}
public static bool Reprotect(IntPtr address, ulong size, Memory.MemoryProtection protection)
public static bool Reprotect(IntPtr address, ulong size, MemoryProtection protection)
{
MmapProts prot = GetProtection(protection);
return Syscall.mprotect(address, size, prot) == 0;
}
private static MmapProts GetProtection(Memory.MemoryProtection protection)
private static MmapProts GetProtection(MemoryProtection protection)
{
switch (protection)
{
case Memory.MemoryProtection.None: return MmapProts.PROT_NONE;
case Memory.MemoryProtection.Read: return MmapProts.PROT_READ;
case Memory.MemoryProtection.ReadAndWrite: return MmapProts.PROT_READ | MmapProts.PROT_WRITE;
case Memory.MemoryProtection.ReadAndExecute: return MmapProts.PROT_READ | MmapProts.PROT_EXEC;
case Memory.MemoryProtection.Execute: return MmapProts.PROT_EXEC;
case MemoryProtection.None: return MmapProts.PROT_NONE;
case MemoryProtection.Read: return MmapProts.PROT_READ;
case MemoryProtection.ReadAndWrite: return MmapProts.PROT_READ | MmapProts.PROT_WRITE;
case MemoryProtection.ReadAndExecute: return MmapProts.PROT_READ | MmapProts.PROT_EXEC;
case MemoryProtection.Execute: return MmapProts.PROT_EXEC;
default: throw new ArgumentException($"Invalid permission \"{protection}\".");
}

View file

@ -32,7 +32,7 @@ namespace ChocolArm64.Translation
public TranslatedSub(DynamicMethod method, TranslationTier tier, bool rejit)
{
Method = method ?? throw new ArgumentNullException(nameof(method));;
Method = method ?? throw new ArgumentNullException(nameof(method));
Tier = tier;
_rejit = rejit;
}

View file

@ -206,7 +206,7 @@ namespace Ryujinx.Audio
return defaultAudioDevice;
}
for(var i = 0; i < audioContext.BackendCount; i++)
for (int i = 0; i < audioContext.BackendCount; i++)
{
SoundIODevice audioDevice = audioContext.GetOutputDevice(i);

View file

@ -140,7 +140,7 @@ namespace Ryujinx.Audio.SoundIo
}
/// <summary>
/// Attempers to get a <see cref="SoundIoAudioTrack"/> from the pool
/// Attempts to get a <see cref="SoundIoAudioTrack"/> from the pool
/// </summary>
/// <param name="track">The track retrieved from the pool</param>
/// <returns>True if retrieve was successful</returns>

View file

@ -13,19 +13,19 @@ namespace Ryujinx.Common.Logging
public LogEventArgs(LogLevel level, TimeSpan time, int threadId, string message)
{
this.Level = level;
this.Time = time;
this.ThreadId = threadId;
this.Message = message;
Level = level;
Time = time;
ThreadId = threadId;
Message = message;
}
public LogEventArgs(LogLevel level, TimeSpan time, int threadId, string message, object data)
{
this.Level = level;
this.Time = time;
this.ThreadId = threadId;
this.Message = message;
this.Data = data;
Level = level;
Time = time;
ThreadId = threadId;
Message = message;
Data = data;
}
}
}

View file

@ -19,7 +19,7 @@ namespace Ryujinx.Common
public T Allocate()
{
var instance = _firstItem;
T instance = _firstItem;
if (instance == null || instance != Interlocked.CompareExchange(ref _firstItem, null, instance))
{
@ -31,11 +31,11 @@ namespace Ryujinx.Common
private T AllocateInternal()
{
var items = _items;
T[] items = _items;
for (int i = 0; i < items.Length; i++)
{
var instance = items[i];
T instance = items[i];
if (instance != null && instance == Interlocked.CompareExchange(ref items[i], null, instance))
{
@ -60,7 +60,7 @@ namespace Ryujinx.Common
private void ReleaseInternal(T obj)
{
var items = _items;
T[] items = _items;
for (int i = 0; i < items.Length; i++)
{

View file

@ -104,9 +104,9 @@ namespace Ryujinx.Graphics
}
else
{
int sumissionMode = (word >> 29) & 7;
int submissionMode = (word >> 29) & 7;
switch (sumissionMode)
switch (submissionMode)
{
case 1:
// Incrementing.

View file

@ -1,4 +1,5 @@
using System;
// ReSharper disable InconsistentNaming
using System;
namespace Ryujinx.Graphics.Gal
{

View file

@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Gal
instruction = word0 | (ulong)word1 << 32;
//Zero instructions (other kind of NOP) stop immediatly,
// Zero instructions (other kind of NOP) stop immediately,
// this is to avoid two rows of zeroes
if (instruction == 0)
{
@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Gal
offset += 8;
}
//Align to meet nvdisasm requeriments
// Align to meet nvdisasm requirements
while (offset % 0x20 != 0)
{
fullWriter.Write(0);

View file

@ -171,7 +171,7 @@ namespace Ryujinx.Graphics.Graphics3d
break;
}
//Move result and use as Method Address, then fetch and send paramter.
// Move result and use as Method Address, then fetch and send parameter.
case AssignmentOperation.MoveAndSetMaddrThenFetchAndSend:
{
SetDstGpr(result);

View file

@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
private int _level;
private string _identation;
private string _indentation;
public CodeGenContext(ShaderConfig config)
{
@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
public void AppendLine(string str)
{
_sb.AppendLine(_identation + str);
_sb.AppendLine(_indentation + str);
}
public string GetCode()
@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
_level++;
UpdateIdentation();
UpdateIndentation();
}
public void LeaveScope(string suffix = "")
@ -65,26 +65,26 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
_level--;
UpdateIdentation();
UpdateIndentation();
AppendLine("}" + suffix);
}
private void UpdateIdentation()
private void UpdateIndentation()
{
_identation = GetIdentation(_level);
_indentation = GetIndentation(_level);
}
private static string GetIdentation(int level)
private static string GetIndentation(int level)
{
string identation = string.Empty;
string indentation = string.Empty;
for (int index = 0; index < level; index++)
{
identation += Tab;
indentation += Tab;
}
return identation;
return indentation;
}
}
}

View file

@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
OpUnary = Op | 1,
OpBinary = Op | 2,
OpTernary = Op | 3,
OpBinaryCom = OpBinary | Comutative,
OpBinaryCom = OpBinary | Commutative,
CallNullary = Call | 0,
CallUnary = Call | 1,
@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
CallTernary = Call | 3,
CallQuaternary = Call | 4,
Comutative = 1 << 8,
Commutative = 1 << 8,
Op = 1 << 9,
Call = 1 << 10,
Special = 1 << 11,

View file

@ -187,7 +187,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
public static string GetUbName(GalShaderType shaderType, int slot)
{
string ubName = OperandManager.GetShaderStagePrefix(shaderType);
string ubName = GetShaderStagePrefix(shaderType);
ubName += "_" + DefaultNames.UniformNamePrefix + slot;

View file

@ -1,3 +1,4 @@
// ReSharper disable InconsistentNaming
using Ryujinx.Graphics.Shader.Instructions;
namespace Ryujinx.Graphics.Shader.Decoders

View file

@ -146,7 +146,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
AddNode(gotoTempAsg);
//For block 0, we don't need to add the extra "reset" at the beggining,
// For block 0, we don't need to add the extra "reset" at the beginning,
// because it is already the first node to be executed on the shader,
// so it is reset to false by the "local" assignment anyway.
if (block.Index != 0)

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
{
case Instruction.Add:
case Instruction.BitwiseExclusiveOr:
TryEliminateBinaryOpComutative(operation, 0);
TryEliminateBinaryOpCommutative(operation, 0);
break;
case Instruction.BitwiseAnd:
@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
break;
case Instruction.Multiply:
TryEliminateBinaryOpComutative(operation, 1);
TryEliminateBinaryOpCommutative(operation, 1);
break;
case Instruction.ShiftLeft:
@ -101,7 +101,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
}
}
private static void TryEliminateBinaryOpComutative(Operation operation, int comparand)
private static void TryEliminateBinaryOpCommutative(Operation operation, int comparand)
{
Operand x = operation.GetSource(0);
Operand y = operation.GetSource(1);

View file

@ -1,10 +1,8 @@
using Ryujinx.Common;
using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Ipc;
using Ryujinx.HLE.HOS.Services;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;

View file

@ -2909,7 +2909,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
}
} while (!ConsumeIf("E"));
}
// ::= sr <unresolved-type> [tempate-args] <base-unresolved-name> # T::x / decltype(p)::x
// ::= sr <unresolved-type> [template-args] <base-unresolved-name> # T::x / decltype(p)::x
else
{
result = ParseUnresolvedType();

View file

@ -1980,9 +1980,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
for (int unit = MappingUnitSizes.Length - 1; unit >= 0 && va == 0; unit--)
{
int alignemnt = MappingUnitSizes[unit];
int alignment = MappingUnitSizes[unit];
va = AllocateVa(AliasRegionStart, regionPagesCount, neededPagesCount, alignemnt);
va = AllocateVa(AliasRegionStart, regionPagesCount, neededPagesCount, alignment);
}
if (va == 0)
@ -2451,7 +2451,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
newNode.Value.SetState(newPermission, newState, newAttribute);
MergeEqualStateNeighbours(newNode);
MergeEqualStateNeighbors(newNode);
}
if (currEndAddr - 1 >= endAddr - 1)
@ -2472,7 +2472,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
MemoryPermission permission = MemoryPermission.None,
MemoryAttribute attribute = MemoryAttribute.None)
{
//Inserts new block at the list, replacing and spliting
// Inserts new block at the list, replacing and splitting
// existing blocks as needed.
int oldCount = _blocks.Count;
@ -2505,7 +2505,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
newNode.Value.SetState(permission, state, attribute);
MergeEqualStateNeighbours(newNode);
MergeEqualStateNeighbors(newNode);
}
if (currEndAddr - 1 >= endAddr - 1)
@ -2537,7 +2537,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
BlockMutator blockMutate,
MemoryPermission permission = MemoryPermission.None)
{
//Inserts new block at the list, replacing and spliting
// Inserts new block at the list, replacing and splitting
// existing blocks as needed, then calling the callback
// function on the new block.
int oldCount = _blocks.Count;
@ -2573,7 +2573,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
blockMutate(newBlock, permission);
MergeEqualStateNeighbours(newNode);
MergeEqualStateNeighbors(newNode);
}
if (currEndAddr - 1 >= endAddr - 1)
@ -2587,7 +2587,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
_blockAllocator.Count += _blocks.Count - oldCount;
}
private void MergeEqualStateNeighbours(LinkedListNode<KMemoryBlock> node)
private void MergeEqualStateNeighbors(LinkedListNode<KMemoryBlock> node)
{
KMemoryBlock block = node.Value;

View file

@ -1,10 +1,8 @@
using ChocolArm64.Memory;
using ChocolArm64.State;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Diagnostics.Demangler;
using Ryujinx.HLE.HOS.Kernel.Memory;
using Ryujinx.HLE.Loaders.Elf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

View file

@ -173,7 +173,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
continue;
}
//All candiates are already selected, choose the best one
// All candidates are already selected, choose the best one
// (the first one that doesn't make the source core idle if moved).
for (int index = 0; index < srcCoresHighestPrioThreadsCount; index++)
{

View file

@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
{ 21, GetPopFromGeneralChannelEvent }
};
//ToDo: Signal this Event somewhere in future.
// TODO: Signal this Event somewhere in future.
_channelEvent = new KEvent(system);
}

View file

@ -108,7 +108,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
long position = context.Request.PtrBuff[0].Position;
long size = context.Request.PtrBuff[0].Size;
//Todo: Write the buffer content.
// TODO: Write the buffer content.
Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), unknown0 });

View file

@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
};
_baseFile = baseFile;
Path = LibHac.Fs.PathTools.Normalize(path);
Path = PathTools.Normalize(path);
}
// Read(u32 readOption, u64 offset, u64 size) -> (u64 out_size, buffer<u8, 0x46, 0> out_buf)

View file

@ -306,7 +306,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
try
{
LibHac.Fs.DirectoryEntryType entryType = _provider.GetEntryType(name);
DirectoryEntryType entryType = _provider.GetEntryType(name);
context.ResponseData.Write((int)entryType);
}

View file

@ -312,7 +312,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
private void ImportTitleKeysFromNsp(LibHac.Fs.IFileSystem nsp, Keyset keySet)
{
foreach (LibHac.Fs.DirectoryEntry ticketEntry in nsp.EnumerateEntries("*.tik"))
foreach (DirectoryEntry ticketEntry in nsp.EnumerateEntries("*.tik"))
{
Ticket ticket = new Ticket(nsp.OpenFile(ticketEntry.FullPath, OpenMode.Read).AsStream());

View file

@ -1014,7 +1014,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
context.Request.PtrBuff[1].Position,
context.Request.PtrBuff[1].Size);
//Todo: Read all handles and values from buffer.
// TODO: Read all handles and values from buffer.
Logger.PrintStub(LogClass.ServiceHid, new {
appletResourceUserId,
@ -1137,7 +1137,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
long counter0 = context.RequestData.ReadInt64();
long counter1 = context.RequestData.ReadInt64();
// Todo: Determine if array<nn::sf::NativeHandle> is a buffer or not...
// TODO: Determine if array<nn::sf::NativeHandle> is a buffer or not...
Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, counter0, counter1 });

View file

@ -1,5 +1,4 @@
using LibHac;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using System;
using System.Collections.Generic;

View file

@ -1,6 +1,5 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Pctl

View file

@ -1,7 +1,5 @@
using Ryujinx.HLE.HOS.Ipc;
using System;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.HLE.HOS.Services.Pm
{

View file

@ -1,4 +1,5 @@
namespace Ryujinx.HLE.HOS.Services.Android
// ReSharper disable InconsistentNaming
namespace Ryujinx.HLE.HOS.Services.Android
{
class ColorShift
{

View file

@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
if (Header.IntsCount != 0x51)
{
throw new System.NotImplementedException($"Unexpected Graphic Buffer ints count (expected 0x51, found 0x{Header.IntsCount:x}");
throw new NotImplementedException($"Unexpected Graphic Buffer ints count (expected 0x51, found 0x{Header.IntsCount:x}");
}
Buffer = reader.ReadStruct<NvGraphicBuffer>();

View file

@ -1,7 +1,6 @@
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Memory;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS;
using Ryujinx.HLE.HOS.Services.Nv.NvMap;

View file

@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.SystemState
internal string ActiveAudioOutput { get; private set; }
public bool DiscordIntergrationEnabled { get; set; }
public bool DiscordIntegrationEnabled { get; set; }
public bool DockedMode { get; set; }

View file

@ -19,7 +19,7 @@ namespace Ryujinx.HLE.Input
device.Memory.FillWithZeros(hidPosition, Horizon.HidSize);
}
public void InitilizePrimaryController(HidControllerType controllerType)
public void InitializePrimaryController(HidControllerType controllerType)
{
HidControllerId controllerId = controllerType == HidControllerType.Handheld ?
HidControllerId.ControllerHandheld : HidControllerId.ControllerPlayer1;
@ -39,7 +39,7 @@ namespace Ryujinx.HLE.Input
PrimaryController.Connect(controllerId);
}
public void InitilizeKeyboard()
public void InitializeKeyboard()
{
_device.Memory.FillWithZeros(HidPosition + HidKeyboardOffset, HidKeyboardSize);
}

View file

@ -34,7 +34,7 @@ namespace Ryujinx.HLE.Loaders.Compression
int encCount = (token >> 0) & 0xf;
int litCount = (token >> 4) & 0xf;
//Copy literal chunck
// Copy literal chunk
litCount = GetLength(litCount);
Buffer.BlockCopy(cmp, cmpPos, dec, decPos, litCount);
@ -47,7 +47,7 @@ namespace Ryujinx.HLE.Loaders.Compression
break;
}
//Copy compressed chunck
// Copy compressed chunk
int back = cmp[cmpPos++] << 0 |
cmp[cmpPos++] << 8;

View file

@ -15,11 +15,11 @@ namespace Ryujinx.HLE.Loaders.Npdm
BinaryReader reader = new BinaryReader(stream);
int byteReaded = 0;
int bytesRead = 0;
Dictionary<string, bool> services = new Dictionary<string, bool>();
while (byteReaded != size)
while (bytesRead != size)
{
byte controlByte = reader.ReadByte();
@ -33,7 +33,7 @@ namespace Ryujinx.HLE.Loaders.Npdm
services[Encoding.ASCII.GetString(reader.ReadBytes(length))] = registerAllowed;
byteReaded += length + 1;
bytesRead += length + 1;
}
Services = new ReadOnlyDictionary<string, bool>(services);

View file

@ -37,7 +37,7 @@ namespace Ryujinx.HLE.Utilities
public static byte[] HexToBytes(string hexString)
{
//Ignore last charactor if HexLength % 2 != 0.
// Ignore last character if HexLength % 2 != 0.
int bytesInHex = hexString.Length / 2;
byte[] output = new byte[bytesInHex];

View file

@ -80,7 +80,7 @@ namespace Ryujinx.Profiler
Monitor.Exit(_timerQueueClearLock);
}
// Only sleep if queue was sucessfully cleared
// Only sleep if queue was successfully cleared
if (queueCleared)
{
Thread.Sleep(5);
@ -92,9 +92,9 @@ namespace Ryujinx.Profiler
{
int count = 0;
while (_timerQueue.TryDequeue(out var item))
while (_timerQueue.TryDequeue(out TimerQueueValue item))
{
if (!Timers.TryGetValue(item.Config, out var value))
if (!Timers.TryGetValue(item.Config, out TimingInfo value))
{
value = new TimingInfo();
Timers.Add(item.Config, value);
@ -206,9 +206,9 @@ namespace Ryujinx.Profiler
return (_timingFlagAverages, _timingFlagLastDelta);
}
public void RegisterFlagReciever(Action<TimingFlag> reciever)
public void RegisterFlagReceiver(Action<TimingFlag> receiver)
{
_timingFlagCallback = reciever;
_timingFlagCallback = receiver;
}
public void Dispose()

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Profiler
private static ProfilerSettings _settings;
[Conditional("USE_PROFILING")]
public static void Initalize()
public static void Initialize()
{
var config = ProfilerConfiguration.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ProfilerConfig.jsonc"));
@ -70,11 +70,11 @@ namespace Ryujinx.Profiler
}
[Conditional("USE_PROFILING")]
public static void RegisterFlagReciever(Action<TimingFlag> reciever)
public static void RegisterFlagReceiver(Action<TimingFlag> receiver)
{
if (!ProfilingEnabled())
return;
_profileInstance.RegisterFlagReciever(reciever);
_profileInstance.RegisterFlagReceiver(receiver);
}
[Conditional("USE_PROFILING")]

View file

@ -1,9 +1,6 @@
using OpenTK.Input;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Utf8Json;
using Utf8Json.Resolvers;
@ -58,7 +55,7 @@ namespace Ryujinx.Profiler
return default(T);
}
var enumName = formatterResolver.GetFormatterWithVerify<string>()
string enumName = formatterResolver.GetFormatterWithVerify<string>()
.Deserialize(ref reader, formatterResolver);
if (Enum.TryParse<T>(enumName, out T result))

View file

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Input;
using OpenTK.Input;
namespace Ryujinx.Profiler
{

View file

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.Profiler
namespace Ryujinx.Profiler
{
public class ProfilerSettings
{

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace Ryujinx.Profiler
namespace Ryujinx.Profiler
{
public enum TimingFlagType
{

View file

@ -107,7 +107,7 @@ namespace Ryujinx.Profiler
_timestamps.Add(_currentTimestamp);
}
var delta = _currentTimestamp.EndTime - _currentTimestamp.BeginTime;
long delta = _currentTimestamp.EndTime - _currentTimestamp.BeginTime;
TotalTime += delta;
Instant += delta;

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.Profiler.UI
{

View file

@ -98,7 +98,7 @@ namespace Ryujinx.Profiler.UI
private readonly object _profileDataLock = new object();
public ProfileWindow()
// Graphigs mode enables 2xAA
// Graphics mode enables 2xAA
: base(1280, 720, new GraphicsMode(new ColorFormat(8, 8, 8, 8), 1, 1, 2))
{
Title = "Profiler";
@ -108,7 +108,7 @@ namespace Ryujinx.Profiler.UI
if (Profile.UpdateRate <= 0)
{
// Perform step regardless of flag type
Profile.RegisterFlagReciever((t) =>
Profile.RegisterFlagReceiver((t) =>
{
if (!_paused)
{
@ -146,7 +146,7 @@ namespace Ryujinx.Profiler.UI
{
GL.ClearColor(Color.Black);
_fontService = new FontService();
_fontService.InitalizeTextures();
_fontService.InitializeTextures();
_fontService.UpdateScreenHeight(Height);
_buttons = new ProfileButton[(int)ButtonIndex.Count];

View file

@ -18,7 +18,7 @@ namespace Ryujinx.Profiler.UI
float barHeight = (LineHeight - LinePadding) / 3.0f;
// Get max values
var maxInstant = maxAverage = maxTotal = 0;
long maxInstant = maxAverage = maxTotal = 0;
foreach (KeyValuePair<ProfileConfig, TimingInfo> kvp in _sortedProfileData)
{
maxInstant = Math.Max(maxInstant, kvp.Value.Instant);

View file

@ -7,8 +7,8 @@ namespace Ryujinx.Profiler.UI
{
public partial class ProfileWindow
{
// Colour index equal to timing flag type as int
private Color[] _timingFlagColours = new[]
// Color index equal to timing flag type as int
private Color[] _timingFlagColors = new[]
{
new Color(150, 25, 25, 50), // FrameSwap = 0
new Color(25, 25, 150, 50), // SystemFrame = 1
@ -62,7 +62,7 @@ namespace Ryujinx.Profiler.UI
if (prevType != timingFlag.FlagType)
{
prevType = timingFlag.FlagType;
GL.Color4(_timingFlagColours[(int)prevType]);
GL.Color4(_timingFlagColors[(int)prevType]);
}
int x = (int)(graphRight - ((graphPositionTicks - timingFlag.Timestamp) / timeWidthTicks) * width);

View file

@ -1,5 +1,4 @@
using System.Diagnostics;
using System.Threading;
using System.Threading;
using OpenTK;
using OpenTK.Input;
using Ryujinx.Common;

View file

@ -36,7 +36,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers
private string GetFontPath()
{
string fontFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
string fontFolder = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
// Only uses Arial, add more fonts here if wanted
string path = Path.Combine(fontFolder, "arial.ttf");
@ -48,7 +48,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers
throw new Exception($"Profiler exception. Required font Courier New or Arial not installed to {fontFolder}");
}
public void InitalizeTextures()
public void InitializeTextures()
{
// Create and init some vars
uint[] rawCharacterSheet = new uint[SheetWidth * SheetHeight];
@ -66,7 +66,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers
// Update raw data for each character
for (int i = 0; i < 94; i++)
{
var surface = RenderSurface((char)(i + 33), font, out var xBearing, out var yBearing, out var advance);
var surface = RenderSurface((char)(i + 33), font, out float xBearing, out float yBearing, out float advance);
characters[i] = UpdateTexture(surface, ref rawCharacterSheet, ref x, ref y, ref lineOffset);
characters[i].BearingX = xBearing;
@ -217,7 +217,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers
lineOffset = 0;
}
// Update lineoffset
// Update lineOffset
if (lineOffset < height)
{
lineOffset = height + 1;

View file

@ -9,8 +9,8 @@ namespace Ryujinx.Tests.Unicorn
public IndexedProperty(Func<TIndex, TValue> getFunc, Action<TIndex, TValue> setAction)
{
this.GetFunc = getFunc;
this.SetAction = setAction;
GetFunc = getFunc;
SetAction = setAction;
}
public TValue this[TIndex i]

View file

@ -1,3 +1,4 @@
// ReSharper disable InconsistentNaming
namespace Ryujinx.Tests.Unicorn.Native
{
public enum ArmRegister

View file

@ -15,7 +15,7 @@ namespace Ryujinx.Tests.Unicorn.Native
public static void MarshalArrayOf<T>(IntPtr input, int length, out T[] output)
{
var size = Marshal.SizeOf(typeof(T));
int size = Marshal.SizeOf(typeof(T));
output = new T[length];
for (int i = 0; i < length; i++)

View file

@ -1,3 +1,4 @@
// ReSharper disable InconsistentNaming
namespace Ryujinx.Tests.Unicorn.Native
{
public enum UnicornMode

View file

@ -1,3 +1,4 @@
using Ryujinx.Tests.Unicorn.Native;
using System;
using System.Diagnostics.Contracts;
using System.Runtime.Intrinsics;
@ -31,38 +32,38 @@ namespace Ryujinx.Tests.Unicorn
public ulong LR
{
get { return GetRegister(Native.ArmRegister.LR); }
set { SetRegister(Native.ArmRegister.LR, value); }
get { return GetRegister(ArmRegister.LR); }
set { SetRegister(ArmRegister.LR, value); }
}
public ulong SP
{
get { return GetRegister(Native.ArmRegister.SP); }
set { SetRegister(Native.ArmRegister.SP, value); }
get { return GetRegister(ArmRegister.SP); }
set { SetRegister(ArmRegister.SP, value); }
}
public ulong PC
{
get { return GetRegister(Native.ArmRegister.PC); }
set { SetRegister(Native.ArmRegister.PC, value); }
get { return GetRegister(ArmRegister.PC); }
set { SetRegister(ArmRegister.PC, value); }
}
public uint Pstate
{
get { return (uint)GetRegister(Native.ArmRegister.PSTATE); }
set { SetRegister(Native.ArmRegister.PSTATE, (uint)value); }
get { return (uint)GetRegister(ArmRegister.PSTATE); }
set { SetRegister(ArmRegister.PSTATE, (uint)value); }
}
public int Fpcr
{
get { return (int)GetRegister(Native.ArmRegister.FPCR); }
set { SetRegister(Native.ArmRegister.FPCR, (uint)value); }
get { return (int)GetRegister(ArmRegister.FPCR); }
set { SetRegister(ArmRegister.FPCR, (uint)value); }
}
public int Fpsr
{
get { return (int)GetRegister(Native.ArmRegister.FPSR); }
set { SetRegister(Native.ArmRegister.FPSR, (uint)value); }
get { return (int)GetRegister(ArmRegister.FPSR); }
set { SetRegister(ArmRegister.FPSR, (uint)value); }
}
public bool OverflowFlag
@ -91,18 +92,18 @@ namespace Ryujinx.Tests.Unicorn
public UnicornAArch64()
{
Native.Interface.Checked(Native.Interface.uc_open((uint)Native.UnicornArch.UC_ARCH_ARM64, (uint)Native.UnicornMode.UC_MODE_LITTLE_ENDIAN, out uc));
SetRegister(Native.ArmRegister.CPACR_EL1, 0x00300000);
Interface.Checked(Interface.uc_open((uint)UnicornArch.UC_ARCH_ARM64, (uint)UnicornMode.UC_MODE_LITTLE_ENDIAN, out uc));
SetRegister(ArmRegister.CPACR_EL1, 0x00300000);
}
~UnicornAArch64()
{
Native.Interface.Checked(Native.Interface.uc_close(uc));
Interface.Checked(Interface.uc_close(uc));
}
public void RunForCount(ulong count)
{
Native.Interface.Checked(Native.Interface.uc_emu_start(uc, this.PC, 0xFFFFFFFFFFFFFFFFu, 0, count));
Interface.Checked(Interface.uc_emu_start(uc, PC, 0xFFFFFFFFFFFFFFFFu, 0, count));
}
public void Step()
@ -110,94 +111,94 @@ namespace Ryujinx.Tests.Unicorn
RunForCount(1);
}
internal static Native.ArmRegister[] X_registers = new Native.ArmRegister[31]
internal static ArmRegister[] X_registers = new ArmRegister[31]
{
Native.ArmRegister.X0,
Native.ArmRegister.X1,
Native.ArmRegister.X2,
Native.ArmRegister.X3,
Native.ArmRegister.X4,
Native.ArmRegister.X5,
Native.ArmRegister.X6,
Native.ArmRegister.X7,
Native.ArmRegister.X8,
Native.ArmRegister.X9,
Native.ArmRegister.X10,
Native.ArmRegister.X11,
Native.ArmRegister.X12,
Native.ArmRegister.X13,
Native.ArmRegister.X14,
Native.ArmRegister.X15,
Native.ArmRegister.X16,
Native.ArmRegister.X17,
Native.ArmRegister.X18,
Native.ArmRegister.X19,
Native.ArmRegister.X20,
Native.ArmRegister.X21,
Native.ArmRegister.X22,
Native.ArmRegister.X23,
Native.ArmRegister.X24,
Native.ArmRegister.X25,
Native.ArmRegister.X26,
Native.ArmRegister.X27,
Native.ArmRegister.X28,
Native.ArmRegister.X29,
Native.ArmRegister.X30,
ArmRegister.X0,
ArmRegister.X1,
ArmRegister.X2,
ArmRegister.X3,
ArmRegister.X4,
ArmRegister.X5,
ArmRegister.X6,
ArmRegister.X7,
ArmRegister.X8,
ArmRegister.X9,
ArmRegister.X10,
ArmRegister.X11,
ArmRegister.X12,
ArmRegister.X13,
ArmRegister.X14,
ArmRegister.X15,
ArmRegister.X16,
ArmRegister.X17,
ArmRegister.X18,
ArmRegister.X19,
ArmRegister.X20,
ArmRegister.X21,
ArmRegister.X22,
ArmRegister.X23,
ArmRegister.X24,
ArmRegister.X25,
ArmRegister.X26,
ArmRegister.X27,
ArmRegister.X28,
ArmRegister.X29,
ArmRegister.X30,
};
internal static Native.ArmRegister[] Q_registers = new Native.ArmRegister[32]
internal static ArmRegister[] Q_registers = new ArmRegister[32]
{
Native.ArmRegister.Q0,
Native.ArmRegister.Q1,
Native.ArmRegister.Q2,
Native.ArmRegister.Q3,
Native.ArmRegister.Q4,
Native.ArmRegister.Q5,
Native.ArmRegister.Q6,
Native.ArmRegister.Q7,
Native.ArmRegister.Q8,
Native.ArmRegister.Q9,
Native.ArmRegister.Q10,
Native.ArmRegister.Q11,
Native.ArmRegister.Q12,
Native.ArmRegister.Q13,
Native.ArmRegister.Q14,
Native.ArmRegister.Q15,
Native.ArmRegister.Q16,
Native.ArmRegister.Q17,
Native.ArmRegister.Q18,
Native.ArmRegister.Q19,
Native.ArmRegister.Q20,
Native.ArmRegister.Q21,
Native.ArmRegister.Q22,
Native.ArmRegister.Q23,
Native.ArmRegister.Q24,
Native.ArmRegister.Q25,
Native.ArmRegister.Q26,
Native.ArmRegister.Q27,
Native.ArmRegister.Q28,
Native.ArmRegister.Q29,
Native.ArmRegister.Q30,
Native.ArmRegister.Q31,
ArmRegister.Q0,
ArmRegister.Q1,
ArmRegister.Q2,
ArmRegister.Q3,
ArmRegister.Q4,
ArmRegister.Q5,
ArmRegister.Q6,
ArmRegister.Q7,
ArmRegister.Q8,
ArmRegister.Q9,
ArmRegister.Q10,
ArmRegister.Q11,
ArmRegister.Q12,
ArmRegister.Q13,
ArmRegister.Q14,
ArmRegister.Q15,
ArmRegister.Q16,
ArmRegister.Q17,
ArmRegister.Q18,
ArmRegister.Q19,
ArmRegister.Q20,
ArmRegister.Q21,
ArmRegister.Q22,
ArmRegister.Q23,
ArmRegister.Q24,
ArmRegister.Q25,
ArmRegister.Q26,
ArmRegister.Q27,
ArmRegister.Q28,
ArmRegister.Q29,
ArmRegister.Q30,
ArmRegister.Q31,
};
internal ulong GetRegister(Native.ArmRegister register)
internal ulong GetRegister(ArmRegister register)
{
byte[] value_bytes = new byte[8];
Native.Interface.Checked(Native.Interface.uc_reg_read(uc, (int)register, value_bytes));
Interface.Checked(Interface.uc_reg_read(uc, (int)register, value_bytes));
return (ulong)BitConverter.ToInt64(value_bytes, 0);
}
internal void SetRegister(Native.ArmRegister register, ulong value)
internal void SetRegister(ArmRegister register, ulong value)
{
byte[] value_bytes = BitConverter.GetBytes(value);
Native.Interface.Checked(Native.Interface.uc_reg_write(uc, (int)register, value_bytes));
Interface.Checked(Interface.uc_reg_write(uc, (int)register, value_bytes));
}
internal Vector128<float> GetVector(Native.ArmRegister register)
internal Vector128<float> GetVector(ArmRegister register)
{
byte[] value_bytes = new byte[16];
Native.Interface.Checked(Native.Interface.uc_reg_read(uc, (int)register, value_bytes));
Interface.Checked(Interface.uc_reg_read(uc, (int)register, value_bytes));
unsafe
{
fixed (byte* p = &value_bytes[0])
@ -207,7 +208,7 @@ namespace Ryujinx.Tests.Unicorn
}
}
internal void SetVector(Native.ArmRegister register, Vector128<float> value)
internal void SetVector(ArmRegister register, Vector128<float> value)
{
byte[] value_bytes = new byte[16];
unsafe
@ -217,7 +218,7 @@ namespace Ryujinx.Tests.Unicorn
Sse.Store((float*)p, value);
}
}
Native.Interface.Checked(Native.Interface.uc_reg_write(uc, (int)register, value_bytes));
Interface.Checked(Interface.uc_reg_write(uc, (int)register, value_bytes));
}
public ulong GetX(int index)
@ -251,7 +252,7 @@ namespace Ryujinx.Tests.Unicorn
public byte[] MemoryRead(ulong address, ulong size)
{
byte[] value = new byte[size];
Native.Interface.Checked(Native.Interface.uc_mem_read(uc, address, value, size));
Interface.Checked(Interface.uc_mem_read(uc, address, value, size));
return value;
}
@ -262,7 +263,7 @@ namespace Ryujinx.Tests.Unicorn
public void MemoryWrite(ulong address, byte[] value)
{
Native.Interface.Checked(Native.Interface.uc_mem_write(uc, address, value, (ulong)value.Length));
Interface.Checked(Interface.uc_mem_write(uc, address, value, (ulong)value.Length));
}
public void MemoryWrite8 (ulong address, byte value) { MemoryWrite(address, new byte[]{value}); }
@ -275,23 +276,23 @@ namespace Ryujinx.Tests.Unicorn
public void MemoryMap(ulong address, ulong size, MemoryPermission permissions)
{
Native.Interface.Checked(Native.Interface.uc_mem_map(uc, address, size, (uint)permissions));
Interface.Checked(Interface.uc_mem_map(uc, address, size, (uint)permissions));
}
public void MemoryUnmap(ulong address, ulong size)
{
Native.Interface.Checked(Native.Interface.uc_mem_unmap(uc, address, size));
Interface.Checked(Interface.uc_mem_unmap(uc, address, size));
}
public void MemoryProtect(ulong address, ulong size, MemoryPermission permissions)
{
Native.Interface.Checked(Native.Interface.uc_mem_protect(uc, address, size, (uint)permissions));
Interface.Checked(Interface.uc_mem_protect(uc, address, size, (uint)permissions));
}
public void DumpMemoryInformation()
{
Native.Interface.Checked(Native.Interface.uc_mem_regions(uc, out IntPtr regions_raw, out uint length));
Native.Interface.MarshalArrayOf<Native.UnicornMemoryRegion>(regions_raw, (int)length, out var regions);
Interface.Checked(Interface.uc_mem_regions(uc, out IntPtr regions_raw, out uint length));
Interface.MarshalArrayOf<UnicornMemoryRegion>(regions_raw, (int)length, out var regions);
foreach (var region in regions)
{
Console.WriteLine("region: begin {0:X16} end {1:X16} perms {2:X8}", region.begin, region.end, region.perms);
@ -302,7 +303,7 @@ namespace Ryujinx.Tests.Unicorn
{
try
{
Native.Interface.uc_version(out uint major, out uint minor);
Interface.uc_version(out uint major, out uint minor);
return true;
}
catch (DllNotFoundException)

View file

@ -1,3 +1,4 @@
// ReSharper disable InconsistentNaming
namespace Ryujinx.Tests.Unicorn
{
public enum UnicornError
@ -17,7 +18,7 @@ namespace Ryujinx.Tests.Unicorn
UC_ERR_WRITE_PROT, // Quit emulation due to UC_MEM_WRITE_PROT violation: uc_emu_start()
UC_ERR_READ_PROT, // Quit emulation due to UC_MEM_READ_PROT violation: uc_emu_start()
UC_ERR_FETCH_PROT, // Quit emulation due to UC_MEM_FETCH_PROT violation: uc_emu_start()
UC_ERR_ARG, // Inavalid argument provided to uc_xxx function (See specific function API)
UC_ERR_ARG, // Invalid argument provided to uc_xxx function (See specific function API)
UC_ERR_READ_UNALIGNED, // Unaligned read
UC_ERR_WRITE_UNALIGNED, // Unaligned write
UC_ERR_FETCH_UNALIGNED, // Unaligned fetch

View file

@ -4,19 +4,19 @@
// Dump shaders in local directory (e.g. `C:\ShaderDumps`)
"graphics_shaders_dump_path": "",
// Enable print debug logs
// Enable printing debug logs
"logging_enable_debug": false,
// Enable print stubbed calls logs
// Enable printing stubbed calls logs
"logging_enable_stub": true,
// Enable print informations logs
// Enable printing information logs
"logging_enable_info": true,
// Enable print warning logs
// Enable printing warning logs
"logging_enable_warn": true,
// Enable print error logs
// Enable printing error logs
"logging_enable_error": true,
// Enable printing guest logs
@ -38,8 +38,8 @@
// Enable or disable Docked Mode
"docked_mode": false,
// Enable or disable Discord Rich Presense
"enable_discord_intergration": true,
// Enable or disable Discord Rich Presence
"enable_discord_integration": true,
// Enable or disable Game Vsync
"enable_vsync": true,

View file

@ -83,9 +83,9 @@ namespace Ryujinx
public bool DockedMode { get; private set; }
/// <summary>
/// Enables or disables Discord Rich Presense
/// Enables or disables Discord Rich Presence
/// </summary>
public bool EnableDiscordIntergration { get; private set; }
public bool EnableDiscordIntegration { get; private set; }
/// <summary>
/// Enables or disables Vertical Sync
@ -220,7 +220,7 @@ namespace Ryujinx
}
}
device.System.State.DiscordIntergrationEnabled = Instance.EnableDiscordIntergration;
device.System.State.DiscordIntegrationEnabled = Instance.EnableDiscordIntegration;
device.EnableDeviceVsync = Instance.EnableVsync;
@ -254,8 +254,8 @@ namespace Ryujinx
}
}
device.Hid.InitilizePrimaryController(Instance.ControllerType);
device.Hid.InitilizeKeyboard();
device.Hid.InitializePrimaryController(Instance.ControllerType);
device.Hid.InitializeKeyboard();
}
private class ConfigurationEnumFormatter<T> : IJsonFormatter<T>
@ -274,7 +274,7 @@ namespace Ryujinx
return default(T);
}
var enumName = formatterResolver.GetFormatterWithVerify<string>()
string enumName = formatterResolver.GetFormatterWithVerify<string>()
.Deserialize(ref reader, formatterResolver);
if (Enum.TryParse<T>(enumName, out T result))

View file

@ -32,12 +32,12 @@ namespace Ryujinx
Configuration.Load(Path.Combine(ApplicationDirectory, "Config.jsonc"));
Configuration.Configure(device);
Profile.Initalize();
Profile.Initialize();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
if (device.System.State.DiscordIntergrationEnabled == true)
if (device.System.State.DiscordIntegrationEnabled == true)
{
DiscordClient = new DiscordRpcClient("568815339807309834");
DiscordPresence = new RichPresence
@ -108,7 +108,7 @@ namespace Ryujinx
Logger.PrintWarning(LogClass.Application, "Please specify the folder with the NSOs/IStorage or a NSO/NRO.");
}
if (device.System.State.DiscordIntergrationEnabled == true)
if (device.System.State.DiscordIntegrationEnabled == true)
{
if (File.ReadAllLines(Path.Combine(ApplicationDirectory, "RPsupported.dat")).Contains(device.System.TitleID))
{

View file

@ -4,7 +4,6 @@ using OpenTK.Input;
using Ryujinx.Graphics.Gal;
using Ryujinx.HLE;
using Ryujinx.HLE.Input;
using Ryujinx.Profiler;
using Ryujinx.Profiler.UI;
using System;
using System.Threading;

View file

@ -1,6 +1,5 @@
using OpenTK.Input;
using Ryujinx.HLE.Input;
using Ryujinx.Common.Logging;
namespace Ryujinx.UI.Input
{

View file

@ -393,11 +393,11 @@
false
]
},
"enable_discord_intergration": {
"$id": "#/properties/enable_discord_intergration",
"enable_discord_integration": {
"$id": "#/properties/enable_discord_integration",
"type": "boolean",
"title": "Enable Discord Rich Presense",
"description": "Enable or disable Discord Rich Presense",
"title": "Enable Discord Rich Presence",
"description": "Enable or disable Discord Rich Presence",
"default": true,
"examples": [
true,