2019-07-14 22:50:11 +02:00
|
|
|
using Ryujinx.Common;
|
|
|
|
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
2018-02-10 01:14:55 +01:00
|
|
|
|
2018-08-17 01:47:36 +02:00
|
|
|
namespace Ryujinx.HLE.HOS.Services.Time
|
2018-02-10 01:14:55 +01:00
|
|
|
{
|
2018-03-19 19:58:46 +01:00
|
|
|
class ISteadyClock : IpcService
|
2018-02-10 01:14:55 +01:00
|
|
|
{
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(0)]
|
|
|
|
// GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetCurrentTimePoint(ServiceCtx context)
|
2018-07-02 02:03:05 +02:00
|
|
|
{
|
2019-07-25 16:44:51 +02:00
|
|
|
SteadyClockTimePoint currentTimePoint = StandardSteadyClockCore.Instance.GetCurrentTimePoint(context.Thread);
|
2018-07-02 02:03:05 +02:00
|
|
|
|
2019-07-14 22:50:11 +02:00
|
|
|
context.ResponseData.WriteStruct(currentTimePoint);
|
2018-07-02 02:03:05 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-07-02 02:03:05 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(1)]
|
|
|
|
// GetTestOffset() -> nn::TimeSpanType
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode GetTestOffset(ServiceCtx context)
|
2018-07-02 02:03:05 +02:00
|
|
|
{
|
2019-07-25 16:44:51 +02:00
|
|
|
context.ResponseData.WriteStruct(StandardSteadyClockCore.Instance.GetTestOffset());
|
2018-07-02 02:03:05 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-07-02 02:03:05 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 03:13:43 +02:00
|
|
|
[Command(2)]
|
|
|
|
// SetTestOffset(nn::TimeSpanType)
|
2019-07-14 21:04:38 +02:00
|
|
|
public ResultCode SetTestOffset(ServiceCtx context)
|
2018-07-02 02:03:05 +02:00
|
|
|
{
|
2019-07-14 22:50:11 +02:00
|
|
|
TimeSpanType testOffset = context.RequestData.ReadStruct<TimeSpanType>();
|
|
|
|
|
2019-07-25 16:44:51 +02:00
|
|
|
StandardSteadyClockCore.Instance.SetTestOffset(testOffset);
|
2019-07-14 22:50:11 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-15 19:52:35 +02:00
|
|
|
[Command(100)] // 2.0.0+
|
|
|
|
// GetRtcValue() -> u64
|
|
|
|
public ResultCode GetRtcValue(ServiceCtx context)
|
|
|
|
{
|
2019-07-25 16:44:51 +02:00
|
|
|
ResultCode result = StandardSteadyClockCore.Instance.GetRtcValue(out ulong rtcValue);
|
2019-07-15 19:52:35 +02:00
|
|
|
|
|
|
|
if (result == ResultCode.Success)
|
|
|
|
{
|
|
|
|
context.ResponseData.Write(rtcValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
[Command(101)] // 2.0.0+
|
|
|
|
// IsRtcResetDetected() -> bool
|
|
|
|
public ResultCode IsRtcResetDetected(ServiceCtx context)
|
|
|
|
{
|
2019-07-25 16:44:51 +02:00
|
|
|
context.ResponseData.Write(StandardSteadyClockCore.Instance.IsRtcResetDetected());
|
2019-07-15 19:52:35 +02:00
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
[Command(102)] // 2.0.0+
|
|
|
|
// GetSetupResultValue() -> u32
|
|
|
|
public ResultCode GetSetupResultValue(ServiceCtx context)
|
|
|
|
{
|
2019-07-25 16:44:51 +02:00
|
|
|
context.ResponseData.Write((uint)StandardSteadyClockCore.Instance.GetSetupResultValue());
|
2019-07-15 19:52:35 +02:00
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
}
|
|
|
|
|
2019-07-14 22:50:11 +02:00
|
|
|
[Command(200)] // 3.0.0+
|
|
|
|
// GetInternalOffset() -> nn::TimeSpanType
|
|
|
|
public ResultCode GetInternalOffset(ServiceCtx context)
|
|
|
|
{
|
2019-07-25 16:44:51 +02:00
|
|
|
context.ResponseData.WriteStruct(StandardSteadyClockCore.Instance.GetInternalOffset());
|
2019-07-14 22:50:11 +02:00
|
|
|
|
|
|
|
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>();
|
|
|
|
|
2019-07-25 16:44:51 +02:00
|
|
|
StandardSteadyClockCore.Instance.SetInternalOffset(internalOffset);
|
2018-07-02 02:03:05 +02:00
|
|
|
|
2019-07-14 21:04:38 +02:00
|
|
|
return ResultCode.Success;
|
2018-02-10 01:14:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|