IServiceCreator.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using LibHac;
  2. using Ryujinx.Common;
  3. using Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator;
  4. using Ryujinx.HLE.HOS.Services.Arp;
  5. namespace Ryujinx.HLE.HOS.Services.Bcat
  6. {
  7. [Service("bcat:a", "bcat:a")]
  8. [Service("bcat:m", "bcat:m")]
  9. [Service("bcat:u", "bcat:u")]
  10. [Service("bcat:s", "bcat:s")]
  11. class IServiceCreator : IpcService
  12. {
  13. private LibHac.Bcat.Impl.Ipc.IServiceCreator _base;
  14. public IServiceCreator(ServiceCtx context, string serviceName)
  15. {
  16. var applicationClient = context.Device.System.LibHacHorizonManager.ApplicationClient;
  17. applicationClient.Sm.GetService(out _base, serviceName).ThrowIfFailure();
  18. }
  19. [CommandHipc(0)]
  20. // CreateBcatService(pid) -> object<nn::bcat::detail::ipc::IBcatService>
  21. public ResultCode CreateBcatService(ServiceCtx context)
  22. {
  23. // TODO: Call arp:r GetApplicationLaunchProperty with the pid to get the TitleId.
  24. // Add an instance of nn::bcat::detail::service::core::PassphraseManager.
  25. // Add an instance of nn::bcat::detail::service::ServiceMemoryManager.
  26. // Add an instance of nn::bcat::detail::service::core::TaskManager who load "bcat-sys:/" system save data and open "dc/task.bin".
  27. // If the file don't exist, create a new one (size of 0x800) and write 2 empty struct with a size of 0x400.
  28. MakeObject(context, new IBcatService(ApplicationLaunchProperty.GetByPid(context)));
  29. // NOTE: If the IBcatService is null this error is returned, Doesn't occur in our case.
  30. // return ResultCode.NullObject;
  31. return ResultCode.Success;
  32. }
  33. [CommandHipc(1)]
  34. // CreateDeliveryCacheStorageService(pid) -> object<nn::bcat::detail::ipc::IDeliveryCacheStorageService>
  35. public ResultCode CreateDeliveryCacheStorageService(ServiceCtx context)
  36. {
  37. ulong pid = context.RequestData.ReadUInt64();
  38. Result rc = _base.CreateDeliveryCacheStorageService(out LibHac.Bcat.Impl.Ipc.IDeliveryCacheStorageService serv, pid);
  39. if (rc.IsSuccess())
  40. {
  41. MakeObject(context, new IDeliveryCacheStorageService(context, serv));
  42. }
  43. return (ResultCode)rc.Value;
  44. }
  45. [CommandHipc(2)]
  46. // CreateDeliveryCacheStorageServiceWithApplicationId(nn::ApplicationId) -> object<nn::bcat::detail::ipc::IDeliveryCacheStorageService>
  47. public ResultCode CreateDeliveryCacheStorageServiceWithApplicationId(ServiceCtx context)
  48. {
  49. ApplicationId applicationId = context.RequestData.ReadStruct<ApplicationId>();
  50. Result rc = _base.CreateDeliveryCacheStorageServiceWithApplicationId(out LibHac.Bcat.Impl.Ipc.IDeliveryCacheStorageService serv,
  51. applicationId);
  52. if (rc.IsSuccess())
  53. {
  54. MakeObject(context, new IDeliveryCacheStorageService(context, serv));
  55. }
  56. return (ResultCode)rc.Value;
  57. }
  58. }
  59. }