diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 38e62761bf..59691bf2e3 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -59,10 +59,10 @@ public: {20401, nullptr, "SyncBlockedUserList"}, {20500, nullptr, "GetProfileExtraList"}, {20501, nullptr, "GetRelationship"}, - {20600, nullptr, "GetUserPresenceView"}, + {20600, &IFriendService::GetUserPresenceView, "GetUserPresenceView"}, {20700, nullptr, "GetPlayHistoryList"}, {20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"}, - {20800, nullptr, "LoadUserSetting"}, + {20800, &IFriendService::LoadUserSetting, "LoadUserSetting"}, {20801, nullptr, "SyncUserSetting"}, {20900, nullptr, "RequestListSummaryOverlayNotification"}, {21000, nullptr, "GetExternalApplicationCatalog"}, @@ -136,6 +136,17 @@ private: }; static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size"); + struct FriendsUserSetting { + Common::UUID uuid; + u32 presence_permission; + u32 play_log_permission; + u64 friend_request_reception; + char friend_code[0x20]; + u64 friend_code_next_issuable_time; + u8 unk_x48[0x7B8]; + }; + static_assert(sizeof(FriendsUserSetting) == 0x800, "FriendsUserSetting is an invalid size"); + void GetCompletionEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_Friend, "called"); @@ -234,11 +245,25 @@ private: } void GetReceivedFriendRequestCount(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + [[maybe_unused]] const auto uuid = rp.PopRaw(); + LOG_DEBUG(Service_Friend, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(ResultSuccess); + rb.Push(0); + rb.Push(0); + } + + void GetUserPresenceView(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called"); + + u8 buf[0xe0]{}; + ctx.WriteBuffer(buf); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push(0); } void GetPlayHistoryStatistics(HLERequestContext& ctx) { @@ -248,6 +273,25 @@ private: rb.Push(ResultSuccess); } + void LoadUserSetting(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); + + LOG_WARNING(Service_Friend, "(STUBBED) called"); + + FriendsUserSetting setting{}; + setting.uuid = uuid; + setting.presence_permission = 2; + setting.play_log_permission = 5; + setting.friend_request_reception = 1; + setting.friend_code_next_issuable_time = 99999999999; + strcpy(setting.friend_code, "0000-0000-0000"); + ctx.WriteBuffer(setting); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + void GetReceivedFriendInvitationCountCache(HLERequestContext& ctx) { LOG_DEBUG(Service_Friend, "(STUBBED) called, check in out"); diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index ce5e3b5b4c..68527ac8ef 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -63,11 +63,11 @@ void ServiceFrameworkBase::RegisterHandlersBaseTipc(const FunctionInfoBase* func void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info) { auto cmd_buf = ctx.CommandBuffer(); - std::string function_name = info == nullptr ? fmt::format("{}", ctx.GetCommand()) : info->name; + std::string function_name = info == nullptr ? "" : info->name; fmt::memory_buffer buf; - fmt::format_to(std::back_inserter(buf), "function '{}': port='{}' cmd_buf={{[0]=0x{:X}", - function_name, service_name, cmd_buf[0]); + fmt::format_to(std::back_inserter(buf), "function '{}({})': port='{}' cmd_buf={{[0]=0x{:X}", + ctx.GetCommand(), function_name, service_name, cmd_buf[0]); for (int i = 1; i <= 8; ++i) { fmt::format_to(std::back_inserter(buf), ", [{}]=0x{:X}", i, cmd_buf[i]); }