7 Commits

Author SHA1 Message Date
morden
1c156a6f45 Added more exclusions that were missing so that this module works with android
Former-commit-id: c11af9a589737f9ae482472c160a930326dc6b50
2019-08-04 15:43:13 -04:00
morden
54026b637d Fixed a steam id error
Former-commit-id: 89a7d44b47a6a9c59e55144c280174bea367a115
2019-04-05 19:51:00 -04:00
mordentral
892bee272d Locking 4.21
Former-commit-id: 23ea465943ac29104282bc3e7ff720c687e7539b
2019-04-02 14:15:59 -04:00
mordentral
d71aaede8d Added OpenSteamUserOverlay to the AdvancedSteamFriendsLibrary
Former-commit-id: d65ec87132032ccfbc06dac90630548ee56d800f
2019-01-15 12:56:03 -05:00
mordentral
38b5c96cbd Adding extended comment to create advanced session, thanks rumbleball
Former-commit-id: 1ed8d2f155d8ea51df6649b674636ceb87c27661
2018-12-05 09:49:57 -05:00
mordentral
ad745512ac Switched to epics new hashing setup for unique ids
Also added new function GetLocalSteamIDFromSteam.


Former-commit-id: 7a15f500cd86064444cedb47433417b7bb9298e4
2018-11-14 14:08:45 -05:00
mordentral
ce7d8b1bf3 4.21 update
Former-commit-id: 91ebbaafc5a4f262d0b811c22b2a83799219fb15
2018-11-07 14:13:15 -05:00
7 changed files with 178 additions and 142 deletions

View File

@@ -2,8 +2,8 @@
"FileVersion" : 3, "FileVersion" : 3,
"FriendlyName" : "Advanced Sessions", "FriendlyName" : "Advanced Sessions",
"Version" : 4.20, "Version" : 4.21,
"VersionName": "4.20", "VersionName": "4.21",
"Description" : "Adds new blueprint functions to handle more advanced session operations.", "Description" : "Adds new blueprint functions to handle more advanced session operations.",
"Category" : "Advanced Sessions Plugin", "Category" : "Advanced Sessions Plugin",
"CreatedBy" : "Joshua Statzer", "CreatedBy" : "Joshua Statzer",

View File

@@ -2,8 +2,8 @@
"FileVersion" : 3, "FileVersion" : 3,
"FriendlyName" : "Advanced Steam Sessions", "FriendlyName" : "Advanced Steam Sessions",
"Version" : 4.20, "Version" : 4.21,
"VersionName": "4.20", "VersionName": "4.21",
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS", "Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
"Category" : "Advanced Sessions Plugin", "Category" : "Advanced Sessions Plugin",
"CreatedBy" : "Joshua Statzer", "CreatedBy" : "Joshua Statzer",

View File

@@ -197,7 +197,8 @@ public:
/** Needed for TMap::GetTypeHash() */ /** Needed for TMap::GetTypeHash() */
friend uint32 GetTypeHash(const FUniqueNetIdSteam2& A) friend uint32 GetTypeHash(const FUniqueNetIdSteam2& A)
{ {
return (uint32)(A.UniqueNetId) + ((uint32)((A.UniqueNetId) >> 32) * 23); return GetTypeHash(A.UniqueNetId);
//return (uint32)(A.UniqueNetId) + ((uint32)((A.UniqueNetId) >> 32) * 23);
} }
/** Convenience cast to CSteamID */ /** Convenience cast to CSteamID */
@@ -335,6 +336,10 @@ public:
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI") UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
static FBPUniqueNetId CreateSteamIDFromString(const FString SteamID64); static FBPUniqueNetId CreateSteamIDFromString(const FString SteamID64);
// Retreives the local steam ID from steam
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
static FBPUniqueNetId GetLocalSteamIDFromSteam();
/* Gets the current game played by a friend - AppID is int32 even though steam ids are uint32, can't be helped in blueprint currently /* Gets the current game played by a friend - AppID is int32 even though steam ids are uint32, can't be helped in blueprint currently
* can use the AppID with the WebAPI GetAppList request. * can use the AppID with the WebAPI GetAppList request.
*/ */

View File

