ISteadyClock.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Ryujinx.Common;
  2. using Ryujinx.HLE.HOS.Services.Time.Clock;
  3. namespace Ryujinx.HLE.HOS.Services.Time
  4. {
  5. class ISteadyClock : IpcService
  6. {
  7. [Command(0)]
  8. // GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint
  9. public ResultCode GetCurrentTimePoint(ServiceCtx context)
  10. {
  11. SteadyClockTimePoint currentTimePoint = SteadyClockCore.Instance.GetCurrentTimePoint(context.Thread);
  12. context.ResponseData.WriteStruct(currentTimePoint);
  13. return ResultCode.Success;
  14. }
  15. [Command(1)]
  16. // GetTestOffset() -> nn::TimeSpanType
  17. public ResultCode GetTestOffset(ServiceCtx context)
  18. {
  19. context.ResponseData.WriteStruct(SteadyClockCore.Instance.GetTestOffset());
  20. return ResultCode.Success;
  21. }
  22. [Command(2)]
  23. // SetTestOffset(nn::TimeSpanType)
  24. public ResultCode SetTestOffset(ServiceCtx context)
  25. {
  26. TimeSpanType testOffset = context.RequestData.ReadStruct<TimeSpanType>();
  27. SteadyClockCore.Instance.SetTestOffset(testOffset);
  28. return 0;
  29. }
  30. [Command(200)] // 3.0.0+
  31. // GetInternalOffset() -> nn::TimeSpanType
  32. public ResultCode GetInternalOffset(ServiceCtx context)
  33. {
  34. context.ResponseData.WriteStruct(SteadyClockCore.Instance.GetInternalOffset());
  35. return ResultCode.Success;
  36. }
  37. [Command(201)] // 3.0.0-3.0.2
  38. // SetInternalOffset(nn::TimeSpanType)
  39. public ResultCode SetInternalOffset(ServiceCtx context)
  40. {
  41. TimeSpanType internalOffset = context.RequestData.ReadStruct<TimeSpanType>();
  42. SteadyClockCore.Instance.SetInternalOffset(internalOffset);
  43. return ResultCode.Success;
  44. }
  45. }
  46. }