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

@ -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;