From f7701e76cfabc38dbb0b482dd36270c79c1d67d1 Mon Sep 17 00:00:00 2001 From: Joshua Date: Thu, 25 Apr 2024 15:49:34 -0400 Subject: [PATCH] Epic is improperly forming the status string and its causing memory access issues. --- .../Private/AdvancedFriendsLibrary.cpp | 10 ++++++---- .../Private/GetFriendsCallbackProxy.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp index 934b154..5df1a94 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp @@ -138,7 +138,7 @@ void UAdvancedFriendsLibrary::GetFriend(APlayerController *PlayerController, con TSharedPtr fr = FriendsInterface->GetFriend(Player->GetControllerId(), *FriendUniqueNetId.GetUniqueNetId(), EFriendsLists::ToString(EFriendsLists::Default)); if (fr.IsValid()) { - FOnlineUserPresence pres = fr->GetPresence(); + const FOnlineUserPresence& pres = fr->GetPresence(); Friend.DisplayName = fr->GetDisplayName(); Friend.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State)); Friend.RealName = fr->GetRealName(); @@ -151,7 +151,8 @@ void UAdvancedFriendsLibrary::GetFriend(APlayerController *PlayerController, con Friend.PresenceInfo.bIsPlaying = pres.bIsPlaying; Friend.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame; Friend.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State)); - Friend.PresenceInfo.StatusString = pres.Status.StatusStr; + // #TODO: Check back in on this in shipping, epic is missing the UTF8_TO_TCHAR call on converting this and its making an invalid string + //Friend.PresenceInfo.StatusString = pres.Status.StatusStr; } } @@ -252,7 +253,7 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont for (int32 i = 0; i < FriendList.Num(); i++) { FBPFriendInfo BPF; - FOnlineUserPresence pres = FriendList[i]->GetPresence(); + const FOnlineUserPresence& pres = FriendList[i]->GetPresence(); BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State)); BPF.DisplayName = FriendList[i]->GetDisplayName(); @@ -264,7 +265,8 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport; BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying; BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State)); - BPF.PresenceInfo.StatusString = pres.Status.StatusStr; + // #TODO: Check back in on this in shipping, epic is missing the UTF8_TO_TCHAR call on converting this and its making an invalid string + //BPF.PresenceInfo.StatusString = pres.Status.StatusStr; BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable; BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame; diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp index ae789dc..2d1d738 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp @@ -81,7 +81,7 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo for (int32 i = 0; i < FriendList.Num(); i++) { FBPFriendInfo BPF; - FOnlineUserPresence pres = FriendList[i]->GetPresence(); + const FOnlineUserPresence& pres = FriendList[i]->GetPresence(); BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State)); BPF.DisplayName = FriendList[i]->GetDisplayName(); BPF.RealName = FriendList[i]->GetRealName(); @@ -92,7 +92,9 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport; BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying; BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State)); - BPF.PresenceInfo.StatusString = pres.Status.StatusStr; + + // #TODO: Check back in on this in shipping, epic is missing the UTF8_TO_TCHAR call on converting this and its making an invalid string + //BPF.PresenceInfo.StatusString = pres.Status.StatusStr; BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable; BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;