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