2019-07-14 21:50:11 +01:00
|
|
|
using Ryujinx.Common;
|
|
|
|
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
2018-02-10 00:14:55 +00:00
|
|
|
|
2018-08-17 00:47:36 +01:00
|
|
|
namespace Ryujinx.HLE.HOS.Services.Time
|
2018-02-10 00:14:55 +00:00
|
|
|
{
|
2018-03-19 18:58:46 +00:00
|
|
|
class ISteadyClock : IpcService
|
2018-02-10 00:14:55 +00:00
|
|
|
{
|
2019-07-12 02:13:43 +01:00
|
|
|
[Command(0)]
|
|
|
|
// GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint
|
2019-07-14 20:04:38 +01:00
|
|
|
public ResultCode GetCurrentTimePoint(ServiceCtx context)
|
2018-07-02 01:03:05 +01:00
|
|
|
{
|
2019-07-14 21:50:11 +01:00
|
|
|
SteadyClockTimePoint currentTimePoint = SteadyClockCore.Instance.GetCurrentTimePoint(context.Thread);
|
2018-07-02 01:03:05 +01:00
|
|
|
|
2019-07-14 21:50:11 +01:00
|
|
|
context.ResponseData.WriteStruct(currentTimePoint);
|
2018-07-02 01:03:05 +01:00
|
|
|
|
2019-07-14 20:04:38 +01:00
|
|
|
return ResultCode.Success;
|
2018-07-02 01:03:05 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 02:13:43 +01:00
|
|
|
[Command(1)]
|
|
|
|
// GetTestOffset() -> nn::TimeSpanType
|
2019-07-14 20:04:38 +01:00
|
|
|
public ResultCode GetTestOffset(ServiceCtx context)
|
2018-07-02 01:03:05 +01:00
|
|
|
{
|
2019-07-14 21:50:11 +01:00
|
|
|
context.ResponseData.WriteStruct(SteadyClockCore.Instance.GetTestOffset());
|
2018-07-02 01:03:05 +01:00
|
|
|
|
2019-07-14 20:04:38 +01:00
|
|
|
return ResultCode.Success;
|
2018-07-02 01:03:05 +01:00
|
|
|
}
|
|
|
|
|
2019-07-12 02:13:43 +01:00
|
|
|
[Command(2)]
|
|
|
|
// SetTestOffset(nn::TimeSpanType)
|
2019-07-14 20:04:38 +01:00
|
|
|
public ResultCode SetTestOffset(ServiceCtx context)
|
2018-07-02 01:03:05 +01:00
|
|
|
{
|
2019-07-14 21:50:11 +01:00
|
|
|
TimeSpanType testOffset = context.RequestData.ReadStruct<TimeSpanType>();
|
|
|
|
|
|
|
|
SteadyClockCore.Instance.SetTestOffset(testOffset);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[Command(200)] // 3.0.0+
|
|
|
|
// GetInternalOffset() -> nn::TimeSpanType
|
|
|
|
public ResultCode GetInternalOffset(ServiceCtx context)
|
|
|
|
{
|
|
|
|
context.ResponseData.WriteStruct(SteadyClockCore.Instance.GetInternalOffset());
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
[Command(201)] // 3.0.0-3.0.2
|
|
|
|
// SetInternalOffset(nn::TimeSpanType)
|
|
|
|
public ResultCode SetInternalOffset(ServiceCtx context)
|
|
|
|
{
|
|
|
|
TimeSpanType internalOffset = context.RequestData.ReadStruct<TimeSpanType>();
|
|
|
|
|
|
|
|
SteadyClockCore.Instance.SetInternalOffset(internalOffset);
|
2018-07-02 01:03:05 +01:00
|
|
|
|
2019-07-14 20:04:38 +01:00
|
|
|
return ResultCode.Success;
|
2018-02-10 00:14:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|