From 7c7ee8f8ca0dddcc7c16c16d8a14527e4557fd82 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 25 Jun 2018 02:04:19 -0300 Subject: [PATCH] Aways write voice state as finished playing while proper audren support is not in place --- .../OsHle/Services/Aud/IAudioRenderer.cs | 27 +++++++++++++------ Ryujinx.HLE/OsHle/Services/Aud/VoiceState.cs | 9 +++++++ 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 Ryujinx.HLE/OsHle/Services/Aud/VoiceState.cs diff --git a/Ryujinx.HLE/OsHle/Services/Aud/IAudioRenderer.cs b/Ryujinx.HLE/OsHle/Services/Aud/IAudioRenderer.cs index d0a7cfc2..bd9188c3 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/IAudioRenderer.cs +++ b/Ryujinx.HLE/OsHle/Services/Aud/IAudioRenderer.cs @@ -44,18 +44,18 @@ namespace Ryujinx.HLE.OsHle.Services.Aud UpdateDataHeader InputDataHeader = AMemoryHelper.Read(Context.Memory, InputPosition); - int MemoryPoolOffset = Marshal.SizeOf(InputDataHeader) + InputDataHeader.BehaviorSize; - UpdateDataHeader OutputDataHeader = new UpdateDataHeader(); + int UpdateHeaderSize = Marshal.SizeOf(); + OutputDataHeader.Revision = Params.Revision; OutputDataHeader.BehaviorSize = 0xb0; - OutputDataHeader.MemoryPoolsSize = (Params.EffectCount + (Params.VoiceCount * 4)) * 0x10; + OutputDataHeader.MemoryPoolsSize = (Params.EffectCount + Params.VoiceCount * 4) * 0x10; OutputDataHeader.VoicesSize = Params.VoiceCount * 0x10; OutputDataHeader.EffectsSize = Params.EffectCount * 0x10; OutputDataHeader.SinksSize = Params.SinkCount * 0x20; OutputDataHeader.PerformanceManagerSize = 0x10; - OutputDataHeader.TotalSize = Marshal.SizeOf(OutputDataHeader) + + OutputDataHeader.TotalSize = UpdateHeaderSize + OutputDataHeader.BehaviorSize + OutputDataHeader.MemoryPoolsSize + OutputDataHeader.VoicesSize + @@ -65,21 +65,32 @@ namespace Ryujinx.HLE.OsHle.Services.Aud AMemoryHelper.Write(Context.Memory, OutputPosition, OutputDataHeader); - for (int Offset = 0x40; Offset < 0x40 + OutputDataHeader.MemoryPoolsSize; Offset += 0x10, MemoryPoolOffset += 0x20) + int InMemoryPoolOffset = UpdateHeaderSize + InputDataHeader.BehaviorSize; + + int OutMemoryPoolOffset = UpdateHeaderSize; + + for (int Offset = 0; Offset < OutputDataHeader.MemoryPoolsSize; Offset += 0x10, InMemoryPoolOffset += 0x20) { - MemoryPoolState PoolState = (MemoryPoolState)Context.Memory.ReadInt32(InputPosition + MemoryPoolOffset + 0x10); + MemoryPoolState PoolState = (MemoryPoolState)Context.Memory.ReadInt32(InputPosition + InMemoryPoolOffset + 0x10); //TODO: Figure out what the other values does. if (PoolState == MemoryPoolState.RequestAttach) { - Context.Memory.WriteInt32(OutputPosition + Offset, (int)MemoryPoolState.Attached); + Context.Memory.WriteInt32(OutputPosition + OutMemoryPoolOffset + Offset, (int)MemoryPoolState.Attached); } else if (PoolState == MemoryPoolState.RequestDetach) { - Context.Memory.WriteInt32(OutputPosition + Offset, (int)MemoryPoolState.Detached); + Context.Memory.WriteInt32(OutputPosition + OutMemoryPoolOffset + Offset, (int)MemoryPoolState.Detached); } } + int OutVoicesOffset = OutMemoryPoolOffset + OutputDataHeader.MemoryPoolsSize; + + for (int Offset = 0; Offset < OutputDataHeader.VoicesSize; Offset += 0x10) + { + Context.Memory.WriteInt32(OutputPosition + OutVoicesOffset + Offset + 8, (int)VoicePlaybackState.Finished); + } + //TODO: We shouldn't be signaling this here. UpdateEvent.WaitEvent.Set(); diff --git a/Ryujinx.HLE/OsHle/Services/Aud/VoiceState.cs b/Ryujinx.HLE/OsHle/Services/Aud/VoiceState.cs new file mode 100644 index 00000000..8b343323 --- /dev/null +++ b/Ryujinx.HLE/OsHle/Services/Aud/VoiceState.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.HLE.OsHle.Services.Aud +{ + enum VoicePlaybackState : int + { + Playing = 0, + Finished = 1, + Paused = 2 + } +}