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

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

View file

@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
public long PopLaunchParameter(ServiceCtx context)
{
//Only the first 0x18 bytes of the Data seems to be actually used.
// Only the first 0x18 bytes of the Data seems to be actually used.
MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams()));
return 0;
@ -74,7 +74,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
public long GetDisplayVersion(ServiceCtx context)
{
//FIXME: Need to check correct version on a switch.
// FIXME: Need to check correct version on a switch.
context.ResponseData.Write(1L);
context.ResponseData.Write(0L);

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

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

@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
public long Write(ServiceCtx context)
{
//TODO: Error conditions.
// TODO: Error conditions.
long writePosition = context.RequestData.ReadInt64();
(long position, long size) = context.Request.GetBufferType0x21();
@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
public long Read(ServiceCtx context)
{
//TODO: Error conditions.
// TODO: Error conditions.
long readPosition = context.RequestData.ReadInt64();
(long position, long size) = context.Request.GetBufferType0x22();

View file

@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
public static byte[] MakeLaunchParams()
{
//Size needs to be at least 0x88 bytes otherwise application errors.
// Size needs to be at least 0x88 bytes otherwise application errors.
using (MemoryStream ms = new MemoryStream())
{
BinaryWriter writer = new BinaryWriter(ms);

View file

@ -16,11 +16,11 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
class IAudioRenderer : IpcService, IDisposable
{
//This is the amount of samples that are going to be appended
//each time that RequestUpdateAudioRenderer is called. Ideally,
//this value shouldn't be neither too small (to avoid the player
//starving due to running out of samples) or too large (to avoid
//high latency).
// This is the amount of samples that are going to be appended
// each time that RequestUpdateAudioRenderer is called. Ideally,
// this value shouldn't be neither too small (to avoid the player
// starving due to running out of samples) or too large (to avoid
// high latency).
private const int MixBufferSamplesCount = 960;
private Dictionary<int, ServiceProcessRequest> _commands;

View file

@ -5,6 +5,6 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
[StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)]
struct VoiceChannelResourceIn
{
//???
// ???
}
}

View file

@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
if (_acquired && !newState)
{
//Release.
// Release.
Reset();
}
@ -124,9 +124,9 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
private void UpdateBuffer(MemoryManager memory)
{
//TODO: Implement conversion for formats other
//than interleaved stereo (2 channels).
//As of now, it assumes that HostChannelsCount == 2.
// TODO: Implement conversion for formats other
// than interleaved stereo (2 channels).
// As of now, it assumes that HostChannelsCount == 2.
WaveBuffer wb = WaveBuffers[_bufferIndex];
if (wb.Position == 0)
@ -173,9 +173,9 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
if (SampleRate != AudioConsts.HostSampleRate)
{
//TODO: We should keep the frames being discarded (see the 4 below)
//on a buffer and include it on the next samples buffer, to allow
//the resampler to do seamless interpolation between wave buffers.
// TODO: We should keep the frames being discarded (see the 4 below)
// on a buffer and include it on the next samples buffer, to allow
// the resampler to do seamless interpolation between wave buffers.
int samplesCount = _samples.Length / AudioConsts.HostChannelsCount;
samplesCount = Math.Max(samplesCount - 4, 0);

View file

@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud
_systemEvent = new KEvent(system);
//TODO: We shouldn't be signaling this here.
// TODO: We shouldn't be signaling this here.
_systemEvent.ReadableEvent.Signal();
}

View file

@ -37,8 +37,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud
{
long result = DecodeInterleaved(context);
//TODO: Figure out what this value is.
//According to switchbrew, it is now used.
// TODO: Figure out what this value is.
// According to switchbrew, it is now used.
context.ResponseData.Write(0L);
return result;

View file

@ -30,7 +30,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud
public long GetWorkBufferSize(ServiceCtx context)
{
//Note: The sample rate is ignored because it is fixed to 48KHz.
// Note: The sample rate is ignored because it is fixed to 48KHz.
int sampleRate = context.RequestData.ReadInt32();
int channelsCount = context.RequestData.ReadInt32();

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Bcat
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Bcat
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Caps
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Caps
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

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

@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
IpcBuffDesc buffDesc = context.Request.ReceiveBuff[0];
//Use smaller length to avoid overflows.
// Use smaller length to avoid overflows.
if (size > buffDesc.Size)
{
size = buffDesc.Size;

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

@ -523,7 +523,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr
NrrInfo info;
result = ParseNrr(out info, context, nrrAddress, nrrSize);
if(result == 0)
if (result == 0)
{
if (_nrrInfos.Count >= MaxNrr)
{

View file

@ -32,8 +32,8 @@ namespace Ryujinx.HLE.HOS.Services.Ns
{
Logger.PrintStub(LogClass.ServiceNs);
//TODO: This is supposed to write a u32 array aswell.
//It's unknown what it contains.
// TODO: This is supposed to write a u32 array aswell.
// It's unknown what it contains.
context.ResponseData.Write(0);
return 0;

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

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

View file

@ -93,7 +93,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
throw new NotImplementedException($"{fdData.Name} {cmd:x4}");
}
//TODO: Verify if the error codes needs to be translated.
// TODO: Verify if the error codes needs to be translated.
context.ResponseData.Write(result);
return 0;
@ -127,7 +127,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
int fd = context.RequestData.ReadInt32();
int eventId = context.RequestData.ReadInt32();
//TODO: Use Fd/EventId, different channels have different events.
// TODO: Use Fd/EventId, different channels have different events.
if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out int handle) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");

View file

@ -50,25 +50,25 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
{
long mapEnd = position + size;
//Check if size is valid (0 is also not allowed).
// Check if size is valid (0 is also not allowed).
if ((ulong)mapEnd <= (ulong)position)
{
return false;
}
//Check if address is page aligned.
// Check if address is page aligned.
if ((position & NvGpuVmm.PageMask) != 0)
{
return false;
}
//Check if region is reserved.
// Check if region is reserved.
if (BinarySearch(_reservations, position) == null)
{
return false;
}
//Check for overlap with already mapped buffers.
// Check for overlap with already mapped buffers.
Range map = BinarySearchLt(_maps, mapEnd);
if (map != null && map.End > (ulong)position)

View file

@ -64,8 +64,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
lock (asCtx)
{
//Note: When the fixed offset flag is not set,
//the Offset field holds the alignment size instead.
// Note: When the fixed offset flag is not set,
// the Offset field holds the alignment size instead.
if ((args.Flags & FlagFixedOffset) != 0)
{
args.Offset = asCtx.Vmm.ReserveFixed(args.Offset, (long)size);
@ -218,8 +218,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
lock (asCtx)
{
//Note: When the fixed offset flag is not set,
//the Offset field holds the alignment size instead.
// Note: When the fixed offset flag is not set,
// the Offset field holds the alignment size instead.
bool vaAllocated = (args.Flags & FlagFixedOffset) == 0;
if (!vaAllocated)

View file

@ -69,14 +69,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
context.Device.Gpu.PushCommandBuffer(vmm, cmdBufData);
}
//TODO: Relocation, waitchecks, etc.
// TODO: Relocation, waitchecks, etc.
return NvResult.Success;
}
private static int GetSyncpoint(ServiceCtx context)
{
//TODO
// TODO
long inputPosition = context.Request.GetBufferType0x21().Position;
long outputPosition = context.Request.GetBufferType0x22().Position;

View file

@ -208,8 +208,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
{
syncpt.AddWaiter(args.Thresh, waitEvent);
//Note: Negative (> INT_MAX) timeouts aren't valid on .NET,
//in this case we just use the maximum timeout possible.
// Note: Negative (> INT_MAX) timeouts aren't valid on .NET,
// in this case we just use the maximum timeout possible.
int timeout = args.Timeout;
if (timeout < -1)

View file

@ -128,9 +128,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
if (address == 0)
{
//When the address is zero, we need to allocate
//our own backing memory for the NvMap.
//TODO: Is this allocation inside the transfer memory?
// When the address is zero, we need to allocate
// our own backing memory for the NvMap.
// TODO: Is this allocation inside the transfer memory?
result = NvResult.OutOfMemory;
}
@ -208,8 +208,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
case NvMapHandleParam.Kind: args.Result = map.Kind; break;
case NvMapHandleParam.Compr: args.Result = 0; break;
//Note: Base is not supported and returns an error.
//Any other value also returns an error.
// Note: Base is not supported and returns an error.
// Any other value also returns an error.
default: return NvResult.InvalidInput;
}

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

@ -29,8 +29,8 @@ namespace Ryujinx.HLE.HOS.Services.Pl
{
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
//We don't need to do anything here because we do lazy initialization
//on SharedFontManager (the font is loaded when necessary).
// We don't need to do anything here because we do lazy initialization
// on SharedFontManager (the font is loaded when necessary).
return 0;
}
@ -38,8 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Pl
{
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
//1 (true) indicates that the font is already loaded.
//All fonts are already loaded.
// 1 (true) indicates that the font is already loaded.
// All fonts are already loaded.
context.ResponseData.Write(1);
return 0;

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

@ -62,7 +62,7 @@ namespace Ryujinx.HLE.HOS.Services.Set
const string version = "3.0.0";
const string build = "NintendoSDK Firmware for NX 3.0.0-10.0";
//http://switchbrew.org/index.php?title=System_Version_Title
// http://switchbrew.org/index.php?title=System_Version_Title
using (MemoryStream ms = new MemoryStream(0x100))
{
BinaryWriter writer = new BinaryWriter(ms);
@ -177,7 +177,7 @@ namespace Ryujinx.HLE.HOS.Services.Set
long titleId = 0x0100000000000809;
string contentPath = device.System.ContentManager.GetInstalledContentPath(titleId, StorageId.NandSystem, ContentType.Data);
if(string.IsNullOrWhiteSpace(contentPath))
if (string.IsNullOrWhiteSpace(contentPath))
{
return null;
}

View file

@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Services.Set
{
static class NxSettings
{
//Generated automatically from a Switch 3.0 config file (Tid: 0100000000000818).
// Generated automatically from a Switch 3.0 config file (Tid: 0100000000000818).
public static Dictionary<string, object> Settings = new Dictionary<string, object>
{
{ "account!na_required_for_network_service", true },

View file

@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
//...
// ...
};
}
}

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

@ -81,7 +81,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi
MemoryHelper.FillWithZeros(context.Memory, recBuffPtr, 0x60);
//Add only the default display to buffer
// Add only the default display to buffer
context.Memory.WriteBytes(recBuffPtr, Encoding.ASCII.GetBytes("Default"));
context.Memory.WriteInt64(recBuffPtr + 0x40, 0x1L);
context.Memory.WriteInt64(recBuffPtr + 0x48, 0x1L);
@ -186,14 +186,14 @@ namespace Ryujinx.HLE.HOS.Services.Vi
if (!convertedScalingMode.HasValue)
{
//Scaling mode out of the range of valid values.
// Scaling mode out of the range of valid values.
return MakeError(ErrorModule.Vi, 1);
}
if (scalingMode != SrcScalingMode.ScaleToWindow &&
scalingMode != SrcScalingMode.PreserveAspectRatio)
{
//Invalid scaling mode specified.
// Invalid scaling mode specified.
return MakeError(ErrorModule.Vi, 6);
}
@ -239,7 +239,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi
{
BinaryWriter writer = new BinaryWriter(ms);
//flat_binder_object (size is 0x28)
// flat_binder_object (size is 0x28)
writer.Write(2); //Type (BINDER_TYPE_WEAK_BINDER)
writer.Write(0); //Flags
writer.Write((int)(id >> 0));

View file

@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi
public static long GetDisplayMode(ServiceCtx context)
{
//TODO: De-hardcode resolution.
// TODO: De-hardcode resolution.
context.ResponseData.Write(1280);
context.ResponseData.Write(720);
context.ResponseData.Write(60.0f);

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;
@ -213,7 +212,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
private long GbpDequeueBuffer(ServiceCtx context, BinaryReader parcelReader)
{
//TODO: Errors.
// TODO: Errors.
int format = parcelReader.ReadInt32();
int width = parcelReader.ReadInt32();
int height = parcelReader.ReadInt32();
@ -229,7 +228,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
{
context.Device.Statistics.RecordGameFrameTime();
//TODO: Errors.
// TODO: Errors.
int slot = parcelReader.ReadInt32();
long Position = parcelReader.BaseStream.Position;
@ -260,7 +259,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
private long GbpCancelBuffer(ServiceCtx context, BinaryReader parcelReader)
{
//TODO: Errors.
// TODO: Errors.
int slot = parcelReader.ReadInt32();
MultiFence fence = ReadFlattenedObject<MultiFence>(parcelReader);
@ -401,7 +400,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
int BlockHeight = 1 << _bufferQueue[slot].Data.Buffer.Surfaces[0].BlockHeightLog2;
//Note: Rotation is being ignored.
// Note: Rotation is being ignored.
int top = crop.Top;
int left = crop.Left;