aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs')
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
index 145d4e3b..a6b33e4a 100644
--- a/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForPsc.cs
@@ -18,12 +18,12 @@ namespace Ryujinx.HLE.HOS.Services.Time
[Service("time:su", TimePermissions.SystemUpdate)]
class IStaticServiceForPsc : IpcService
{
- private TimeManager _timeManager;
- private TimePermissions _permissions;
+ private readonly TimeManager _timeManager;
+ private readonly TimePermissions _permissions;
private int _timeSharedMemoryNativeHandle = 0;
- public IStaticServiceForPsc(ServiceCtx context, TimePermissions permissions) : this(TimeManager.Instance, permissions) {}
+ public IStaticServiceForPsc(ServiceCtx context, TimePermissions permissions) : this(TimeManager.Instance, permissions) { }
public IStaticServiceForPsc(TimeManager manager, TimePermissions permissions)
{
@@ -149,8 +149,8 @@ namespace Ryujinx.HLE.HOS.Services.Time
// SetStandardUserSystemClockAutomaticCorrectionEnabled(b8)
public ResultCode SetStandardUserSystemClockAutomaticCorrectionEnabled(ServiceCtx context)
{
- SteadyClockCore steadyClock = _timeManager.StandardSteadyClock;
- StandardUserSystemClockCore userClock = _timeManager.StandardUserSystemClock;
+ SteadyClockCore steadyClock = _timeManager.StandardSteadyClock;
+ StandardUserSystemClockCore userClock = _timeManager.StandardUserSystemClock;
if (!userClock.IsInitialized() || !steadyClock.IsInitialized())
{
@@ -229,7 +229,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
ITickSource tickSource = context.Device.System.TickSource;
- SystemClockContext otherContext = context.RequestData.ReadStruct<SystemClockContext>();
+ SystemClockContext otherContext = context.RequestData.ReadStruct<SystemClockContext>();
SteadyClockTimePoint currentTimePoint = steadyClock.GetCurrentTimePoint(tickSource);
ResultCode result = ResultCode.TimeMismatch;
@@ -237,7 +237,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
if (currentTimePoint.ClockSourceId == otherContext.SteadyTimePoint.ClockSourceId)
{
TimeSpanType ticksTimeSpan = TimeSpanType.FromTicks(tickSource.Counter, tickSource.Frequency);
- long baseTimePoint = otherContext.Offset + currentTimePoint.TimePoint - ticksTimeSpan.ToSeconds();
+ long baseTimePoint = otherContext.Offset + currentTimePoint.TimePoint - ticksTimeSpan.ToSeconds();
context.ResponseData.Write(baseTimePoint);
@@ -287,7 +287,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
context.RequestData.BaseStream.Position += 7;
- SystemClockContext userContext = context.RequestData.ReadStruct<SystemClockContext>();
+ SystemClockContext userContext = context.RequestData.ReadStruct<SystemClockContext>();
SystemClockContext networkContext = context.RequestData.ReadStruct<SystemClockContext>();
ITickSource tickSource = context.Device.System.TickSource;
@@ -308,7 +308,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
{
ClockSnapshot clockSnapshotA = ReadClockSnapshotFromBuffer(context, context.Request.PtrBuff[0]);
ClockSnapshot clockSnapshotB = ReadClockSnapshotFromBuffer(context, context.Request.PtrBuff[1]);
- TimeSpanType difference = TimeSpanType.FromSeconds(clockSnapshotB.UserContext.Offset - clockSnapshotA.UserContext.Offset);
+ TimeSpanType difference = TimeSpanType.FromSeconds(clockSnapshotB.UserContext.Offset - clockSnapshotA.UserContext.Offset);
if (clockSnapshotB.UserContext.SteadyTimePoint.ClockSourceId != clockSnapshotA.UserContext.SteadyTimePoint.ClockSourceId || (clockSnapshotB.IsAutomaticCorrectionEnabled && clockSnapshotA.IsAutomaticCorrectionEnabled))
{
@@ -337,7 +337,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
if (clockSnapshotA.NetworkTime != 0 && clockSnapshotB.NetworkTime != 0)
{
- result = TimeSpanType.FromSeconds(clockSnapshotB.NetworkTime - clockSnapshotA.NetworkTime);
+ result = TimeSpanType.FromSeconds(clockSnapshotB.NetworkTime - clockSnapshotA.NetworkTime);
resultCode = ResultCode.Success;
}
else
@@ -359,13 +359,13 @@ namespace Ryujinx.HLE.HOS.Services.Time
{
clockSnapshot = new ClockSnapshot();
- SteadyClockCore steadyClockCore = _timeManager.StandardSteadyClock;
+ SteadyClockCore steadyClockCore = _timeManager.StandardSteadyClock;
SteadyClockTimePoint currentTimePoint = steadyClockCore.GetCurrentTimePoint(tickSource);
clockSnapshot.IsAutomaticCorrectionEnabled = _timeManager.StandardUserSystemClock.IsAutomaticCorrectionEnabled();
- clockSnapshot.UserContext = userContext;
- clockSnapshot.NetworkContext = networkContext;
- clockSnapshot.SteadyClockTimePoint = currentTimePoint;
+ clockSnapshot.UserContext = userContext;
+ clockSnapshot.NetworkContext = networkContext;
+ clockSnapshot.SteadyClockTimePoint = currentTimePoint;
ResultCode result = _timeManager.TimeZone.Manager.GetDeviceLocationName(out string deviceLocationName);
@@ -386,7 +386,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
if (result == ResultCode.Success)
{
- clockSnapshot.UserCalendarTime = userCalendarInfo.Time;
+ clockSnapshot.UserCalendarTime = userCalendarInfo.Time;
clockSnapshot.UserCalendarAdditionalTime = userCalendarInfo.AdditionalInfo;
if (ClockSnapshot.GetCurrentTime(out clockSnapshot.NetworkTime, currentTimePoint, clockSnapshot.NetworkContext) != ResultCode.Success)
@@ -398,9 +398,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
if (result == ResultCode.Success)
{
- clockSnapshot.NetworkCalendarTime = networkCalendarInfo.Time;
+ clockSnapshot.NetworkCalendarTime = networkCalendarInfo.Time;
clockSnapshot.NetworkCalendarAdditionalTime = networkCalendarInfo.AdditionalInfo;
- clockSnapshot.Type = type;
+ clockSnapshot.Type = type;
// Probably a version field?
clockSnapshot.Unknown = 0;
@@ -419,10 +419,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
context.Memory.Read(ipcDesc.Position, temp);
- using (BinaryReader bufferReader = new BinaryReader(new MemoryStream(temp)))
- {
- return bufferReader.ReadStruct<ClockSnapshot>();
- }
+ using BinaryReader bufferReader = new(new MemoryStream(temp));
+
+ return bufferReader.ReadStruct<ClockSnapshot>();
}
private void WriteClockSnapshotFromBuffer(ServiceCtx context, IpcRecvListBuffDesc ipcDesc, ClockSnapshot clockSnapshot)
@@ -430,4 +429,4 @@ namespace Ryujinx.HLE.HOS.Services.Time
MemoryHelper.Write(context.Memory, ipcDesc.Position, clockSnapshot);
}
}
-} \ No newline at end of file
+}