This commit is contained in:
Starlet 2019-04-21 13:16:01 -04:00
commit 41cce9b9d0

View file

@ -15,9 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
private static readonly DateTime StartupDate = DateTime.UtcNow; private static readonly DateTime StartupDate = DateTime.UtcNow;
private KSharedMemory _timeSharedMem; public IStaticService()
public IStaticService(KSharedMemory timeSharedMem)
{ {
_commands = new Dictionary<int, ServiceProcessRequest> _commands = new Dictionary<int, ServiceProcessRequest>
{ {
@ -29,8 +27,6 @@ namespace Ryujinx.HLE.HOS.Services.Time
{ 20, GetSharedMemoryNativeHandle }, { 20, GetSharedMemoryNativeHandle },
{ 300, CalculateMonotonicSystemClockBaseTimePoint } { 300, CalculateMonotonicSystemClockBaseTimePoint }
}; };
_timeSharedMem = timeSharedMem;
} }
public long GetStandardUserSystemClock(ServiceCtx context) public long GetStandardUserSystemClock(ServiceCtx context)
@ -70,9 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
public long GetSharedMemoryNativeHandle(ServiceCtx context) public long GetSharedMemoryNativeHandle(ServiceCtx context)
{ {
KHandleTable handleTable = context.Process.HandleTable; if (context.Process.HandleTable.GenerateHandle(context.Device.System.TimeSharedMem, out int handle) != KernelResult.Success)
if (handleTable.GenerateHandle(_timeSharedMem, out int handle) != KernelResult.Success)
{ {
throw new InvalidOperationException("Out of handles!"); throw new InvalidOperationException("Out of handles!");
} }