@@ -6,6 +6,8 @@
#include "Kismet/BlueprintFunctionLibrary.h" #include "Kismet/BlueprintFunctionLibrary.h"
#include "Online.h" #include "Online.h"
#include "OnlineSubsystem.h" #include "OnlineSubsystem.h"
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#endif
#include "Interfaces/OnlineSessionInterface.h" #include "Interfaces/OnlineSessionInterface.h"
// @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just // @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just
@@ -22,16 +24,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
#pragma pop_macro("ARRAY_COUNT") #pragma pop_macro("ARRAY_COUNT")
@@ -203,11 +205,22 @@ struct FBPSteamWorkshopItemDetails
GENERATED_USTRUCT_BODY() GENERATED_USTRUCT_BODY()
public: public:
FBPSteamWorkshopItemDetails() FBPSteamWorkshopItemDetails()
{ {
ResultOfRequest = FBPSteamResult::k_EResultOK;
FileType = FBPWorkshopFileType::k_EWorkshopFileTypeMax;
CreatorAppID = 0;
ConsumerAppID = 0;
VotesUp = 0;
VotesDown = 0;
CalculatedScore = 0.f;
bBanned = false;
bAcceptedForUse = false;
bTagsTruncated = false;
} }
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
FBPSteamWorkshopItemDetails(SteamUGCDetails_t &hUGCDetails) FBPSteamWorkshopItemDetails(SteamUGCDetails_t &hUGCDetails)
{ {
ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult; ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult;
@@ -245,6 +258,7 @@ public:
CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner); CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner);
} }
#endif
// Result of obtaining the details // Result of obtaining the details
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")

View File

@@ -196,6 +196,21 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri
return netId; return netId;
} }
FBPUniqueNetId UAdvancedSteamFriendsLibrary::GetLocalSteamIDFromSteam()
{
FBPUniqueNetId netId;
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (SteamAPI_Init())
{
TSharedPtr<const FUniqueNetId> SteamID(new const FUniqueNetIdSteam2(SteamUser()->GetSteamID()));
netId.SetUniqueNetId(SteamID);
}
#endif
return netId;
}
bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly) bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly)
{ {
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX

View File

@@ -4,6 +4,8 @@
#include "UObject/CoreOnline.h" #include "UObject/CoreOnline.h"
#include "AdvancedSteamFriendsLibrary.h" #include "AdvancedSteamFriendsLibrary.h"
#include "OnlineSubSystemHeader.h" #include "OnlineSubSystemHeader.h"
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#endif
//#include "OnlineSubsystemSteamTypes.h" //#include "OnlineSubsystemSteamTypes.h"
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@@ -27,13 +29,13 @@ USteamRequestGroupOfficersCallbackProxy* USteamRequestGroupOfficersCallbackProxy
} }
void USteamRequestGroupOfficersCallbackProxy::Activate() void USteamRequestGroupOfficersCallbackProxy::Activate()
{ {
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (SteamAPI_Init()) if (SteamAPI_Init())
{ {
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes()); uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
SteamAPICall_t hSteamAPICall = SteamFriends()->RequestClanOfficerList(id); SteamAPICall_t hSteamAPICall = SteamFriends()->RequestClanOfficerList(id);
m_callResultGroupOfficerRequestDetails.Set(hSteamAPICall, this, &USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails); m_callResultGroupOfficerRequestDetails.Set(hSteamAPICall, this, &USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails);
return; return;
} }
@@ -42,78 +44,77 @@ void USteamRequestGroupOfficersCallbackProxy::Activate()
OnFailure.Broadcast(EmptyArray); OnFailure.Broadcast(EmptyArray);
} }
void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure) #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
{ void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure)
TArray<FBPSteamGroupOfficer> OfficerArray; {
TArray<FBPSteamGroupOfficer> OfficerArray;
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
if (bIOFailure || !pResult || !pResult->m_bSuccess)
if (bIOFailure || !pResult || !pResult->m_bSuccess) {
{ if (SteamSubsystem != nullptr)
if (SteamSubsystem != nullptr) {
{ SteamSubsystem->ExecuteNextTick([this]()
SteamSubsystem->ExecuteNextTick([this]() {
{ TArray<FBPSteamGroupOfficer> FailureArray;
TArray<FBPSteamGroupOfficer> FailureArray; OnFailure.Broadcast(FailureArray);
OnFailure.Broadcast(FailureArray); });
}); }
} //OnFailure.Broadcast(OfficerArray);
//OnFailure.Broadcast(OfficerArray); return;
return; }
}
if (SteamAPI_Init())
if (SteamAPI_Init()) {
{ uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
FBPSteamGroupOfficer Officer;
FBPSteamGroupOfficer Officer; CSteamID ClanOwner = SteamFriends()->GetClanOwner(id);
CSteamID ClanOwner = SteamFriends()->GetClanOwner(id);
Officer.bIsOwner = true;
Officer.bIsOwner = true;
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(ClanOwner));
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(ClanOwner)); Officer.OfficerUniqueNetID.SetUniqueNetId(ValueID);
Officer.OfficerUniqueNetID.SetUniqueNetId(ValueID); OfficerArray.Add(Officer);
OfficerArray.Add(Officer);
for (int i = 0; i < pResult->m_cOfficers; i++)
for (int i = 0; i < pResult->m_cOfficers; i++) {
{ CSteamID OfficerSteamID = SteamFriends()->GetClanOfficerByIndex(id, i);
CSteamID OfficerSteamID = SteamFriends()->GetClanOfficerByIndex(id, i);
Officer.bIsOwner = false;
Officer.bIsOwner = false;
TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam2(OfficerSteamID));
TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam2(OfficerSteamID)); Officer.OfficerUniqueNetID.SetUniqueNetId(newValueID);
Officer.OfficerUniqueNetID.SetUniqueNetId(newValueID);
OfficerArray.Add(Officer);
OfficerArray.Add(Officer); }
}
if (SteamSubsystem != nullptr)
if (SteamSubsystem != nullptr) {
{ SteamSubsystem->ExecuteNextTick([OfficerArray, this]()
SteamSubsystem->ExecuteNextTick([OfficerArray, this]() {
{ OnSuccess.Broadcast(OfficerArray);
OnSuccess.Broadcast(OfficerArray); });
}); }
}
//OnSuccess.Broadcast(OfficerArray);
//OnSuccess.Broadcast(OfficerArray); return;
return; }
} else
else {
{ if (SteamSubsystem != nullptr)
if (SteamSubsystem != nullptr) {
{ SteamSubsystem->ExecuteNextTick([this]()
SteamSubsystem->ExecuteNextTick([this]() {
{ TArray<FBPSteamGroupOfficer> FailureArray;
TArray<FBPSteamGroupOfficer> FailureArray; OnFailure.Broadcast(FailureArray);
OnFailure.Broadcast(FailureArray); });
}); }
} }
}
#endif // Should never hit this anyway
//OnFailure.Broadcast(OfficerArray);
// Should never hit this anyway }
//OnFailure.Broadcast(OfficerArray); #endif
}

