diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs b/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs index cecea86057..675ea8c7c9 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudErr.cs @@ -5,5 +5,6 @@ namespace Ryujinx.HLE.HOS.Services.Aud public const int DeviceNotFound = 1; public const int UnsupportedRevision = 2; public const int UnsupportedSampleRate = 3; + public const int OpusInvalidInput = 6; } } \ No newline at end of file diff --git a/Ryujinx.HLE/OsHle/Services/Aud/IHardwareOpusDecoder.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs similarity index 71% rename from Ryujinx.HLE/OsHle/Services/Aud/IHardwareOpusDecoder.cs rename to Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs index 8ed560fd5b..e1319443ef 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/IHardwareOpusDecoder.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs @@ -1,10 +1,10 @@ using Concentus.Structs; -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -using static Ryujinx.HLE.OsHle.ErrorCode; +using static Ryujinx.HLE.HOS.ErrorCode; -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { class IHardwareOpusDecoder : IpcService { @@ -23,7 +23,8 @@ namespace Ryujinx.HLE.OsHle.Services.Aud { m_Commands = new Dictionary() { - { 0, DecodeInterleaved } + { 0, DecodeInterleaved }, + { 4, DecodeInterleavedWithPerf } }; this.SampleRate = SampleRate; @@ -32,6 +33,17 @@ namespace Ryujinx.HLE.OsHle.Services.Aud Decoder = new OpusDecoder(FixedSampleRate, ChannelsCount); } + public long DecodeInterleavedWithPerf(ServiceCtx Context) + { + long Result = DecodeInterleaved(Context); + + //TODO: Figure out what this value is. + //According to switchbrew, it is now used. + Context.ResponseData.Write(0L); + + return Result; + } + public long DecodeInterleaved(ServiceCtx Context) { long InPosition = Context.Request.SendBuff[0].Position; @@ -47,12 +59,12 @@ namespace Ryujinx.HLE.OsHle.Services.Aud byte[] OpusData = Context.Memory.ReadBytes(InPosition, InSize); - int Processed = ((OpusData[0] << 0) | - (OpusData[1] << 8) | - (OpusData[2] << 16) | - (OpusData[3] << 24)) + 8; + int Processed = ((OpusData[0] << 24) | + (OpusData[1] << 16) | + (OpusData[2] << 8) | + (OpusData[3] << 0)) + 8; - if (Processed > InSize) + if ((uint)Processed > (ulong)InSize) { return MakeError(ErrorModule.Audio, AudErr.OpusInvalidInput); } diff --git a/Ryujinx.HLE/OsHle/Services/Aud/IHardwareOpusDecoderManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs similarity index 96% rename from Ryujinx.HLE/OsHle/Services/Aud/IHardwareOpusDecoderManager.cs rename to Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs index 4c485313c5..875dc74c34 100644 --- a/Ryujinx.HLE/OsHle/Services/Aud/IHardwareOpusDecoderManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs @@ -1,7 +1,7 @@ -using Ryujinx.HLE.OsHle.Ipc; +using Ryujinx.HLE.HOS.Ipc; using System.Collections.Generic; -namespace Ryujinx.HLE.OsHle.Services.Aud +namespace Ryujinx.HLE.HOS.Services.Aud { class IHardwareOpusDecoderManager : IpcService { diff --git a/Ryujinx.HLE/OsHle/Services/Aud/AudErr.cs b/Ryujinx.HLE/OsHle/Services/Aud/AudErr.cs deleted file mode 100644 index ec5d054ebf..0000000000 --- a/Ryujinx.HLE/OsHle/Services/Aud/AudErr.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Ryujinx.HLE.OsHle.Services.Aud -{ - static class AudErr - { - public const int OpusInvalidInput = 6; - } -} \ No newline at end of file