diff --git a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs index 2c1d0c3bcc..ef69f598c6 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs @@ -14,6 +14,8 @@ namespace Ryujinx.HLE.HOS.Services.Am private KEvent LaunchableEvent; + private int IdleTimeDetectionExtension; + public ISelfController(Horizon System) { m_Commands = new Dictionary() @@ -29,7 +31,9 @@ namespace Ryujinx.HLE.HOS.Services.Am { 14, SetRestartMessageEnabled }, { 16, SetOutOfFocusSuspendingEnabled }, { 19, SetScreenShotImageOrientation }, - { 50, SetHandlesRequestToDisplay } + { 50, SetHandlesRequestToDisplay }, + { 62, SetIdleTimeDetectionExtension }, + { 63, GetIdleTimeDetectionExtension } }; LaunchableEvent = new KEvent(System); @@ -145,5 +149,25 @@ 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}"); + + return 0; + } + + // GetIdleTimeDetectionExtension() -> u32 + public long GetIdleTimeDetectionExtension(ServiceCtx Context) + { + Context.ResponseData.Write(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 85f82622f9..13225951e1 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs @@ -38,6 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer private int Track; + private PlayState PlayState; + public IAudioRenderer( Horizon System, AMemory Memory, @@ -46,6 +48,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { m_Commands = new Dictionary() { + { 0, GetSampleRate }, + { 1, GetSampleCount }, + { 2, GetMixBufferCount }, + { 3, GetState }, { 4, RequestUpdateAudioRenderer }, { 5, StartAudioRenderer }, { 6, StopAudioRenderer }, @@ -68,6 +74,42 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer Voices = CreateArray(Params.VoiceCount); InitializeAudioOut(); + + PlayState = PlayState.Stopped; + } + + // GetSampleRate() -> u32 + public long GetSampleRate(ServiceCtx Context) + { + Context.ResponseData.Write(Params.SampleRate); + + return 0; + } + + // GetSampleCount() -> u32 + public long GetSampleCount(ServiceCtx Context) + { + Context.ResponseData.Write(Params.SampleCount); + + return 0; + } + + // GetMixBufferCount() -> u32 + public long GetMixBufferCount(ServiceCtx Context) + { + Context.ResponseData.Write(Params.MixCount); + + return 0; + } + + // GetState() -> u32 + private long GetState(ServiceCtx Context) + { + Context.ResponseData.Write((int)PlayState); + + Context.Device.Log.PrintStub(LogClass.ServiceAudio, $"Stubbed. Renderer State: {Enum.GetName(typeof(PlayState), PlayState)}"); + + return 0; } private void AudioCallback() @@ -206,6 +248,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + PlayState = PlayState.Playing; + return 0; } @@ -213,6 +257,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); + PlayState = PlayState.Stopped; + return 0; } diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs index 7ebe2b5873..7859e0135d 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs @@ -3,6 +3,7 @@ using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Services.Aud.AudioRenderer; using Ryujinx.HLE.Logging; using Ryujinx.HLE.Utilities; +using System; using System.Collections.Generic; using static Ryujinx.HLE.HOS.ErrorCode; @@ -28,9 +29,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud { m_Commands = new Dictionary() { - { 0, OpenAudioRenderer }, - { 1, GetAudioRendererWorkBufferSize }, - { 2, GetAudioDevice } + { 0, OpenAudioRenderer }, + { 1, GetAudioRendererWorkBufferSize }, + { 2, GetAudioDeviceService }, + { 4, GetAudioDeviceServiceWithRevisionInfo } }; } @@ -161,13 +163,26 @@ namespace Ryujinx.HLE.HOS.Services.Aud return Result / 8; } - public long GetAudioDevice(ServiceCtx Context) + // 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) + { + 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 new file mode 100644 index 0000000000..c635431405 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs @@ -0,0 +1,46 @@ +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.Logging; +using System; +using System.Collections.Generic; + +namespace Ryujinx.HLE.HOS.Services.Irs +{ + class IIrSensorServer : IpcService + { + private Dictionary m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + private bool Activated; + + public IIrSensorServer() + { + m_Commands = new Dictionary() + { + { 302, ActivateIrsensor }, + { 303, DeactivateIrsensor } + }; + } + + // ActivateIrsensor(nn::applet::AppletResourceUserId, pid) + public long ActivateIrsensor(ServiceCtx Context) + { + long AppletResourceUserId = Context.RequestData.ReadInt64(); + + 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(); + + Context.Device.Log.PrintStub(LogClass.ServiceIrs, $"Stubbed. AppletResourceUserId: {AppletResourceUserId}"); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs index e65ef08679..2a92cf76c5 100644 --- a/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs +++ b/Ryujinx.HLE/HOS/Services/Mm/IRequest.cs @@ -1,5 +1,6 @@ using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.Logging; +using System; using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Mm @@ -14,12 +15,25 @@ namespace Ryujinx.HLE.HOS.Services.Mm { m_Commands = new Dictionary() { - { 4, Initialize }, - { 6, SetAndWait }, - { 7, Get } + { 1, InitializeOld }, + { 4, Initialize }, + { 6, SetAndWait }, + { 7, Get } }; } + // 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; + } + public long Initialize(ServiceCtx Context) { Context.Device.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); diff --git a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs index 5e1e780aac..fd5a06e6d9 100644 --- a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs +++ b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs @@ -6,6 +6,7 @@ using Ryujinx.HLE.HOS.Services.Bsd; using Ryujinx.HLE.HOS.Services.Caps; using Ryujinx.HLE.HOS.Services.FspSrv; using Ryujinx.HLE.HOS.Services.Hid; +using Ryujinx.HLE.HOS.Services.Irs; using Ryujinx.HLE.HOS.Services.Lm; using Ryujinx.HLE.HOS.Services.Mm; using Ryujinx.HLE.HOS.Services.Nfp; @@ -96,6 +97,9 @@ namespace Ryujinx.HLE.HOS.Services case "hid": return new IHidServer(System); + case "irs": + return new IIrSensorServer(); + case "lm": return new ILogService(); diff --git a/Ryujinx.HLE/Logging/LogClass.cs b/Ryujinx.HLE/Logging/LogClass.cs index 95cae7e0ab..4905013411 100644 --- a/Ryujinx.HLE/Logging/LogClass.cs +++ b/Ryujinx.HLE/Logging/LogClass.cs @@ -22,6 +22,7 @@ namespace Ryujinx.HLE.Logging ServiceFriend, ServiceFs, ServiceHid, + ServiceIrs, ServiceLm, ServiceMm, ServiceNfp,