friend.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // Copyright 2018 yuzu emulator team
  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/friend/friend.h"
  7. #include "core/hle/service/friend/interface.h"
  8. namespace Service::Friend {
  9. class IFriendService final : public ServiceFramework<IFriendService> {
  10. public:
  11. IFriendService() : ServiceFramework("IFriendService") {
  12. static const FunctionInfo functions[] = {
  13. {0, nullptr, "GetCompletionEvent"},
  14. {1, nullptr, "Cancel"},
  15. {10100, nullptr, "GetFriendListIds"},
  16. {10101, nullptr, "GetFriendList"},
  17. {10102, nullptr, "UpdateFriendInfo"},
  18. {10110, nullptr, "GetFriendProfileImage"},
  19. {10200, nullptr, "SendFriendRequestForApplication"},
  20. {10211, nullptr, "AddFacedFriendRequestForApplication"},
  21. {10400, nullptr, "GetBlockedUserListIds"},
  22. {10500, nullptr, "GetProfileList"},
  23. {10600, nullptr, "DeclareOpenOnlinePlaySession"},
  24. {10601, &IFriendService::DeclareCloseOnlinePlaySession,
  25. "DeclareCloseOnlinePlaySession"},
  26. {10610, nullptr, "UpdateUserPresence"},
  27. {10700, nullptr, "GetPlayHistoryRegistrationKey"},
  28. {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"},
  29. {10702, nullptr, "AddPlayHistory"},
  30. {11000, nullptr, "GetProfileImageUrl"},
  31. {20100, nullptr, "GetFriendCount"},
  32. {20101, nullptr, "GetNewlyFriendCount"},
  33. {20102, nullptr, "GetFriendDetailedInfo"},
  34. {20103, nullptr, "SyncFriendList"},
  35. {20104, nullptr, "RequestSyncFriendList"},
  36. {20110, nullptr, "LoadFriendSetting"},
  37. {20200, nullptr, "GetReceivedFriendRequestCount"},
  38. {20201, nullptr, "GetFriendRequestList"},
  39. {20300, nullptr, "GetFriendCandidateList"},
  40. {20301, nullptr, "GetNintendoNetworkIdInfo"},
  41. {20302, nullptr, "GetSnsAccountLinkage"},
  42. {20303, nullptr, "GetSnsAccountProfile"},
  43. {20304, nullptr, "GetSnsAccountFriendList"},
  44. {20400, nullptr, "GetBlockedUserList"},
  45. {20401, nullptr, "SyncBlockedUserList"},
  46. {20500, nullptr, "GetProfileExtraList"},
  47. {20501, nullptr, "GetRelationship"},
  48. {20600, nullptr, "GetUserPresenceView"},
  49. {20700, nullptr, "GetPlayHistoryList"},
  50. {20701, nullptr, "GetPlayHistoryStatistics"},
  51. {20800, nullptr, "LoadUserSetting"},
  52. {20801, nullptr, "SyncUserSetting"},
  53. {20900, nullptr, "RequestListSummaryOverlayNotification"},
  54. {21000, nullptr, "GetExternalApplicationCatalog"},
  55. {30100, nullptr, "DropFriendNewlyFlags"},
  56. {30101, nullptr, "DeleteFriend"},
  57. {30110, nullptr, "DropFriendNewlyFlag"},
  58. {30120, nullptr, "ChangeFriendFavoriteFlag"},
  59. {30121, nullptr, "ChangeFriendOnlineNotificationFlag"},
  60. {30200, nullptr, "SendFriendRequest"},
  61. {30201, nullptr, "SendFriendRequestWithApplicationInfo"},
  62. {30202, nullptr, "CancelFriendRequest"},
  63. {30203, nullptr, "AcceptFriendRequest"},
  64. {30204, nullptr, "RejectFriendRequest"},
  65. {30205, nullptr, "ReadFriendRequest"},
  66. {30210, nullptr, "GetFacedFriendRequestRegistrationKey"},
  67. {30211, nullptr, "AddFacedFriendRequest"},
  68. {30212, nullptr, "CancelFacedFriendRequest"},
  69. {30213, nullptr, "GetFacedFriendRequestProfileImage"},
  70. {30214, nullptr, "GetFacedFriendRequestProfileImageFromPath"},
  71. {30215, nullptr, "SendFriendRequestWithExternalApplicationCatalogId"},
  72. {30216, nullptr, "ResendFacedFriendRequest"},
  73. {30217, nullptr, "SendFriendRequestWithNintendoNetworkIdInfo"},
  74. {30300, nullptr, "GetSnsAccountLinkPageUrl"},
  75. {30301, nullptr, "UnlinkSnsAccount"},
  76. {30400, nullptr, "BlockUser"},
  77. {30401, nullptr, "BlockUserWithApplicationInfo"},
  78. {30402, nullptr, "UnblockUser"},
  79. {30500, nullptr, "GetProfileExtraFromFriendCode"},
  80. {30700, nullptr, "DeletePlayHistory"},
  81. {30810, nullptr, "ChangePresencePermission"},
  82. {30811, nullptr, "ChangeFriendRequestReception"},
  83. {30812, nullptr, "ChangePlayLogPermission"},
  84. {30820, nullptr, "IssueFriendCode"},
  85. {30830, nullptr, "ClearPlayLog"},
  86. {49900, nullptr, "DeleteNetworkServiceAccountCache"},
  87. };
  88. RegisterHandlers(functions);
  89. }
  90. private:
  91. void DeclareCloseOnlinePlaySession(Kernel::HLERequestContext& ctx) {
  92. // Stub used by Splatoon 2
  93. LOG_WARNING(Service_ACC, "(STUBBED) called");
  94. IPC::ResponseBuilder rb{ctx, 2};
  95. rb.Push(RESULT_SUCCESS);
  96. }
  97. };
  98. void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) {
  99. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  100. rb.Push(RESULT_SUCCESS);
  101. rb.PushIpcInterface<IFriendService>();
  102. LOG_DEBUG(Service_ACC, "called");
  103. }
  104. Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
  105. : ServiceFramework(name), module(std::move(module)) {}
  106. void InstallInterfaces(SM::ServiceManager& service_manager) {
  107. auto module = std::make_shared<Module>();
  108. std::make_shared<Friend>(module, "friend:a")->InstallAsService(service_manager);
  109. std::make_shared<Friend>(module, "friend:m")->InstallAsService(service_manager);
  110. std::make_shared<Friend>(module, "friend:s")->InstallAsService(service_manager);
  111. std::make_shared<Friend>(module, "friend:u")->InstallAsService(service_manager);
  112. std::make_shared<Friend>(module, "friend:v")->InstallAsService(service_manager);
  113. }
  114. } // namespace Service::Friend