Implement EphemeralNetworkSystemClock

This commit is contained in:
Thog 2019-07-22 21:46:25 +02:00
commit fa26ee7b99
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
4 changed files with 42 additions and 5 deletions

View file

@ -0,0 +1,29 @@
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
class EphemeralNetworkSystemClockCore : SystemClockCore
{
private static EphemeralNetworkSystemClockCore instance;
public static EphemeralNetworkSystemClockCore Instance
{
get
{
if (instance == null)
{
instance = new EphemeralNetworkSystemClockCore(TickBasedSteadyClockCore.Instance);
}
return instance;
}
}
public EphemeralNetworkSystemClockCore(SteadyClockCore steadyClockCore) : base(steadyClockCore) { }
public override ResultCode Flush(SystemClockContext context)
{
// TODO: set:sys SetUserSystemClockContext
return ResultCode.Success;
}
}
}

View file

@ -2,7 +2,6 @@
{ {
class StandardLocalSystemClockCore : SystemClockCore class StandardLocalSystemClockCore : SystemClockCore
{ {
private static StandardLocalSystemClockCore instance; private static StandardLocalSystemClockCore instance;
public static StandardLocalSystemClockCore Instance public static StandardLocalSystemClockCore Instance

View file

@ -4,10 +4,10 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
{ {
abstract class SystemClockCore abstract class SystemClockCore
{ {
private StandardSteadyClockCore _steadyClockCore; private SteadyClockCore _steadyClockCore;
private SystemClockContext _context; private SystemClockContext _context;
public SystemClockCore(StandardSteadyClockCore steadyClockCore) public SystemClockCore(SteadyClockCore steadyClockCore)
{ {
_steadyClockCore = steadyClockCore; _steadyClockCore = steadyClockCore;
_context = new SystemClockContext(); _context = new SystemClockContext();
@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
_context.SteadyTimePoint.ClockSourceId = steadyClockCore.GetClockSourceId(); _context.SteadyTimePoint.ClockSourceId = steadyClockCore.GetClockSourceId();
} }
public virtual StandardSteadyClockCore GetSteadyClockCore() public virtual SteadyClockCore GetSteadyClockCore()
{ {
return _steadyClockCore; return _steadyClockCore;
} }
@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
if (result == ResultCode.Success) if (result == ResultCode.Success)
{ {
StandardSteadyClockCore steadyClockCore = GetSteadyClockCore(); SteadyClockCore steadyClockCore = GetSteadyClockCore();
SteadyClockTimePoint steadyClockTimePoint = steadyClockCore.GetCurrentTimePoint(thread); SteadyClockTimePoint steadyClockTimePoint = steadyClockCore.GetCurrentTimePoint(thread);

View file

@ -66,6 +66,15 @@ namespace Ryujinx.HLE.HOS.Services.Time
return ResultCode.Success; return ResultCode.Success;
} }
[Command(5)] // 4.0.0+
// GetEphemeralNetworkSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
public ResultCode GetEphemeralNetworkSystemClock(ServiceCtx context)
{
MakeObject(context, new ISystemClock(StandardNetworkSystemClockCore.Instance, false));
return ResultCode.Success;
}
[Command(20)] // 6.0.0+ [Command(20)] // 6.0.0+
// GetSharedMemoryNativeHandle() -> handle<copy> // GetSharedMemoryNativeHandle() -> handle<copy>
public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context) public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context)