Initial fix

Based off of Yuzu's PR authored by ogniK5377: https://github.com/yuzu-emu/yuzu/pull/1455
This commit is contained in:
John Clemis 2018-12-13 00:25:02 -06:00
parent 2e143365eb
commit 24d069759d
6 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
class EffectContext
{
public EffectOut OutStatus;
public EffectContext()
{
OutStatus.State = EffectState.None;
}
}
}

View file

@ -0,0 +1,25 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0xc0, Pack = 4)]
unsafe struct EffectIn
{
public EffectType Type;
public byte FirstUpdate;
public byte Enabled;
public byte Unknown11;
public uint MixID;
public ulong BufferBase;
public ulong BufferSZ;
public int Priority;
public uint Unknown24;
public fixed byte Padding[0xa0];
}
}

View file

@ -0,0 +1,14 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x13, Pack = 4)]
struct EffectOut
{
public EffectState State;
public int Unknown14;
public long Unknown18;
public short Unknown12;
public byte Unknown11;
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
enum EffectState
{
None = 0,
New = 1
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
enum EffectType
{
None = 0,
Aux = 2
}
}

View file

@ -38,6 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
private VoiceContext[] _voices;
private EffectContext[] _effects;
private int _track;
private PlayState _playState;
@ -75,6 +77,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
_voices = CreateArray<VoiceContext>(Params.VoiceCount);
_effects = CreateArray<EffectContext>(Params.EffectCount);
InitializeAudioOut();
_playState = PlayState.Stopped;
@ -210,6 +214,18 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
voiceCtx.PlayState = voice.PlayState;
}
EffectIn[] effectsIn = reader.Read<EffectIn>(inputHeader.EffectSize);
for (int index = 0; index < effectsIn.Length; index++)
{
EffectIn effect = effectsIn[index];
if (effect.FirstUpdate != 0)
{
_effects[index].OutStatus.State = EffectState.New;
}
}
UpdateAudio();
UpdateDataHeader outputHeader = new UpdateDataHeader();
@ -243,6 +259,11 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
writer.Write(voice.OutStatus);
}
foreach (EffectContext effect in _effects)
{
writer.Write(effect.OutStatus);
}
return 0;
}