caps_u.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Copyright 2020 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/logging/log.h"
  5. #include "core/hle/ipc_helpers.h"
  6. #include "core/hle/service/caps/caps.h"
  7. #include "core/hle/service/caps/caps_u.h"
  8. namespace Service::Capture {
  9. class IAlbumAccessorApplicationSession final
  10. : public ServiceFramework<IAlbumAccessorApplicationSession> {
  11. public:
  12. explicit IAlbumAccessorApplicationSession()
  13. : ServiceFramework{"IAlbumAccessorApplicationSession"} {
  14. // clang-format off
  15. static const FunctionInfo functions[] = {
  16. {2001, nullptr, "OpenAlbumMovieReadStream"},
  17. {2002, nullptr, "CloseAlbumMovieReadStream"},
  18. {2003, nullptr, "GetAlbumMovieReadStreamMovieDataSize"},
  19. {2004, nullptr, "ReadMovieDataFromAlbumMovieReadStream"},
  20. {2005, nullptr, "GetAlbumMovieReadStreamBrokenReason"},
  21. };
  22. // clang-format on
  23. RegisterHandlers(functions);
  24. }
  25. };
  26. CAPS_U::CAPS_U() : ServiceFramework("caps:u") {
  27. // clang-format off
  28. static const FunctionInfo functions[] = {
  29. {32, &CAPS_U::SetShimLibraryVersion, "SetShimLibraryVersion"},
  30. {102, &CAPS_U::GetAlbumContentsFileListForApplication, "GetAlbumContentsFileListForApplication"},
  31. {103, nullptr, "DeleteAlbumContentsFileForApplication"},
  32. {104, nullptr, "GetAlbumContentsFileSizeForApplication"},
  33. {105, nullptr, "DeleteAlbumFileByAruidForDebug"},
  34. {110, nullptr, "LoadAlbumContentsFileScreenShotImageForApplication"},
  35. {120, nullptr, "LoadAlbumContentsFileThumbnailImageForApplication"},
  36. {130, nullptr, "PrecheckToCreateContentsForApplication"},
  37. {140, nullptr, "GetAlbumFileList1AafeAruidDeprecated"},
  38. {141, nullptr, "GetAlbumFileList2AafeUidAruidDeprecated"},
  39. {142, &CAPS_U::GetAlbumFileList3AaeAruid, "GetAlbumFileList3AaeAruid"},
  40. {143, nullptr, "GetAlbumFileList4AaeUidAruid"},
  41. {60002, nullptr, "OpenAccessorSessionForApplication"},
  42. };
  43. // clang-format on
  44. RegisterHandlers(functions);
  45. }
  46. CAPS_U::~CAPS_U() = default;
  47. void CAPS_U::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) {
  48. IPC::RequestParser rp{ctx};
  49. const auto library_version{rp.Pop<u64>()};
  50. const auto applet_resource_user_id{rp.Pop<u64>()};
  51. LOG_WARNING(Service_Capture, "(STUBBED) called. library_version={}, applet_resource_user_id={}",
  52. library_version, applet_resource_user_id);
  53. IPC::ResponseBuilder rb{ctx, 2};
  54. rb.Push(RESULT_SUCCESS);
  55. }
  56. void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& ctx) {
  57. // Takes a type-0x6 output buffer containing an array of ApplicationAlbumFileEntry, a PID, an
  58. // u8 ContentType, two s64s, and an u64 AppletResourceUserId. Returns an output u64 for total
  59. // output entries (which is copied to a s32 by official SW).
  60. IPC::RequestParser rp{ctx};
  61. const auto pid{rp.Pop<s32>()};
  62. const auto content_type{rp.PopEnum<ContentType>()};
  63. const auto start_posix_time{rp.Pop<s64>()};
  64. const auto end_posix_time{rp.Pop<s64>()};
  65. const auto applet_resource_user_id{rp.Pop<u64>()};
  66. // TODO: Update this when we implement the album.
  67. // Currently we do not have a method of accessing album entries, set this to 0 for now.
  68. constexpr u32 total_entries_1{};
  69. constexpr u32 total_entries_2{};
  70. LOG_WARNING(
  71. Service_Capture,
  72. "(STUBBED) called. pid={}, content_type={}, start_posix_time={}, "
  73. "end_posix_time={}, applet_resource_user_id={}, total_entries_1={}, total_entries_2={}",
  74. pid, content_type, start_posix_time, end_posix_time, applet_resource_user_id,
  75. total_entries_1, total_entries_2);
  76. IPC::ResponseBuilder rb{ctx, 4};
  77. rb.Push(RESULT_SUCCESS);
  78. rb.Push(total_entries_1);
  79. rb.Push(total_entries_2);
  80. }
  81. void CAPS_U::GetAlbumFileList3AaeAruid(Kernel::HLERequestContext& ctx) {
  82. GetAlbumContentsFileListForApplication(ctx);
  83. }
  84. } // namespace Service::Capture