IServiceCreator.cs 2.9 KB

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