blob: 4bb19e752f2530354d3bb3054a56cbb5205fbf73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
using Ryujinx.Cpu;
using Ryujinx.HLE.Utilities;
using System;
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
abstract class SteadyClockCore
{
private UInt128 _clockSourceId;
private bool _isRtcResetDetected;
private bool _isInitialized;
public SteadyClockCore()
{
_clockSourceId = new UInt128(Guid.NewGuid().ToByteArray());
_isRtcResetDetected = false;
_isInitialized = false;
}
public UInt128 GetClockSourceId()
{
return _clockSourceId;
}
public void SetClockSourceId(UInt128 clockSourceId)
{
_clockSourceId = clockSourceId;
}
public void SetRtcReset()
{
_isRtcResetDetected = true;
}
public virtual TimeSpanType GetTestOffset()
{
return new TimeSpanType(0);
}
public virtual void SetTestOffset(TimeSpanType testOffset) {}
public ResultCode GetRtcValue(out ulong rtcValue)
{
rtcValue = 0;
return ResultCode.NotImplemented;
}
public bool IsRtcResetDetected()
{
return _isRtcResetDetected;
}
public ResultCode GetSetupResultValue()
{
return ResultCode.Success;
}
public virtual TimeSpanType GetInternalOffset()
{
return new TimeSpanType(0);
}
public virtual void SetInternalOffset(TimeSpanType internalOffset) {}
public virtual SteadyClockTimePoint GetTimePoint(ITickSource tickSource)
{
throw new NotImplementedException();
}
public virtual TimeSpanType GetCurrentRawTimePoint(ITickSource tickSource)
{
SteadyClockTimePoint timePoint = GetTimePoint(tickSource);
return TimeSpanType.FromSeconds(timePoint.TimePoint);
}
public SteadyClockTimePoint GetCurrentTimePoint(ITickSource tickSource)
{
SteadyClockTimePoint result = GetTimePoint(tickSource);
result.TimePoint += GetTestOffset().ToSeconds();
result.TimePoint += GetInternalOffset().ToSeconds();
return result;
}
public bool IsInitialized()
{
return _isInitialized;
}
public void MarkInitialized()
{
_isInitialized = true;
}
}
}
|