aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLordmau5 <mail@lordmau5.com>2018-06-30 17:53:04 +0200
committergdkchan <gab.dark.100@gmail.com>2018-06-30 12:53:04 -0300
commite913d56fdc2eaf0081efefbaa4bc7e736e05a397 (patch)
treec6c87235cf8e16e13581956bab65474c034f4e60
parent2f25b34941335bc4ba58812045783afaf7865812 (diff)
Implement GetReleasedAudioOutBufferAuto properly (#206)
* Implement GetReleasedAudioOutBufferAuto properly * Also implement AppendAudioOutBufferAuto properly
-rw-r--r--Ryujinx.HLE/OsHle/Services/Aud/IAudioOut.cs94
1 files changed, 52 insertions, 42 deletions
diff --git a/Ryujinx.HLE/OsHle/Services/Aud/IAudioOut.cs b/Ryujinx.HLE/OsHle/Services/Aud/IAudioOut.cs
index ef8bd89b..49c87a56 100644
--- a/Ryujinx.HLE/OsHle/Services/Aud/IAudioOut.cs
+++ b/Ryujinx.HLE/OsHle/Services/Aud/IAudioOut.cs
@@ -24,15 +24,15 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
- { 0, GetAudioOutState },
- { 1, StartAudioOut },
- { 2, StopAudioOut },
- { 3, AppendAudioOutBuffer },
- { 4, RegisterBufferEvent },
- { 5, GetReleasedAudioOutBuffer },
- { 6, ContainsAudioOutBuffer },
- { 7, AppendAudioOutBufferEx },
- { 8, GetReleasedAudioOutBufferEx }
+ { 0, GetAudioOutState },
+ { 1, StartAudioOut },
+ { 2, StopAudioOut },
+ { 3, AppendAudioOutBuffer },
+ { 4, RegisterBufferEvent },
+ { 5, GetReleasedAudioOutBuffer },
+ { 6, ContainsAudioOutBuffer },
+ { 7, AppendAudioOutBufferAuto },
+ { 8, GetReleasedAudioOutBufferAuto }
};
this.AudioOut = AudioOut;
@@ -63,11 +63,49 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
public long AppendAudioOutBuffer(ServiceCtx Context)
{
+ return AppendAudioOutBufferImpl(Context, Context.Request.SendBuff[0].Position);
+ }
+
+ public long RegisterBufferEvent(ServiceCtx Context)
+ {
+ int Handle = Context.Process.HandleTable.OpenHandle(ReleaseEvent);
+
+ Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
+
+ return 0;
+ }
+
+ public long GetReleasedAudioOutBuffer(ServiceCtx Context)
+ {
+ long Position = Context.Request.ReceiveBuff[0].Position;
+ long Size = Context.Request.ReceiveBuff[0].Size;
+
+ return GetReleasedAudioOutBufferImpl(Context, Position, Size);
+ }
+
+ public long ContainsAudioOutBuffer(ServiceCtx Context)
+ {
+ long Tag = Context.RequestData.ReadInt64();
+
+ Context.ResponseData.Write(AudioOut.ContainsBuffer(Track, Tag) ? 1 : 0);
+
+ return 0;
+ }
+
+ public long AppendAudioOutBufferAuto(ServiceCtx Context)
+ {
+ (long Position, long Size) = Context.Request.GetBufferType0x21();
+
+ return AppendAudioOutBufferImpl(Context, Position);
+ }
+
+ public long AppendAudioOutBufferImpl(ServiceCtx Context, long Position)
+ {
long Tag = Context.RequestData.ReadInt64();
AudioOutData Data = AMemoryHelper.Read<AudioOutData>(
Context.Memory,
- Context.Request.SendBuff[0].Position);
+ Position);
byte[] Buffer = Context.Memory.ReadBytes(
Data.SampleBufferPtr,
@@ -78,20 +116,15 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
return 0;
}
- public long RegisterBufferEvent(ServiceCtx Context)
+ public long GetReleasedAudioOutBufferAuto(ServiceCtx Context)
{
- int Handle = Context.Process.HandleTable.OpenHandle(ReleaseEvent);
+ (long Position, long Size) = Context.Request.GetBufferType0x22();
- Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
-
- return 0;
+ return GetReleasedAudioOutBufferImpl(Context, Position, Size);
}
- public long GetReleasedAudioOutBuffer(ServiceCtx Context)
+ public long GetReleasedAudioOutBufferImpl(ServiceCtx Context, long Position, long Size)
{
- long Position = Context.Request.ReceiveBuff[0].Position;
- long Size = Context.Request.ReceiveBuff[0].Size;
-
uint Count = (uint)((ulong)Size >> 3);
long[] ReleasedBuffers = AudioOut.GetReleasedBuffers(Track, (int)Count);
@@ -113,29 +146,6 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
return 0;
}
- public long ContainsAudioOutBuffer(ServiceCtx Context)
- {
- long Tag = Context.RequestData.ReadInt64();
-
- Context.ResponseData.Write(AudioOut.ContainsBuffer(Track, Tag) ? 1 : 0);
-
- return 0;
- }
-
- public long AppendAudioOutBufferEx(ServiceCtx Context)
- {
- Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
-
- return 0;
- }
-
- public long GetReleasedAudioOutBufferEx(ServiceCtx Context)
- {
- Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
-
- return 0;
- }
-
public void Dispose()
{
Dispose(true);