aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThog <me@thog.eu>2020-02-06 05:09:59 +0100
committerGitHub <noreply@github.com>2020-02-06 05:09:59 +0100
commitdb9f8f999f2c9a50e25685424271735ed3538539 (patch)
tree869d87bfa89a0d061cc579890dd5a0ef3bcbaf5f
parenta0e6647860b689cd2c3d865e6b235b12ec96b89a (diff)
Implement IDeliveryCacheProgressService in bcat (#908)
* Implement IDeliveryCacheProgressService in bcat This stub IDeliveryCacheProgressService IPC interface as we don't plan to support cache delivery. * Address jd's comments * Address jd's comment correctly * Address gdk's comments
-rw-r--r--Ryujinx.Common/Logging/LogClass.cs1
-rw-r--r--Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IBcatService.cs9
-rw-r--r--Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheProgressService.cs64
-rw-r--r--Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/Types/DeliveryCacheProgressImpl.cs18
4 files changed, 92 insertions, 0 deletions
diff --git a/Ryujinx.Common/Logging/LogClass.cs b/Ryujinx.Common/Logging/LogClass.cs
index 43efd8d5..2aa60146 100644
--- a/Ryujinx.Common/Logging/LogClass.cs
+++ b/Ryujinx.Common/Logging/LogClass.cs
@@ -19,6 +19,7 @@ namespace Ryujinx.Common.Logging
ServiceAm,
ServiceApm,
ServiceAudio,
+ ServiceBcat,
ServiceBsd,
ServiceBtm,
ServiceCaps,
diff --git a/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IBcatService.cs b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IBcatService.cs
index 1b32756a..ff743f15 100644
--- a/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IBcatService.cs
+++ b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IBcatService.cs
@@ -5,5 +5,14 @@ namespace Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator
class IBcatService : IpcService
{
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;
+ }
}
} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheProgressService.cs b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheProgressService.cs
new file mode 100644
index 00000000..cb809048
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheProgressService.cs
@@ -0,0 +1,64 @@
+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)
+ {
+ using (MemoryStream memory = new MemoryStream((int)ipcDesc.Size))
+ using (BinaryWriter bufferWriter = new BinaryWriter(memory))
+ {
+ bufferWriter.WriteStruct(deliveryCacheProgress);
+ context.Memory.WriteBytes(ipcDesc.Position, memory.ToArray());
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/Types/DeliveryCacheProgressImpl.cs b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/Types/DeliveryCacheProgressImpl.cs
new file mode 100644
index 00000000..fb9a67be
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/Types/DeliveryCacheProgressImpl.cs
@@ -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
+ }
+}