aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2020-04-29 21:58:19 -0700
committerGitHub <noreply@github.com>2020-04-30 14:58:19 +1000
commit7ab3fccd4d13bf3ed07a7fa207cfee61b43c56f3 (patch)
tree744caac5f15b69f1c411c0dc4f491f9f56a57278 /Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
parent23170da5a0092c2a9d2d5d0b49da5ee1f53637ac (diff)
Add BCAT delivery cache support (#1154)
* Initial bcat delivery cache support * Use LibHac 0.11.0 * Add option to open the BCAT savedata directory
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs56
1 files changed, 39 insertions, 17 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
index ec34f540..ac1abc35 100644
--- a/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
+++ b/Ryujinx.HLE/HOS/Services/Bcat/IServiceCreator.cs
@@ -1,18 +1,25 @@
+using LibHac;
+using Ryujinx.Common;
using Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator;
using Ryujinx.HLE.HOS.Services.Arp;
namespace Ryujinx.HLE.HOS.Services.Bcat
{
- [Service("bcat:a")]
- [Service("bcat:m")]
- [Service("bcat:u")]
- [Service("bcat:s")]
+ [Service("bcat:a", "bcat:a")]
+ [Service("bcat:m", "bcat:m")]
+ [Service("bcat:u", "bcat:u")]
+ [Service("bcat:s", "bcat:s")]
class IServiceCreator : IpcService
{
- public IServiceCreator(ServiceCtx context) { }
+ private LibHac.Bcat.Detail.Ipc.IServiceCreator _base;
+
+ public IServiceCreator(ServiceCtx context, string serviceName)
+ {
+ context.Device.System.LibHacHorizonClient.Sm.GetService(out _base, serviceName).ThrowIfFailure();
+ }
[Command(0)]
- // CreateBcatService(u64, pid) -> object<nn::bcat::detail::ipc::IBcatService>
+ // 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.
@@ -30,21 +37,36 @@ namespace Ryujinx.HLE.HOS.Services.Bcat
}
[Command(1)]
- // CreateDeliveryCacheStorageService(u64, pid) -> object<nn::bcat::detail::ipc::IDeliveryCacheStorageService>
+ // CreateDeliveryCacheStorageService(pid) -> object<nn::bcat::detail::ipc::IDeliveryCacheStorageService>
public ResultCode CreateDeliveryCacheStorageService(ServiceCtx context)
{
- // TODO: Call arp:r GetApplicationLaunchProperty with the pid to get the TitleId.
- // Add an instance of nn::bcat::detail::service::core::ApplicationStorageManager who load "bcat-dc-X:/" system save data,
- // return ResultCode.NullSaveData if failed.
- // Where X depend of the ApplicationLaunchProperty stored in an array (range 0-3).
- // Add an instance of nn::bcat::detail::service::ServiceMemoryManager.
+ ulong pid = context.RequestData.ReadUInt64();
- MakeObject(context, new IDeliveryCacheStorageService(context, ApplicationLaunchProperty.GetByPid(context)));
+ Result rc = _base.CreateDeliveryCacheStorageService(out LibHac.Bcat.Detail.Ipc.IDeliveryCacheStorageService serv, pid);
- // NOTE: If the IDeliveryCacheStorageService is null this error is returned, Doesn't occur in our case.
- // return ResultCode.NullObject;
+ if (rc.IsSuccess())
+ {
+ MakeObject(context, new IDeliveryCacheStorageService(context, serv));
+ }
- return ResultCode.Success;
+ return (ResultCode)rc.Value;
+ }
+
+ [Command(2)]
+ // CreateDeliveryCacheStorageServiceWithApplicationId(nn::ApplicationId) -> object<nn::bcat::detail::ipc::IDeliveryCacheStorageService>
+ public ResultCode CreateDeliveryCacheStorageServiceWithApplicationId(ServiceCtx context)
+ {
+ ApplicationId applicationId = context.RequestData.ReadStruct<ApplicationId>();
+
+ Result rc = _base.CreateDeliveryCacheStorageServiceWithApplicationId(out LibHac.Bcat.Detail.Ipc.IDeliveryCacheStorageService serv,
+ applicationId);
+
+ if (rc.IsSuccess())
+ {
+ MakeObject(context, new IDeliveryCacheStorageService(context, serv));
+ }
+
+ return (ResultCode)rc.Value;
}
}
-} \ No newline at end of file
+}