aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremmauss <emmausssss@gmail.com>2018-10-07 18:12:11 +0300
committerThomas Guillemard <thog@protonmail.com>2018-10-07 17:12:11 +0200
commit625fc8c0e0f7a10bbdabe86f9cc86b16d1a62be3 (patch)
treea0f8d488a0b918226460a738689ca7c005cbfbba
parentcaa181edf2c956a1433d3c2f8678231af52f9dad (diff)
Stubs Again (#439)
* stub/implement audren commands * stub ISelfController get/set IdleTimeDetectonExtension * stub irs * add irs logclass, stub mmu:u irequest 1 * style fixes, addressed comments
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/ISelfController.cs26
-rw-r--r--Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs46
-rw-r--r--Ryujinx.HLE/HOS/Services/Aud/IAudioRendererManager.cs25
-rw-r--r--Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs46
-rw-r--r--Ryujinx.HLE/HOS/Services/Mm/IRequest.cs20
-rw-r--r--Ryujinx.HLE/HOS/Services/ServiceFactory.cs4
-rw-r--r--Ryujinx.HLE/Logging/LogClass.cs1
7 files changed, 159 insertions, 9 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs
index 2c1d0c3b..ef69f598 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<int, ServiceProcessRequest>()
@@ -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 85f82622..13225951 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<int, ServiceProcessRequest>()
{
+ { 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<VoiceContext>(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 7ebe2b58..7859e013 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<int, ServiceProcessRequest>()
{
- { 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<nn::audio::detail::IAudioDevice>
+ 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<nn::audio::detail::IAudioDevice>
+ 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 00000000..c6354314
--- /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<int, ServiceProcessRequest> m_Commands;
+
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+
+ private bool Activated;
+
+ public IIrSensorServer()
+ {
+ m_Commands = new Dictionary<int, ServiceProcessRequest>()
+ {
+ { 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 e65ef086..2a92cf76 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<int, ServiceProcessRequest>()
{
- { 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 5e1e780a..fd5a06e6 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 95cae7e0..49050134 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,