From 39e48649e48c69e253d81ef2db060089151f1aff Mon Sep 17 00:00:00 2001 From: emmaus Date: Fri, 5 Oct 2018 12:19:38 +0000 Subject: [PATCH] style fixes, addressed comments --- .../HOS/Services/Am/ISelfController.cs | 6 ++- .../Aud/AudioRenderer/IAudioRenderer.cs | 40 ++++++++++--------- .../HOS/Services/Aud/IAudioRendererManager.cs | 11 +++-- .../HOS/Services/Irs/IIrSensorServer.cs | 10 ++--- Ryujinx.HLE/HOS/Services/Mm/IRequest.cs | 5 +++ 5 files changed, 43 insertions(+), 29 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs index ee24a73afb..ef69f598c6 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs @@ -150,20 +150,22 @@ namespace Ryujinx.HLE.HOS.Services.Am return 0; } + // SetIdleTimeDetectionExtension(u32) public long SetIdleTimeDetectionExtension(ServiceCtx Context) { IdleTimeDetectionExtension = Context.RequestData.ReadInt32(); - Context.Device.Log.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension = {IdleTimeDetectionExtension}"); + Context.Device.Log.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension: {IdleTimeDetectionExtension}"); return 0; } + // GetIdleTimeDetectionExtension() -> u32 public long GetIdleTimeDetectionExtension(ServiceCtx Context) { Context.ResponseData.Write(IdleTimeDetectionExtension); - Context.Device.Log.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension = {IdleTimeDetectionExtension}"); + Context.Device.Log.PrintStub(LogClass.ServiceAm, $"Stubbed. IdleTimeDetectionExtension: {IdleTimeDetectionExtension}"); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs index f93d1597fa..13225951e1 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs @@ -38,7 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer private int Track; - private bool IsStarted; + private PlayState PlayState; public IAudioRenderer( Horizon System, @@ -48,14 +48,14 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { m_Commands = new Dictionary() { - { 0, GetAudioRendererSampleRate }, - { 1, GetAudioRendererSampleCount }, - { 2, GetAudioRendererMixBufferCount }, - { 3, GetAudioRendererState }, - { 4, RequestUpdateAudioRenderer }, - { 5, StartAudioRenderer }, - { 6, StopAudioRenderer }, - { 7, QuerySystemEvent } + { 0, GetSampleRate }, + { 1, GetSampleCount }, + { 2, GetMixBufferCount }, + { 3, GetState }, + { 4, RequestUpdateAudioRenderer }, + { 5, StartAudioRenderer }, + { 6, StopAudioRenderer }, + { 7, QuerySystemEvent } }; UpdateEvent = new KEvent(System); @@ -75,35 +75,39 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer InitializeAudioOut(); - IsStarted = false; + PlayState = PlayState.Stopped; } - public long GetAudioRendererSampleRate(ServiceCtx Context) + // GetSampleRate() -> u32 + public long GetSampleRate(ServiceCtx Context) { Context.ResponseData.Write(Params.SampleRate); return 0; } - public long GetAudioRendererSampleCount(ServiceCtx Context) + // GetSampleCount() -> u32 + public long GetSampleCount(ServiceCtx Context) { Context.ResponseData.Write(Params.SampleCount); return 0; } - public long GetAudioRendererMixBufferCount(ServiceCtx Context) + // GetMixBufferCount() -> u32 + public long GetMixBufferCount(ServiceCtx Context) { Context.ResponseData.Write(Params.MixCount); return 0; } - private long GetAudioRendererState(ServiceCtx Context) + // GetState() -> u32 + private long GetState(ServiceCtx Context) { - Context.ResponseData.Write(!IsStarted); + Context.ResponseData.Write((int)PlayState); - Context.Device.Log.PrintStub(LogClass.ServiceAudio, $"Stubbed. Renderer State = {(IsStarted? "Started":"Stopped")}"); + Context.Device.Log.PrintStub(LogClass.ServiceAudio, $"Stubbed. Renderer State: {Enum.GetName(typeof(PlayState), PlayState)}"); return 0; } @@ -244,7 +248,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); - IsStarted = true; + PlayState = PlayState.Playing; return 0; } @@ -253,7 +257,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); - IsStarted = false; + PlayState = PlayState.Stopped; return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs index 3da4cb7d61..7859e0135d 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs @@ -163,21 +163,26 @@ namespace Ryujinx.HLE.HOS.Services.Aud return Result / 8; } + // GetAudioDeviceService(nn::applet::AppletResourceUserId) -> object public long GetAudioDeviceService(ServiceCtx Context) { - long UserId = Context.RequestData.ReadInt64(); + long AppletResourceUserId = Context.RequestData.ReadInt64(); MakeObject(Context, new IAudioDevice(Context.Device.System)); return 0; } + // GetAudioDeviceServiceWithRevisionInfo(nn::applet::AppletResourceUserId, u32) -> object private long GetAudioDeviceServiceWithRevisionInfo(ServiceCtx Context) { - Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + long AppletResourceUserId = Context.RequestData.ReadInt64(); + int RevisionInfo = Context.RequestData.ReadInt32(); + + Context.Device.Log.PrintStub(LogClass.ServiceAudio, $"Stubbed. AppletResourceUserId: {AppletResourceUserId} - " + + $"RevisionInfo: {RevisionInfo}"); return GetAudioDeviceService(Context); } - } } diff --git a/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs b/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs index d0b2ba1a9b..c635431405 100644 --- a/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs +++ b/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs @@ -23,24 +23,22 @@ namespace Ryujinx.HLE.HOS.Services.Irs }; } + // ActivateIrsensor(nn::applet::AppletResourceUserId, pid) public long ActivateIrsensor(ServiceCtx Context) { long AppletResourceUserId = Context.RequestData.ReadInt64(); - int IrsSensorHandle = Context.RequestData.ReadInt32(); - Context.Device.Log.PrintStub(LogClass.ServiceIrs, $"Stubbed. AppletResourceUserId: {AppletResourceUserId} - " + - $"IrsSensorHandle: {IrsSensorHandle}"); + Context.Device.Log.PrintStub(LogClass.ServiceIrs, $"Stubbed. AppletResourceUserId: {AppletResourceUserId}"); return 0; } + // DeactivateIrsensor(nn::applet::AppletResourceUserId, pid) public long DeactivateIrsensor(ServiceCtx Context) { long AppletResourceUserId = Context.RequestData.ReadInt64(); - int IrsSensorHandle = Context.RequestData.ReadInt32(); - Context.Device.Log.PrintStub(LogClass.ServiceIrs, $"Stubbed. AppletResourceUserId: {AppletResourceUserId} - " + - $"IrsSensorHandle: {IrsSensorHandle}"); + Context.Device.Log.PrintStub(LogClass.ServiceIrs, $"Stubbed. AppletResourceUserId: {AppletResourceUserId}"); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs index e5a256ecdb..2a92cf76c5 100644 --- a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs @@ -22,8 +22,13 @@ namespace Ryujinx.HLE.HOS.Services.Mm }; } + // InitializeOld(u32, u32, u32) public long InitializeOld(ServiceCtx Context) { + int Unknown0 = Context.RequestData.ReadInt32(); + int Unknown1 = Context.RequestData.ReadInt32(); + int Unknown2 = Context.RequestData.ReadInt32(); + Context.Device.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); return 0;