From b4f8ae7a759670c3fa22ff11e468c677fd64a682 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Thu, 30 Dec 2021 11:42:22 +0100 Subject: [PATCH] friend: Stub IsFriendListCacheAvailable and EnsureFriendListAvailable (#2949) * friend: Stub IsFriendListCacheAvailable and EnsureFriendListAvailable This PR stubs IsFriendListCacheAvailable and EnsureFriendListAvailable call of friend service which close #2896. Sadly, Super Bomberman R Online is still stuck on the loading screen and keep calling `TryPopFromFriendInvitationStorageChannel`, probably because another issue somewhere. * Add FW version * Apply suggestions from gdkchan Co-authored-by: gdkchan * Update IFriendService.cs Co-authored-by: gdkchan --- .../Friend/ServiceCreator/IFriendService.cs | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs index c3e1d967ae..7a98b0e13c 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/ServiceCreator/IFriendService.cs @@ -120,6 +120,45 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator return ResultCode.Success; } + [CommandHipc(10120)] // 10.0.0+ + // nn::friends::IsFriendListCacheAvailable(nn::account::Uid userId) -> bool + public ResultCode IsFriendListCacheAvailable(ServiceCtx context) + { + UserId userId = context.RequestData.ReadStruct(); + + if (userId.IsNull) + { + return ResultCode.InvalidArgument; + } + + // TODO: Service mount the friends:/ system savedata and try to load friend.cache file, returns true if exists, false otherwise. + // NOTE: If no cache is available, guest then calls nn::friends::EnsureFriendListAvailable, we can avoid that by faking the cache check. + context.ResponseData.Write(true); + + // TODO: Since we don't support friend features, it's fine to stub it for now. + Logger.Stub?.PrintStub(LogClass.ServiceFriend, new { UserId = userId.ToString() }); + + return ResultCode.Success; + } + + [CommandHipc(10121)] // 10.0.0+ + // nn::friends::EnsureFriendListAvailable(nn::account::Uid userId) + public ResultCode EnsureFriendListAvailable(ServiceCtx context) + { + UserId userId = context.RequestData.ReadStruct(); + + if (userId.IsNull) + { + return ResultCode.InvalidArgument; + } + + // TODO: Service mount the friends:/ system savedata and create a friend.cache file for the given user id. + // Since we don't support friend features, it's fine to stub it for now. + Logger.Stub?.PrintStub(LogClass.ServiceFriend, new { UserId = userId.ToString() }); + + return ResultCode.Success; + } + [CommandHipc(10400)] // nn::friends::GetBlockedUserListIds(int offset, nn::account::Uid userId) -> (u32, buffer) public ResultCode GetBlockedUserListIds(ServiceCtx context) @@ -311,4 +350,4 @@ namespace Ryujinx.HLE.HOS.Services.Friend.ServiceCreator return ResultCode.Success; } } -} \ No newline at end of file +}