ServiceSet.cs 1.6 KB

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