ServiceSet.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using ChocolArm64.Memory;
  2. using Ryujinx.Core.OsHle.Ipc;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.Core.OsHle.IpcServices.Set
  6. {
  7. class ServiceSet : IIpcService
  8. {
  9. private Dictionary<int, ServiceProcessRequest> m_Commands;
  10. public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  11. public ServiceSet()
  12. {
  13. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  14. {
  15. { 1, GetAvailableLanguageCodes }
  16. };
  17. }
  18. private const int LangCodesCount = 13;
  19. public static long GetAvailableLanguageCodes(ServiceCtx Context)
  20. {
  21. int PtrBuffSize = Context.RequestData.ReadInt32();
  22. if (Context.Request.RecvListBuff.Count > 0)
  23. {
  24. long Position = Context.Request.RecvListBuff[0].Position;
  25. short Size = Context.Request.RecvListBuff[0].Size;
  26. //This should return an array of ints with values matching the LanguageCode enum.
  27. foreach (long value in new long[] { 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L })
  28. {
  29. AMemoryHelper.WriteBytes(Context.Memory, Position += 8, BitConverter.GetBytes(value));
  30. }
  31. }
  32. Context.ResponseData.Write(LangCodesCount);
  33. return 0;
  34. }
  35. }
  36. }