diff options
| author | Thomas Guillemard <me@thog.eu> | 2019-10-11 17:22:24 +0200 |
|---|---|---|
| committer | Ac_K <Acoustik666@gmail.com> | 2019-10-11 17:22:24 +0200 |
| commit | 9142aca48ff09ed32954eceb3456a255d61945b7 (patch) | |
| tree | d1b41c6d70d81d1964c5ef76a2399d7eb8784965 /Ryujinx.Common/Utilities | |
| parent | 1aba033ba7868d29f5f840c99ee11dd29d689972 (diff) | |
Fix hwopus DecodeInterleaved implementation (#786)
* Fix hwopus DecodeInterleaved implementation
Also implement new variants of this api.
This should fix #763
* Sample rate shouldn't be hardcoded
This fix issues while opening Pokémon Let's Go pause menu.
* Apply Ac_K's suggestion about EndianSwap
* Address gdkchan's comment
* Address Ac_k's comment
Diffstat (limited to 'Ryujinx.Common/Utilities')
| -rw-r--r-- | Ryujinx.Common/Utilities/EndianSwap.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Ryujinx.Common/Utilities/EndianSwap.cs b/Ryujinx.Common/Utilities/EndianSwap.cs new file mode 100644 index 00000000..049570e3 --- /dev/null +++ b/Ryujinx.Common/Utilities/EndianSwap.cs @@ -0,0 +1,31 @@ +using System; + +namespace Ryujinx.Common +{ + public static class EndianSwap + { + public static ushort Swap16(ushort value) => (ushort)(((value >> 8) & 0xff) | (value << 8)); + + public static int Swap32(int value) + { + uint uintVal = (uint)value; + + return (int)(((uintVal >> 24) & 0x000000ff) | + ((uintVal >> 8) & 0x0000ff00) | + ((uintVal << 8) & 0x00ff0000) | + ((uintVal << 24) & 0xff000000)); + } + + public static uint FromBigEndianToPlatformEndian(uint value) + { + uint result = value; + + if (BitConverter.IsLittleEndian) + { + result = (uint)EndianSwap.Swap32((int)result); + } + + return result; + } + } +} |
