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