diff --git a/ARMeilleure/Decoders/OpCodeT32MemImm12.cs b/ARMeilleure/Decoders/OpCodeT32MemImm12.cs new file mode 100644 index 000000000..7838604b2 --- /dev/null +++ b/ARMeilleure/Decoders/OpCodeT32MemImm12.cs @@ -0,0 +1,25 @@ +namespace ARMeilleure.Decoders +{ + class OpCodeT32MemImm12 : OpCodeT32, IOpCode32Mem + { + public int Rt { get; } + public int Rn { get; } + public bool WBack => false; + public bool IsLoad { get; } + public bool Index => true; + public bool Add => true; + public int Immediate { get; } + + public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT32MemImm12(inst, address, opCode); + + public OpCodeT32MemImm12(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode) + { + Rt = (opCode >> 12) & 0xf; + Rn = (opCode >> 16) & 0xf; + + Immediate = opCode & 0xfff; + + IsLoad = ((opCode >> 20) & 1) != 0; + } + } +} \ No newline at end of file diff --git a/ARMeilleure/Decoders/OpCodeT32MemImm8.cs b/ARMeilleure/Decoders/OpCodeT32MemImm8.cs new file mode 100644 index 000000000..d8b7763cb --- /dev/null +++ b/ARMeilleure/Decoders/OpCodeT32MemImm8.cs @@ -0,0 +1,29 @@ +namespace ARMeilleure.Decoders +{ + class OpCodeT32MemImm8 : OpCodeT32, IOpCode32Mem + { + public int Rt { get; } + public int Rn { get; } + public bool WBack { get; } + public bool IsLoad { get; } + public bool Index { get; } + public bool Add { get; } + public int Immediate { get; } + + public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT32MemImm8(inst, address, opCode); + + public OpCodeT32MemImm8(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode) + { + Rt = (opCode >> 12) & 0xf; + Rn = (opCode >> 16) & 0xf; + + Index = ((opCode >> 10) & 1) != 0; + Add = ((opCode >> 9) & 1) != 0; + WBack = ((opCode >> 8) & 1) != 0; + + Immediate = opCode & 0xff; + + IsLoad = ((opCode >> 20) & 1) != 0; + } + } +} \ No newline at end of file diff --git a/ARMeilleure/Decoders/OpCodeTable.cs b/ARMeilleure/Decoders/OpCodeTable.cs index 28650256d..197645cde 100644 --- a/ARMeilleure/Decoders/OpCodeTable.cs +++ b/ARMeilleure/Decoders/OpCodeTable.cs @@ -1065,6 +1065,26 @@ namespace ARMeilleure.Decoders SetT32("11110x011011xxxx0xxx1111xxxxxxxx", InstName.Cmp, InstEmit32.Cmp, OpCodeT32AluImm.Create); SetT32("11101010100xxxxxxxx", InstName.Str, InstEmit32.Str, OpCodeT32MemImm8.Create); + SetT32("111110001100xxxxxxxxxxxxxxxxxxxx", InstName.Str, InstEmit32.Str, OpCodeT32MemImm12.Create); + SetT32("111110000000xxxxxxxx1<<>xxxxxxxx", InstName.Strb, InstEmit32.Strb, OpCodeT32MemImm8.Create); + SetT32("111110001000xxxxxxxxxxxxxxxxxxxx", InstName.Strb, InstEmit32.Strb, OpCodeT32MemImm12.Create); + SetT32("111110000010xxxxxxxx1<<>xxxxxxxx", InstName.Strh, InstEmit32.Strh, OpCodeT32MemImm8.Create); + SetT32("111110001010xxxxxxxxxxxxxxxxxxxx", InstName.Strh, InstEmit32.Strh, OpCodeT32MemImm12.Create); SetT32("11101011101(oldValue, value)); } diff --git a/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/Decoder.cs b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/Decoder.cs new file mode 100644 index 000000000..b77fc4b05 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/Decoder.cs @@ -0,0 +1,27 @@ +using Concentus.Structs; + +namespace Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager +{ + class Decoder : IDecoder + { + private readonly OpusDecoder _decoder; + + public int SampleRate => _decoder.SampleRate; + public int ChannelsCount => _decoder.NumChannels; + + public Decoder(int sampleRate, int channelsCount) + { + _decoder = new OpusDecoder(sampleRate, channelsCount); + } + + public int Decode(byte[] inData, int inDataOffset, int len, short[] outPcm, int outPcmOffset, int frameSize) + { + return _decoder.Decode(inData, inDataOffset, len, outPcm, outPcmOffset, frameSize); + } + + public void ResetState() + { + _decoder.ResetState(); + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/DecoderCommon.cs b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/DecoderCommon.cs new file mode 100644 index 000000000..944541cce --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/DecoderCommon.cs @@ -0,0 +1,92 @@ +using Concentus; +using Concentus.Enums; +using Concentus.Structs; +using Ryujinx.HLE.HOS.Services.Audio.Types; +using System; +using System.Runtime.CompilerServices; + +namespace Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager +{ + static class DecoderCommon + { + private static ResultCode GetPacketNumSamples(this IDecoder decoder, out int numSamples, byte[] packet) + { + int result = OpusPacketInfo.GetNumSamples(packet, 0, packet.Length, decoder.SampleRate); + + numSamples = result; + + if (result == OpusError.OPUS_INVALID_PACKET) + { + return ResultCode.OpusInvalidInput; + } + else if (result == OpusError.OPUS_BAD_ARG) + { + return ResultCode.OpusInvalidInput; + } + + return ResultCode.Success; + } + + public static ResultCode DecodeInterleaved( + this IDecoder decoder, + bool reset, + ReadOnlySpan input, + out short[] outPcmData, + ulong outputSize, + out uint outConsumed, + out int outSamples) + { + outPcmData = null; + outConsumed = 0; + outSamples = 0; + + int streamSize = input.Length; + + if (streamSize < Unsafe.SizeOf()) + { + return ResultCode.OpusInvalidInput; + } + + OpusPacketHeader header = OpusPacketHeader.FromSpan(input); + int headerSize = Unsafe.SizeOf(); + uint totalSize = header.length + (uint)headerSize; + + if (totalSize > streamSize) + { + return ResultCode.OpusInvalidInput; + } + + byte[] opusData = input.Slice(headerSize, (int)header.length).ToArray(); + + ResultCode result = decoder.GetPacketNumSamples(out int numSamples, opusData); + + if (result == ResultCode.Success) + { + if ((uint)numSamples * (uint)decoder.ChannelsCount * sizeof(short) > outputSize) + { + return ResultCode.OpusInvalidInput; + } + + outPcmData = new short[numSamples * decoder.ChannelsCount]; + + if (reset) + { + decoder.ResetState(); + } + + try + { + outSamples = decoder.Decode(opusData, 0, opusData.Length, outPcmData, 0, outPcmData.Length / decoder.ChannelsCount); + outConsumed = totalSize; + } + catch (OpusException) + { + // TODO: as OpusException doesn't provide us the exact error code, this is kind of inaccurate in some cases... + return ResultCode.OpusInvalidInput; + } + } + + return ResultCode.Success; + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/IDecoder.cs b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/IDecoder.cs new file mode 100644 index 000000000..9047c2668 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/IDecoder.cs @@ -0,0 +1,11 @@ +namespace Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager +{ + interface IDecoder + { + int SampleRate { get; } + int ChannelsCount { get; } + + int Decode(byte[] inData, int inDataOffset, int len, short[] outPcm, int outPcmOffset, int frameSize); + void ResetState(); + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/IHardwareOpusDecoder.cs b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/IHardwareOpusDecoder.cs index 44eeb32de..84c55d5ec 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/IHardwareOpusDecoder.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/IHardwareOpusDecoder.cs @@ -1,244 +1,112 @@ -using Concentus; -using Concentus.Enums; -using Concentus.Structs; using Ryujinx.HLE.HOS.Services.Audio.Types; using System; -using System.IO; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager { class IHardwareOpusDecoder : IpcService { - private int _sampleRate; - private int _channelsCount; - private bool _reset; + private readonly IDecoder _decoder; + private readonly OpusDecoderFlags _flags; - private OpusDecoder _decoder; - - public IHardwareOpusDecoder(int sampleRate, int channelsCount) + public IHardwareOpusDecoder(int sampleRate, int channelsCount, OpusDecoderFlags flags) { - _sampleRate = sampleRate; - _channelsCount = channelsCount; - _reset = false; - - _decoder = new OpusDecoder(sampleRate, channelsCount); + _decoder = new Decoder(sampleRate, channelsCount); + _flags = flags; } - private ResultCode GetPacketNumSamples(out int numSamples, byte[] packet) + public IHardwareOpusDecoder(int sampleRate, int channelsCount, int streams, int coupledStreams, OpusDecoderFlags flags, byte[] mapping) { - int result = OpusPacketInfo.GetNumSamples(_decoder, packet, 0, packet.Length); - - numSamples = result; - - if (result == OpusError.OPUS_INVALID_PACKET) - { - return ResultCode.OpusInvalidInput; - } - else if (result == OpusError.OPUS_BAD_ARG) - { - return ResultCode.OpusInvalidInput; - } - - return ResultCode.Success; - } - - private ResultCode DecodeInterleavedInternal(BinaryReader input, out short[] outPcmData, long outputSize, out uint outConsumed, out int outSamples) - { - outPcmData = null; - outConsumed = 0; - outSamples = 0; - - long streamSize = input.BaseStream.Length; - - if (streamSize < Marshal.SizeOf()) - { - return ResultCode.OpusInvalidInput; - } - - OpusPacketHeader header = OpusPacketHeader.FromStream(input); - - uint totalSize = header.length + (uint)Marshal.SizeOf(); - - if (totalSize > streamSize) - { - return ResultCode.OpusInvalidInput; - } - - byte[] opusData = input.ReadBytes((int)header.length); - - ResultCode result = GetPacketNumSamples(out int numSamples, opusData); - - if (result == ResultCode.Success) - { - if ((uint)numSamples * (uint)_channelsCount * sizeof(short) > outputSize) - { - return ResultCode.OpusInvalidInput; - } - - outPcmData = new short[numSamples * _channelsCount]; - - if (_reset) - { - _reset = false; - - _decoder.ResetState(); - } - - try - { - outSamples = _decoder.Decode(opusData, 0, opusData.Length, outPcmData, 0, outPcmData.Length / _channelsCount); - outConsumed = totalSize; - } - catch (OpusException) - { - // TODO: as OpusException doesn't provide us the exact error code, this is kind of inaccurate in some cases... - return ResultCode.OpusInvalidInput; - } - } - - return ResultCode.Success; + _decoder = new MultiSampleDecoder(sampleRate, channelsCount, streams, coupledStreams, mapping); + _flags = flags; } [CommandHipc(0)] - // DecodeInterleaved(buffer) -> (u32, u32, buffer) - public ResultCode DecodeInterleavedOriginal(ServiceCtx context) + // DecodeInterleavedOld(buffer) -> (u32, u32, buffer) + public ResultCode DecodeInterleavedOld(ServiceCtx context) { - ResultCode result; + return DecodeInterleavedInternal(context, OpusDecoderFlags.None, reset: false, withPerf: false); + } - ulong inPosition = context.Request.SendBuff[0].Position; - ulong inSize = context.Request.SendBuff[0].Size; - ulong outputPosition = context.Request.ReceiveBuff[0].Position; - ulong outputSize = context.Request.ReceiveBuff[0].Size; - - byte[] buffer = new byte[inSize]; - - context.Memory.Read(inPosition, buffer); - - using (BinaryReader inputStream = new BinaryReader(new MemoryStream(buffer))) - { - result = DecodeInterleavedInternal(inputStream, out short[] outPcmData, (long)outputSize, out uint outConsumed, out int outSamples); - - if (result == ResultCode.Success) - { - byte[] pcmDataBytes = new byte[outPcmData.Length * sizeof(short)]; - Buffer.BlockCopy(outPcmData, 0, pcmDataBytes, 0, pcmDataBytes.Length); - context.Memory.Write(outputPosition, pcmDataBytes); - - context.ResponseData.Write(outConsumed); - context.ResponseData.Write(outSamples); - } - } - - return result; + [CommandHipc(2)] + // DecodeInterleavedForMultiStreamOld(buffer) -> (u32, u32, buffer) + public ResultCode DecodeInterleavedForMultiStreamOld(ServiceCtx context) + { + return DecodeInterleavedInternal(context, OpusDecoderFlags.None, reset: false, withPerf: false); } [CommandHipc(4)] // 6.0.0+ // DecodeInterleavedWithPerfOld(buffer) -> (u32, u32, u64, buffer) public ResultCode DecodeInterleavedWithPerfOld(ServiceCtx context) { - ResultCode result; + return DecodeInterleavedInternal(context, OpusDecoderFlags.None, reset: false, withPerf: true); + } - ulong inPosition = context.Request.SendBuff[0].Position; - ulong inSize = context.Request.SendBuff[0].Size; - ulong outputPosition = context.Request.ReceiveBuff[0].Position; - ulong outputSize = context.Request.ReceiveBuff[0].Size; - - byte[] buffer = new byte[inSize]; - - context.Memory.Read(inPosition, buffer); - - using (BinaryReader inputStream = new BinaryReader(new MemoryStream(buffer))) - { - result = DecodeInterleavedInternal(inputStream, out short[] outPcmData, (long)outputSize, out uint outConsumed, out int outSamples); - - if (result == ResultCode.Success) - { - byte[] pcmDataBytes = new byte[outPcmData.Length * sizeof(short)]; - Buffer.BlockCopy(outPcmData, 0, pcmDataBytes, 0, pcmDataBytes.Length); - context.Memory.Write(outputPosition, pcmDataBytes); - - context.ResponseData.Write(outConsumed); - context.ResponseData.Write(outSamples); - - // This is the time the DSP took to process the request, TODO: fill this. - context.ResponseData.Write(0); - } - } - - return result; + [CommandHipc(5)] // 6.0.0+ + // DecodeInterleavedForMultiStreamWithPerfOld(buffer) -> (u32, u32, u64, buffer) + public ResultCode DecodeInterleavedForMultiStreamWithPerfOld(ServiceCtx context) + { + return DecodeInterleavedInternal(context, OpusDecoderFlags.None, reset: false, withPerf: true); } [CommandHipc(6)] // 6.0.0+ - // DecodeInterleavedOld(bool reset, buffer) -> (u32, u32, u64, buffer) - public ResultCode DecodeInterleavedOld(ServiceCtx context) + // DecodeInterleavedWithPerfAndResetOld(bool reset, buffer) -> (u32, u32, u64, buffer) + public ResultCode DecodeInterleavedWithPerfAndResetOld(ServiceCtx context) { - ResultCode result; + bool reset = context.RequestData.ReadBoolean(); - _reset = context.RequestData.ReadBoolean(); + return DecodeInterleavedInternal(context, OpusDecoderFlags.None, reset, withPerf: true); + } - ulong inPosition = context.Request.SendBuff[0].Position; - ulong inSize = context.Request.SendBuff[0].Size; - ulong outputPosition = context.Request.ReceiveBuff[0].Position; - ulong outputSize = context.Request.ReceiveBuff[0].Size; + [CommandHipc(7)] // 6.0.0+ + // DecodeInterleavedForMultiStreamWithPerfAndResetOld(bool reset, buffer) -> (u32, u32, u64, buffer) + public ResultCode DecodeInterleavedForMultiStreamWithPerfAndResetOld(ServiceCtx context) + { + bool reset = context.RequestData.ReadBoolean(); - byte[] buffer = new byte[inSize]; - - context.Memory.Read(inPosition, buffer); - - using (BinaryReader inputStream = new BinaryReader(new MemoryStream(buffer))) - { - result = DecodeInterleavedInternal(inputStream, out short[] outPcmData, (long)outputSize, out uint outConsumed, out int outSamples); - - if (result == ResultCode.Success) - { - byte[] pcmDataBytes = new byte[outPcmData.Length * sizeof(short)]; - Buffer.BlockCopy(outPcmData, 0, pcmDataBytes, 0, pcmDataBytes.Length); - context.Memory.Write(outputPosition, pcmDataBytes); - - context.ResponseData.Write(outConsumed); - context.ResponseData.Write(outSamples); - - // This is the time the DSP took to process the request, TODO: fill this. - context.ResponseData.Write(0); - } - } - - return result; + return DecodeInterleavedInternal(context, OpusDecoderFlags.None, reset, withPerf: true); } [CommandHipc(8)] // 7.0.0+ // DecodeInterleaved(bool reset, buffer) -> (u32, u32, u64, buffer) public ResultCode DecodeInterleaved(ServiceCtx context) { - ResultCode result; + bool reset = context.RequestData.ReadBoolean(); - _reset = context.RequestData.ReadBoolean(); + return DecodeInterleavedInternal(context, _flags, reset, withPerf: true); + } + [CommandHipc(9)] // 7.0.0+ + // DecodeInterleavedForMultiStream(bool reset, buffer) -> (u32, u32, u64, buffer) + public ResultCode DecodeInterleavedForMultiStream(ServiceCtx context) + { + bool reset = context.RequestData.ReadBoolean(); + + return DecodeInterleavedInternal(context, _flags, reset, withPerf: true); + } + + private ResultCode DecodeInterleavedInternal(ServiceCtx context, OpusDecoderFlags flags, bool reset, bool withPerf) + { ulong inPosition = context.Request.SendBuff[0].Position; ulong inSize = context.Request.SendBuff[0].Size; ulong outputPosition = context.Request.ReceiveBuff[0].Position; ulong outputSize = context.Request.ReceiveBuff[0].Size; - byte[] buffer = new byte[inSize]; + ReadOnlySpan input = context.Memory.GetSpan(inPosition, (int)inSize); - context.Memory.Read(inPosition, buffer); + ResultCode result = _decoder.DecodeInterleaved(reset, input, out short[] outPcmData, outputSize, out uint outConsumed, out int outSamples); - using (BinaryReader inputStream = new BinaryReader(new MemoryStream(buffer))) + if (result == ResultCode.Success) { - result = DecodeInterleavedInternal(inputStream, out short[] outPcmData, (long)outputSize, out uint outConsumed, out int outSamples); + context.Memory.Write(outputPosition, MemoryMarshal.Cast(outPcmData.AsSpan())); - if (result == ResultCode.Success) + context.ResponseData.Write(outConsumed); + context.ResponseData.Write(outSamples); + + if (withPerf) { - byte[] pcmDataBytes = new byte[outPcmData.Length * sizeof(short)]; - Buffer.BlockCopy(outPcmData, 0, pcmDataBytes, 0, pcmDataBytes.Length); - context.Memory.Write(outputPosition, pcmDataBytes); - - context.ResponseData.Write(outConsumed); - context.ResponseData.Write(outSamples); - // This is the time the DSP took to process the request, TODO: fill this. - context.ResponseData.Write(0); + context.ResponseData.Write(0UL); } } diff --git a/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/MultiSampleDecoder.cs b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/MultiSampleDecoder.cs new file mode 100644 index 000000000..23721d3bf --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Audio/HardwareOpusDecoderManager/MultiSampleDecoder.cs @@ -0,0 +1,28 @@ +using Concentus.Structs; + +namespace Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager +{ + class MultiSampleDecoder : IDecoder + { + private readonly OpusMSDecoder _decoder; + + public int SampleRate => _decoder.SampleRate; + public int ChannelsCount { get; } + + public MultiSampleDecoder(int sampleRate, int channelsCount, int streams, int coupledStreams, byte[] mapping) + { + ChannelsCount = channelsCount; + _decoder = new OpusMSDecoder(sampleRate, channelsCount, streams, coupledStreams, mapping); + } + + public int Decode(byte[] inData, int inDataOffset, int len, short[] outPcm, int outPcmOffset, int frameSize) + { + return _decoder.DecodeMultistream(inData, inDataOffset, len, outPcm, outPcmOffset, frameSize, 0); + } + + public void ResetState() + { + _decoder.ResetState(); + } + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs b/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs index d8e4f75d0..81ea952b5 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/IHardwareOpusDecoderManager.cs @@ -1,6 +1,7 @@ using Ryujinx.Common; using Ryujinx.HLE.HOS.Services.Audio.HardwareOpusDecoderManager; using Ryujinx.HLE.HOS.Services.Audio.Types; +using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Audio { @@ -16,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio int sampleRate = context.RequestData.ReadInt32(); int channelsCount = context.RequestData.ReadInt32(); - MakeObject(context, new IHardwareOpusDecoder(sampleRate, channelsCount)); + MakeObject(context, new IHardwareOpusDecoder(sampleRate, channelsCount, OpusDecoderFlags.None)); // Close transfer memory immediately as we don't use it. context.Device.System.KernelContext.Syscall.CloseHandle(context.Request.HandleDesc.ToCopy[0]); @@ -28,11 +29,50 @@ namespace Ryujinx.HLE.HOS.Services.Audio // GetWorkBufferSize(bytes<8, 4>) -> u32 public ResultCode GetWorkBufferSize(ServiceCtx context) { - // NOTE: The sample rate is ignored because it is fixed to 48KHz. int sampleRate = context.RequestData.ReadInt32(); int channelsCount = context.RequestData.ReadInt32(); - context.ResponseData.Write(GetOpusDecoderSize(channelsCount)); + int opusDecoderSize = GetOpusDecoderSize(channelsCount); + + int frameSize = BitUtils.AlignUp(channelsCount * 1920 / (48000 / sampleRate), 64); + int totalSize = opusDecoderSize + 1536 + frameSize; + + context.ResponseData.Write(totalSize); + + return ResultCode.Success; + } + + [CommandHipc(2)] // 3.0.0+ + // InitializeForMultiStream(u32, handle, buffer, 0x19>) -> object + public ResultCode InitializeForMultiStream(ServiceCtx context) + { + ulong parametersAddress = context.Request.PtrBuff[0].Position; + + OpusMultiStreamParameters parameters = context.Memory.Read(parametersAddress); + + MakeObject(context, new IHardwareOpusDecoder(parameters.SampleRate, parameters.ChannelsCount, OpusDecoderFlags.None)); + + // Close transfer memory immediately as we don't use it. + context.Device.System.KernelContext.Syscall.CloseHandle(context.Request.HandleDesc.ToCopy[0]); + + return ResultCode.Success; + } + + [CommandHipc(3)] // 3.0.0+ + // GetWorkBufferSizeForMultiStream(buffer, 0x19>) -> u32 + public ResultCode GetWorkBufferSizeForMultiStream(ServiceCtx context) + { + ulong parametersAddress = context.Request.PtrBuff[0].Position; + + OpusMultiStreamParameters parameters = context.Memory.Read(parametersAddress); + + int opusDecoderSize = GetOpusMultistreamDecoderSize(parameters.NumberOfStreams, parameters.NumberOfStereoStreams); + + int streamSize = BitUtils.AlignUp(parameters.NumberOfStreams * 1500, 64); + int frameSize = BitUtils.AlignUp(parameters.ChannelsCount * 1920 / (48000 / parameters.SampleRate), 64); + int totalSize = opusDecoderSize + streamSize + frameSize; + + context.ResponseData.Write(totalSize); return ResultCode.Success; } @@ -44,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio OpusParametersEx parameters = context.RequestData.ReadStruct(); // UseLargeFrameSize can be ignored due to not relying on fixed size buffers for storing the decoded result. - MakeObject(context, new IHardwareOpusDecoder(parameters.SampleRate, parameters.ChannelCount)); + MakeObject(context, new IHardwareOpusDecoder(parameters.SampleRate, parameters.ChannelsCount, parameters.Flags)); // Close transfer memory immediately as we don't use it. context.Device.System.KernelContext.Syscall.CloseHandle(context.Request.HandleDesc.ToCopy[0]); @@ -58,15 +98,84 @@ namespace Ryujinx.HLE.HOS.Services.Audio { OpusParametersEx parameters = context.RequestData.ReadStruct(); - // NOTE: The sample rate is ignored because it is fixed to 48KHz. - context.ResponseData.Write(GetOpusDecoderSize(parameters.ChannelCount)); + int opusDecoderSize = GetOpusDecoderSize(parameters.ChannelsCount); + + int frameSizeMono48KHz = parameters.Flags.HasFlag(OpusDecoderFlags.LargeFrameSize) ? 5760 : 1920; + int frameSize = BitUtils.AlignUp(parameters.ChannelsCount * frameSizeMono48KHz / (48000 / parameters.SampleRate), 64); + int totalSize = opusDecoderSize + 1536 + frameSize; + + context.ResponseData.Write(totalSize); return ResultCode.Success; } + [CommandHipc(6)] // 12.0.0+ + // InitializeForMultiStreamEx(u32, handle, buffer, 0x19>) -> object + public ResultCode InitializeForMultiStreamEx(ServiceCtx context) + { + ulong parametersAddress = context.Request.PtrBuff[0].Position; + + OpusMultiStreamParametersEx parameters = context.Memory.Read(parametersAddress); + + byte[] mappings = MemoryMarshal.Cast(parameters.ChannelMappings.ToSpan()).ToArray(); + + // UseLargeFrameSize can be ignored due to not relying on fixed size buffers for storing the decoded result. + MakeObject(context, new IHardwareOpusDecoder( + parameters.SampleRate, + parameters.ChannelsCount, + parameters.NumberOfStreams, + parameters.NumberOfStereoStreams, + parameters.Flags, + mappings)); + + // Close transfer memory immediately as we don't use it. + context.Device.System.KernelContext.Syscall.CloseHandle(context.Request.HandleDesc.ToCopy[0]); + + return ResultCode.Success; + } + + [CommandHipc(7)] // 12.0.0+ + // GetWorkBufferSizeForMultiStreamEx(buffer, 0x19>) -> u32 + public ResultCode GetWorkBufferSizeForMultiStreamEx(ServiceCtx context) + { + ulong parametersAddress = context.Request.PtrBuff[0].Position; + + OpusMultiStreamParametersEx parameters = context.Memory.Read(parametersAddress); + + int opusDecoderSize = GetOpusMultistreamDecoderSize(parameters.NumberOfStreams, parameters.NumberOfStereoStreams); + + int frameSizeMono48KHz = parameters.Flags.HasFlag(OpusDecoderFlags.LargeFrameSize) ? 5760 : 1920; + int streamSize = BitUtils.AlignUp(parameters.NumberOfStreams * 1500, 64); + int frameSize = BitUtils.AlignUp(parameters.ChannelsCount * frameSizeMono48KHz / (48000 / parameters.SampleRate), 64); + int totalSize = opusDecoderSize + streamSize + frameSize; + + context.ResponseData.Write(totalSize); + + return ResultCode.Success; + } + + private static int GetOpusMultistreamDecoderSize(int streams, int coupledStreams) + { + if (streams < 1 || coupledStreams > streams || coupledStreams < 0) + { + return 0; + } + + int coupledSize = GetOpusDecoderSize(2); + int monoSize = GetOpusDecoderSize(1); + + return Align4(monoSize - GetOpusDecoderAllocSize(1)) * (streams - coupledStreams) + + Align4(coupledSize - GetOpusDecoderAllocSize(2)) * coupledStreams + 0xb90c; + } + + private static int Align4(int value) + { + return BitUtils.AlignUp(value, 4); + } + private static int GetOpusDecoderSize(int channelsCount) { - const int silkDecoderSize = 0x2198; + const int SilkDecoderSize = 0x2160; if (channelsCount < 1 || channelsCount > 2) { @@ -74,24 +183,23 @@ namespace Ryujinx.HLE.HOS.Services.Audio } int celtDecoderSize = GetCeltDecoderSize(channelsCount); + int opusDecoderSize = GetOpusDecoderAllocSize(channelsCount) | 0x4c; - int opusDecoderSize = (channelsCount * 0x800 + 0x4807) & -0x800 | 0x50; + return opusDecoderSize + SilkDecoderSize + celtDecoderSize; + } - return opusDecoderSize + silkDecoderSize + celtDecoderSize; + private static int GetOpusDecoderAllocSize(int channelsCount) + { + return (channelsCount * 0x800 + 0x4803) & -0x800; } private static int GetCeltDecoderSize(int channelsCount) { - const int decodeBufferSize = 0x2030; - const int celtDecoderSize = 0x58; - const int celtSigSize = 0x4; - const int overlap = 120; - const int eBandsCount = 21; + const int DecodeBufferSize = 0x2030; + const int Overlap = 120; + const int EBandsCount = 21; - return (decodeBufferSize + overlap * 4) * channelsCount + - eBandsCount * 16 + - celtDecoderSize + - celtSigSize; + return (DecodeBufferSize + Overlap * 4) * channelsCount + EBandsCount * 16 + 0x50; } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Audio/Types/OpusMultiStreamParameters.cs b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusMultiStreamParameters.cs new file mode 100644 index 000000000..fd63a4f79 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusMultiStreamParameters.cs @@ -0,0 +1,15 @@ +using Ryujinx.Common.Memory; +using System.Runtime.InteropServices; + +namespace Ryujinx.HLE.HOS.Services.Audio.Types +{ + [StructLayout(LayoutKind.Sequential, Size = 0x110)] + struct OpusMultiStreamParameters + { + public int SampleRate; + public int ChannelsCount; + public int NumberOfStreams; + public int NumberOfStereoStreams; + public Array64 ChannelMappings; + } +} diff --git a/Ryujinx.HLE/HOS/Services/Audio/Types/OpusMultiStreamParametersEx.cs b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusMultiStreamParametersEx.cs new file mode 100644 index 000000000..1315c734e --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusMultiStreamParametersEx.cs @@ -0,0 +1,19 @@ +using Ryujinx.Common.Memory; +using System.Runtime.InteropServices; + +namespace Ryujinx.HLE.HOS.Services.Audio.Types +{ + [StructLayout(LayoutKind.Sequential, Size = 0x118)] + struct OpusMultiStreamParametersEx + { + public int SampleRate; + public int ChannelsCount; + public int NumberOfStreams; + public int NumberOfStereoStreams; + public OpusDecoderFlags Flags; + + Array4 Padding1; + + public Array64 ChannelMappings; + } +} diff --git a/Ryujinx.HLE/HOS/Services/Audio/Types/OpusPacketHeader.cs b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusPacketHeader.cs index 0a50a5c88..3d6302948 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/Types/OpusPacketHeader.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusPacketHeader.cs @@ -12,9 +12,9 @@ namespace Ryujinx.HLE.HOS.Services.Audio.Types public uint length; public uint finalRange; - public static OpusPacketHeader FromStream(BinaryReader reader) + public static OpusPacketHeader FromSpan(ReadOnlySpan data) { - OpusPacketHeader header = reader.ReadStruct(); + OpusPacketHeader header = MemoryMarshal.Cast(data)[0]; header.length = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(header.length) : header.length; header.finalRange = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(header.finalRange) : header.finalRange; diff --git a/Ryujinx.HLE/HOS/Services/Audio/Types/OpusParametersEx.cs b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusParametersEx.cs index f00df2f8c..f088ed012 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/Types/OpusParametersEx.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/Types/OpusParametersEx.cs @@ -7,8 +7,8 @@ namespace Ryujinx.HLE.HOS.Services.Audio.Types struct OpusParametersEx { public int SampleRate; - public int ChannelCount; - public OpusDecoderFlags UseLargeFrameSize; + public int ChannelsCount; + public OpusDecoderFlags Flags; Array4 Padding1; } diff --git a/Ryujinx.Input/HLE/NpadController.cs b/Ryujinx.Input/HLE/NpadController.cs index eb9989b03..1e0789b77 100644 --- a/Ryujinx.Input/HLE/NpadController.cs +++ b/Ryujinx.Input/HLE/NpadController.cs @@ -302,7 +302,7 @@ namespace Ryujinx.Input.HLE Vector3 gyroscope = _gamepad.GetMotionData(MotionInputId.Gyroscope); accelerometer = new Vector3(accelerometer.X, -accelerometer.Z, accelerometer.Y); - gyroscope = new Vector3(gyroscope.X, gyroscope.Z, gyroscope.Y); + gyroscope = new Vector3(gyroscope.X, -gyroscope.Z, gyroscope.Y); _leftMotionInput.Update(accelerometer, gyroscope, (ulong)PerformanceCounter.ElapsedNanoseconds / 1000, controllerConfig.Motion.Sensitivity, (float)controllerConfig.Motion.GyroDeadzone); diff --git a/Ryujinx.Tests/Cpu/CpuTest32.cs b/Ryujinx.Tests/Cpu/CpuTest32.cs index 1ffea0b67..2176e5adf 100644 --- a/Ryujinx.Tests/Cpu/CpuTest32.cs +++ b/Ryujinx.Tests/Cpu/CpuTest32.cs @@ -286,6 +286,35 @@ namespace Ryujinx.Tests.Cpu Assert.That(GetContext().Pstate, Is.EqualTo(finalCpsr)); } + public void RunPrecomputedTestCase(PrecomputedMemoryThumbTestCase test) + { + byte[] testMem = new byte[Size]; + + for (ulong i = 0; i < Size; i += 2) + { + testMem[i + 0] = (byte)((i + DataBaseAddress) >> 0); + testMem[i + 1] = (byte)((i + DataBaseAddress) >> 8); + } + + SetWorkingMemory(0, testMem); + + RunPrecomputedTestCase(new PrecomputedThumbTestCase(){ + Instructions = test.Instructions, + StartRegs = test.StartRegs, + FinalRegs = test.FinalRegs, + }); + + foreach (var delta in test.MemoryDelta) + { + testMem[delta.Address - DataBaseAddress + 0] = (byte)(delta.Value >> 0); + testMem[delta.Address - DataBaseAddress + 1] = (byte)(delta.Value >> 8); + } + + byte[] mem = _memory.GetSpan(DataBaseAddress, (int)Size).ToArray(); + + Assert.That(mem, Is.EqualTo(testMem), "testmem"); + } + protected void SetWorkingMemory(uint offset, byte[] data) { _memory.Write(DataBaseAddress + offset, data); @@ -641,4 +670,4 @@ namespace Ryujinx.Tests.Cpu _context.SetFPstateFlag(FPState.VFlag, (fpscr & (1u << (int)FPState.VFlag)) != 0); } } -} +} \ No newline at end of file diff --git a/Ryujinx.Tests/Cpu/CpuTestT32Mem.cs b/Ryujinx.Tests/Cpu/CpuTestT32Mem.cs new file mode 100644 index 000000000..024548aef --- /dev/null +++ b/Ryujinx.Tests/Cpu/CpuTestT32Mem.cs @@ -0,0 +1,522 @@ +using ARMeilleure.State; +using NUnit.Framework; +using System; + +namespace Ryujinx.Tests.Cpu +{ + [Category("T32Mem")] + public sealed class CpuTestT32Mem : CpuTest32 + { + [Test] + public void TestT32MemImm([ValueSource(nameof(ImmTestCases))] PrecomputedMemoryThumbTestCase test) + { + RunPrecomputedTestCase(test); + } + + public static readonly PrecomputedMemoryThumbTestCase[] ImmTestCases = + { + // STRB (imm8) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf80c, 0x1b2f, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000023bd, 0x000027bb, 0x00002715, 0x000028f5, 0x0000233f, 0x0000213b, 0x00002eea, 0x0000282b, 0x000021e1, 0x0000264c, 0x000029e0, 0x00002ae7, 0x000021ff, 0x000026e3, 0x00000001, 0x800001f0 }, + FinalRegs = new uint[] { 0x000023bd, 0x000027bb, 0x00002715, 0x000028f5, 0x0000233f, 0x0000213b, 0x00002eea, 0x0000282b, 0x000021e1, 0x0000264c, 0x000029e0, 0x00002ae7, 0x0000222e, 0x000026e3, 0x00000001, 0x800001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x21fe, Value: 0xbbfe) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf80a, 0x2f81, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000223c, 0x00002db9, 0x00002900, 0x0000247c, 0x00002b0a, 0x0000266b, 0x000026df, 0x00002447, 0x000024bb, 0x00002687, 0x0000266f, 0x00002a80, 0x000025ff, 0x00002881, 0x00000001, 0xa00001f0 }, + FinalRegs = new uint[] { 0x0000223c, 0x00002db9, 0x00002900, 0x0000247c, 0x00002b0a, 0x0000266b, 0x000026df, 0x00002447, 0x000024bb, 0x00002687, 0x000026f0, 0x00002a80, 0x000025ff, 0x00002881, 0x00000001, 0xa00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x26f0, Value: 0x2600) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf803, 0x6968, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000026ed, 0x00002685, 0x00002cd1, 0x00002dac, 0x00002a23, 0x00002626, 0x00002ec9, 0x0000245c, 0x000024ef, 0x00002319, 0x000026ce, 0x0000214d, 0x00002401, 0x000028b4, 0x00000001, 0x300001f0 }, + FinalRegs = new uint[] { 0x000026ed, 0x00002685, 0x00002cd1, 0x00002d44, 0x00002a23, 0x00002626, 0x00002ec9, 0x0000245c, 0x000024ef, 0x00002319, 0x000026ce, 0x0000214d, 0x00002401, 0x000028b4, 0x00000001, 0x300001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2dac, Value: 0x2dc9) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf804, 0x89ad, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000265d, 0x00002b9c, 0x00002360, 0x000029ec, 0x00002413, 0x00002d8e, 0x00002aad, 0x00002d29, 0x00002bca, 0x00002a44, 0x00002980, 0x00002710, 0x000022fa, 0x0000222e, 0x00000001, 0xc00001f0 }, + FinalRegs = new uint[] { 0x0000265d, 0x00002b9c, 0x00002360, 0x000029ec, 0x00002366, 0x00002d8e, 0x00002aad, 0x00002d29, 0x00002bca, 0x00002a44, 0x00002980, 0x00002710, 0x000022fa, 0x0000222e, 0x00000001, 0xc00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2412, Value: 0xca12) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf80d, 0xa9fe, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000298d, 0x00002e6c, 0x00002986, 0x00002ebb, 0x0000213e, 0x00002e39, 0x0000246f, 0x00002b6c, 0x00002ee2, 0x0000259e, 0x0000250a, 0x000029f6, 0x000021e7, 0x00002d9d, 0x00000001, 0x900001f0 }, + FinalRegs = new uint[] { 0x0000298d, 0x00002e6c, 0x00002986, 0x00002ebb, 0x0000213e, 0x00002e39, 0x0000246f, 0x00002b6c, 0x00002ee2, 0x0000259e, 0x0000250a, 0x000029f6, 0x000021e7, 0x00002c9f, 0x00000001, 0x900001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2d9c, Value: 0x0a9c) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf80d, 0x3c46, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002c6f, 0x000028cc, 0x000025f0, 0x000022cc, 0x00002de3, 0x0000243c, 0x000025fb, 0x00002e88, 0x00002985, 0x000023ee, 0x00002120, 0x00002d50, 0x0000270a, 0x00002bbd, 0x00000001, 0xa00001f0 }, + FinalRegs = new uint[] { 0x00002c6f, 0x000028cc, 0x000025f0, 0x000022cc, 0x00002de3, 0x0000243c, 0x000025fb, 0x00002e88, 0x00002985, 0x000023ee, 0x00002120, 0x00002d50, 0x0000270a, 0x00002bbd, 0x00000001, 0xa00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2b76, Value: 0xcc76) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf801, 0x6c56, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002d6e, 0x00002530, 0x00002e6d, 0x00002942, 0x00002985, 0x00002d64, 0x00002a73, 0x00002ac6, 0x00002955, 0x00002881, 0x0000221d, 0x00002cb0, 0x0000225f, 0x00002534, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x00002d6e, 0x00002530, 0x00002e6d, 0x00002942, 0x00002985, 0x00002d64, 0x00002a73, 0x00002ac6, 0x00002955, 0x00002881, 0x0000221d, 0x00002cb0, 0x0000225f, 0x00002534, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x24da, Value: 0x2473) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf809, 0xcc76, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002d50, 0x000025f2, 0x0000250a, 0x0000214c, 0x000023d1, 0x00002115, 0x00002c27, 0x00002540, 0x0000222b, 0x00002d03, 0x00002679, 0x00002b52, 0x00002eee, 0x00002b2a, 0x00000001, 0xd00001f0 }, + FinalRegs = new uint[] { 0x00002d50, 0x000025f2, 0x0000250a, 0x0000214c, 0x000023d1, 0x00002115, 0x00002c27, 0x00002540, 0x0000222b, 0x00002d03, 0x00002679, 0x00002b52, 0x00002eee, 0x00002b2a, 0x00000001, 0xd00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2c8c, Value: 0xee8c) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf808, 0x1c8d, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002844, 0x00002b78, 0x000028b0, 0x000026ff, 0x0000280b, 0x00002e0b, 0x00002de4, 0x00002b53, 0x00002ecd, 0x000021b5, 0x000026bc, 0x00002e9d, 0x00002d33, 0x000027f0, 0x00000001, 0x800001f0 }, + FinalRegs = new uint[] { 0x00002844, 0x00002b78, 0x000028b0, 0x000026ff, 0x0000280b, 0x00002e0b, 0x00002de4, 0x00002b53, 0x00002ecd, 0x000021b5, 0x000026bc, 0x00002e9d, 0x00002d33, 0x000027f0, 0x00000001, 0x800001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2e40, Value: 0x2e78) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf80b, 0xbc26, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002244, 0x000025ad, 0x00002434, 0x00002b06, 0x00002ebd, 0x0000292b, 0x00002431, 0x00002e12, 0x0000289b, 0x0000265a, 0x00002747, 0x00002bac, 0x00002dae, 0x00002582, 0x00000001, 0xf00001f0 }, + FinalRegs = new uint[] { 0x00002244, 0x000025ad, 0x00002434, 0x00002b06, 0x00002ebd, 0x0000292b, 0x00002431, 0x00002e12, 0x0000289b, 0x0000265a, 0x00002747, 0x00002bac, 0x00002dae, 0x00002582, 0x00000001, 0xf00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2b86, Value: 0x2bac) }, + }, + // STRB (imm12) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf887, 0x67c2, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x700001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x700001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x27c2, Value: 0x2700) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf883, 0x9fda, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xc00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xc00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2fda, Value: 0x2f00) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf889, 0xd200, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x400001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x400001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf88c, 0x1c5b, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x500001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x500001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2c5a, Value: 0x005a) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf887, 0x9fe2, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2fe2, Value: 0x2f00) }, + }, + // STRH (imm8) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf826, 0x0b0a, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000025a2, 0x000024d5, 0x00002ca1, 0x0000238a, 0x0000279c, 0x0000244c, 0x00002620, 0x00002c0e, 0x0000233e, 0x0000285f, 0x000021ab, 0x00002bd0, 0x0000281f, 0x00002be7, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x000025a2, 0x000024d5, 0x00002ca1, 0x0000238a, 0x0000279c, 0x0000244c, 0x0000262a, 0x00002c0e, 0x0000233e, 0x0000285f, 0x000021ab, 0x00002bd0, 0x0000281f, 0x00002be7, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2620, Value: 0x25a2) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf827, 0xcf61, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002555, 0x0000238f, 0x00002829, 0x000028c8, 0x00002399, 0x00002aab, 0x00002d6f, 0x000029eb, 0x000029e0, 0x00002d33, 0x0000292a, 0x00002b33, 0x00002e29, 0x00002ca4, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x00002555, 0x0000238f, 0x00002829, 0x000028c8, 0x00002399, 0x00002aab, 0x00002d6f, 0x00002a4c, 0x000029e0, 0x00002d33, 0x0000292a, 0x00002b33, 0x00002e29, 0x00002ca4, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2a4c, Value: 0x2e29) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf821, 0x9b00, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000027ba, 0x00002514, 0x00002b07, 0x00002daf, 0x00002790, 0x0000274b, 0x00002379, 0x00002a98, 0x000024c8, 0x00002398, 0x000021ba, 0x00002959, 0x00002821, 0x00002d09, 0x00000001, 0x500001f0 }, + FinalRegs = new uint[] { 0x000027ba, 0x00002514, 0x00002b07, 0x00002daf, 0x00002790, 0x0000274b, 0x00002379, 0x00002a98, 0x000024c8, 0x00002398, 0x000021ba, 0x00002959, 0x00002821, 0x00002d09, 0x00000001, 0x500001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2514, Value: 0x2398) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf82c, 0xa927, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000226a, 0x00002792, 0x00002870, 0x00002918, 0x00002757, 0x00002679, 0x00002546, 0x000027f5, 0x00002edc, 0x00002cd3, 0x0000274a, 0x00002562, 0x000029a1, 0x00002976, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x0000226a, 0x00002792, 0x00002870, 0x00002918, 0x00002757, 0x00002679, 0x00002546, 0x000027f5, 0x00002edc, 0x00002cd3, 0x0000274a, 0x00002562, 0x0000297a, 0x00002976, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x29a0, Value: 0x4aa0), (Address: 0x29a2, Value: 0x2927) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf824, 0xcfe4, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000238b, 0x00002d22, 0x00002476, 0x000028ae, 0x00002442, 0x0000212b, 0x000026de, 0x00002a1a, 0x00002a02, 0x00002e47, 0x00002b2d, 0x00002427, 0x00002d1c, 0x000026d4, 0x00000001, 0xd00001f0 }, + FinalRegs = new uint[] { 0x0000238b, 0x00002d22, 0x00002476, 0x000028ae, 0x00002526, 0x0000212b, 0x000026de, 0x00002a1a, 0x00002a02, 0x00002e47, 0x00002b2d, 0x00002427, 0x00002d1c, 0x000026d4, 0x00000001, 0xd00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2526, Value: 0x2d1c) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf820, 0x1c3d, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002227, 0x00002b29, 0x0000232a, 0x0000214e, 0x000029ef, 0x00002522, 0x000029d3, 0x0000286c, 0x000029b2, 0x00002147, 0x00002c65, 0x00002891, 0x000029c2, 0x000028a5, 0x00000001, 0x800001f0 }, + FinalRegs = new uint[] { 0x00002227, 0x00002b29, 0x0000232a, 0x0000214e, 0x000029ef, 0x00002522, 0x000029d3, 0x0000286c, 0x000029b2, 0x00002147, 0x00002c65, 0x00002891, 0x000029c2, 0x000028a5, 0x00000001, 0x800001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x21ea, Value: 0x2b29) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf826, 0x1cdf, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002232, 0x000029a1, 0x00002938, 0x00002ae7, 0x000029a4, 0x00002366, 0x0000273a, 0x000023f6, 0x00002601, 0x00002919, 0x000028e3, 0x00002907, 0x000023c1, 0x00002138, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x00002232, 0x000029a1, 0x00002938, 0x00002ae7, 0x000029a4, 0x00002366, 0x0000273a, 0x000023f6, 0x00002601, 0x00002919, 0x000028e3, 0x00002907, 0x000023c1, 0x00002138, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x265a, Value: 0xa15a), (Address: 0x265c, Value: 0x2629) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf82b, 0x3c66, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002974, 0x00002372, 0x0000276c, 0x000021df, 0x00002272, 0x00002928, 0x00002c50, 0x0000290e, 0x00002319, 0x000021d1, 0x00002a82, 0x000027ff, 0x00002730, 0x000027b2, 0x00000001, 0x700001f0 }, + FinalRegs = new uint[] { 0x00002974, 0x00002372, 0x0000276c, 0x000021df, 0x00002272, 0x00002928, 0x00002c50, 0x0000290e, 0x00002319, 0x000021d1, 0x00002a82, 0x000027ff, 0x00002730, 0x000027b2, 0x00000001, 0x700001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2798, Value: 0xdf98), (Address: 0x279a, Value: 0x2721) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf822, 0x3c06, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000021b8, 0x00002357, 0x00002b00, 0x00002207, 0x00002648, 0x0000219c, 0x000021d2, 0x000023b0, 0x00002368, 0x00002a41, 0x000026ac, 0x00002a86, 0x00002879, 0x00002c1d, 0x00000001, 0x700001f0 }, + FinalRegs = new uint[] { 0x000021b8, 0x00002357, 0x00002b00, 0x00002207, 0x00002648, 0x0000219c, 0x000021d2, 0x000023b0, 0x00002368, 0x00002a41, 0x000026ac, 0x00002a86, 0x00002879, 0x00002c1d, 0x00000001, 0x700001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2afa, Value: 0x2207) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf824, 0xac84, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002796, 0x000027c8, 0x0000241b, 0x0000214d, 0x0000220b, 0x00002587, 0x00002130, 0x00002910, 0x00002ac2, 0x00002e74, 0x000028f8, 0x000024bf, 0x0000263a, 0x00002625, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x00002796, 0x000027c8, 0x0000241b, 0x0000214d, 0x0000220b, 0x00002587, 0x00002130, 0x00002910, 0x00002ac2, 0x00002e74, 0x000028f8, 0x000024bf, 0x0000263a, 0x00002625, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2186, Value: 0xf886), (Address: 0x2188, Value: 0x2128) }, + }, + // STRH (imm12) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8a5, 0x59d4, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x000001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x000001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x29d4, Value: 0x2000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8ac, 0xc533, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2532, Value: 0x0032), (Address: 0x2534, Value: 0x2520) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8a3, 0xb559, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x000001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x000001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2558, Value: 0x0058), (Address: 0x255a, Value: 0x2520) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8a5, 0xdb3a, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xb00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xb00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2b3a, Value: 0x2000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8a9, 0x02cc, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xc00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xc00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x22cc, Value: 0x2000) }, + }, + // STR (imm8) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf846, 0x1fb4, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002b17, 0x0000272f, 0x00002483, 0x0000284c, 0x0000287f, 0x0000238f, 0x0000222d, 0x00002259, 0x0000249d, 0x00002e3f, 0x00002323, 0x00002729, 0x000025c1, 0x00002866, 0x00000001, 0x900001f0 }, + FinalRegs = new uint[] { 0x00002b17, 0x0000272f, 0x00002483, 0x0000284c, 0x0000287f, 0x0000238f, 0x000022e1, 0x00002259, 0x0000249d, 0x00002e3f, 0x00002323, 0x00002729, 0x000025c1, 0x00002866, 0x00000001, 0x900001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x22e0, Value: 0x2fe0), (Address: 0x22e2, Value: 0x0027), (Address: 0x22e4, Value: 0x2200) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf844, 0x3f11, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000028e1, 0x00002d48, 0x000027d6, 0x000023ac, 0x000027bb, 0x000026cf, 0x000023c1, 0x00002633, 0x0000214b, 0x00002434, 0x0000239a, 0x000025c6, 0x00002148, 0x00002d1f, 0x00000001, 0x300001f0 }, + FinalRegs = new uint[] { 0x000028e1, 0x00002d48, 0x000027d6, 0x000023ac, 0x000027cc, 0x000026cf, 0x000023c1, 0x00002633, 0x0000214b, 0x00002434, 0x0000239a, 0x000025c6, 0x00002148, 0x00002d1f, 0x00000001, 0x300001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x27cc, Value: 0x23ac), (Address: 0x27ce, Value: 0x0000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf847, 0x09c2, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000248b, 0x00002396, 0x000023c5, 0x00002be0, 0x0000237d, 0x00002191, 0x00002da0, 0x0000211c, 0x00002d24, 0x000021e6, 0x000024ff, 0x00002268, 0x00002968, 0x0000244d, 0x00000001, 0x800001f0 }, + FinalRegs = new uint[] { 0x0000248b, 0x00002396, 0x000023c5, 0x00002be0, 0x0000237d, 0x00002191, 0x00002da0, 0x0000205a, 0x00002d24, 0x000021e6, 0x000024ff, 0x00002268, 0x00002968, 0x0000244d, 0x00000001, 0x800001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x211c, Value: 0x248b), (Address: 0x211e, Value: 0x0000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf84d, 0x7f23, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000025b0, 0x0000260e, 0x00002343, 0x00002e36, 0x000024c5, 0x000029bc, 0x0000278e, 0x00002b63, 0x00002ce7, 0x000029af, 0x000023bf, 0x00002475, 0x00002197, 0x00002c33, 0x00000001, 0x200001f0 }, + FinalRegs = new uint[] { 0x000025b0, 0x0000260e, 0x00002343, 0x00002e36, 0x000024c5, 0x000029bc, 0x0000278e, 0x00002b63, 0x00002ce7, 0x000029af, 0x000023bf, 0x00002475, 0x00002197, 0x00002c56, 0x00000001, 0x200001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2c56, Value: 0x2b63), (Address: 0x2c58, Value: 0x0000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf843, 0x9d24, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002ce4, 0x00002e0e, 0x000026d5, 0x000025fb, 0x00002b78, 0x0000215a, 0x00002af7, 0x0000259c, 0x00002645, 0x000027dc, 0x00002163, 0x000028f5, 0x000029df, 0x0000230b, 0x00000001, 0x500001f0 }, + FinalRegs = new uint[] { 0x00002ce4, 0x00002e0e, 0x000026d5, 0x000025d7, 0x00002b78, 0x0000215a, 0x00002af7, 0x0000259c, 0x00002645, 0x000027dc, 0x00002163, 0x000028f5, 0x000029df, 0x0000230b, 0x00000001, 0x500001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x25d6, Value: 0xdcd6), (Address: 0x25d8, Value: 0x0027), (Address: 0x25da, Value: 0x2500) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf849, 0xdc1a, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002d98, 0x0000254a, 0x00002540, 0x00002324, 0x0000264e, 0x00002523, 0x0000271f, 0x00002875, 0x000023b3, 0x00002680, 0x00002223, 0x000022bf, 0x000025f4, 0x00002d81, 0x00000001, 0x700001f0 }, + FinalRegs = new uint[] { 0x00002d98, 0x0000254a, 0x00002540, 0x00002324, 0x0000264e, 0x00002523, 0x0000271f, 0x00002875, 0x000023b3, 0x00002680, 0x00002223, 0x000022bf, 0x000025f4, 0x00002d81, 0x00000001, 0x700001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2666, Value: 0x2d81), (Address: 0x2668, Value: 0x0000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf849, 0x0cd1, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000255a, 0x00002655, 0x00002276, 0x000022e4, 0x00002eef, 0x00002e99, 0x00002b55, 0x00002a40, 0x00002661, 0x00002dbd, 0x00002687, 0x000024e1, 0x000023ea, 0x00002b88, 0x00000001, 0xc00001f0 }, + FinalRegs = new uint[] { 0x0000255a, 0x00002655, 0x00002276, 0x000022e4, 0x00002eef, 0x00002e99, 0x00002b55, 0x00002a40, 0x00002661, 0x00002dbd, 0x00002687, 0x000024e1, 0x000023ea, 0x00002b88, 0x00000001, 0xc00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2cec, Value: 0x255a), (Address: 0x2cee, Value: 0x0000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf847, 0x7c96, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000027f6, 0x0000222a, 0x000024e1, 0x00002a2d, 0x00002ee8, 0x000023f2, 0x000029de, 0x00002a53, 0x000029da, 0x00002d2c, 0x00002d6f, 0x000026b8, 0x00002777, 0x00002e3a, 0x00000001, 0xf00001f0 }, + FinalRegs = new uint[] { 0x000027f6, 0x0000222a, 0x000024e1, 0x00002a2d, 0x00002ee8, 0x000023f2, 0x000029de, 0x00002a53, 0x000029da, 0x00002d2c, 0x00002d6f, 0x000026b8, 0x00002777, 0x00002e3a, 0x00000001, 0xf00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x29bc, Value: 0x53bc), (Address: 0x29be, Value: 0x002a), (Address: 0x29c0, Value: 0x2900) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf84d, 0x8cbd, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002a58, 0x00002a59, 0x00002dfd, 0x00002ba8, 0x00002929, 0x00002146, 0x00002706, 0x000025f3, 0x000023d7, 0x0000221f, 0x000027ae, 0x00002a6e, 0x00002824, 0x00002357, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x00002a58, 0x00002a59, 0x00002dfd, 0x00002ba8, 0x00002929, 0x00002146, 0x00002706, 0x000025f3, 0x000023d7, 0x0000221f, 0x000027ae, 0x00002a6e, 0x00002824, 0x00002357, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x229a, Value: 0x23d7), (Address: 0x229c, Value: 0x0000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf846, 0xacaf, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000284f, 0x00002def, 0x0000292f, 0x000021e8, 0x0000274e, 0x00002518, 0x00002538, 0x00002375, 0x00002d28, 0x0000229a, 0x0000255f, 0x00002eca, 0x00002e15, 0x000021aa, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x0000284f, 0x00002def, 0x0000292f, 0x000021e8, 0x0000274e, 0x00002518, 0x00002538, 0x00002375, 0x00002d28, 0x0000229a, 0x0000255f, 0x00002eca, 0x00002e15, 0x000021aa, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2488, Value: 0x5f88), (Address: 0x248a, Value: 0x0025), (Address: 0x248c, Value: 0x2400) }, + }, + // STR (imm12) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8cc, 0x1a6e, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x500001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x500001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2a6e, Value: 0x2000), (Address: 0x2a70, Value: 0x0000) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8c9, 0xcfc1, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x2fc0, Value: 0x00c0), (Address: 0x2fc2, Value: 0x0020), (Address: 0x2fc4, Value: 0x2f00) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8c3, 0xb5dd, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x25dc, Value: 0x00dc), (Address: 0x25de, Value: 0x0020), (Address: 0x25e0, Value: 0x2500) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8c0, 0x69e9, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xe00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x29e8, Value: 0x00e8), (Address: 0x29ea, Value: 0x0020), (Address: 0x29ec, Value: 0x2900) }, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8cd, 0x028f, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] { (Address: 0x228e, Value: 0x008e), (Address: 0x2290, Value: 0x0020), (Address: 0x2292, Value: 0x2200) }, + }, + // LDRB (imm8) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf816, 0x1c48, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002cb8, 0x00002345, 0x00002ebc, 0x00002db8, 0x000021d4, 0x000026e4, 0x00002458, 0x000029e3, 0x000028d2, 0x000027f4, 0x000023d6, 0x00002def, 0x0000285c, 0x00002d06, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x00002cb8, 0x00000010, 0x00002ebc, 0x00002db8, 0x000021d4, 0x000026e4, 0x00002458, 0x000029e3, 0x000028d2, 0x000027f4, 0x000023d6, 0x00002def, 0x0000285c, 0x00002d06, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf815, 0x2d6e, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000021e4, 0x00002425, 0x00002e42, 0x00002a58, 0x00002708, 0x00002965, 0x00002a1d, 0x00002ed5, 0x00002cc4, 0x000026e1, 0x00002b4b, 0x00002ade, 0x00002824, 0x00002975, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x000021e4, 0x00002425, 0x00000028, 0x00002a58, 0x00002708, 0x000028f7, 0x00002a1d, 0x00002ed5, 0x00002cc4, 0x000026e1, 0x00002b4b, 0x00002ade, 0x00002824, 0x00002975, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf818, 0x0d33, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002492, 0x0000214d, 0x00002827, 0x000021af, 0x0000215e, 0x000028d6, 0x000024ec, 0x00002984, 0x0000297b, 0x000024b5, 0x000024ca, 0x0000298f, 0x00002339, 0x00002b7e, 0x00000001, 0xd00001f0 }, + FinalRegs = new uint[] { 0x00000048, 0x0000214d, 0x00002827, 0x000021af, 0x0000215e, 0x000028d6, 0x000024ec, 0x00002984, 0x00002948, 0x000024b5, 0x000024ca, 0x0000298f, 0x00002339, 0x00002b7e, 0x00000001, 0xd00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf810, 0xbff3, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002ea6, 0x000024fa, 0x00002346, 0x00002748, 0x0000283f, 0x00002770, 0x000023e3, 0x000021aa, 0x0000214a, 0x00002d58, 0x00002159, 0x000022e7, 0x00002242, 0x00002728, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x00002f99, 0x000024fa, 0x00002346, 0x00002748, 0x0000283f, 0x00002770, 0x000023e3, 0x000021aa, 0x0000214a, 0x00002d58, 0x00002159, 0x0000002f, 0x00002242, 0x00002728, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + // LDRB (imm12) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf892, 0xcc8f, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x0000002c, 0x00002000, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf89a, 0x7fdc, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x200001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x000000dc, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x200001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf890, 0x5f9f, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x800001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x0000002f, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x800001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf894, 0xdda1, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x900001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x0000002d, 0x00000001, 0x900001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf890, 0xc281, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x100001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000022, 0x00002000, 0x00000001, 0x100001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + // LDRH (imm8) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf834, 0x89d8, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002a9e, 0x00002d84, 0x00002e9b, 0x00002e7f, 0x000024a2, 0x00002b7b, 0x00002e3b, 0x0000299a, 0x00002dff, 0x00002a9e, 0x000027b2, 0x00002a90, 0x00002883, 0x0000288d, 0x00000001, 0x500001f0 }, + FinalRegs = new uint[] { 0x00002a9e, 0x00002d84, 0x00002e9b, 0x00002e7f, 0x000023ca, 0x00002b7b, 0x00002e3b, 0x0000299a, 0x000024a2, 0x00002a9e, 0x000027b2, 0x00002a90, 0x00002883, 0x0000288d, 0x00000001, 0x500001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf833, 0x6be4, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000028bd, 0x00002b0e, 0x00002bc1, 0x00002a83, 0x00002293, 0x00002c7c, 0x00002bfe, 0x00002eb7, 0x0000299b, 0x000026e6, 0x0000219c, 0x00002d5e, 0x00002cd4, 0x000026cf, 0x00000001, 0xd00001f0 }, + FinalRegs = new uint[] { 0x000028bd, 0x00002b0e, 0x00002bc1, 0x00002b67, 0x00002293, 0x00002c7c, 0x0000842a, 0x00002eb7, 0x0000299b, 0x000026e6, 0x0000219c, 0x00002d5e, 0x00002cd4, 0x000026cf, 0x00000001, 0xd00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf83d, 0x1bca, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000250e, 0x00002776, 0x000029e5, 0x0000276e, 0x00002c6b, 0x00002712, 0x00002a85, 0x00002d56, 0x000024c0, 0x00002d86, 0x0000254a, 0x00002549, 0x00002795, 0x00002e97, 0x00000001, 0x200001f0 }, + FinalRegs = new uint[] { 0x0000250e, 0x0000982e, 0x000029e5, 0x0000276e, 0x00002c6b, 0x00002712, 0x00002a85, 0x00002d56, 0x000024c0, 0x00002d86, 0x0000254a, 0x00002549, 0x00002795, 0x00002f61, 0x00000001, 0x200001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + // LDRH (imm12) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8b7, 0x92fc, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xa00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x000022fc, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xa00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8ba, 0xadd9, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xa00001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x0000da2d, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xa00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8bb, 0x0bb0, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xd00001f0 }, + FinalRegs = new uint[] { 0x00002bb0, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0xd00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8b8, 0xc3f8, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x600001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x000023f8, 0x00002000, 0x00000001, 0x600001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + // LDR (imm8) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf85b, 0x3fd1, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002a19, 0x00002e5b, 0x0000231b, 0x000021fa, 0x00002e95, 0x00002bd5, 0x00002e9c, 0x00002dfa, 0x000021d8, 0x00002ce1, 0x00002318, 0x00002735, 0x0000247d, 0x00002436, 0x00000001, 0xf00001f0 }, + FinalRegs = new uint[] { 0x00002a19, 0x00002e5b, 0x0000231b, 0x28082806, 0x00002e95, 0x00002bd5, 0x00002e9c, 0x00002dfa, 0x000021d8, 0x00002ce1, 0x00002318, 0x00002806, 0x0000247d, 0x00002436, 0x00000001, 0xf00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf854, 0xab9e, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x0000214f, 0x00002578, 0x00002a98, 0x000021b0, 0x00002ebb, 0x0000284a, 0x00002319, 0x00002581, 0x00002179, 0x00002594, 0x00002373, 0x000028f4, 0x00002ec5, 0x00002e0a, 0x00000001, 0xb00001f0 }, + FinalRegs = new uint[] { 0x0000214f, 0x00002578, 0x00002a98, 0x000021b0, 0x00002f59, 0x0000284a, 0x00002319, 0x00002581, 0x00002179, 0x00002594, 0xbe2ebc2e, 0x000028f4, 0x00002ec5, 0x00002e0a, 0x00000001, 0xb00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf852, 0x6d2d, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002e27, 0x00002676, 0x00002bde, 0x000022d9, 0x00002362, 0x00002d4b, 0x00002dab, 0x000022b6, 0x0000229c, 0x00002507, 0x00002848, 0x0000225f, 0x00002ac2, 0x000023c3, 0x00000001, 0xf00001f0 }, + FinalRegs = new uint[] { 0x00002e27, 0x00002676, 0x00002bb1, 0x000022d9, 0x00002362, 0x00002d4b, 0xb42bb22b, 0x000022b6, 0x0000229c, 0x00002507, 0x00002848, 0x0000225f, 0x00002ac2, 0x000023c3, 0x00000001, 0xf00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf850, 0x8da5, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002559, 0x0000285e, 0x000021de, 0x00002223, 0x000023ff, 0x00002e05, 0x00002bf3, 0x000024a5, 0x00002124, 0x00002768, 0x00002a14, 0x0000219e, 0x00002739, 0x00002e3c, 0x00000001, 0xd00001f0 }, + FinalRegs = new uint[] { 0x000024b4, 0x0000285e, 0x000021de, 0x00002223, 0x000023ff, 0x00002e05, 0x00002bf3, 0x000024a5, 0x24b624b4, 0x00002768, 0x00002a14, 0x0000219e, 0x00002739, 0x00002e3c, 0x00000001, 0xd00001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf857, 0x19f6, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x000027f5, 0x0000285e, 0x000025f6, 0x00002e22, 0x00002224, 0x00002870, 0x00002ecc, 0x000024cf, 0x00002711, 0x0000241b, 0x00002ddf, 0x00002545, 0x000028ca, 0x000023c5, 0x00000001, 0x400001f0 }, + FinalRegs = new uint[] { 0x000027f5, 0xd224d024, 0x000025f6, 0x00002e22, 0x00002224, 0x00002870, 0x00002ecc, 0x000023d9, 0x00002711, 0x0000241b, 0x00002ddf, 0x00002545, 0x000028ca, 0x000023c5, 0x00000001, 0x400001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + // LDR (imm12) + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8d1, 0xc65e, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x000001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x2660265e, 0x00002000, 0x00000001, 0x000001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8db, 0xd09b, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x800001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x9e209c20, 0x00000001, 0x800001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8d2, 0x6fde, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x900001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x2fe02fde, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x900001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + new PrecomputedMemoryThumbTestCase() + { + Instructions = new ushort[] { 0xf8dc, 0x3de5, 0x4770, 0xe7fe }, + StartRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x500001f0 }, + FinalRegs = new uint[] { 0x00002000, 0x00002000, 0x00002000, 0xe82de62d, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00002000, 0x00000001, 0x500001f0 }, + MemoryDelta = new (ulong Address, ushort Value)[] {}, + }, + }; + } +} \ No newline at end of file diff --git a/Ryujinx.Tests/Cpu/PrecomputedMemoryThumbTestCase.cs b/Ryujinx.Tests/Cpu/PrecomputedMemoryThumbTestCase.cs new file mode 100644 index 000000000..4fb02c2b7 --- /dev/null +++ b/Ryujinx.Tests/Cpu/PrecomputedMemoryThumbTestCase.cs @@ -0,0 +1,12 @@ +using System; + +namespace Ryujinx.Tests.Cpu +{ + public struct PrecomputedMemoryThumbTestCase + { + public ushort[] Instructions; + public uint[] StartRegs; + public uint[] FinalRegs; + public (ulong Address, ushort Value)[] MemoryDelta; + }; +} \ No newline at end of file