LibHacIReader.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using LibHac;
  2. using LibHac.Common;
  3. using LibHac.Ncm;
  4. using LibHac.Ns;
  5. using System;
  6. using ApplicationId = LibHac.ApplicationId;
  7. namespace Ryujinx.HLE.HOS.Services.Arp
  8. {
  9. class LibHacIReader : LibHac.Arp.Impl.IReader
  10. {
  11. public ApplicationId ApplicationId { get; set; }
  12. public Result GetApplicationLaunchProperty(out LibHac.Arp.ApplicationLaunchProperty launchProperty, ulong processId)
  13. {
  14. launchProperty = new LibHac.Arp.ApplicationLaunchProperty
  15. {
  16. StorageId = StorageId.BuiltInUser,
  17. ApplicationId = ApplicationId
  18. };
  19. return Result.Success;
  20. }
  21. public void Dispose() { }
  22. public Result GetApplicationLaunchPropertyWithApplicationId(out LibHac.Arp.ApplicationLaunchProperty launchProperty, ApplicationId applicationId)
  23. {
  24. launchProperty = new LibHac.Arp.ApplicationLaunchProperty
  25. {
  26. StorageId = StorageId.BuiltInUser,
  27. ApplicationId = applicationId
  28. };
  29. return Result.Success;
  30. }
  31. public Result GetApplicationControlProperty(out ApplicationControlProperty controlProperty, ulong processId)
  32. {
  33. throw new NotImplementedException();
  34. }
  35. public Result GetApplicationControlPropertyWithApplicationId(out ApplicationControlProperty controlProperty, ApplicationId applicationId)
  36. {
  37. throw new NotImplementedException();
  38. }
  39. public Result GetServiceObject(out object serviceObject)
  40. {
  41. throw new NotImplementedException();
  42. }
  43. }
  44. internal class LibHacArpServiceObject : LibHac.Sm.IServiceObject
  45. {
  46. private SharedRef<LibHacIReader> _serviceObject;
  47. public LibHacArpServiceObject(ref SharedRef<LibHacIReader> serviceObject)
  48. {
  49. _serviceObject = SharedRef<LibHacIReader>.CreateCopy(in serviceObject);
  50. }
  51. public void Dispose()
  52. {
  53. _serviceObject.Destroy();
  54. }
  55. public Result GetServiceObject(ref SharedRef<IDisposable> serviceObject)
  56. {
  57. serviceObject.SetByCopy(in _serviceObject);
  58. return Result.Success;
  59. }
  60. }
  61. }