IProfile.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using ChocolArm64.Memory;
  2. using Ryujinx.HLE.HOS.Ipc;
  3. using Ryujinx.HLE.HOS.SystemState;
  4. using Ryujinx.HLE.Logging;
  5. using Ryujinx.HLE.Utilities;
  6. using System.Collections.Generic;
  7. using System.Text;
  8. namespace Ryujinx.HLE.HOS.Services.Acc
  9. {
  10. class IProfile : IpcService
  11. {
  12. private Dictionary<int, ServiceProcessRequest> m_Commands;
  13. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  14. private UserProfile Profile;
  15. public IProfile(UserProfile Profile)
  16. {
  17. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  18. {
  19. { 0, Get },
  20. { 1, GetBase }
  21. };
  22. this.Profile = Profile;
  23. }
  24. public long Get(ServiceCtx Context)
  25. {
  26. Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
  27. long Position = Context.Request.ReceiveBuff[0].Position;
  28. AMemoryHelper.FillWithZeros(Context.Memory, Position, 0x80);
  29. Context.Memory.WriteInt32(Position, 0);
  30. Context.Memory.WriteInt32(Position + 4, 1);
  31. Context.Memory.WriteInt64(Position + 8, 1);
  32. return GetBase(Context);
  33. }
  34. public long GetBase(ServiceCtx Context)
  35. {
  36. Profile.Uuid.Write(Context.ResponseData);
  37. Context.ResponseData.Write(Profile.LastModifiedTimestamp);
  38. byte[] Username = StringUtils.GetFixedLengthBytes(Profile.Name, 0x20, Encoding.UTF8);
  39. Context.ResponseData.Write(Username);
  40. return 0;
  41. }
  42. }
  43. }