mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-24 17:04:18 +00:00
Compare commits
3 Commits
d9ca76cfde
...
4.21_Locke
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c156a6f45 | ||
|
|
54026b637d | ||
|
|
892bee272d |
@@ -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,6 +205,7 @@ struct FBPSteamWorkshopItemDetails
|
|||||||
GENERATED_USTRUCT_BODY()
|
GENERATED_USTRUCT_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FBPSteamWorkshopItemDetails()
|
FBPSteamWorkshopItemDetails()
|
||||||
{
|
{
|
||||||
ResultOfRequest = FBPSteamResult::k_EResultOK;
|
ResultOfRequest = FBPSteamResult::k_EResultOK;
|
||||||
@@ -217,6 +220,7 @@ public:
|
|||||||
bTagsTruncated = 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;
|
||||||
@@ -254,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")
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::GetLocalSteamIDFromSteam()
|
|||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
if (SteamAPI_Init())
|
if (SteamAPI_Init())
|
||||||
{
|
{
|
||||||
FUniqueNetIdSteam2 SteamID(SteamUser()->GetSteamID());
|
TSharedPtr<const FUniqueNetId> SteamID(new const FUniqueNetIdSteam2(SteamUser()->GetSteamID()));
|
||||||
netId.SetUniqueNetId(&SteamID);
|
netId.SetUniqueNetId(SteamID);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user