Implement IDeliveryCacheProgressService in bcat

This stub IDeliveryCacheProgressService IPC interface as we don't plan
to support cache delivery.
This commit is contained in:
Thog 2020-01-26 19:49:25 +01:00
commit c6e8cf81ba
4 changed files with 97 additions and 1 deletions

View file

@ -45,6 +45,7 @@ namespace Ryujinx.Common.Logging
ServiceSsl, ServiceSsl,
ServiceSss, ServiceSss,
ServiceTime, ServiceTime,
ServiceVi ServiceVi,
ServiceBcat
} }
} }

View file

@ -5,5 +5,14 @@ namespace Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator
class IBcatService : IpcService class IBcatService : IpcService
{ {
public IBcatService(ApplicationLaunchProperty applicationLaunchProperty) { } public IBcatService(ApplicationLaunchProperty applicationLaunchProperty) { }
[Command(10100)]
// RequestSyncDeliveryCache() -> object<nn::bcat::detail::ipc::IDeliveryCacheProgressService>
public ResultCode RequestSyncDeliveryCache(ServiceCtx context)
{
MakeObject(context, new IDeliveryCacheProgressService(context));
return ResultCode.Success;
}
} }
} }

View file

@ -0,0 +1,68 @@
using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator.Types;
using System;
using System.IO;
namespace Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator
{
class IDeliveryCacheProgressService : IpcService
{
private KEvent _event;
public IDeliveryCacheProgressService(ServiceCtx context)
{
_event = new KEvent(context.Device.System);
}
[Command(0)]
// GetEvent() -> handle<copy>
public ResultCode GetEvent(ServiceCtx context)
{
if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out int handle) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
context.Response.HandleDesc = IpcHandleDesc.MakeMove(handle);
Logger.PrintStub(LogClass.ServiceBcat);
return ResultCode.Success;
}
[Command(1)]
// GetImpl() -> buffer<nn::bcat::detail::DeliveryCacheProgressImpl, 0x1a>
public ResultCode GetImpl(ServiceCtx context)
{
DeliveryCacheProgressImpl deliveryCacheProgress = new DeliveryCacheProgressImpl
{
State = DeliveryCacheProgressImpl.Status.Done,
Result = 0
};
WriteDeliveryCacheProgressImpl(context, context.Request.RecvListBuff[0], deliveryCacheProgress);
Logger.PrintStub(LogClass.ServiceBcat);
return ResultCode.Success;
}
private void WriteDeliveryCacheProgressImpl(ServiceCtx context, IpcRecvListBuffDesc ipcDesc, DeliveryCacheProgressImpl deliveryCacheProgress)
{
MemoryStream memory = new MemoryStream((int)ipcDesc.Size);
using (BinaryWriter bufferWriter = new BinaryWriter(memory))
{
bufferWriter.WriteStruct(deliveryCacheProgress);
}
context.Memory.WriteBytes(ipcDesc.Position, memory.ToArray());
memory.Dispose();
}
}
}

View file

@ -0,0 +1,18 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator.Types
{
[StructLayout(LayoutKind.Sequential, Size = 0x200)]
public struct DeliveryCacheProgressImpl
{
public enum Status
{
// TODO: determine other values
Done = 9
}
public Status State;
public uint Result;
// TODO: reverse the rest of the structure
}
}