IAudioRenderer.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Ryujinx.Core.OsHle.Handles;
  2. using Ryujinx.Core.OsHle.Ipc;
  3. using System.Collections.Generic;
  4. namespace Ryujinx.Core.OsHle.Objects.Aud
  5. {
  6. class IAudioRenderer : IIpcInterface
  7. {
  8. private Dictionary<int, ServiceProcessRequest> m_Commands;
  9. public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  10. public IAudioRenderer()
  11. {
  12. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  13. {
  14. { 4, RequestUpdateAudioRenderer },
  15. { 5, StartAudioRenderer },
  16. { 6, StopAudioRenderer },
  17. { 7, QuerySystemEvent }
  18. };
  19. }
  20. public long RequestUpdateAudioRenderer(ServiceCtx Context)
  21. {
  22. //(buffer<unknown, 5, 0>) -> (buffer<unknown, 6, 0>, buffer<unknown, 6, 0>)
  23. long Position = Context.Request.ReceiveBuff[0].Position;
  24. //0x40 bytes header
  25. Context.Memory.WriteInt32(Position + 0x4, 0xb0); //Behavior Out State Size? (note: this is the last section)
  26. Context.Memory.WriteInt32(Position + 0x8, 0x18e0); //Memory Pool Out State Size?
  27. Context.Memory.WriteInt32(Position + 0xc, 0x600); //Voice Out State Size?
  28. Context.Memory.WriteInt32(Position + 0x14, 0xe0); //Effect Out State Size?
  29. Context.Memory.WriteInt32(Position + 0x1c, 0x20); //Sink Out State Size?
  30. Context.Memory.WriteInt32(Position + 0x20, 0x10); //Performance Out State Size?
  31. Context.Memory.WriteInt32(Position + 0x3c, 0x20e0); //Total Size (including 0x40 bytes header)
  32. for (int Offset = 0x40; Offset < 0x40 + 0x18e0; Offset += 0x10)
  33. {
  34. Context.Memory.WriteInt32(Position + Offset, 5);
  35. }
  36. return 0;
  37. }
  38. public long StartAudioRenderer(ServiceCtx Context)
  39. {
  40. return 0;
  41. }
  42. public long StopAudioRenderer(ServiceCtx Context)
  43. {
  44. return 0;
  45. }
  46. public long QuerySystemEvent(ServiceCtx Context)
  47. {
  48. int Handle = Context.Ns.Os.Handles.GenerateId(new HEvent());
  49. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
  50. return 0;
  51. }
  52. }
  53. }