From f2290730860d3c53231f9513bf68307f02df3ad2 Mon Sep 17 00:00:00 2001
From: jhorv <38920027+jhorv@users.noreply.github.com>
Date: Fri, 5 Apr 2024 14:48:28 -0400
Subject: [PATCH] format and comment fixes
---
.../Renderer/Server/BehaviourContext.cs | 2 +-
.../Renderer/Server/Splitter/SplitterContext.cs | 16 +++++-----------
.../Renderer/Server/Voice/VoiceState.cs | 14 ++++++++++++--
.../Extensions/SequenceReaderExtensions.cs | 11 ++++++-----
4 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/src/Ryujinx.Audio/Renderer/Server/BehaviourContext.cs b/src/Ryujinx.Audio/Renderer/Server/BehaviourContext.cs
index f5bec026ac..099d8f5619 100644
--- a/src/Ryujinx.Audio/Renderer/Server/BehaviourContext.cs
+++ b/src/Ryujinx.Audio/Renderer/Server/BehaviourContext.cs
@@ -274,7 +274,7 @@ namespace Ryujinx.Audio.Renderer.Server
}
///
- /// Check if the audio renderer should trust the user destination count in .
+ /// Check if the audio renderer should trust the user destination count in .
///
/// True if the audio renderer should trust the user destination count.
public bool IsSplitterBugFixed()
diff --git a/src/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs b/src/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs
index 83f7cb3e15..82eeae90d4 100644
--- a/src/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs
+++ b/src/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs
@@ -26,7 +26,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
private Memory _splitterDestinations;
///
- /// If set to true, trust the user destination count in .
+ /// If set to true, trust the user destination count in .
///
public bool IsBugFixed { get; private set; }
@@ -111,7 +111,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
///
/// The storage.
/// The storage.
- /// If set to true, trust the user destination count in .
+ /// If set to true, trust the user destination count in .
private void Setup(Memory splitters, Memory splitterDestinations, bool isBugFixed)
{
_splitters = splitters;
@@ -153,7 +153,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
{
for (int i = 0; i < inputHeader.SplitterCount; i++)
{
- // NOTE: this Rewind/Advance logic is done here to mimic the behavior of the previous implementation.
+ // NOTE: this Rewind/Advance logic is done here to mimic the behavior of the previous implementation.
ref readonly SplitterInParameter parameter = ref input.GetRefOrRefToCopy(out _);
input.Rewind(Unsafe.SizeOf());
@@ -169,13 +169,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
splitter.Update(this, in parameter, ref input);
}
- // NOTE: this historically has been advancing 0xC (12) bytes without explanation. It was hard
- // to discern as it was combined with the sizeof(SplitterInParameter) (16), == 0x1C (28).
-
- // NOTE: this historically was also advancing by parameter.DestinationCount * 4, but that was
- // to account for the reading done by splitter.Update(). Now we pass in `ref input`, so the
- // reads performed by splitter.Update() are automatically accounted for.
-
+ // NOTE: there are 12 bytes of unused (or unknown?) data after the destination IDs array.
input.Advance(0xC);
}
else
@@ -194,7 +188,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
{
for (int i = 0; i < inputHeader.SplitterDestinationCount; i++)
{
- // NOTE: this Rewind/Advance logic is done here to mimic the behavior of the previous implementation.
+ // NOTE: this Rewind/Advance logic is done here to mimic the behavior of the previous implementation.
ref readonly SplitterDestinationInParameter parameter = ref input.GetRefOrRefToCopy(out _);
input.Rewind(Unsafe.SizeOf());
diff --git a/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs b/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs
index 7e128c8366..8ef98ecea0 100644
--- a/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs
+++ b/src/Ryujinx.Audio/Renderer/Server/Voice/VoiceState.cs
@@ -426,7 +426,11 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
/// The voice states associated to the .
/// The mapper to use.
/// The behaviour context.
- public void UpdateWaveBuffers(out ErrorInfo[] errorInfos, in VoiceInParameter parameter, ReadOnlySpan> voiceUpdateStates, PoolMapper mapper, ref BehaviourContext behaviourContext)
+ public void UpdateWaveBuffers(out ErrorInfo[] errorInfos,
+ in VoiceInParameter parameter,
+ ReadOnlySpan> voiceUpdateStates,
+ PoolMapper mapper,
+ ref BehaviourContext behaviourContext)
{
errorInfos = new ErrorInfo[Constants.VoiceWaveBufferCount * 2];
@@ -458,7 +462,13 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
/// If set to true, the server side wavebuffer is considered valid.
/// The mapper to use.
/// The behaviour context.
- private void UpdateWaveBuffer(Span errorInfos, ref WaveBuffer waveBuffer, ref WaveBufferInternal inputWaveBuffer, SampleFormat sampleFormat, bool isValid, PoolMapper mapper, ref BehaviourContext behaviourContext)
+ private void UpdateWaveBuffer(Span errorInfos,
+ ref WaveBuffer waveBuffer,
+ ref WaveBufferInternal inputWaveBuffer,
+ SampleFormat sampleFormat,
+ bool isValid,
+ PoolMapper mapper,
+ ref BehaviourContext behaviourContext)
{
if (!isValid && waveBuffer.IsSendToAudioProcessor && waveBuffer.BufferAddressInfo.CpuAddress != 0)
{
diff --git a/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs b/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs
index 1fc471a365..5403c87c07 100644
--- a/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs
+++ b/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs
@@ -10,10 +10,10 @@ namespace Ryujinx.Common.Extensions
{
///
/// Dumps the entire to a file, restoring its previous location afterward.
- /// Useful for debugging purposes.
+ /// Useful for debugging purposes.
///
- ///
- ///
+ /// The to write to a file
+ /// The path and name of the file to create and dump to
public static void DumpToFile(this ref SequenceReader reader, string fileFullName)
{
var initialConsumed = reader.Consumed;
@@ -37,7 +37,7 @@ namespace Ryujinx.Common.Extensions
/// Returns a reference to the desired value. This ref should always be used. The argument passed in should never be used, as this is only used for storage if the value
/// must be copied from multiple segments held by the .
///
- ///
+ /// Type to get
/// The to read from
/// A location used as storage if (and only if) the value to be read spans multiple segments
/// A reference to the desired value, either directly to memory in the , or to if it has been used for copying the value in to
@@ -102,7 +102,7 @@ namespace Ryujinx.Common.Extensions
///
/// Reads the desired unmanaged value by copying it to the specified .
///
- ///
+ /// Type to read
/// The to read from
/// The target that will receive the read value
/// The does not contain enough data to read a value of type
@@ -130,6 +130,7 @@ namespace Ryujinx.Common.Extensions
/// Try to read the given type out of the buffer if possible. Warning: this is dangerous to use with arbitrary
/// structs - see remarks for full details.
///
+ /// Type to read
///
/// IMPORTANT: The read is a straight copy of bits. If a struct depends on specific state of it's members to
/// behave correctly this can lead to exceptions, etc. If reading endian specific integers, use the explicit