View File

@@ -2,6 +2,8 @@
#include "SteamWSRequestUGCDetailsCallbackProxy.h" #include "SteamWSRequestUGCDetailsCallbackProxy.h"
#include "OnlineSubSystemHeader.h" #include "OnlineSubSystemHeader.h"
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// UEndSessionCallbackProxy // UEndSessionCallbackProxy
@@ -21,13 +23,13 @@ USteamWSRequestUGCDetailsCallbackProxy* USteamWSRequestUGCDetailsCallbackProxy::
} }
void USteamWSRequestUGCDetailsCallbackProxy::Activate() void USteamWSRequestUGCDetailsCallbackProxy::Activate()
{ {
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (SteamAPI_Init()) if (SteamAPI_Init())
{ {
// #TODO: Support arrays instead in the future? // #TODO: Support arrays instead in the future?
UGCQueryHandle_t hQueryHandle = SteamUGC()->CreateQueryUGCDetailsRequest((PublishedFileId_t *)&WorkShopID.SteamWorkshopID, 1); UGCQueryHandle_t hQueryHandle = SteamUGC()->CreateQueryUGCDetailsRequest((PublishedFileId_t *)&WorkShopID.SteamWorkshopID, 1);
// #TODO: add search settings here by calling into the handle? // #TODO: add search settings here by calling into the handle?
SteamAPICall_t hSteamAPICall = SteamUGC()->SendQueryUGCRequest(hQueryHandle); SteamAPICall_t hSteamAPICall = SteamUGC()->SendQueryUGCRequest(hQueryHandle);
// Need to release the query // Need to release the query
@@ -46,54 +48,53 @@ void USteamWSRequestUGCDetailsCallbackProxy::Activate()
OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
} }
void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure) #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
{ void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure)
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX {
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
if (bIOFailure || !pResult || pResult->m_unNumResultsReturned <= 0)
if (bIOFailure || !pResult || pResult->m_unNumResultsReturned <= 0)
{ {
if (SteamSubsystem != nullptr) if (SteamSubsystem != nullptr)
{ {
SteamSubsystem->ExecuteNextTick([this]() SteamSubsystem->ExecuteNextTick([this]()
{ {
OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
}); });
} }
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); //OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
return; return;
} }
if (SteamAPI_Init()) if (SteamAPI_Init())
{ {
SteamUGCDetails_t Details; SteamUGCDetails_t Details;
if (SteamUGC()->GetQueryUGCResult(pResult->m_handle, 0, &Details)) if (SteamUGC()->GetQueryUGCResult(pResult->m_handle, 0, &Details))
{ {
if (SteamSubsystem != nullptr) if (SteamSubsystem != nullptr)
{ {
SteamSubsystem->ExecuteNextTick([Details, this]() SteamSubsystem->ExecuteNextTick([Details, this]()
{ {
OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details)); OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
}); });
} }
//OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details)); //OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
return; return;
} }
} }
else else
{ {
if (SteamSubsystem != nullptr) if (SteamSubsystem != nullptr)
{ {
SteamSubsystem->ExecuteNextTick([this]() SteamSubsystem->ExecuteNextTick([this]()
{ {
OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
}); });
} }
} }
#endif
// Not needed, should never hit here
// Not needed, should never hit here //OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); }
} #endif