mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-08-20 07:38:42 +02:00
* 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
32 lines
821 B
C#
32 lines
821 B
C#
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;
|
|
}
|
|
}
|
|
}
|