AuxiliaryBufferHeader.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // Copyright (c) 2019-2020 Ryujinx
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. //
  17. using Ryujinx.Cpu;
  18. using System.Runtime.InteropServices;
  19. namespace Ryujinx.Audio.Renderer.Dsp.State
  20. {
  21. [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x40)]
  22. public struct AuxiliaryBufferHeader
  23. {
  24. [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0xC)]
  25. public struct AuxiliaryBufferInfo
  26. {
  27. private const uint ReadOffsetPosition = 0x0;
  28. private const uint WriteOffsetPosition = 0x4;
  29. public uint ReadOffset;
  30. public uint WriteOffset;
  31. private uint _reserved;
  32. public static uint GetReadOffset(MemoryManager manager, ulong bufferAddress)
  33. {
  34. return manager.Read<uint>(bufferAddress + ReadOffsetPosition);
  35. }
  36. public static uint GetWriteOffset(MemoryManager manager, ulong bufferAddress)
  37. {
  38. return manager.Read<uint>(bufferAddress + WriteOffsetPosition);
  39. }
  40. public static void SetReadOffset(MemoryManager manager, ulong bufferAddress, uint value)
  41. {
  42. manager.Write(bufferAddress + ReadOffsetPosition, value);
  43. }
  44. public static void SetWriteOffset(MemoryManager manager, ulong bufferAddress, uint value)
  45. {
  46. manager.Write(bufferAddress + WriteOffsetPosition, value);
  47. }
  48. }
  49. public AuxiliaryBufferInfo BufferInfo;
  50. public unsafe fixed uint Unknown[13];
  51. }
  52. }