Update ISystemClock to 9.0.0
This commit is contained in:
parent
b4e5311902
commit
4fca3839ca
3 changed files with 54 additions and 10 deletions
|
@ -1,4 +1,5 @@
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -6,13 +7,13 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
{
|
{
|
||||||
abstract class SystemClockContextUpdateCallback
|
abstract class SystemClockContextUpdateCallback
|
||||||
{
|
{
|
||||||
private List<KEvent> _operationEventList;
|
private List<KWritableEvent> _operationEventList;
|
||||||
protected SystemClockContext _context;
|
protected SystemClockContext _context;
|
||||||
private bool _hasContext;
|
private bool _hasContext;
|
||||||
|
|
||||||
public SystemClockContextUpdateCallback()
|
public SystemClockContextUpdateCallback()
|
||||||
{
|
{
|
||||||
_operationEventList = new List<KEvent>();
|
_operationEventList = new List<KWritableEvent>();
|
||||||
_context = new SystemClockContext();
|
_context = new SystemClockContext();
|
||||||
_hasContext = false;
|
_hasContext = false;
|
||||||
}
|
}
|
||||||
|
@ -27,13 +28,20 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegisterOperationEvent(KWritableEvent writableEvent)
|
||||||
|
{
|
||||||
|
Monitor.Enter(_operationEventList);
|
||||||
|
_operationEventList.Add(writableEvent);
|
||||||
|
Monitor.Exit(_operationEventList);
|
||||||
|
}
|
||||||
|
|
||||||
private void BroadcastOperationEvent()
|
private void BroadcastOperationEvent()
|
||||||
{
|
{
|
||||||
Monitor.Enter(_operationEventList);
|
Monitor.Enter(_operationEventList);
|
||||||
|
|
||||||
foreach (KEvent e in _operationEventList)
|
foreach (KWritableEvent e in _operationEventList)
|
||||||
{
|
{
|
||||||
e.WritableEvent.Signal();
|
e.Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor.Exit(_operationEventList);
|
Monitor.Exit(_operationEventList);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using System;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
{
|
{
|
||||||
|
@ -96,6 +97,14 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
_systemClockContextUpdateCallback = systemClockContextUpdateCallback;
|
_systemClockContextUpdateCallback = systemClockContextUpdateCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegisterOperationEvent(KWritableEvent writableEvent)
|
||||||
|
{
|
||||||
|
if (_systemClockContextUpdateCallback != null)
|
||||||
|
{
|
||||||
|
_systemClockContextUpdateCallback.RegisterOperationEvent(writableEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ResultCode SetSystemClockContext(SystemClockContext context)
|
public ResultCode SetSystemClockContext(SystemClockContext context)
|
||||||
{
|
{
|
||||||
ResultCode result = SetClockContext(context);
|
ResultCode result = SetClockContext(context);
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time.StaticService
|
namespace Ryujinx.HLE.HOS.Services.Time.StaticService
|
||||||
{
|
{
|
||||||
|
@ -8,12 +12,14 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
|
||||||
private SystemClockCore _clockCore;
|
private SystemClockCore _clockCore;
|
||||||
private bool _writePermission;
|
private bool _writePermission;
|
||||||
private bool _bypassUninitializedClock;
|
private bool _bypassUninitializedClock;
|
||||||
|
private int _operationEventReadableHandle;
|
||||||
|
|
||||||
public ISystemClock(SystemClockCore clockCore, bool writePermission, bool bypassUninitializedCloc)
|
public ISystemClock(SystemClockCore clockCore, bool writePermission, bool bypassUninitializedCloc)
|
||||||
{
|
{
|
||||||
_clockCore = clockCore;
|
_clockCore = clockCore;
|
||||||
_writePermission = writePermission;
|
_writePermission = writePermission;
|
||||||
_bypassUninitializedClock = bypassUninitializedCloc;
|
_bypassUninitializedClock = bypassUninitializedCloc;
|
||||||
|
_operationEventReadableHandle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command(0)]
|
[Command(0)]
|
||||||
|
@ -93,5 +99,26 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command(4)] // 9.0.0+
|
||||||
|
// GetOperationEventReadableHandle() -> handle<copy>
|
||||||
|
public ResultCode GetOperationEventReadableHandle(ServiceCtx context)
|
||||||
|
{
|
||||||
|
if (_operationEventReadableHandle == 0)
|
||||||
|
{
|
||||||
|
KEvent kEvent = new KEvent(context.Device.System);
|
||||||
|
|
||||||
|
_clockCore.RegisterOperationEvent(kEvent.WritableEvent);
|
||||||
|
|
||||||
|
if (context.Process.HandleTable.GenerateHandle(kEvent.ReadableEvent, out _operationEventReadableHandle) != KernelResult.Success)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Out of handles!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_operationEventReadableHandle);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue