0
0
Fork 0

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
This commit is contained in:
emmauss 2018-10-07 18:12:11 +03:00 committed by Thomas Guillemard
parent caa181edf2
commit 625fc8c0e0
7 changed files with 159 additions and 9 deletions

View file

@ -14,6 +14,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
private KEvent LaunchableEvent; private KEvent LaunchableEvent;
private int IdleTimeDetectionExtension;
public ISelfController(Horizon System) public ISelfController(Horizon System)
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
@ -29,7 +31,9 @@ namespace Ryujinx.HLE.HOS.Services.Am
{ 14, SetRestartMessageEnabled }, { 14, SetRestartMessageEnabled },
{ 16, SetOutOfFocusSuspendingEnabled }, { 16, SetOutOfFocusSuspendingEnabled },
{ 19, SetScreenShotImageOrientation }, { 19, SetScreenShotImageOrientation },
{ 50, SetHandlesRequestToDisplay } { 50, SetHandlesRequestToDisplay },
{ 62, SetIdleTimeDetectionExtension },
{ 63, GetIdleTimeDetectionExtension }
}; };
LaunchableEvent = new KEvent(System); LaunchableEvent = new KEvent(System);
@ -145,5 +149,25 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0; 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;
}
} }
} }

View file

@ -38,6 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
private int Track; private int Track;
private PlayState PlayState;
public IAudioRenderer( public IAudioRenderer(
Horizon System, Horizon System,
AMemory Memory, AMemory Memory,
@ -46,6 +48,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 0, GetSampleRate },
{ 1, GetSampleCount },
{ 2, GetMixBufferCount },
{ 3, GetState },
{ 4, RequestUpdateAudioRenderer }, { 4, RequestUpdateAudioRenderer },
{ 5, StartAudioRenderer }, { 5, StartAudioRenderer },
{ 6, StopAudioRenderer }, { 6, StopAudioRenderer },
@ -68,6 +74,42 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
Voices = CreateArray<VoiceContext>(Params.VoiceCount); Voices = CreateArray<VoiceContext>(Params.VoiceCount);
InitializeAudioOut(); 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() private void AudioCallback()
@ -206,6 +248,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{ {
Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
PlayState = PlayState.Playing;
return 0; return 0;
} }
@ -213,6 +257,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{ {
Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed."); Context.Device.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
PlayState = PlayState.Stopped;
return 0; return 0;
} }

View file

@ -3,6 +3,7 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Services.Aud.AudioRenderer; using Ryujinx.HLE.HOS.Services.Aud.AudioRenderer;
using Ryujinx.HLE.Logging; using Ryujinx.HLE.Logging;
using Ryujinx.HLE.Utilities; using Ryujinx.HLE.Utilities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using static Ryujinx.HLE.HOS.ErrorCode; using static Ryujinx.HLE.HOS.ErrorCode;
@ -28,9 +29,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 0, OpenAudioRenderer }, { 0, OpenAudioRenderer },
{ 1, GetAudioRendererWorkBufferSize }, { 1, GetAudioRendererWorkBufferSize },
{ 2, GetAudioDevice } { 2, GetAudioDeviceService },
{ 4, GetAudioDeviceServiceWithRevisionInfo }
}; };
} }
@ -161,13 +163,26 @@ namespace Ryujinx.HLE.HOS.Services.Aud
return Result / 8; 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)); MakeObject(Context, new IAudioDevice(Context.Device.System));
return 0; 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);
}
} }
} }

View file

@ -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;
}
}
}

View file

@ -1,5 +1,6 @@
using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Logging; using Ryujinx.HLE.Logging;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Mm namespace Ryujinx.HLE.HOS.Services.Mm
@ -14,12 +15,25 @@ namespace Ryujinx.HLE.HOS.Services.Mm
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 4, Initialize }, { 1, InitializeOld },
{ 6, SetAndWait }, { 4, Initialize },
{ 7, Get } { 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) public long Initialize(ServiceCtx Context)
{ {
Context.Device.Log.PrintStub(LogClass.ServiceMm, "Stubbed."); Context.Device.Log.PrintStub(LogClass.ServiceMm, "Stubbed.");

View file

@ -6,6 +6,7 @@ using Ryujinx.HLE.HOS.Services.Bsd;
using Ryujinx.HLE.HOS.Services.Caps; using Ryujinx.HLE.HOS.Services.Caps;
using Ryujinx.HLE.HOS.Services.FspSrv; using Ryujinx.HLE.HOS.Services.FspSrv;
using Ryujinx.HLE.HOS.Services.Hid; using Ryujinx.HLE.HOS.Services.Hid;
using Ryujinx.HLE.HOS.Services.Irs;
using Ryujinx.HLE.HOS.Services.Lm; using Ryujinx.HLE.HOS.Services.Lm;
using Ryujinx.HLE.HOS.Services.Mm; using Ryujinx.HLE.HOS.Services.Mm;
using Ryujinx.HLE.HOS.Services.Nfp; using Ryujinx.HLE.HOS.Services.Nfp;
@ -96,6 +97,9 @@ namespace Ryujinx.HLE.HOS.Services
case "hid": case "hid":
return new IHidServer(System); return new IHidServer(System);
case "irs":
return new IIrSensorServer();
case "lm": case "lm":
return new ILogService(); return new ILogService();

View file

@ -22,6 +22,7 @@ namespace Ryujinx.HLE.Logging
ServiceFriend, ServiceFriend,
ServiceFs, ServiceFs,
ServiceHid, ServiceHid,
ServiceIrs,
ServiceLm, ServiceLm,
ServiceMm, ServiceMm,
ServiceNfp, ServiceNfp,