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

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

View file

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