Address comments
This commit is contained in:
parent
69dbde450c
commit
d17389d83d
6 changed files with 23 additions and 25 deletions
|
@ -23,14 +23,13 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
{
|
{
|
||||||
return new TimeSpanType(ticks * 1000000000 / frequency);
|
return new TimeSpanType(ticks * 1000000000 / frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct SteadyClockTimePoint
|
public struct SteadyClockTimePoint
|
||||||
{
|
{
|
||||||
public ulong TimePoint;
|
public ulong TimePoint;
|
||||||
public UInt128 ClockSourceId;
|
public UInt128 ClockSourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
@ -39,6 +38,4 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
public ulong Offset;
|
public ulong Offset;
|
||||||
public SteadyClockTimePoint SteadyTimePoint;
|
public SteadyClockTimePoint SteadyTimePoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
TimeSpanType ticksTimeSpan = TimeSpanType.FromTicks(thread.Context.ThreadState.CntpctEl0, thread.Context.ThreadState.CntfrqEl0);
|
TimeSpanType ticksTimeSpan = TimeSpanType.FromTicks(thread.Context.ThreadState.CntpctEl0, thread.Context.ThreadState.CntfrqEl0);
|
||||||
|
|
||||||
result.TimePoint = _internalOffset.ToSeconds() + ticksTimeSpan.ToSeconds();
|
result.TimePoint = _internalOffset.ToSeconds() + ticksTimeSpan.ToSeconds();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,6 @@ using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time
|
namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
{
|
{
|
||||||
[Flags]
|
|
||||||
enum TimePermissions
|
|
||||||
{
|
|
||||||
LocalSystemClockWritableMask = 0x1,
|
|
||||||
UserSystemClockWritableMask = 0x2,
|
|
||||||
NetworkSystemClockWritableMask = 0x4,
|
|
||||||
UnknwonPermissionMask = 0x8,
|
|
||||||
|
|
||||||
User = 0,
|
|
||||||
Applet = LocalSystemClockWritableMask | UserSystemClockWritableMask | UnknwonPermissionMask,
|
|
||||||
System = NetworkSystemClockWritableMask
|
|
||||||
}
|
|
||||||
|
|
||||||
[Service("time:a", TimePermissions.Applet)]
|
[Service("time:a", TimePermissions.Applet)]
|
||||||
[Service("time:s", TimePermissions.System)]
|
[Service("time:s", TimePermissions.System)]
|
||||||
[Service("time:u", TimePermissions.User)]
|
[Service("time:u", TimePermissions.User)]
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
{
|
{
|
||||||
class ISteadyClock : IpcService
|
class ISteadyClock : IpcService
|
||||||
{
|
{
|
||||||
|
|
||||||
[Command(0)]
|
[Command(0)]
|
||||||
// GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint
|
// GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint
|
||||||
public ResultCode GetCurrentTimePoint(ServiceCtx context)
|
public ResultCode GetCurrentTimePoint(ServiceCtx context)
|
||||||
|
|
|
@ -18,8 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetCurrentTime() -> nn::time::PosixTime
|
// GetCurrentTime() -> nn::time::PosixTime
|
||||||
public ResultCode GetCurrentTime(ServiceCtx context)
|
public ResultCode GetCurrentTime(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SteadyClockCore steadyClockCore = _clockCore.GetSteadyClockCore();
|
SteadyClockCore steadyClockCore = _clockCore.GetSteadyClockCore();
|
||||||
|
|
||||||
SteadyClockTimePoint currentTimePoint = steadyClockCore.GetCurrentTimePoint(context.Thread);
|
SteadyClockTimePoint currentTimePoint = steadyClockCore.GetCurrentTimePoint(context.Thread);
|
||||||
|
|
||||||
ResultCode result = _clockCore.GetSystemClockContext(context.Thread, out SystemClockContext clockContext);
|
ResultCode result = _clockCore.GetSystemClockContext(context.Thread, out SystemClockContext clockContext);
|
||||||
|
@ -50,10 +49,8 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
return ResultCode.PermissionDenied;
|
return ResultCode.PermissionDenied;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong posixTime = context.RequestData.ReadUInt64();
|
ulong posixTime = context.RequestData.ReadUInt64();
|
||||||
|
SteadyClockCore steadyClockCore = _clockCore.GetSteadyClockCore();
|
||||||
SteadyClockCore steadyClockCore = _clockCore.GetSteadyClockCore();
|
|
||||||
|
|
||||||
SteadyClockTimePoint currentTimePoint = steadyClockCore.GetCurrentTimePoint(context.Thread);
|
SteadyClockTimePoint currentTimePoint = steadyClockCore.GetCurrentTimePoint(context.Thread);
|
||||||
|
|
||||||
SystemClockContext clockContext = new SystemClockContext()
|
SystemClockContext clockContext = new SystemClockContext()
|
||||||
|
|
17
Ryujinx.HLE/HOS/Services/Time/TimePermissions.cs
Normal file
17
Ryujinx.HLE/HOS/Services/Time/TimePermissions.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
enum TimePermissions
|
||||||
|
{
|
||||||
|
LocalSystemClockWritableMask = 0x1,
|
||||||
|
UserSystemClockWritableMask = 0x2,
|
||||||
|
NetworkSystemClockWritableMask = 0x4,
|
||||||
|
UnknownPermissionMask = 0x8,
|
||||||
|
|
||||||
|
User = 0,
|
||||||
|
Applet = LocalSystemClockWritableMask | UserSystemClockWritableMask | UnknownPermissionMask,
|
||||||
|
System = NetworkSystemClockWritableMask
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue