From 3c82c8de8c8687579171a624c4345781519d9d66 Mon Sep 17 00:00:00 2001 From: emmauss Date: Thu, 22 Mar 2018 01:30:10 +0200 Subject: rename some services (#63) --- Ryujinx.Core/OsHle/Services/Am/ISelfController.cs | 4 +- .../OsHle/Services/Aud/IAudioOutManager.cs | 94 ++++++++++++++++++++++ .../OsHle/Services/Aud/IAudioRendererManager.cs | 59 ++++++++++++++ Ryujinx.Core/OsHle/Services/Aud/ServiceAudOut.cs | 94 ---------------------- Ryujinx.Core/OsHle/Services/Aud/ServiceAudRen.cs | 59 -------------- Ryujinx.Core/OsHle/Services/ServiceFactory.cs | 4 +- 6 files changed, 157 insertions(+), 157 deletions(-) create mode 100644 Ryujinx.Core/OsHle/Services/Aud/IAudioOutManager.cs create mode 100644 Ryujinx.Core/OsHle/Services/Aud/IAudioRendererManager.cs delete mode 100644 Ryujinx.Core/OsHle/Services/Aud/ServiceAudOut.cs delete mode 100644 Ryujinx.Core/OsHle/Services/Aud/ServiceAudRen.cs diff --git a/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs b/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs index 28047159..bf928f79 100644 --- a/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs +++ b/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Core.OsHle.Services.Am { m_Commands = new Dictionary() { - { 1, Exit }, + { 1, LockExit }, { 10, SetScreenShotPermission }, { 11, SetOperationModeChangedNotification }, { 12, SetPerformanceModeChangedNotification }, @@ -23,7 +23,7 @@ namespace Ryujinx.Core.OsHle.Services.Am }; } - public long Exit(ServiceCtx Context) + public long LockExit(ServiceCtx Context) { return 0; } diff --git a/Ryujinx.Core/OsHle/Services/Aud/IAudioOutManager.cs b/Ryujinx.Core/OsHle/Services/Aud/IAudioOutManager.cs new file mode 100644 index 00000000..986b5c1e --- /dev/null +++ b/Ryujinx.Core/OsHle/Services/Aud/IAudioOutManager.cs @@ -0,0 +1,94 @@ +using ChocolArm64.Memory; +using Ryujinx.Audio; +using Ryujinx.Core.OsHle.Handles; +using Ryujinx.Core.OsHle.Ipc; +using System.Collections.Generic; +using System.Text; + +namespace Ryujinx.Core.OsHle.Services.Aud +{ + class IAudioOutManager : IpcService + { + private Dictionary m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public IAudioOutManager() + { + m_Commands = new Dictionary() + { + { 0, ListAudioOuts }, + { 1, OpenAudioOut } + }; + } + + public long ListAudioOuts(ServiceCtx Context) + { + long Position = Context.Request.ReceiveBuff[0].Position; + + AMemoryHelper.WriteBytes(Context.Memory, Position, Encoding.ASCII.GetBytes("iface")); + + Context.ResponseData.Write(1); + + return 0; + } + + public long OpenAudioOut(ServiceCtx Context) + { + IAalOutput AudioOut = Context.Ns.AudioOut; + + string DeviceName = AMemoryHelper.ReadAsciiString( + Context.Memory, + Context.Request.SendBuff[0].Position, + Context.Request.SendBuff[0].Size); + + if (DeviceName == string.Empty) + { + DeviceName = "FIXME"; + } + + long DeviceNamePosition = Context.Request.ReceiveBuff[0].Position; + long DeviceNameSize = Context.Request.ReceiveBuff[0].Size; + + byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName); + + if (DeviceName.Length <= DeviceNameSize) + { + AMemoryHelper.WriteBytes(Context.Memory, DeviceNamePosition, DeviceNameBuffer); + } + + int SampleRate = Context.RequestData.ReadInt32(); + int Channels = Context.RequestData.ReadInt32(); + + Channels = (ushort)(Channels >> 16); + + if (SampleRate == 0) + { + SampleRate = 48000; + } + + if (Channels < 1 || Channels > 2) + { + Channels = 2; + } + + KEvent ReleaseEvent = new KEvent(); + + ReleaseCallback Callback = () => + { + ReleaseEvent.Handle.Set(); + }; + + int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback, out AudioFormat Format); + + MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track)); + + Context.ResponseData.Write(SampleRate); + Context.ResponseData.Write(Channels); + Context.ResponseData.Write((int)Format); + Context.ResponseData.Write((int)PlaybackState.Stopped); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Aud/IAudioRendererManager.cs b/Ryujinx.Core/OsHle/Services/Aud/IAudioRendererManager.cs new file mode 100644 index 00000000..fcf084a9 --- /dev/null +++ b/Ryujinx.Core/OsHle/Services/Aud/IAudioRendererManager.cs @@ -0,0 +1,59 @@ +using Ryujinx.Core.OsHle.Ipc; +using System.Collections.Generic; + +namespace Ryujinx.Core.OsHle.Services.Aud +{ + class IAudioRendererManager : IpcService + { + private Dictionary m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public IAudioRendererManager() + { + m_Commands = new Dictionary() + { + { 0, OpenAudioRenderer }, + { 1, GetAudioRendererWorkBufferSize }, + { 2, GetAudioDevice } + }; + } + + public long OpenAudioRenderer(ServiceCtx Context) + { + MakeObject(Context, new IAudioRenderer()); + + return 0; + } + + public long GetAudioRendererWorkBufferSize(ServiceCtx Context) + { + int SampleRate = Context.RequestData.ReadInt32(); + int Unknown4 = Context.RequestData.ReadInt32(); + int Unknown8 = Context.RequestData.ReadInt32(); + int UnknownC = Context.RequestData.ReadInt32(); + int Unknown10 = Context.RequestData.ReadInt32(); + int Unknown14 = Context.RequestData.ReadInt32(); + int Unknown18 = Context.RequestData.ReadInt32(); + int Unknown1c = Context.RequestData.ReadInt32(); + int Unknown20 = Context.RequestData.ReadInt32(); + int Unknown24 = Context.RequestData.ReadInt32(); + int Unknown28 = Context.RequestData.ReadInt32(); + int Unknown2c = Context.RequestData.ReadInt32(); + int Rev1Magic = Context.RequestData.ReadInt32(); + + Context.ResponseData.Write(0x400L); + + return 0; + } + + public long GetAudioDevice(ServiceCtx Context) + { + long UserId = Context.RequestData.ReadInt64(); + + MakeObject(Context, new IAudioDevice()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Aud/ServiceAudOut.cs b/Ryujinx.Core/OsHle/Services/Aud/ServiceAudOut.cs deleted file mode 100644 index dd362c15..00000000 --- a/Ryujinx.Core/OsHle/Services/Aud/ServiceAudOut.cs +++ /dev/null @@ -1,94 +0,0 @@ -using ChocolArm64.Memory; -using Ryujinx.Audio; -using Ryujinx.Core.OsHle.Handles; -using Ryujinx.Core.OsHle.Ipc; -using System.Collections.Generic; -using System.Text; - -namespace Ryujinx.Core.OsHle.Services.Aud -{ - class ServiceAudOut : IpcService - { - private Dictionary m_Commands; - - public override IReadOnlyDictionary Commands => m_Commands; - - public ServiceAudOut() - { - m_Commands = new Dictionary() - { - { 0, ListAudioOuts }, - { 1, OpenAudioOut } - }; - } - - public long ListAudioOuts(ServiceCtx Context) - { - long Position = Context.Request.ReceiveBuff[0].Position; - - AMemoryHelper.WriteBytes(Context.Memory, Position, Encoding.ASCII.GetBytes("iface")); - - Context.ResponseData.Write(1); - - return 0; - } - - public long OpenAudioOut(ServiceCtx Context) - { - IAalOutput AudioOut = Context.Ns.AudioOut; - - string DeviceName = AMemoryHelper.ReadAsciiString( - Context.Memory, - Context.Request.SendBuff[0].Position, - Context.Request.SendBuff[0].Size); - - if (DeviceName == string.Empty) - { - DeviceName = "FIXME"; - } - - long DeviceNamePosition = Context.Request.ReceiveBuff[0].Position; - long DeviceNameSize = Context.Request.ReceiveBuff[0].Size; - - byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName); - - if (DeviceName.Length <= DeviceNameSize) - { - AMemoryHelper.WriteBytes(Context.Memory, DeviceNamePosition, DeviceNameBuffer); - } - - int SampleRate = Context.RequestData.ReadInt32(); - int Channels = Context.RequestData.ReadInt32(); - - Channels = (ushort)(Channels >> 16); - - if (SampleRate == 0) - { - SampleRate = 48000; - } - - if (Channels < 1 || Channels > 2) - { - Channels = 2; - } - - KEvent ReleaseEvent = new KEvent(); - - ReleaseCallback Callback = () => - { - ReleaseEvent.Handle.Set(); - }; - - int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback, out AudioFormat Format); - - MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track)); - - Context.ResponseData.Write(SampleRate); - Context.ResponseData.Write(Channels); - Context.ResponseData.Write((int)Format); - Context.ResponseData.Write((int)PlaybackState.Stopped); - - return 0; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Aud/ServiceAudRen.cs b/Ryujinx.Core/OsHle/Services/Aud/ServiceAudRen.cs deleted file mode 100644 index 245d85d8..00000000 --- a/Ryujinx.Core/OsHle/Services/Aud/ServiceAudRen.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Ryujinx.Core.OsHle.Ipc; -using System.Collections.Generic; - -namespace Ryujinx.Core.OsHle.Services.Aud -{ - class ServiceAudRen : IpcService - { - private Dictionary m_Commands; - - public override IReadOnlyDictionary Commands => m_Commands; - - public ServiceAudRen() - { - m_Commands = new Dictionary() - { - { 0, OpenAudioRenderer }, - { 1, GetAudioRendererWorkBufferSize }, - { 2, GetAudioDevice } - }; - } - - public long OpenAudioRenderer(ServiceCtx Context) - { - MakeObject(Context, new IAudioRenderer()); - - return 0; - } - - public long GetAudioRendererWorkBufferSize(ServiceCtx Context) - { - int SampleRate = Context.RequestData.ReadInt32(); - int Unknown4 = Context.RequestData.ReadInt32(); - int Unknown8 = Context.RequestData.ReadInt32(); - int UnknownC = Context.RequestData.ReadInt32(); - int Unknown10 = Context.RequestData.ReadInt32(); - int Unknown14 = Context.RequestData.ReadInt32(); - int Unknown18 = Context.RequestData.ReadInt32(); - int Unknown1c = Context.RequestData.ReadInt32(); - int Unknown20 = Context.RequestData.ReadInt32(); - int Unknown24 = Context.RequestData.ReadInt32(); - int Unknown28 = Context.RequestData.ReadInt32(); - int Unknown2c = Context.RequestData.ReadInt32(); - int Rev1Magic = Context.RequestData.ReadInt32(); - - Context.ResponseData.Write(0x400L); - - return 0; - } - - public long GetAudioDevice(ServiceCtx Context) - { - long UserId = Context.RequestData.ReadInt64(); - - MakeObject(Context, new IAudioDevice()); - - return 0; - } - } -} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs b/Ryujinx.Core/OsHle/Services/ServiceFactory.cs index e001a3b0..427b239b 100644 --- a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs +++ b/Ryujinx.Core/OsHle/Services/ServiceFactory.cs @@ -44,10 +44,10 @@ namespace Ryujinx.Core.OsHle.Services return new ServiceAppletOE(); case "audout:u": - return new ServiceAudOut(); + return new IAudioOutManager(); case "audren:u": - return new ServiceAudRen(); + return new IAudioRendererManager(); case "bsd:s": return new ServiceBsd(); -- cgit v1.2.3