2021-09-28 19:03:35 -04:00
|
|
|
|
using Ryujinx.HLE.HOS.Ipc;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Pcv.Clkrst.ClkrstManager;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Pcv.Types;
|
2023-01-04 17:15:45 -05:00
|
|
|
|
using Ryujinx.Horizon.Common;
|
2021-09-28 19:03:35 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst
|
2019-09-18 20:45:11 -04:00
|
|
|
|
{
|
|
|
|
|
[Service("clkrst")] // 8.0.0+
|
|
|
|
|
[Service("clkrst:i")] // 8.0.0+
|
|
|
|
|
class IClkrstManager : IpcService
|
|
|
|
|
{
|
2021-09-28 19:03:35 -04:00
|
|
|
|
private int _moduleStateTableEventHandle = 0;
|
|
|
|
|
|
2019-09-18 20:45:11 -04:00
|
|
|
|
public IClkrstManager(ServiceCtx context) { }
|
2021-09-28 19:03:35 -04:00
|
|
|
|
|
|
|
|
|
[CommandHipc(0)]
|
|
|
|
|
// OpenSession(u32 device_code, u32 unk) -> object<nn::clkrst::IClkrstSession>
|
|
|
|
|
public ResultCode OpenSession(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
DeviceCode deviceCode = (DeviceCode)context.RequestData.ReadUInt32();
|
|
|
|
|
uint unknown = context.RequestData.ReadUInt32();
|
|
|
|
|
|
|
|
|
|
// TODO: Service checks the deviceCode and the unk value.
|
|
|
|
|
|
|
|
|
|
MakeObject(context, new IClkrstSession(deviceCode, unknown));
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[CommandHipc(4)]
|
|
|
|
|
// GetModuleStateTableEvent() -> handle<copy>
|
|
|
|
|
public ResultCode GetModuleStateTableEvent(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
if (_moduleStateTableEventHandle == 0)
|
|
|
|
|
{
|
2023-01-04 17:15:45 -05:00
|
|
|
|
if (context.Process.HandleTable.GenerateHandle(context.Device.System.IirsSharedMem, out _moduleStateTableEventHandle) != Result.Success)
|
2021-09-28 19:03:35 -04:00
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Out of handles!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_moduleStateTableEventHandle);
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[CommandHipc(5)]
|
|
|
|
|
// GetModuleStateTableMaxCount() -> u32 max_count
|
|
|
|
|
public ResultCode GetModuleStateTableMaxCount(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
context.ResponseData.Write(26u);
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
2019-09-18 20:45:11 -04:00
|
|
|
|
}
|
|
|
|
|
}
|