mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-29 05:37:11 +02:00
Move solution and projects to src
This commit is contained in:
parent
cd124bda58
commit
cee7121058
3466 changed files with 55 additions and 55 deletions
35
src/Ryujinx.Tests/Audio/Renderer/Server/AddressInfoTests.cs
Normal file
35
src/Ryujinx.Tests/Audio/Renderer/Server/AddressInfoTests.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class AddressInfoTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<AddressInfo>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetReference()
|
||||
{
|
||||
MemoryPoolState[] memoryPoolState = new MemoryPoolState[1];
|
||||
memoryPoolState[0] = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
memoryPoolState[0].SetCpuAddress(0x1000000, 0x10000);
|
||||
memoryPoolState[0].DspAddress = 0x4000000;
|
||||
|
||||
AddressInfo addressInfo = AddressInfo.Create(0x1000000, 0x1000);
|
||||
|
||||
addressInfo.ForceMappedDspAddress = 0x2000000;
|
||||
|
||||
Assert.AreEqual(0x2000000, addressInfo.GetReference(true));
|
||||
|
||||
addressInfo.SetupMemoryPool(memoryPoolState.AsSpan());
|
||||
|
||||
Assert.AreEqual(0x4000000, addressInfo.GetReference(true));
|
||||
}
|
||||
}
|
||||
}
|
296
src/Ryujinx.Tests/Audio/Renderer/Server/BehaviourContextTests.cs
Normal file
296
src/Ryujinx.Tests/Audio/Renderer/Server/BehaviourContextTests.cs
Normal file
|
@ -0,0 +1,296 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
public class BehaviourContextTests
|
||||
{
|
||||
[Test]
|
||||
public void TestCheckFeature()
|
||||
{
|
||||
int latestRevision = BehaviourContext.BaseRevisionMagic + BehaviourContext.LastRevision;
|
||||
int previousRevision = BehaviourContext.BaseRevisionMagic + (BehaviourContext.LastRevision - 1);
|
||||
int invalidRevision = BehaviourContext.BaseRevisionMagic + (BehaviourContext.LastRevision + 1);
|
||||
|
||||
Assert.IsTrue(BehaviourContext.CheckFeatureSupported(latestRevision, latestRevision));
|
||||
Assert.IsFalse(BehaviourContext.CheckFeatureSupported(previousRevision, latestRevision));
|
||||
Assert.IsTrue(BehaviourContext.CheckFeatureSupported(latestRevision, previousRevision));
|
||||
// In case we get an invalid revision, this is supposed to auto default to REV1 internally.. idk what the hell Nintendo was thinking here..
|
||||
Assert.IsTrue(BehaviourContext.CheckFeatureSupported(invalidRevision, latestRevision));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestsMemoryPoolForceMappingEnabled()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision1);
|
||||
|
||||
Assert.IsFalse(behaviourContext.IsMemoryPoolForceMappingEnabled());
|
||||
|
||||
behaviourContext.UpdateFlags(0x1);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsMemoryPoolForceMappingEnabled());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision1()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision1);
|
||||
|
||||
Assert.IsFalse(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsFalse(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsFalse(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision2()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision2);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsFalse(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsFalse(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision3()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision3);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsFalse(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision4()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision4);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.75f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision5()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision5);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision6()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision6);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision7()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision7);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision8()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision8);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(3, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision9()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision9);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsTrue(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsFalse(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(3, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision10()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision10);
|
||||
|
||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
||||
Assert.IsTrue(behaviourContext.IsEffectInfoVersion2Supported());
|
||||
Assert.IsTrue(behaviourContext.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(4, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class MemoryPoolStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(Unsafe.SizeOf<MemoryPoolState>(), 0x20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestContains()
|
||||
{
|
||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||
|
||||
memoryPool.DspAddress = 0x2000000;
|
||||
|
||||
Assert.IsTrue(memoryPool.Contains(0x1000000, 0x10));
|
||||
Assert.IsTrue(memoryPool.Contains(0x1000FE0, 0x10));
|
||||
Assert.IsTrue(memoryPool.Contains(0x1000FFF, 0x1));
|
||||
Assert.IsFalse(memoryPool.Contains(0x1000FFF, 0x2));
|
||||
Assert.IsFalse(memoryPool.Contains(0x1001000, 0x10));
|
||||
Assert.IsFalse(memoryPool.Contains(0x2000000, 0x10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTranslate()
|
||||
{
|
||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||
|
||||
memoryPool.DspAddress = 0x2000000;
|
||||
|
||||
Assert.AreEqual(0x2000FE0, memoryPool.Translate(0x1000FE0, 0x10));
|
||||
Assert.AreEqual(0x2000FFF, memoryPool.Translate(0x1000FFF, 0x1));
|
||||
Assert.AreEqual(0x0, memoryPool.Translate(0x1000FFF, 0x2));
|
||||
Assert.AreEqual(0x0, memoryPool.Translate(0x1001000, 0x10));
|
||||
Assert.AreEqual(0x0, memoryPool.Translate(0x2000000, 0x10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsMapped()
|
||||
{
|
||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||
|
||||
Assert.IsFalse(memoryPool.IsMapped());
|
||||
|
||||
memoryPool.DspAddress = 0x2000000;
|
||||
|
||||
Assert.IsTrue(memoryPool.IsMapped());
|
||||
}
|
||||
}
|
||||
}
|
15
src/Ryujinx.Tests/Audio/Renderer/Server/MixStateTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/Server/MixStateTests.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Mix;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class MixStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x940, Unsafe.SizeOf<MixState>());
|
||||
}
|
||||
}
|
||||
}
|
135
src/Ryujinx.Tests/Audio/Renderer/Server/PoolMapperTests.cs
Normal file
135
src/Ryujinx.Tests/Audio/Renderer/Server/PoolMapperTests.cs
Normal file
|
@ -0,0 +1,135 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio;
|
||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||
using System;
|
||||
using static Ryujinx.Audio.Renderer.Common.BehaviourParameter;
|
||||
using CpuAddress = System.UInt64;
|
||||
using DspAddress = System.UInt64;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class PoolMapperTests
|
||||
{
|
||||
private const uint DummyProcessHandle = 0xCAFEBABE;
|
||||
|
||||
[Test]
|
||||
public void TestInitializeSystemPool()
|
||||
{
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
const CpuAddress CpuAddress = 0x20000;
|
||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||
const ulong CpuSize = 0x1000;
|
||||
|
||||
Assert.IsFalse(poolMapper.InitializeSystemPool(ref memoryPoolCpu, CpuAddress, CpuSize));
|
||||
Assert.IsTrue(poolMapper.InitializeSystemPool(ref memoryPoolDsp, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(CpuAddress, memoryPoolDsp.CpuAddress);
|
||||
Assert.AreEqual(CpuSize, memoryPoolDsp.Size);
|
||||
Assert.AreEqual(DspAddress, memoryPoolDsp.DspAddress);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetProcessHandle()
|
||||
{
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
Assert.AreEqual(0xFFFF8001, poolMapper.GetProcessHandle(ref memoryPoolCpu));
|
||||
Assert.AreEqual(DummyProcessHandle, poolMapper.GetProcessHandle(ref memoryPoolDsp));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMappings()
|
||||
{
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
const CpuAddress CpuAddress = 0x20000;
|
||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||
const ulong CpuSize = 0x1000;
|
||||
|
||||
memoryPoolDsp.SetCpuAddress(CpuAddress, CpuSize);
|
||||
memoryPoolCpu.SetCpuAddress(CpuAddress, CpuSize);
|
||||
|
||||
Assert.AreEqual(DspAddress, poolMapper.Map(ref memoryPoolCpu));
|
||||
Assert.AreEqual(DspAddress, poolMapper.Map(ref memoryPoolDsp));
|
||||
Assert.AreEqual(DspAddress, memoryPoolDsp.DspAddress);
|
||||
Assert.IsTrue(poolMapper.Unmap(ref memoryPoolCpu));
|
||||
|
||||
memoryPoolDsp.IsUsed = true;
|
||||
Assert.IsFalse(poolMapper.Unmap(ref memoryPoolDsp));
|
||||
memoryPoolDsp.IsUsed = false;
|
||||
Assert.IsTrue(poolMapper.Unmap(ref memoryPoolDsp));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTryAttachBuffer()
|
||||
{
|
||||
const CpuAddress CpuAddress = 0x20000;
|
||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||
const ulong CpuSize = 0x1000;
|
||||
|
||||
const int MemoryPoolStateArraySize = 0x10;
|
||||
const CpuAddress CpuAddressRegionEnding = CpuAddress * MemoryPoolStateArraySize;
|
||||
|
||||
MemoryPoolState[] memoryPoolStateArray = new MemoryPoolState[MemoryPoolStateArraySize];
|
||||
|
||||
for (int i = 0; i < memoryPoolStateArray.Length; i++)
|
||||
{
|
||||
memoryPoolStateArray[i] = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
memoryPoolStateArray[i].SetCpuAddress(CpuAddress + (ulong)i * CpuSize, CpuSize);
|
||||
}
|
||||
|
||||
ErrorInfo errorInfo;
|
||||
|
||||
AddressInfo addressInfo = AddressInfo.Create();
|
||||
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
|
||||
Assert.IsTrue(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, 0, 0));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(0, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
|
||||
Assert.IsTrue(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(CpuAddress, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(DspAddress, addressInfo.ForceMappedDspAddress);
|
||||
|
||||
poolMapper = new PoolMapper(DummyProcessHandle, false);
|
||||
|
||||
Assert.IsFalse(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, 0, 0));
|
||||
|
||||
addressInfo.ForceMappedDspAddress = 0;
|
||||
|
||||
Assert.IsFalse(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(CpuAddress, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
|
||||
poolMapper = new PoolMapper(DummyProcessHandle, memoryPoolStateArray.AsMemory(), false);
|
||||
|
||||
Assert.IsFalse(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddressRegionEnding, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(CpuAddressRegionEnding, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
Assert.IsFalse(addressInfo.HasMemoryPoolState);
|
||||
|
||||
Assert.IsTrue(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.Success, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(0, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
Assert.IsTrue(addressInfo.HasMemoryPoolState);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Splitter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class SplitterDestinationTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0xE0, Unsafe.SizeOf<SplitterDestination>());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Splitter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class SplitterStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<SplitterState>());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class VoiceChannelResourceTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0xD0, Unsafe.SizeOf<VoiceChannelResource>());
|
||||
}
|
||||
}
|
||||
}
|
15
src/Ryujinx.Tests/Audio/Renderer/Server/VoiceStateTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/Server/VoiceStateTests.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class VoiceStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.LessOrEqual(Unsafe.SizeOf<VoiceState>(), 0x220);
|
||||
}
|
||||
}
|
||||
}
|
15
src/Ryujinx.Tests/Audio/Renderer/Server/WaveBufferTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/Server/WaveBufferTests.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class WaveBufferTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x58, Unsafe.SizeOf<WaveBuffer>());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue