2022-08-18 18:04:54 +02:00
|
|
|
|
using Ryujinx.Common.Logging;
|
2020-12-12 04:06:20 +01:00
|
|
|
|
using Ryujinx.Cpu;
|
2020-02-06 05:09:59 +01:00
|
|
|
|
using Ryujinx.HLE.HOS.Ipc;
|
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator.Types;
|
2023-01-04 23:15:45 +01:00
|
|
|
|
using Ryujinx.Horizon.Common;
|
2020-02-06 05:09:59 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator
|
|
|
|
|
{
|
|
|
|
|
class IDeliveryCacheProgressService : IpcService
|
|
|
|
|
{
|
|
|
|
|
private KEvent _event;
|
2020-12-02 00:23:43 +01:00
|
|
|
|
private int _eventHandle;
|
2020-02-06 05:09:59 +01:00
|
|
|
|
|
|
|
|
|
public IDeliveryCacheProgressService(ServiceCtx context)
|
|
|
|
|
{
|
2020-05-04 05:41:29 +02:00
|
|
|
|
_event = new KEvent(context.Device.System.KernelContext);
|
2020-02-06 05:09:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-15 01:00:34 +02:00
|
|
|
|
[CommandCmif(0)]
|
2020-02-06 05:09:59 +01:00
|
|
|
|
// GetEvent() -> handle<copy>
|
|
|
|
|
public ResultCode GetEvent(ServiceCtx context)
|
|
|
|
|
{
|
2020-12-02 00:23:43 +01:00
|
|
|
|
if (_eventHandle == 0)
|
2020-02-06 05:09:59 +01:00
|
|
|
|
{
|
2023-01-04 23:15:45 +01:00
|
|
|
|
if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out _eventHandle) != Result.Success)
|
2020-12-02 00:23:43 +01:00
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Out of handles!");
|
|
|
|
|
}
|
2020-02-06 05:09:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 00:23:43 +01:00
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_eventHandle);
|
2020-02-06 05:09:59 +01:00
|
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceBcat);
|
2020-02-06 05:09:59 +01:00
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-15 01:00:34 +02:00
|
|
|
|
[CommandCmif(1)]
|
2020-02-06 05:09:59 +01:00
|
|
|
|
// GetImpl() -> buffer<nn::bcat::detail::DeliveryCacheProgressImpl, 0x1a>
|
|
|
|
|
public ResultCode GetImpl(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
DeliveryCacheProgressImpl deliveryCacheProgress = new DeliveryCacheProgressImpl
|
|
|
|
|
{
|
|
|
|
|
State = DeliveryCacheProgressImpl.Status.Done,
|
|
|
|
|
Result = 0
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-24 12:16:01 +02:00
|
|
|
|
ulong dcpSize = WriteDeliveryCacheProgressImpl(context, context.Request.RecvListBuff[0], deliveryCacheProgress);
|
2020-12-12 04:06:20 +01:00
|
|
|
|
context.Response.PtrBuff[0] = context.Response.PtrBuff[0].WithSize(dcpSize);
|
2020-02-06 05:09:59 +01:00
|
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceBcat);
|
2020-02-06 05:09:59 +01:00
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-24 12:16:01 +02:00
|
|
|
|
private ulong WriteDeliveryCacheProgressImpl(ServiceCtx context, IpcRecvListBuffDesc ipcDesc, DeliveryCacheProgressImpl deliveryCacheProgress)
|
2020-02-06 05:09:59 +01:00
|
|
|
|
{
|
2020-12-12 04:06:20 +01:00
|
|
|
|
return MemoryHelper.Write(context.Memory, ipcDesc.Position, deliveryCacheProgress);
|
2020-02-06 05:09:59 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|