mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-23 00:14:24 +00:00
Update AdvancedSteamFriendsLibrary.h
This commit is contained in:
@@ -30,16 +30,16 @@
|
|||||||
#pragma push_macro("ARRAY_COUNT")
|
#pragma push_macro("ARRAY_COUNT")
|
||||||
#undef ARRAY_COUNT
|
#undef ARRAY_COUNT
|
||||||
|
|
||||||
#if USING_CODE_ANALYSIS
|
#if USING_CODE_ANALYSIS
|
||||||
MSVC_PRAGMA(warning(push))
|
MSVC_PRAGMA(warning(push))
|
||||||
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
||||||
#endif // USING_CODE_ANALYSIS
|
#endif // USING_CODE_ANALYSIS
|
||||||
|
|
||||||
#include <steam/steam_api.h>
|
#include <steam/steam_api.h>
|
||||||
|
|
||||||
#if USING_CODE_ANALYSIS
|
#if USING_CODE_ANALYSIS
|
||||||
MSVC_PRAGMA(warning(pop))
|
MSVC_PRAGMA(warning(pop))
|
||||||
#endif // USING_CODE_ANALYSIS
|
#endif // USING_CODE_ANALYSIS
|
||||||
|
|
||||||
#include <steam/isteamapps.h>
|
#include <steam/isteamapps.h>
|
||||||
#include <steam/isteamapplist.h>
|
#include <steam/isteamapplist.h>
|
||||||
@@ -52,183 +52,183 @@ MSVC_PRAGMA(warning(pop))
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Making a copy of this here since the original is still in a private folder and is screwing with things
|
// Making a copy of this here since the original is still in a private folder and is screwing with things
|
||||||
/**
|
/**
|
||||||
* Steam specific implementation of the unique net id
|
* Steam specific implementation of the unique net id
|
||||||
*/
|
*/
|
||||||
class FUniqueNetIdSteam2 :
|
class FUniqueNetIdSteam2 :
|
||||||
public FUniqueNetId
|
public FUniqueNetId
|
||||||
{
|
{
|
||||||
PACKAGE_SCOPE:
|
PACKAGE_SCOPE:
|
||||||
/** Holds the net id for a player */
|
/** Holds the net id for a player */
|
||||||
uint64 UniqueNetId;
|
uint64 UniqueNetId;
|
||||||
|
|
||||||
/** Hidden on purpose */
|
/** Hidden on purpose */
|
||||||
FUniqueNetIdSteam2() :
|
FUniqueNetIdSteam2() :
|
||||||
UniqueNetId(0)
|
UniqueNetId(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy Constructor
|
* Copy Constructor
|
||||||
*
|
*
|
||||||
* @param Src the id to copy
|
* @param Src the id to copy
|
||||||
*/
|
*/
|
||||||
explicit FUniqueNetIdSteam2(const FUniqueNetIdSteam2& Src) :
|
explicit FUniqueNetIdSteam2(const FUniqueNetIdSteam2& Src) :
|
||||||
UniqueNetId(Src.UniqueNetId)
|
UniqueNetId(Src.UniqueNetId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructs this object with the specified net id
|
* Constructs this object with the specified net id
|
||||||
*
|
*
|
||||||
* @param InUniqueNetId the id to set ours to
|
* @param InUniqueNetId the id to set ours to
|
||||||
*/
|
*/
|
||||||
explicit FUniqueNetIdSteam2(uint64 InUniqueNetId) :
|
explicit FUniqueNetIdSteam2(uint64 InUniqueNetId) :
|
||||||
UniqueNetId(InUniqueNetId)
|
UniqueNetId(InUniqueNetId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this object with the steam id
|
* Constructs this object with the steam id
|
||||||
*
|
*
|
||||||
* @param InUniqueNetId the id to set ours to
|
* @param InUniqueNetId the id to set ours to
|
||||||
*/
|
*/
|
||||||
explicit FUniqueNetIdSteam2(CSteamID InSteamId) :
|
explicit FUniqueNetIdSteam2(CSteamID InSteamId) :
|
||||||
UniqueNetId(InSteamId.ConvertToUint64())
|
UniqueNetId(InSteamId.ConvertToUint64())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this object with the specified net id
|
* Constructs this object with the specified net id
|
||||||
*
|
*
|
||||||
* @param String textual representation of an id
|
* @param String textual representation of an id
|
||||||
*/
|
*/
|
||||||
explicit FUniqueNetIdSteam2(const FString& Str) :
|
explicit FUniqueNetIdSteam2(const FString& Str) :
|
||||||
UniqueNetId(FCString::Atoi64(*Str))
|
UniqueNetId(FCString::Atoi64(*Str))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this object with the specified net id
|
* Constructs this object with the specified net id
|
||||||
*
|
*
|
||||||
* @param InUniqueNetId the id to set ours to (assumed to be FUniqueNetIdSteam in fact)
|
* @param InUniqueNetId the id to set ours to (assumed to be FUniqueNetIdSteam in fact)
|
||||||
*/
|
*/
|
||||||
explicit FUniqueNetIdSteam2(const FUniqueNetId& InUniqueNetId) :
|
explicit FUniqueNetIdSteam2(const FUniqueNetId& InUniqueNetId) :
|
||||||
UniqueNetId(*(uint64*)InUniqueNetId.GetBytes())
|
UniqueNetId(*(uint64*)InUniqueNetId.GetBytes())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual FName GetType() const override
|
virtual FName GetType() const override
|
||||||
{
|
{
|
||||||
return STEAM_SUBSYSTEM;
|
return STEAM_SUBSYSTEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the raw byte representation of this net id
|
* Get the raw byte representation of this net id
|
||||||
* This data is platform dependent and shouldn't be manipulated directly
|
* This data is platform dependent and shouldn't be manipulated directly
|
||||||
*
|
*
|
||||||
* @return byte array of size GetSize()
|
* @return byte array of size GetSize()
|
||||||
*/
|
*/
|
||||||
virtual const uint8* GetBytes() const override
|
virtual const uint8* GetBytes() const override
|
||||||
{
|
{
|
||||||
return (uint8*)&UniqueNetId;
|
return (uint8*)&UniqueNetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the id
|
* Get the size of the id
|
||||||
*
|
*
|
||||||
* @return size in bytes of the id representation
|
* @return size in bytes of the id representation
|
||||||
*/
|
*/
|
||||||
virtual int32 GetSize() const override
|
virtual int32 GetSize() const override
|
||||||
{
|
{
|
||||||
return sizeof(uint64);
|
return sizeof(uint64);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the validity of the id
|
* Check the validity of the id
|
||||||
*
|
*
|
||||||
* @return true if this is a well formed ID, false otherwise
|
* @return true if this is a well formed ID, false otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool IsValid() const override
|
virtual bool IsValid() const override
|
||||||
{
|
{
|
||||||
return UniqueNetId != 0 && CSteamID(UniqueNetId).IsValid();
|
return UniqueNetId != 0 && CSteamID(UniqueNetId).IsValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platform specific conversion to string representation of data
|
* Platform specific conversion to string representation of data
|
||||||
*
|
*
|
||||||
* @return data in string form
|
* @return data in string form
|
||||||
*/
|
*/
|
||||||
virtual FString ToString() const override
|
virtual FString ToString() const override
|
||||||
{
|
{
|
||||||
return FString::Printf(TEXT("%llu"), UniqueNetId);
|
return FString::Printf(TEXT("%llu"), UniqueNetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a human readable representation of the net id
|
* Get a human readable representation of the net id
|
||||||
* Shouldn't be used for anything other than logging/debugging
|
* Shouldn't be used for anything other than logging/debugging
|
||||||
*
|
*
|
||||||
* @return id in string form
|
* @return id in string form
|
||||||
*/
|
*/
|
||||||
virtual FString ToDebugString() const override
|
virtual FString ToDebugString() const override
|
||||||
{
|
{
|
||||||
CSteamID SteamID(UniqueNetId);
|
CSteamID SteamID(UniqueNetId);
|
||||||
if (SteamID.IsLobby())
|
if (SteamID.IsLobby())
|
||||||
{
|
{
|
||||||
return FString::Printf(TEXT("Lobby [0x%llX]"), UniqueNetId);
|
return FString::Printf(TEXT("Lobby [0x%llX]"), UniqueNetId);
|
||||||
}
|
}
|
||||||
else if (SteamID.BAnonGameServerAccount())
|
else if (SteamID.BAnonGameServerAccount())
|
||||||
{
|
{
|
||||||
return FString::Printf(TEXT("Server [0x%llX]"), UniqueNetId);
|
return FString::Printf(TEXT("Server [0x%llX]"), UniqueNetId);
|
||||||
}
|
}
|
||||||
else if (SteamID.IsValid())
|
else if (SteamID.IsValid())
|
||||||
{
|
{
|
||||||
const FString NickName(SteamFriends() ? UTF8_TO_TCHAR(SteamFriends()->GetFriendPersonaName(UniqueNetId)) : TEXT("UNKNOWN"));
|
const FString NickName(SteamFriends() ? UTF8_TO_TCHAR(SteamFriends()->GetFriendPersonaName(UniqueNetId)) : TEXT("UNKNOWN"));
|
||||||
return FString::Printf(TEXT("%s [0x%llX]"), *NickName, UniqueNetId);
|
return FString::Printf(TEXT("%s [0x%llX]"), *NickName, UniqueNetId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return FString::Printf(TEXT("INVALID [0x%llX]"), UniqueNetId);
|
return FString::Printf(TEXT("INVALID [0x%llX]"), UniqueNetId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Needed for TMap::GetTypeHash() */
|
/** Needed for TMap::GetTypeHash() */
|
||||||
friend uint32 GetTypeHash(const FUniqueNetIdSteam2& A)
|
friend uint32 GetTypeHash(const FUniqueNetIdSteam2& A)
|
||||||
{
|
{
|
||||||
return GetTypeHash(A.UniqueNetId);
|
return GetTypeHash(A.UniqueNetId);
|
||||||
//return (uint32)(A.UniqueNetId) + ((uint32)((A.UniqueNetId) >> 32) * 23);
|
//return (uint32)(A.UniqueNetId) + ((uint32)((A.UniqueNetId) >> 32) * 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convenience cast to CSteamID */
|
/** Convenience cast to CSteamID */
|
||||||
operator CSteamID()
|
operator CSteamID()
|
||||||
{
|
{
|
||||||
return UniqueNetId;
|
return UniqueNetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convenience cast to CSteamID */
|
/** Convenience cast to CSteamID */
|
||||||
operator const CSteamID() const
|
operator const CSteamID() const
|
||||||
{
|
{
|
||||||
return UniqueNetId;
|
return UniqueNetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convenience cast to CSteamID pointer */
|
/** Convenience cast to CSteamID pointer */
|
||||||
operator CSteamID*()
|
operator CSteamID*()
|
||||||
{
|
{
|
||||||
return (CSteamID*)&UniqueNetId;
|
return (CSteamID*)&UniqueNetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convenience cast to CSteamID pointer */
|
/** Convenience cast to CSteamID pointer */
|
||||||
operator const CSteamID*() const
|
operator const CSteamID*() const
|
||||||
{
|
{
|
||||||
return (const CSteamID*)&UniqueNetId;
|
return (const CSteamID*)&UniqueNetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend FArchive& operator<<(FArchive& Ar, FUniqueNetIdSteam2& UserId)
|
friend FArchive& operator<<(FArchive& Ar, FUniqueNetIdSteam2& UserId)
|
||||||
{
|
{
|
||||||
return Ar << UserId.UniqueNetId;
|
return Ar << UserId.UniqueNetId;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -297,11 +297,11 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
FString GroupTag;
|
FString GroupTag;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
int32 numOnline;
|
int32 numOnline = 0;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
int32 numInGame;
|
int32 numInGame = 0;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||||
int32 numChatting;
|
int32 numChatting = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user