audren: implement Renderer Info output informations (#1179)

This implement the rendering information output informations of
RequestUpdate.

This is needed by some games to keep track of the count of update on the
DSP.
This commit is contained in:
Thog 2020-04-30 05:03:05 +02:00 committed by GitHub
parent c2ac45adc5
commit 23170da5a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 0 deletions

View file

@ -40,6 +40,8 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
private PlayState _playState;
private ulong _elapsedFrameCount;
public IAudioRenderer(
Horizon system,
MemoryManager memory,
@ -63,6 +65,8 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
_effects = CreateArray<EffectContext>(rendererParams.EffectCount);
_elapsedFrameCount = 0;
InitializeAudioOut();
_playState = PlayState.Stopped;
@ -264,6 +268,18 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
writer.Write(effect.OutStatus);
}
writer.SkipBytes(_params.SinkCount * 0x20);
writer.SkipBytes(outputHeader.PerformanceManagerSize);
writer.SkipBytes(outputHeader.BehaviorSize);
if (behaviorInfo.IsElapsedFrameCountSupported())
{
writer.Write(new RendererInfoOut
{
ElapsedFrameCount = _elapsedFrameCount
});
}
return ResultCode.Success;
}
@ -331,6 +347,8 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
{
AppendMixedBuffer(released[index]);
}
_elapsedFrameCount++;
}
private void AppendMixedBuffer(long tag)

View file

@ -0,0 +1,11 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
{
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
struct RendererInfoOut
{
public ulong ElapsedFrameCount;
public ulong Reserved;
}
}

View file

@ -21,5 +21,10 @@ namespace Ryujinx.HLE.Utilities
Position += Marshal.SizeOf<T>();
}
public void SkipBytes(long count)
{
Position += count;
}
}
}