From 85dbb9559ad317a657dafd24da27fec4b3f5250f Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Tue, 4 Dec 2018 14:23:37 -0600 Subject: Adjust naming conventions and general refactoring in HLE Project (#490) * Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Remove unneeded property setters --- Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs | 110 ++++++++++----------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Aud/AudioOut') diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs index 1ad049c6..93bda210 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs @@ -9,19 +9,19 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut { class IAudioOut : IpcService, IDisposable { - private Dictionary m_Commands; + private Dictionary _commands; - public override IReadOnlyDictionary Commands => m_Commands; + public override IReadOnlyDictionary Commands => _commands; - private IAalOutput AudioOut; + private IAalOutput _audioOut; - private KEvent ReleaseEvent; + private KEvent _releaseEvent; - private int Track; + private int _track; - public IAudioOut(IAalOutput AudioOut, KEvent ReleaseEvent, int Track) + public IAudioOut(IAalOutput audioOut, KEvent releaseEvent, int track) { - m_Commands = new Dictionary() + _commands = new Dictionary { { 0, GetAudioOutState }, { 1, StartAudioOut }, @@ -34,116 +34,116 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut { 8, GetReleasedAudioOutBufferAuto } }; - this.AudioOut = AudioOut; - this.ReleaseEvent = ReleaseEvent; - this.Track = Track; + _audioOut = audioOut; + _releaseEvent = releaseEvent; + _track = track; } - public long GetAudioOutState(ServiceCtx Context) + public long GetAudioOutState(ServiceCtx context) { - Context.ResponseData.Write((int)AudioOut.GetState(Track)); + context.ResponseData.Write((int)_audioOut.GetState(_track)); return 0; } - public long StartAudioOut(ServiceCtx Context) + public long StartAudioOut(ServiceCtx context) { - AudioOut.Start(Track); + _audioOut.Start(_track); return 0; } - public long StopAudioOut(ServiceCtx Context) + public long StopAudioOut(ServiceCtx context) { - AudioOut.Stop(Track); + _audioOut.Stop(_track); return 0; } - public long AppendAudioOutBuffer(ServiceCtx Context) + public long AppendAudioOutBuffer(ServiceCtx context) { - return AppendAudioOutBufferImpl(Context, Context.Request.SendBuff[0].Position); + return AppendAudioOutBufferImpl(context, context.Request.SendBuff[0].Position); } - public long RegisterBufferEvent(ServiceCtx Context) + public long RegisterBufferEvent(ServiceCtx context) { - if (Context.Process.HandleTable.GenerateHandle(ReleaseEvent.ReadableEvent, out int Handle) != KernelResult.Success) + if (context.Process.HandleTable.GenerateHandle(_releaseEvent.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } - Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); return 0; } - public long GetReleasedAudioOutBuffer(ServiceCtx Context) + public long GetReleasedAudioOutBuffer(ServiceCtx context) { - long Position = Context.Request.ReceiveBuff[0].Position; - long Size = Context.Request.ReceiveBuff[0].Size; + long position = context.Request.ReceiveBuff[0].Position; + long size = context.Request.ReceiveBuff[0].Size; - return GetReleasedAudioOutBufferImpl(Context, Position, Size); + return GetReleasedAudioOutBufferImpl(context, position, size); } - public long ContainsAudioOutBuffer(ServiceCtx Context) + public long ContainsAudioOutBuffer(ServiceCtx context) { - long Tag = Context.RequestData.ReadInt64(); + long tag = context.RequestData.ReadInt64(); - Context.ResponseData.Write(AudioOut.ContainsBuffer(Track, Tag) ? 1 : 0); + context.ResponseData.Write(_audioOut.ContainsBuffer(_track, tag) ? 1 : 0); return 0; } - public long AppendAudioOutBufferAuto(ServiceCtx Context) + public long AppendAudioOutBufferAuto(ServiceCtx context) { - (long Position, long Size) = Context.Request.GetBufferType0x21(); + (long position, long size) = context.Request.GetBufferType0x21(); - return AppendAudioOutBufferImpl(Context, Position); + return AppendAudioOutBufferImpl(context, position); } - public long AppendAudioOutBufferImpl(ServiceCtx Context, long Position) + public long AppendAudioOutBufferImpl(ServiceCtx context, long position) { - long Tag = Context.RequestData.ReadInt64(); + long tag = context.RequestData.ReadInt64(); - AudioOutData Data = MemoryHelper.Read( - Context.Memory, - Position); + AudioOutData data = MemoryHelper.Read( + context.Memory, + position); - byte[] Buffer = Context.Memory.ReadBytes( - Data.SampleBufferPtr, - Data.SampleBufferSize); + byte[] buffer = context.Memory.ReadBytes( + data.SampleBufferPtr, + data.SampleBufferSize); - AudioOut.AppendBuffer(Track, Tag, Buffer); + _audioOut.AppendBuffer(_track, tag, buffer); return 0; } - public long GetReleasedAudioOutBufferAuto(ServiceCtx Context) + public long GetReleasedAudioOutBufferAuto(ServiceCtx context) { - (long Position, long Size) = Context.Request.GetBufferType0x22(); + (long position, long size) = context.Request.GetBufferType0x22(); - return GetReleasedAudioOutBufferImpl(Context, Position, Size); + return GetReleasedAudioOutBufferImpl(context, position, size); } - public long GetReleasedAudioOutBufferImpl(ServiceCtx Context, long Position, long Size) + public long GetReleasedAudioOutBufferImpl(ServiceCtx context, long position, long size) { - uint Count = (uint)((ulong)Size >> 3); + uint count = (uint)((ulong)size >> 3); - long[] ReleasedBuffers = AudioOut.GetReleasedBuffers(Track, (int)Count); + long[] releasedBuffers = _audioOut.GetReleasedBuffers(_track, (int)count); - for (uint Index = 0; Index < Count; Index++) + for (uint index = 0; index < count; index++) { - long Tag = 0; + long tag = 0; - if (Index < ReleasedBuffers.Length) + if (index < releasedBuffers.Length) { - Tag = ReleasedBuffers[Index]; + tag = releasedBuffers[index]; } - Context.Memory.WriteInt64(Position + Index * 8, Tag); + context.Memory.WriteInt64(position + index * 8, tag); } - Context.ResponseData.Write(ReleasedBuffers.Length); + context.ResponseData.Write(releasedBuffers.Length); return 0; } @@ -153,11 +153,11 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut Dispose(true); } - protected virtual void Dispose(bool Disposing) + protected virtual void Dispose(bool disposing) { - if (Disposing) + if (disposing) { - AudioOut.CloseTrack(Track); + _audioOut.CloseTrack(_track); } } } -- cgit v1.2.3