forked from Mirror/Ryujinx
08831eecf7
* IPC refactor part 3 + 4: New server HIPC message processor with source generator based serialization * Make types match on calls to AlignUp/AlignDown * Formatting * Address some PR feedback * Move BitfieldExtensions to Ryujinx.Common.Utilities and consolidate implementations * Rename Reader/Writer to SpanReader/SpanWriter and move to Ryujinx.Common.Memory * Implement EventType * Address more PR feedback * Log request processing errors since they are not normal * Rename waitable to multiwait and add missing lock * PR feedback * Ac_K PR feedback
57 lines
No EOL
1.9 KiB
C#
57 lines
No EOL
1.9 KiB
C#
using Ryujinx.HLE.HOS.Ipc;
|
|
using Ryujinx.HLE.HOS.Services.Pcv.Clkrst.ClkrstManager;
|
|
using Ryujinx.HLE.HOS.Services.Pcv.Types;
|
|
using Ryujinx.Horizon.Common;
|
|
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Pcv.Clkrst
|
|
{
|
|
[Service("clkrst")] // 8.0.0+
|
|
[Service("clkrst:i")] // 8.0.0+
|
|
class IClkrstManager : IpcService
|
|
{
|
|
private int _moduleStateTableEventHandle = 0;
|
|
|
|
public IClkrstManager(ServiceCtx context) { }
|
|
|
|
[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)
|
|
{
|
|
if (context.Process.HandleTable.GenerateHandle(context.Device.System.IirsSharedMem, out _moduleStateTableEventHandle) != Result.Success)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
} |