IAlbumApplicationService.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Ryujinx.Common.Logging;
  2. using Ryujinx.Cpu;
  3. using Ryujinx.HLE.HOS.Services.Caps.Types;
  4. namespace Ryujinx.HLE.HOS.Services.Caps
  5. {
  6. [Service("caps:u")]
  7. class IAlbumApplicationService : IpcService
  8. {
  9. public IAlbumApplicationService(ServiceCtx context) { }
  10. [CommandHipc(32)] // 7.0.0+
  11. // SetShimLibraryVersion(pid, u64, nn::applet::AppletResourceUserId)
  12. public ResultCode SetShimLibraryVersion(ServiceCtx context)
  13. {
  14. return context.Device.System.CaptureManager.SetShimLibraryVersion(context);
  15. }
  16. [CommandHipc(102)]
  17. // GetAlbumFileList0AafeAruidDeprecated(pid, u16 content_type, u64 start_time, u64 end_time, nn::applet::AppletResourceUserId) -> (u64 count, buffer<ApplicationAlbumFileEntry, 0x6>)
  18. public ResultCode GetAlbumFileList0AafeAruidDeprecated(ServiceCtx context)
  19. {
  20. // NOTE: ApplicationAlbumFileEntry size is 0x30.
  21. return GetAlbumFileList(context);
  22. }
  23. [CommandHipc(142)]
  24. // GetAlbumFileList3AaeAruid(pid, u16 content_type, u64 start_time, u64 end_time, nn::applet::AppletResourceUserId) -> (u64 count, buffer<ApplicationAlbumFileEntry, 0x6>)
  25. public ResultCode GetAlbumFileList3AaeAruid(ServiceCtx context)
  26. {
  27. // NOTE: ApplicationAlbumFileEntry size is 0x20.
  28. return GetAlbumFileList(context);
  29. }
  30. private ResultCode GetAlbumFileList(ServiceCtx context)
  31. {
  32. ResultCode resultCode = ResultCode.Success;
  33. ulong count = 0;
  34. ContentType contentType = (ContentType)context.RequestData.ReadUInt16();
  35. ulong startTime = context.RequestData.ReadUInt64();
  36. ulong endTime = context.RequestData.ReadUInt64();
  37. context.RequestData.ReadUInt16(); // Alignment.
  38. ulong appletResourceUserId = context.RequestData.ReadUInt64();
  39. ulong applicationAlbumFileEntryPosition = context.Request.ReceiveBuff[0].Position;
  40. ulong applicationAlbumFileEntrySize = context.Request.ReceiveBuff[0].Size;
  41. MemoryHelper.FillWithZeros(context.Memory, applicationAlbumFileEntryPosition, (int)applicationAlbumFileEntrySize);
  42. if (contentType > ContentType.Unknown || contentType == ContentType.ExtraMovie)
  43. {
  44. resultCode = ResultCode.InvalidContentType;
  45. }
  46. // TODO: Service checks if the pid is present in an internal list and returns ResultCode.BlacklistedPid if it is.
  47. // The list contents needs to be determined.
  48. // Service populate the buffer with a ApplicationAlbumFileEntry related to the pid.
  49. Logger.Stub?.PrintStub(LogClass.ServiceCaps, new { contentType, startTime, endTime, appletResourceUserId });
  50. context.ResponseData.Write(count);
  51. return resultCode;
  52. }
  53. }
  54. }