Fixed.
This commit is contained in:
parent
38d92cd476
commit
9f44819cd9
6 changed files with 84 additions and 73 deletions
|
@ -11,13 +11,12 @@
|
||||||
public int MixesSize;
|
public int MixesSize;
|
||||||
public int SinksSize;
|
public int SinksSize;
|
||||||
public int PerformanceBufferSize;
|
public int PerformanceBufferSize;
|
||||||
public int Unknown0;
|
public int Unknown24;
|
||||||
public int Unknown1;
|
public int Unknown28;
|
||||||
public int Unknown2;
|
public int Unknown2C;
|
||||||
public int Unknown3;
|
public int Unknown30;
|
||||||
public int Unknown4;
|
public int Unknown34;
|
||||||
public int Unknown5;
|
public int Unknown38;
|
||||||
public int Unknown6;
|
|
||||||
public int TotalSize;
|
public int TotalSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
{
|
{
|
||||||
struct AudioRendererResponse
|
struct AudioRendererOutput
|
||||||
{
|
{
|
||||||
public int Revision;
|
public int Revision;
|
||||||
public int ErrorInfoSize;
|
public int ErrorInfoSize;
|
||||||
public int MemoryPoolsSize;
|
public int MemoryPoolsSize;
|
||||||
public int VoicesSize;
|
public int VoicesSize;
|
||||||
public int Unknown0;
|
public int VoiceResourceSize;
|
||||||
public int EffectsSize;
|
public int EffectsSize;
|
||||||
public int Unknown1;
|
public int MixesSize;
|
||||||
public int SinksSize;
|
public int SinksSize;
|
||||||
public int PerformanceManagerSize;
|
public int PerformanceManagerSize;
|
||||||
public int Unknown2;
|
public int Unknown24;
|
||||||
public int Unknown3;
|
public int Unknown28;
|
||||||
public int Unknown4;
|
public int Unknown2C;
|
||||||
public int Unknown5;
|
public int Unknown30;
|
||||||
public int Unknown6;
|
public int Unknown34;
|
||||||
public int Unknown7;
|
public int Unknown38;
|
||||||
public int Unknown8;
|
|
||||||
public int TotalSize;
|
public int TotalSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,22 +1,22 @@
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
{
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct AudioRendererParameters
|
struct AudioRendererParameters
|
||||||
{
|
{
|
||||||
public int SampleRate;
|
public int SampleRate;
|
||||||
public int SampleCount;
|
public int SampleCount;
|
||||||
public int Unknown0;
|
public int Unknown8;
|
||||||
public int Unknown1;
|
public int UnknownC;
|
||||||
public int VoiceCount;
|
public int VoiceCount;
|
||||||
public int SinkCount;
|
public int SinkCount;
|
||||||
public int EffectCount;
|
public int EffectCount;
|
||||||
public int Unknown2;
|
public int Unknown1C;
|
||||||
public byte Unknown3;
|
public int Unknown20;
|
||||||
public byte Padding0;
|
public int SplitterCount;
|
||||||
public byte Padding1;
|
public int Unknown28;
|
||||||
public byte Padding2;
|
public int Unknown2C;
|
||||||
public int SplitterCount;
|
public int Revision;
|
||||||
public int Unknown4;
|
|
||||||
public int Padding3;
|
|
||||||
public int Magic;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ using Ryujinx.HLE.OsHle.Handles;
|
||||||
using Ryujinx.HLE.OsHle.Ipc;
|
using Ryujinx.HLE.OsHle.Ipc;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
|
@ -17,7 +16,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
|
|
||||||
private KEvent UpdateEvent;
|
private KEvent UpdateEvent;
|
||||||
|
|
||||||
private AudioRendererParameters WorkerParams;
|
private AudioRendererParameters Params;
|
||||||
|
|
||||||
public IAudioRenderer(AudioRendererParameters WorkerParams)
|
public IAudioRenderer(AudioRendererParameters WorkerParams)
|
||||||
{
|
{
|
||||||
|
@ -29,9 +28,9 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
{ 7, QuerySystemEvent }
|
{ 7, QuerySystemEvent }
|
||||||
};
|
};
|
||||||
|
|
||||||
UpdateEvent = new KEvent();
|
UpdateEvent = new KEvent();
|
||||||
|
|
||||||
this.WorkerParams = WorkerParams;
|
this.Params = WorkerParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long RequestUpdateAudioRenderer(ServiceCtx Context)
|
public long RequestUpdateAudioRenderer(ServiceCtx Context)
|
||||||
|
@ -39,49 +38,39 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
long OutputPosition = Context.Request.GetBufferType0x22().Position;
|
||||||
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
||||||
|
|
||||||
AudioRendererConfig InputRequest = AMemoryHelper.Read<AudioRendererConfig>(Context.Memory, InputPosition);
|
AudioRendererConfig InputData = AMemoryHelper.Read<AudioRendererConfig>(Context.Memory, InputPosition);
|
||||||
|
|
||||||
int MemoryPoolOffset = Marshal.SizeOf(InputRequest) + InputRequest.BehaviourSize;
|
int MemoryPoolOffset = Marshal.SizeOf(InputData) + InputData.BehaviourSize;
|
||||||
|
|
||||||
GCHandle Handle = GCHandle.Alloc(WorkerParams, GCHandleType.Pinned);
|
AudioRendererOutput OutputData = new AudioRendererOutput();
|
||||||
|
|
||||||
AudioRendererResponse OutputResponse = (AudioRendererResponse)Marshal.PtrToStructure(Handle.AddrOfPinnedObject(), typeof(AudioRendererResponse));
|
OutputData.Revision = Params.Revision;
|
||||||
|
OutputData.ErrorInfoSize = 0xb0;
|
||||||
|
OutputData.MemoryPoolsSize = (Params.EffectCount + (Params.VoiceCount * 4)) * 0x10;
|
||||||
|
OutputData.VoicesSize = Params.VoiceCount * 0x10;
|
||||||
|
OutputData.EffectsSize = Params.EffectCount * 0x10;
|
||||||
|
OutputData.SinksSize = Params.SinkCount * 0x20;
|
||||||
|
OutputData.PerformanceManagerSize = 0x10;
|
||||||
|
OutputData.TotalSize = Marshal.SizeOf(OutputData) + OutputData.ErrorInfoSize + OutputData.MemoryPoolsSize +
|
||||||
|
OutputData.VoicesSize + OutputData.EffectsSize + OutputData.SinksSize + OutputData.PerformanceManagerSize;
|
||||||
|
|
||||||
Handle.Free();
|
AMemoryHelper.Write(Context.Memory, OutputPosition, OutputData);
|
||||||
|
|
||||||
OutputResponse.Revision = WorkerParams.Magic;
|
for (int Offset = 0x40; Offset < 0x40 + OutputData.MemoryPoolsSize; Offset += 0x10, MemoryPoolOffset += 0x20)
|
||||||
OutputResponse.ErrorInfoSize = 0xb0;
|
|
||||||
OutputResponse.MemoryPoolsSize = (WorkerParams.EffectCount + (WorkerParams.VoiceCount * 4)) * 0x10;
|
|
||||||
OutputResponse.VoicesSize = WorkerParams.VoiceCount * 0x10;
|
|
||||||
OutputResponse.EffectsSize = WorkerParams.EffectCount * 0x10;
|
|
||||||
OutputResponse.SinksSize = WorkerParams.SinkCount * 0x20;
|
|
||||||
OutputResponse.PerformanceManagerSize = 0x10;
|
|
||||||
OutputResponse.TotalSize = Marshal.SizeOf(OutputResponse) + OutputResponse.ErrorInfoSize + OutputResponse.MemoryPoolsSize +
|
|
||||||
OutputResponse.VoicesSize + OutputResponse.EffectsSize + OutputResponse.SinksSize + OutputResponse.PerformanceManagerSize;
|
|
||||||
|
|
||||||
Context.Memory.WriteInt32(OutputPosition + 0x4, OutputResponse.ErrorInfoSize);
|
|
||||||
Context.Memory.WriteInt32(OutputPosition + 0x8, OutputResponse.MemoryPoolsSize);
|
|
||||||
Context.Memory.WriteInt32(OutputPosition + 0xc, OutputResponse.VoicesSize);
|
|
||||||
Context.Memory.WriteInt32(OutputPosition + 0x14, OutputResponse.EffectsSize);
|
|
||||||
Context.Memory.WriteInt32(OutputPosition + 0x1c, OutputResponse.SinksSize);
|
|
||||||
Context.Memory.WriteInt32(OutputPosition + 0x20, OutputResponse.PerformanceManagerSize);
|
|
||||||
Context.Memory.WriteInt32(OutputPosition + 0x3c, OutputResponse.TotalSize - 4);
|
|
||||||
|
|
||||||
for (int Offset = 0x40; Offset < 0x40 + OutputResponse.MemoryPoolsSize; Offset += 0x10, MemoryPoolOffset += 0x20)
|
|
||||||
{
|
{
|
||||||
int PoolState = Context.Memory.ReadInt32(InputPosition + MemoryPoolOffset + 0xC);
|
MemoryPoolStates PoolState = (MemoryPoolStates) Context.Memory.ReadInt32(InputPosition + MemoryPoolOffset + 0x10);
|
||||||
|
|
||||||
if (PoolState == 4)
|
if (PoolState == MemoryPoolStates.RequestAttach)
|
||||||
{
|
{
|
||||||
Context.Memory.WriteInt32(OutputPosition + Offset, 5);
|
Context.Memory.WriteInt32(OutputPosition + Offset, (int)MemoryPoolStates.Attached);
|
||||||
}
|
}
|
||||||
else if (PoolState == 2)
|
else if (PoolState == MemoryPoolStates.RequestDetach)
|
||||||
{
|
{
|
||||||
Context.Memory.WriteInt32(OutputPosition + Offset, 3);
|
Context.Memory.WriteInt32(OutputPosition + Offset, (int)MemoryPoolStates.Detached);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Context.Memory.WriteInt32(OutputPosition + Offset, PoolState);
|
Context.Memory.WriteInt32(OutputPosition + Offset, (int)PoolState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,24 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
public long OpenAudioRenderer(ServiceCtx Context)
|
public long OpenAudioRenderer(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
//Same buffer as GetAudioRendererWorkBufferSize is receive here.
|
//Same buffer as GetAudioRendererWorkBufferSize is receive here.
|
||||||
GCHandle Handle = GCHandle.Alloc(Context.RequestData.ReadBytes(Marshal.SizeOf(typeof(AudioRendererParameters))), GCHandleType.Pinned);
|
|
||||||
|
|
||||||
AudioRendererParameters WorkerParams = (AudioRendererParameters)Marshal.PtrToStructure(Handle.AddrOfPinnedObject(), typeof(AudioRendererParameters));
|
AudioRendererParameters Params = new AudioRendererParameters();
|
||||||
|
|
||||||
Handle.Free();
|
Params.SampleRate = Context.RequestData.ReadInt32();
|
||||||
|
Params.SampleCount = Context.RequestData.ReadInt32();
|
||||||
|
Params.Unknown8 = Context.RequestData.ReadInt32();
|
||||||
|
Params.UnknownC = Context.RequestData.ReadInt32();
|
||||||
|
Params.VoiceCount = Context.RequestData.ReadInt32();
|
||||||
|
Params.SinkCount = Context.RequestData.ReadInt32();
|
||||||
|
Params.EffectCount = Context.RequestData.ReadInt32();
|
||||||
|
Params.Unknown1C = Context.RequestData.ReadInt32();
|
||||||
|
Params.Unknown20 = Context.RequestData.ReadInt32();
|
||||||
|
Params.SplitterCount = Context.RequestData.ReadInt32();
|
||||||
|
Params.Unknown28 = Context.RequestData.ReadInt32();
|
||||||
|
Params.Unknown2C = Context.RequestData.ReadInt32();
|
||||||
|
Params.Revision = Context.RequestData.ReadInt32();
|
||||||
|
|
||||||
MakeObject(Context, new IAudioRenderer(WorkerParams));
|
MakeObject(Context, new IAudioRenderer(Params));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +65,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
long Unknown24 = Context.RequestData.ReadUInt32();
|
long Unknown24 = Context.RequestData.ReadUInt32();
|
||||||
long Unknown28 = Context.RequestData.ReadUInt32(); //SplitterCount
|
long Unknown28 = Context.RequestData.ReadUInt32(); //SplitterCount
|
||||||
long Unknown2c = Context.RequestData.ReadUInt32(); //Not used here in FW3.0.1
|
long Unknown2c = Context.RequestData.ReadUInt32(); //Not used here in FW3.0.1
|
||||||
int RevMagic = Context.RequestData.ReadInt32();
|
int RevMagic = Context.RequestData.ReadInt32();
|
||||||
|
|
||||||
int Version = (RevMagic - Rev0Magic) >> 24;
|
int Version = (RevMagic - Rev0Magic) >> 24;
|
||||||
|
|
||||||
|
|
13
Ryujinx.HLE/OsHle/Services/Aud/MemoryPoolStates.cs
Normal file
13
Ryujinx.HLE/OsHle/Services/Aud/MemoryPoolStates.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
|
{
|
||||||
|
enum MemoryPoolStates : int
|
||||||
|
{
|
||||||
|
Invalid = 0x0,
|
||||||
|
Unknown = 0x1,
|
||||||
|
RequestDetach = 0x2,
|
||||||
|
Detached = 0x3,
|
||||||
|
RequestAttach = 0x4,
|
||||||
|
Attached = 0x5,
|
||||||
|
Released = 0x6,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue