aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-05-04 13:16:51 -0300
committerGitHub <noreply@github.com>2023-05-04 18:16:51 +0200
commit264438ff19898bcb8f8fc16dc9243bf9f4eba072 (patch)
treefd069fe4f0dcd2a78fc9c8ccc6d4e93bec2330b5 /src/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
parent3b8ac1641a8a40849915396813e26384b5894911 (diff)
Revert "bcat ipc (#4446)" (#4801)
This reverts commit 42507323535443ad79be071367f3d4815afca688.
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs')
-rw-r--r--src/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs b/src/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
new file mode 100644
index 00000000..1437a8e1
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
@@ -0,0 +1,85 @@
+using LibHac;
+using LibHac.Common;
+using Ryujinx.Common;
+using Ryujinx.HLE.HOS.Services.Arp;
+using Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator;
+
+namespace Ryujinx.HLE.HOS.Services.Bcat
+{
+ [Service("bcat:a", "bcat:a")]
+ [Service("bcat:m", "bcat:m")]
+ [Service("bcat:u", "bcat:u")]
+ [Service("bcat:s", "bcat:s")]
+ class IServiceCreator : DisposableIpcService
+ {
+ private SharedRef<LibHac.Bcat.Impl.Ipc.IServiceCreator> _base;
+
+ public IServiceCreator(ServiceCtx context, string serviceName)
+ {
+ var applicationClient = context.Device.System.LibHacHorizonManager.ApplicationClient;
+ applicationClient.Sm.GetService(ref _base, serviceName).ThrowIfFailure();
+ }
+
+ protected override void Dispose(bool isDisposing)
+ {
+ if (isDisposing)
+ {
+ _base.Destroy();
+ }
+ }
+
+ [CommandCmif(0)]
+ // CreateBcatService(pid) -> object<nn::bcat::detail::ipc::IBcatService>
+ public ResultCode CreateBcatService(ServiceCtx context)
+ {
+ // TODO: Call arp:r GetApplicationLaunchProperty with the pid to get the TitleId.
+ // Add an instance of nn::bcat::detail::service::core::PassphraseManager.
+ // Add an instance of nn::bcat::detail::service::ServiceMemoryManager.
+ // Add an instance of nn::bcat::detail::service::core::TaskManager who load "bcat-sys:/" system save data and open "dc/task.bin".
+ // If the file don't exist, create a new one (size of 0x800) and write 2 empty struct with a size of 0x400.
+
+ MakeObject(context, new IBcatService(ApplicationLaunchProperty.GetByPid(context)));
+
+ // NOTE: If the IBcatService is null this error is returned, Doesn't occur in our case.
+ // return ResultCode.NullObject;
+
+ return ResultCode.Success;
+ }
+
+ [CommandCmif(1)]
+ // CreateDeliveryCacheStorageService(pid) -> object<nn::bcat::detail::ipc::IDeliveryCacheStorageService>
+ public ResultCode CreateDeliveryCacheStorageService(ServiceCtx context)
+ {
+ ulong pid = context.RequestData.ReadUInt64();
+
+ using var serv = new SharedRef<LibHac.Bcat.Impl.Ipc.IDeliveryCacheStorageService>();
+
+ Result rc = _base.Get.CreateDeliveryCacheStorageService(ref serv.Ref, pid);
+
+ if (rc.IsSuccess())
+ {
+ MakeObject(context, new IDeliveryCacheStorageService(context, ref serv.Ref));
+ }
+
+ return (ResultCode)rc.Value;
+ }
+
+ [CommandCmif(2)]
+ // CreateDeliveryCacheStorageServiceWithApplicationId(nn::ApplicationId) -> object<nn::bcat::detail::ipc::IDeliveryCacheStorageService>
+ public ResultCode CreateDeliveryCacheStorageServiceWithApplicationId(ServiceCtx context)
+ {
+ ApplicationId applicationId = context.RequestData.ReadStruct<ApplicationId>();
+
+ using var service = new SharedRef<LibHac.Bcat.Impl.Ipc.IDeliveryCacheStorageService>();
+
+ Result rc = _base.Get.CreateDeliveryCacheStorageServiceWithApplicationId(ref service.Ref, applicationId);
+
+ if (rc.IsSuccess())
+ {
+ MakeObject(context, new IDeliveryCacheStorageService(context, ref service.Ref));
+ }
+
+ return (ResultCode)rc.Value;
+ }
+ }
+}