Up to Unreal 5.7
This commit is contained in:
parent
8a63902c06
commit
1a64805d43
239 changed files with 3947 additions and 296 deletions
|
|
@ -1,2 +0,0 @@
|
|||
* text=auto
|
||||
*.bat eol=crlf
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
.hg/
|
||||
binaries/
|
||||
deriveddatacache/
|
||||
.vs/
|
||||
build/
|
||||
intermediate/
|
||||
PACKPLUGIN/
|
||||
saved/
|
||||
*.orig
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"FileVersion": 3,
|
||||
"FriendlyName": "Advanced Sessions",
|
||||
"Version": 5.4,
|
||||
"VersionName": "5.4",
|
||||
"Version": 5.7,
|
||||
"VersionName": "5.7",
|
||||
"Description": "Adds new blueprint functions to handle more advanced session operations.",
|
||||
"Category": "Advanced Sessions Plugin",
|
||||
"CreatedBy": "Joshua Statzer",
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"FileVersion" : 3,
|
||||
|
||||
"FriendlyName" : "Advanced Steam Sessions",
|
||||
"Version" : 5.4,
|
||||
"VersionName": "5.4",
|
||||
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
|
||||
"Category" : "Advanced Sessions Plugin",
|
||||
"CreatedBy" : "Joshua Statzer",
|
||||
"CreatedByURL" : "N/A",
|
||||
|
||||
"Modules" :
|
||||
[
|
||||
{
|
||||
"Name": "AdvancedSteamSessions",
|
||||
"Type": "RunTime",
|
||||
"LoadingPhase": "Default"
|
||||
}
|
||||
],
|
||||
"Plugins": [
|
||||
{
|
||||
"Name": "AdvancedSessions",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystem",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystemSteam",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystemUtils",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SteamShared",
|
||||
"Enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[FilterPlugin]
|
||||
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
|
||||
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
|
||||
;
|
||||
; Examples:
|
||||
; /README.txt
|
||||
; /Extras/...
|
||||
; /Binaries/ThirdParty/*.dll
|
||||
BIN
VIRTUOS_ExpansionPluginTests/Plugins/AdvancedSessions/AdvancedSteamSessions/Resources/Icon128.png
(Stored with Git LFS)
BIN
VIRTUOS_ExpansionPluginTests/Plugins/AdvancedSessions/AdvancedSteamSessions/Resources/Icon128.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,22 +0,0 @@
|
|||
using UnrealBuildTool;
|
||||
using System.IO;
|
||||
|
||||
public class AdvancedSteamSessions : ModuleRules
|
||||
{
|
||||
public AdvancedSteamSessions(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
//bEnforceIWYU = true;
|
||||
|
||||
PublicDefinitions.Add("WITH_ADVANCED_STEAM_SESSIONS=1");
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OnlineSubsystem", "CoreUObject", "OnlineSubsystemUtils", "Networking", "Sockets", "AdvancedSessions"/*"Voice", "OnlineSubsystemSteam"*/ });
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "Sockets", "Networking", "OnlineSubsystemUtils" /*"Voice", "Steamworks","OnlineSubsystemSteam"*/});
|
||||
|
||||
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
|
||||
{
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "SteamShared", "Steamworks", "OnlineSubsystemSteam" });
|
||||
//PublicIncludePaths.AddRange(new string[] { "../Plugins/Online/OnlineSubsystemSteam/Source/Private" });// This is dumb but it isn't very open
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,389 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "CoreMinimal.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Online.h"
|
||||
#include "OnlineSubsystem.h"
|
||||
#include "Interfaces/OnlineFriendsInterface.h"
|
||||
#include "Interfaces/OnlineUserInterface.h"
|
||||
#include "Interfaces/OnlineMessageInterface.h"
|
||||
#include "Interfaces/OnlinePresenceInterface.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "Interfaces/OnlineSessionInterface.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
#include "UObject/UObjectIterator.h"
|
||||
|
||||
// This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro
|
||||
// @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just
|
||||
// disable the warnings locally. Remove when this is fixed in the SDK
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
// #TODO check back on this at some point
|
||||
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
|
||||
#endif
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
#pragma push_macro("ARRAY_COUNT")
|
||||
#undef ARRAY_COUNT
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(push))
|
||||
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
#include <steam/steam_api.h>
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(pop))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
#include <steam/isteamapps.h>
|
||||
#include <steam/isteamapplist.h>
|
||||
//#include <OnlineSubsystemSteamTypes.h>
|
||||
#pragma pop_macro("ARRAY_COUNT")
|
||||
|
||||
// @todo Steam: See above
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// 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
|
||||
*/
|
||||
class FUniqueNetIdSteam2 :
|
||||
public FUniqueNetId
|
||||
{
|
||||
PACKAGE_SCOPE:
|
||||
/** Holds the net id for a player */
|
||||
uint64 UniqueNetId;
|
||||
|
||||
/** Hidden on purpose */
|
||||
FUniqueNetIdSteam2() :
|
||||
UniqueNetId(0)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy Constructor
|
||||
*
|
||||
* @param Src the id to copy
|
||||
*/
|
||||
explicit FUniqueNetIdSteam2(const FUniqueNetIdSteam2& Src) :
|
||||
UniqueNetId(Src.UniqueNetId)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructs this object with the specified net id
|
||||
*
|
||||
* @param InUniqueNetId the id to set ours to
|
||||
*/
|
||||
explicit FUniqueNetIdSteam2(uint64 InUniqueNetId) :
|
||||
UniqueNetId(InUniqueNetId)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs this object with the steam id
|
||||
*
|
||||
* @param InUniqueNetId the id to set ours to
|
||||
*/
|
||||
explicit FUniqueNetIdSteam2(CSteamID InSteamId) :
|
||||
UniqueNetId(InSteamId.ConvertToUint64())
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs this object with the specified net id
|
||||
*
|
||||
* @param String textual representation of an id
|
||||
*/
|
||||
explicit FUniqueNetIdSteam2(const FString& Str) :
|
||||
UniqueNetId(FCString::Atoi64(*Str))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs this object with the specified net id
|
||||
*
|
||||
* @param InUniqueNetId the id to set ours to (assumed to be FUniqueNetIdSteam in fact)
|
||||
*/
|
||||
explicit FUniqueNetIdSteam2(const FUniqueNetId& InUniqueNetId) :
|
||||
UniqueNetId(*(uint64*)InUniqueNetId.GetBytes())
|
||||
{
|
||||
}
|
||||
|
||||
virtual FName GetType() const override
|
||||
{
|
||||
return STEAM_SUBSYSTEM;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw byte representation of this net id
|
||||
* This data is platform dependent and shouldn't be manipulated directly
|
||||
*
|
||||
* @return byte array of size GetSize()
|
||||
*/
|
||||
virtual const uint8* GetBytes() const override
|
||||
{
|
||||
return (uint8*)&UniqueNetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of the id
|
||||
*
|
||||
* @return size in bytes of the id representation
|
||||
*/
|
||||
virtual int32 GetSize() const override
|
||||
{
|
||||
return sizeof(uint64);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the validity of the id
|
||||
*
|
||||
* @return true if this is a well formed ID, false otherwise
|
||||
*/
|
||||
virtual bool IsValid() const override
|
||||
{
|
||||
return UniqueNetId != 0 && CSteamID(UniqueNetId).IsValid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Platform specific conversion to string representation of data
|
||||
*
|
||||
* @return data in string form
|
||||
*/
|
||||
virtual FString ToString() const override
|
||||
{
|
||||
return FString::Printf(TEXT("%llu"), UniqueNetId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a human readable representation of the net id
|
||||
* Shouldn't be used for anything other than logging/debugging
|
||||
*
|
||||
* @return id in string form
|
||||
*/
|
||||
virtual FString ToDebugString() const override
|
||||
{
|
||||
CSteamID SteamID(UniqueNetId);
|
||||
if (SteamID.IsLobby())
|
||||
{
|
||||
return FString::Printf(TEXT("Lobby [0x%llX]"), UniqueNetId);
|
||||
}
|
||||
else if (SteamID.BAnonGameServerAccount())
|
||||
{
|
||||
return FString::Printf(TEXT("Server [0x%llX]"), UniqueNetId);
|
||||
}
|
||||
else if (SteamID.IsValid())
|
||||
{
|
||||
const FString NickName(SteamFriends() ? UTF8_TO_TCHAR(SteamFriends()->GetFriendPersonaName(UniqueNetId)) : TEXT("UNKNOWN"));
|
||||
return FString::Printf(TEXT("%s [0x%llX]"), *NickName, UniqueNetId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FString::Printf(TEXT("INVALID [0x%llX]"), UniqueNetId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual uint32 GetTypeHash() const override
|
||||
{
|
||||
return ::GetTypeHash(UniqueNetId);
|
||||
}
|
||||
|
||||
/** Convenience cast to CSteamID */
|
||||
operator CSteamID()
|
||||
{
|
||||
return UniqueNetId;
|
||||
}
|
||||
|
||||
/** Convenience cast to CSteamID */
|
||||
operator const CSteamID() const
|
||||
{
|
||||
return UniqueNetId;
|
||||
}
|
||||
|
||||
/** Convenience cast to CSteamID pointer */
|
||||
operator CSteamID*()
|
||||
{
|
||||
return (CSteamID*)&UniqueNetId;
|
||||
}
|
||||
|
||||
/** Convenience cast to CSteamID pointer */
|
||||
operator const CSteamID*() const
|
||||
{
|
||||
return (const CSteamID*)&UniqueNetId;
|
||||
}
|
||||
|
||||
friend FArchive& operator<<(FArchive& Ar, FUniqueNetIdSteam2& UserId)
|
||||
{
|
||||
return Ar << UserId.UniqueNetId;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#include "AdvancedSteamFriendsLibrary.generated.h"
|
||||
|
||||
|
||||
//General Advanced Sessions Log
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedSteamFriendsLog, Log, All);
|
||||
|
||||
UENUM(Blueprintable)
|
||||
enum class SteamAvatarSize : uint8
|
||||
{
|
||||
SteamAvatar_INVALID = 0,
|
||||
SteamAvatar_Small = 1,
|
||||
SteamAvatar_Medium = 2,
|
||||
SteamAvatar_Large = 3
|
||||
};
|
||||
|
||||
UENUM(Blueprintable)
|
||||
enum class ESteamUserOverlayType : uint8
|
||||
{
|
||||
/*Opens the overlay web browser to the specified user or groups profile.*/
|
||||
steamid,
|
||||
/*Opens a chat window to the specified user, or joins the group chat.*/
|
||||
chat,
|
||||
/*Opens a window to a Steam Trading session that was started with the ISteamEconomy / StartTrade Web API.*/
|
||||
jointrade,
|
||||
/*Opens the overlay web browser to the specified user's stats.*/
|
||||
stats,
|
||||
/*Opens the overlay web browser to the specified user's achievements.*/
|
||||
achievements,
|
||||
/*Opens the overlay in minimal mode prompting the user to add the target user as a friend.*/
|
||||
friendadd,
|
||||
/*Opens the overlay in minimal mode prompting the user to remove the target friend.*/
|
||||
friendremove,
|
||||
/*Opens the overlay in minimal mode prompting the user to accept an incoming friend invite.*/
|
||||
friendrequestaccept,
|
||||
/*Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite.*/
|
||||
friendrequestignore,
|
||||
/*Opens the invite overlay, invitations sent from this dialog will be for the provided lobby*/
|
||||
invitetolobby
|
||||
};
|
||||
|
||||
static FString EnumToString(const FString& enumName, uint8 value)
|
||||
{
|
||||
|
||||
const UEnum* EnumPtr = FindFirstObject<UEnum>(*enumName, EFindFirstObjectOptions::None, ELogVerbosity::Warning, TEXT("EumtoString"));
|
||||
|
||||
if (!EnumPtr)
|
||||
return FString();
|
||||
|
||||
FString EnumName = EnumPtr->GetNameStringByIndex(value);
|
||||
return EnumName;
|
||||
}
|
||||
|
||||
|
||||
USTRUCT(BlueprintType, Category = "Online|SteamAPI|SteamGroups")
|
||||
struct FBPSteamGroupInfo
|
||||
{
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
FBPUniqueNetId GroupID; // Uint64 representation
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
FString GroupName;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
FString GroupTag;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
int32 numOnline = 0;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
int32 numInGame = 0;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
int32 numChatting = 0;
|
||||
|
||||
};
|
||||
|
||||
UENUM(Blueprintable)
|
||||
enum class EBPTextFilteringContext : uint8
|
||||
{
|
||||
/*Unknown context.*/
|
||||
FContext_Unknown = 0,
|
||||
/*Game content, only legally required filtering is performed.*/
|
||||
FContext_GameContent = 1,
|
||||
/*Char from another player.*/
|
||||
FContext_Chat = 2,
|
||||
/*Character or item name.*/
|
||||
FContext_Name = 3
|
||||
};
|
||||
|
||||
UCLASS()
|
||||
class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
//********* Friend List Functions *************//
|
||||
|
||||
// Get a texture of a valid friends avatar, STEAM ONLY, Returns invalid texture if the subsystem hasn't loaded that size of avatar yet
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI", meta = (ExpandEnumAsExecs = "Result"))
|
||||
static UTexture2D * GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize = SteamAvatarSize::SteamAvatar_Medium);
|
||||
|
||||
// Preloads the avatar and name of a steam friend, return whether it is already available or not, STEAM ONLY, Takes time to actually load everything after this is called.
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static bool RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly = false);
|
||||
|
||||
// Opens the steam overlay to go to the specified user dialog
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static bool OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
|
||||
|
||||
// Returns if the steam overlay is currently active (this can return false during initial overlay hooking)
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static bool IsOverlayEnabled();
|
||||
|
||||
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static int32 GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId);
|
||||
|
||||
// Gets the persona name of a steam ID, STEAM ONLY, Returns empty if no result, might need RequestSteamFriendInfo called first.
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static FString GetSteamPersonaName(const FBPUniqueNetId UniqueNetId);
|
||||
|
||||
// Creates a unique steam id directly from a string holding a uint64 value, useful for testing
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
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
|
||||
* can use the AppID with the WebAPI GetAppList request.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI", meta = (ExpandEnumAsExecs = "Result"))
|
||||
static void GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result/*, FString & GameName*/, int32 & AppID);
|
||||
|
||||
// Get a full list of steam groups
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|SteamGroups")
|
||||
static void GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups);
|
||||
|
||||
// Initializes text filtering (pre-loading dictonaries)
|
||||
// Returns if it succeeded, false if filtering is unavailable for the games language
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
|
||||
static bool InitTextFiltering();
|
||||
|
||||
// Attempts to filter a string with the given filtering context
|
||||
// Returns true if the text has been filtered, false if it hasn't (no filtering required or operation failed)
|
||||
// If false it will still output the original text
|
||||
// Textsource is the steam id that is the source of the text (player name / chat)
|
||||
// Requires that InitTextFiltering be called first!!
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
|
||||
static bool FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText);
|
||||
|
||||
// Returns if steam is running in big picture mode
|
||||
UFUNCTION(BlueprintPure, Category = "Online|SteamAPI")
|
||||
static bool IsSteamInBigPictureMode();
|
||||
};
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
class AdvancedSteamSessions : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
/** IModuleInterface implementation */
|
||||
void StartupModule();
|
||||
void ShutdownModule();
|
||||
};
|
||||
|
|
@ -1,351 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "CoreMinimal.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Online.h"
|
||||
#include "OnlineSubsystem.h"
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
#include "steam/isteamugc.h"
|
||||
#include "steam/isteamremotestorage.h"
|
||||
#endif
|
||||
#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
|
||||
// disable the warnings locally. Remove when this is fixed in the SDK
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
// #TODO check back on this at some point
|
||||
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
|
||||
#endif
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
#pragma push_macro("ARRAY_COUNT")
|
||||
#undef ARRAY_COUNT
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(push))
|
||||
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
#include <steam/steam_api.h>
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(pop))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
|
||||
#pragma pop_macro("ARRAY_COUNT")
|
||||
|
||||
#endif
|
||||
|
||||
// @todo Steam: See above
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#include "AdvancedSteamWorkshopLibrary.generated.h"
|
||||
|
||||
|
||||
//General Advanced Sessions Log
|
||||
DECLARE_LOG_CATEGORY_EXTERN(AdvancedSteamWorkshopLog, Log, All);
|
||||
|
||||
|
||||
// Using a custom struct because uint32 isn't blueprint supported and I don't want to cast to int32
|
||||
// due to the size of the workshop it could end up overflowing?
|
||||
USTRUCT(BlueprintType)
|
||||
struct FBPSteamWorkshopID
|
||||
{
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
public:
|
||||
|
||||
uint64 SteamWorkshopID;
|
||||
|
||||
FBPSteamWorkshopID()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
FBPSteamWorkshopID(uint64 ID)
|
||||
{
|
||||
SteamWorkshopID = ID;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// General result codes - Copying steams version over
|
||||
// Check these to future proof
|
||||
UENUM(BlueprintType)
|
||||
enum class FBPSteamResult : uint8
|
||||
{
|
||||
K_EResultInvalid = 0,
|
||||
k_EResultOK = 1, // success
|
||||
k_EResultFail = 2, // generic failure
|
||||
k_EResultNoConnection = 3, // no/failed network connection
|
||||
// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
|
||||
k_EResultInvalidPassword = 5, // password/ticket is invalid
|
||||
k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere
|
||||
k_EResultInvalidProtocolVer = 7, // protocol version is incorrect
|
||||
k_EResultInvalidParam = 8, // a parameter is incorrect
|
||||
k_EResultFileNotFound = 9, // file was not found
|
||||
k_EResultBusy = 10, // called method busy - action not taken
|
||||
k_EResultInvalidState = 11, // called object was in an invalid state
|
||||
k_EResultInvalidName = 12, // name is invalid
|
||||
k_EResultInvalidEmail = 13, // email is invalid
|
||||
k_EResultDuplicateName = 14, // name is not unique
|
||||
k_EResultAccessDenied = 15, // access is denied
|
||||
k_EResultTimeout = 16, // operation timed out
|
||||
k_EResultBanned = 17, // VAC2 banned
|
||||
k_EResultAccountNotFound = 18, // account not found
|
||||
k_EResultInvalidSteamID = 19, // steamID is invalid
|
||||
k_EResultServiceUnavailable = 20, // The requested service is currently unavailable
|
||||
k_EResultNotLoggedOn = 21, // The user is not logged on
|
||||
k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party)
|
||||
k_EResultEncryptionFailure = 23, // Encryption or Decryption failed
|
||||
k_EResultInsufficientPrivilege = 24, // Insufficient privilege
|
||||
k_EResultLimitExceeded = 25, // Too much of a good thing
|
||||
k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes)
|
||||
k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired
|
||||
k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again
|
||||
k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time
|
||||
k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user
|
||||
k_EResultIPNotFound = 31, // IP address not found
|
||||
k_EResultPersistFailed = 32, // failed to write change to the data store
|
||||
k_EResultLockingFailed = 33, // failed to acquire access lock for this operation
|
||||
k_EResultLogonSessionReplaced = 34,
|
||||
k_EResultConnectFailed = 35,
|
||||
k_EResultHandshakeFailed = 36,
|
||||
k_EResultIOFailure = 37,
|
||||
k_EResultRemoteDisconnect = 38,
|
||||
k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested
|
||||
k_EResultBlocked = 40, // a user didn't allow it
|
||||
k_EResultIgnored = 41, // target is ignoring sender
|
||||
k_EResultNoMatch = 42, // nothing matching the request found
|
||||
k_EResultAccountDisabled = 43,
|
||||
k_EResultServiceReadOnly = 44, // this service is not accepting content changes right now
|
||||
k_EResultAccountNotFeatured = 45, // account doesn't have value, so this feature isn't available
|
||||
k_EResultAdministratorOK = 46, // allowed to take this action, but only because requester is admin
|
||||
k_EResultContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol.
|
||||
k_EResultTryAnotherCM = 48, // The current CM can't service the user making a request, user should try another.
|
||||
k_EResultPasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed.
|
||||
k_EResultAlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait
|
||||
k_EResultSuspended = 51, // Long running operation (content download) suspended/paused
|
||||
k_EResultCancelled = 52, // Operation canceled (typically by user: content download)
|
||||
k_EResultDataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable
|
||||
k_EResultDiskFull = 54, // Operation canceled - not enough disk space.
|
||||
k_EResultRemoteCallFailed = 55, // an remote call or IPC call failed
|
||||
k_EResultPasswordUnset = 56, // Password could not be verified as it's unset server side
|
||||
k_EResultExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account
|
||||
k_EResultPSNTicketInvalid = 58, // PSN ticket was invalid
|
||||
k_EResultExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first
|
||||
k_EResultRemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files
|
||||
k_EResultIllegalPassword = 61, // The requested new password is not legal
|
||||
k_EResultSameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer )
|
||||
k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure
|
||||
k_EResultCannotUseOldPassword = 64, // The requested new password is not legal
|
||||
k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid
|
||||
k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
|
||||
k_EResultHardwareNotCapableOfIPT = 67, //
|
||||
k_EResultIPTInitError = 68, //
|
||||
k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
|
||||
k_EResultFacebookQueryError = 70, // Facebook query returned an error
|
||||
k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired
|
||||
k_EResultIPLoginRestrictionFailed = 72,
|
||||
k_EResultAccountLockedDown = 73,
|
||||
k_EResultAccountLogonDeniedVerifiedEmailRequired = 74,
|
||||
k_EResultNoMatchingURL = 75,
|
||||
k_EResultBadResponse = 76, // parse failure, missing field, etc.
|
||||
k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password
|
||||
k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range
|
||||
k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen
|
||||
k_EResultDisabled = 80, // The requested service has been configured to be unavailable
|
||||
k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid !
|
||||
k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action
|
||||
k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted
|
||||
k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
|
||||
k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
|
||||
k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted
|
||||
k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
|
||||
k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch
|
||||
k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
|
||||
k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
|
||||
k_EResultNotModified = 91, // data not modified
|
||||
};
|
||||
|
||||
// Check these to future proof
|
||||
UENUM(BlueprintType)
|
||||
enum class FBPWorkshopFileType : uint8
|
||||
{
|
||||
k_EWorkshopFileTypeCommunity = 0,
|
||||
k_EWorkshopFileTypeMicrotransaction = 1,
|
||||
k_EWorkshopFileTypeCollection = 2,
|
||||
k_EWorkshopFileTypeArt = 3,
|
||||
k_EWorkshopFileTypeVideo = 4,
|
||||
k_EWorkshopFileTypeScreenshot = 5,
|
||||
k_EWorkshopFileTypeGame = 6,
|
||||
k_EWorkshopFileTypeSoftware = 7,
|
||||
k_EWorkshopFileTypeConcept = 8,
|
||||
k_EWorkshopFileTypeWebGuide = 9,
|
||||
k_EWorkshopFileTypeIntegratedGuide = 10,
|
||||
k_EWorkshopFileTypeMerch = 11,
|
||||
k_EWorkshopFileTypeControllerBinding = 12,
|
||||
k_EWorkshopFileTypeSteamworksAccessInvite = 13,
|
||||
k_EWorkshopFileTypeSteamVideo = 14,
|
||||
|
||||
// Update k_EWorkshopFileTypeMax if you add values.
|
||||
k_EWorkshopFileTypeMax = 15
|
||||
};
|
||||
|
||||
// WorkshopItemDetails Struct
|
||||
USTRUCT(BlueprintType)
|
||||
struct FBPSteamWorkshopItemDetails
|
||||
{
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
public:
|
||||
|
||||
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) && STEAM_SDK_INSTALLED
|
||||
FBPSteamWorkshopItemDetails(SteamUGCDetails_t &hUGCDetails)
|
||||
{
|
||||
ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult;
|
||||
FileType = (FBPWorkshopFileType)hUGCDetails.m_eFileType;
|
||||
CreatorAppID = (int32)hUGCDetails.m_nCreatorAppID;
|
||||
ConsumerAppID = (int32)hUGCDetails.m_nConsumerAppID;
|
||||
Title = FString(hUGCDetails.m_rgchTitle, k_cchPublishedDocumentTitleMax);
|
||||
Description = FString(hUGCDetails.m_rgchDescription, k_cchPublishedDocumentDescriptionMax);
|
||||
ItemUrl = FString(hUGCDetails.m_rgchURL, k_cchPublishedFileURLMax);
|
||||
VotesUp = (int32)hUGCDetails.m_unVotesUp;
|
||||
VotesDown = (int32)hUGCDetails.m_unVotesDown;
|
||||
CalculatedScore = hUGCDetails.m_flScore;
|
||||
bBanned = hUGCDetails.m_bBanned;
|
||||
bAcceptedForUse = hUGCDetails.m_bAcceptedForUse;
|
||||
bTagsTruncated = hUGCDetails.m_bTagsTruncated;
|
||||
|
||||
CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner);
|
||||
}
|
||||
|
||||
FBPSteamWorkshopItemDetails(const SteamUGCDetails_t &hUGCDetails)
|
||||
{
|
||||
ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult;
|
||||
FileType = (FBPWorkshopFileType)hUGCDetails.m_eFileType;
|
||||
CreatorAppID = (int32)hUGCDetails.m_nCreatorAppID;
|
||||
ConsumerAppID = (int32)hUGCDetails.m_nConsumerAppID;
|
||||
Title = FString(hUGCDetails.m_rgchTitle, k_cchPublishedDocumentTitleMax);
|
||||
Description = FString(hUGCDetails.m_rgchDescription, k_cchPublishedDocumentDescriptionMax);
|
||||
ItemUrl = FString(hUGCDetails.m_rgchURL, k_cchPublishedFileURLMax);
|
||||
VotesUp = (int32)hUGCDetails.m_unVotesUp;
|
||||
VotesDown = (int32)hUGCDetails.m_unVotesDown;
|
||||
CalculatedScore = hUGCDetails.m_flScore;
|
||||
bBanned = hUGCDetails.m_bBanned;
|
||||
bAcceptedForUse = hUGCDetails.m_bAcceptedForUse;
|
||||
bTagsTruncated = hUGCDetails.m_bTagsTruncated;
|
||||
|
||||
CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Result of obtaining the details
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
FBPSteamResult ResultOfRequest;
|
||||
|
||||
// Type of file
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
FBPWorkshopFileType FileType;
|
||||
|
||||
// These two are listed as baked to an int, but is stored as a uint, think its safe to keep int
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
int32 CreatorAppID;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
int32 ConsumerAppID;
|
||||
|
||||
// Title of item
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
FString Title;
|
||||
|
||||
// Description of item
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
FString Description;
|
||||
|
||||
//Url for a video of website
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
FString ItemUrl;
|
||||
|
||||
// Votes will be unlikely to go above signed limited
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
int32 VotesUp;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
int32 VotesDown;
|
||||
|
||||
// Calculated score
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
float CalculatedScore;
|
||||
|
||||
// whether the file was banned
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
bool bBanned;
|
||||
|
||||
// developer has specifically flagged this item as accepted in the Workshop
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
bool bAcceptedForUse;
|
||||
|
||||
// whether the list of tags was too long to be returned in the provided buffer
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
bool bTagsTruncated;
|
||||
|
||||
// Steam ID of the user who created this content.
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
FString CreatorSteamID;
|
||||
|
||||
/*
|
||||
PublishedFileId_t m_nPublishedFileId;
|
||||
uint32 m_rtimeCreated; // time when the published file was created
|
||||
uint32 m_rtimeUpdated; // time when the published file was last updated
|
||||
uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable)
|
||||
ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility
|
||||
char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file
|
||||
// file/url information
|
||||
UGCHandle_t m_hFile; // The handle of the primary file
|
||||
UGCHandle_t m_hPreviewFile; // The handle of the preview file
|
||||
char m_pchFileName[k_cchFilenameMax]; // The cloud filename of the primary file
|
||||
int32 m_nFileSize; // Size of the primary file
|
||||
int32 m_nPreviewFileSize; // Size of the preview file
|
||||
uint32 m_unNumChildren; // if m_eFileType == k_EWorkshopFileTypeCollection, then this number will be the number of children contained within the collection
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
UCLASS()
|
||||
class UAdvancedSteamWorkshopLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
//********* Steam Functions *************//
|
||||
|
||||
// Returns IDs for subscribed workshop items, TArray length dictates how many
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSteamWorkshop")
|
||||
static TArray<FBPSteamWorkshopID> GetSubscribedWorkshopItems(int32 & NumberOfItems);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSteamWorkshop")
|
||||
static void GetNumSubscribedWorkshopItems(int32 & NumberOfItems);
|
||||
|
||||
};
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Subsystems/GameInstanceSubsystem.h"
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
#include <steam/steam_api.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "SteamNotificationsSubsystem.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSteamOverlayActivated, bool, bOverlayState);
|
||||
|
||||
UCLASS()
|
||||
class ADVANCEDSTEAMSESSIONS_API USteamNotificationsSubsystem : public UGameInstanceSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
// Event thrown when the steam overlay switches states
|
||||
UPROPERTY(BlueprintAssignable, Category = "SteamEvents")
|
||||
FOnSteamOverlayActivated OnSteamOverlayActivated_Bind;
|
||||
|
||||
USteamNotificationsSubsystem() : Super()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class cSteamEventsStore
|
||||
{
|
||||
public:
|
||||
USteamNotificationsSubsystem* ParentSubsystem = nullptr;
|
||||
void Initialize(USteamNotificationsSubsystem* MyParent)
|
||||
{
|
||||
ParentSubsystem = MyParent;
|
||||
}
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
cSteamEventsStore() :
|
||||
OnExternalUITriggeredCallback(this, &cSteamEventsStore::OnExternalUITriggered)
|
||||
{
|
||||
|
||||
}
|
||||
#else
|
||||
//cSteamEventsStore()
|
||||
//{
|
||||
|
||||
//}
|
||||
#endif
|
||||
|
||||
//~cSteamEventsStore(){}
|
||||
|
||||
private:
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
STEAM_CALLBACK(cSteamEventsStore, OnExternalUITriggered, GameOverlayActivated_t, OnExternalUITriggeredCallback);
|
||||
#endif
|
||||
};
|
||||
|
||||
cSteamEventsStore MyEvents;
|
||||
|
||||
/** Implement this for initialization of instances of the system */
|
||||
virtual void Initialize(FSubsystemCollectionBase& Collection) override
|
||||
{
|
||||
MyEvents.Initialize(this);
|
||||
}
|
||||
|
||||
/** Implement this for deinitialization of instances of the system */
|
||||
virtual void Deinitialize() override
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
void USteamNotificationsSubsystem::cSteamEventsStore::OnExternalUITriggered(GameOverlayActivated_t* CallbackData)
|
||||
{
|
||||
if (ParentSubsystem)
|
||||
{
|
||||
ParentSubsystem->OnSteamOverlayActivated_Bind.Broadcast((bool)CallbackData->m_bActive);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
|
||||
// This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro
|
||||
|
||||
// @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just
|
||||
// disable the warnings locally. Remove when this is fixed in the SDK
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
// #TODO check back on this at some point
|
||||
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
|
||||
#endif
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
//#include "OnlineSubsystemSteam.h"
|
||||
|
||||
#pragma push_macro("ARRAY_COUNT")
|
||||
#undef ARRAY_COUNT
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(push))
|
||||
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
#include <steam/steam_api.h>
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(pop))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
|
||||
#pragma pop_macro("ARRAY_COUNT")
|
||||
|
||||
#endif
|
||||
|
||||
// @todo Steam: See above
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "SteamRequestGroupOfficersCallbackProxy.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType, Category = "Online|SteamAPI|SteamGroups")
|
||||
struct FBPSteamGroupOfficer
|
||||
{
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
FBPUniqueNetId OfficerUniqueNetID; // Uint64 representation
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
|
||||
bool bIsOwner = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintGroupOfficerDetailsDelegate, const TArray<FBPSteamGroupOfficer> &, OfficerList);
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class USteamRequestGroupOfficersCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
virtual ~USteamRequestGroupOfficersCallbackProxy();
|
||||
|
||||
// Called when there is a successful results return
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintGroupOfficerDetailsDelegate OnSuccess;
|
||||
|
||||
// Called when there is an unsuccessful results return
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintGroupOfficerDetailsDelegate OnFailure;
|
||||
|
||||
// Returns a list of steam group officers
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|SteamAPI|SteamGroups")
|
||||
static USteamRequestGroupOfficersCallbackProxy* GetSteamGroupOfficerList(UObject* WorldContextObject, FBPUniqueNetId GroupUniqueNetID);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
void OnRequestGroupOfficerDetails( ClanOfficerListResponse_t *pResult, bool bIOFailure);
|
||||
CCallResult<USteamRequestGroupOfficersCallbackProxy, ClanOfficerListResponse_t> m_callResultGroupOfficerRequestDetails;
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
FBPUniqueNetId GroupUniqueID;
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AdvancedSteamWorkshopLibrary.h"
|
||||
#include "BlueprintDataDefinitions.h"
|
||||
|
||||
// This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro
|
||||
|
||||
// @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just
|
||||
// disable the warnings locally. Remove when this is fixed in the SDK
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
// #TODO check back on this at some point
|
||||
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
|
||||
#endif
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
//#include "OnlineSubsystemSteam.h"
|
||||
|
||||
#pragma push_macro("ARRAY_COUNT")
|
||||
#undef ARRAY_COUNT
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(push))
|
||||
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
#include <steam/steam_api.h>
|
||||
|
||||
#if USING_CODE_ANALYSIS
|
||||
MSVC_PRAGMA(warning(pop))
|
||||
#endif // USING_CODE_ANALYSIS
|
||||
|
||||
|
||||
#pragma pop_macro("ARRAY_COUNT")
|
||||
|
||||
#endif
|
||||
|
||||
// @todo Steam: See above
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#include "SteamWSRequestUGCDetailsCallbackProxy.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintWorkshopDetailsDelegate, const FBPSteamWorkshopItemDetails&, WorkShopDetails);
|
||||
|
||||
UCLASS(MinimalAPI)
|
||||
class USteamWSRequestUGCDetailsCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
// Called when there is a successful results return
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintWorkshopDetailsDelegate OnSuccess;
|
||||
|
||||
// Called when there is an unsuccessful results return
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FBlueprintWorkshopDetailsDelegate OnFailure;
|
||||
|
||||
// Ends the current session
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSteamWorkshop")
|
||||
static USteamWSRequestUGCDetailsCallbackProxy* GetWorkshopItemDetails(UObject* WorldContextObject, FBPSteamWorkshopID WorkShopID);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
// End of UOnlineBlueprintCallProxyBase interface
|
||||
|
||||
private:
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
// Internal callback when the operation completes, calls out to the public success/failure callbacks
|
||||
|
||||
void OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure);
|
||||
CCallResult<USteamWSRequestUGCDetailsCallbackProxy, SteamUGCQueryCompleted_t> m_callResultUGCRequestDetails;
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
FBPSteamWorkshopID WorkShopID;
|
||||
UObject* WorldContextObject;
|
||||
};
|
||||
|
|
@ -1,438 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
#include "AdvancedSteamFriendsLibrary.h"
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
|
||||
//General Log
|
||||
DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog);
|
||||
|
||||
|
||||
// Clan functions, add in soon
|
||||
/*int32 UAdvancedSteamFriendsLibrary::GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId)
|
||||
{
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
|
||||
|
||||
// clan (group) iteration and access functions
|
||||
//virtual int GetClanCount() = 0;
|
||||
//virtual CSteamID GetClanByIndex(int iClan) = 0;
|
||||
//virtual const char *GetClanName(CSteamID steamIDClan) = 0;
|
||||
//virtual const char *GetClanTag(CSteamID steamIDClan) = 0;
|
||||
// returns the most recent information we have about what's happening in a clan
|
||||
//virtual bool GetClanActivityCounts(CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting) = 0;
|
||||
// for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest
|
||||
//virtual SteamAPICall_t DownloadClanActivityCounts(ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest) = 0;
|
||||
|
||||
// requests information about a clan officer list
|
||||
// when complete, data is returned in ClanOfficerListResponse_t call result
|
||||
// this makes available the calls below
|
||||
// you can only ask about clans that a user is a member of
|
||||
// note that this won't download avatars automatically; if you get an officer,
|
||||
// and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar
|
||||
//virtual SteamAPICall_t RequestClanOfficerList(CSteamID steamIDClan) = 0;
|
||||
|
||||
|
||||
// returns the steamID of the clan owner
|
||||
//virtual CSteamID GetClanOwner(CSteamID steamIDClan) = 0;
|
||||
// returns the number of officers in a clan (including the owner)
|
||||
//virtual int GetClanOfficerCount(CSteamID steamIDClan) = 0;
|
||||
// returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount)
|
||||
//virtual CSteamID GetClanOfficerByIndex(CSteamID steamIDClan, int iOfficer) = 0;
|
||||
|
||||
|
||||
return SteamFriends()->GetFriendSteamLevel(id);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups)
|
||||
{
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
int numClans = SteamFriends()->GetClanCount();
|
||||
|
||||
for (int i = 0; i < numClans; i++)
|
||||
{
|
||||
CSteamID SteamGroupID = SteamFriends()->GetClanByIndex(i);
|
||||
|
||||
if(!SteamGroupID.IsValid())
|
||||
continue;
|
||||
|
||||
FBPSteamGroupInfo GroupInfo;
|
||||
|
||||
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(SteamGroupID));
|
||||
GroupInfo.GroupID.SetUniqueNetId(ValueID);
|
||||
SteamFriends()->GetClanActivityCounts(SteamGroupID, &GroupInfo.numOnline, &GroupInfo.numInGame, &GroupInfo.numChatting);
|
||||
GroupInfo.GroupName = FString(UTF8_TO_TCHAR(SteamFriends()->GetClanName(SteamGroupID)));
|
||||
GroupInfo.GroupTag = FString(UTF8_TO_TCHAR(SteamFriends()->GetClanTag(SteamGroupID)));
|
||||
|
||||
SteamGroups.Add(GroupInfo);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result/*, FString & GameName*/, int32 & AppID)
|
||||
{
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamFriendGamePlayed Had a bad UniqueNetId!"));
|
||||
Result = EBlueprintResultSwitch::OnFailure;
|
||||
return;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
|
||||
FriendGameInfo_t GameInfo;
|
||||
bool bIsInGame = SteamFriends()->GetFriendGamePlayed(id, &GameInfo);
|
||||
|
||||
if (bIsInGame && GameInfo.m_gameID.IsValid())
|
||||
{
|
||||
AppID = GameInfo.m_gameID.AppID();
|
||||
|
||||
// Forgot this test and left it in, it is incorrect, you would need restricted access
|
||||
// And it would only find games in the local library anyway
|
||||
/*char NameBuffer[512];
|
||||
int Len = SteamAppList()->GetAppName(GameInfo.m_gameID.AppID(), NameBuffer, 512);
|
||||
|
||||
if (Len != -1) // Invalid
|
||||
{
|
||||
GameName = FString(UTF8_TO_TCHAR(NameBuffer));
|
||||
}*/
|
||||
|
||||
Result = EBlueprintResultSwitch::OnSuccess;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
Result = EBlueprintResultSwitch::OnFailure;
|
||||
}
|
||||
|
||||
int32 UAdvancedSteamFriendsLibrary::GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId)
|
||||
{
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
|
||||
return SteamFriends()->GetFriendSteamLevel(id);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
FString UAdvancedSteamFriendsLibrary::GetSteamPersonaName(const FBPUniqueNetId UniqueNetId)
|
||||
{
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamPersonaName Had a bad UniqueNetId!"));
|
||||
return FString(TEXT(""));
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
const char* PersonaName = SteamFriends()->GetFriendPersonaName(id);
|
||||
return FString(UTF8_TO_TCHAR(PersonaName));
|
||||
}
|
||||
#endif
|
||||
|
||||
return FString(TEXT(""));
|
||||
}
|
||||
|
||||
FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FString SteamID64)
|
||||
{
|
||||
FBPUniqueNetId netId;
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!(SteamID64.Len() > 0))
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("CreateSteamIDFromString Had a bad UniqueNetId!"));
|
||||
return netId;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
// Already does the conversion
|
||||
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(SteamID64));
|
||||
//FCString::Atoi64(*SteamID64));
|
||||
|
||||
netId.SetUniqueNetId(ValueID);
|
||||
return netId;
|
||||
}
|
||||
#endif
|
||||
|
||||
return netId;
|
||||
}
|
||||
|
||||
FBPUniqueNetId UAdvancedSteamFriendsLibrary::GetLocalSteamIDFromSteam()
|
||||
{
|
||||
FBPUniqueNetId netId;
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
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)
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("RequestSteamFriendInfo Had a bad UniqueNetId!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
|
||||
return !SteamFriends()->RequestUserInformation(id, bRequireNameOnly);
|
||||
}
|
||||
#endif
|
||||
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("RequestSteamFriendInfo Couldn't init steamAPI!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType)
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Had a bad UniqueNetId!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
if (DialogType == ESteamUserOverlayType::invitetolobby)
|
||||
{
|
||||
SteamFriends()->ActivateGameOverlayInviteDialog(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
FString DialogName = EnumToString("ESteamUserOverlayType", (uint8)DialogType);
|
||||
SteamFriends()->ActivateGameOverlayToUser(TCHAR_TO_ANSI(*DialogName), id);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Couldn't init steamAPI!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UAdvancedSteamFriendsLibrary::IsOverlayEnabled()
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
return SteamUtils()->IsOverlayEnabled();
|
||||
}
|
||||
#endif
|
||||
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Couldn't init steamAPI!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamFriendAvatar Had a bad UniqueNetId!"));
|
||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32 Width = 0;
|
||||
uint32 Height = 0;
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
//Getting the PictureID from the SteamAPI and getting the Size with the ID
|
||||
//virtual bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) = 0;
|
||||
|
||||
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
int Picture = 0;
|
||||
|
||||
switch(AvatarSize)
|
||||
{
|
||||
case SteamAvatarSize::SteamAvatar_Small: Picture = SteamFriends()->GetSmallFriendAvatar(id); break;
|
||||
case SteamAvatarSize::SteamAvatar_Medium: Picture = SteamFriends()->GetMediumFriendAvatar(id); break;
|
||||
case SteamAvatarSize::SteamAvatar_Large: Picture = SteamFriends()->GetLargeFriendAvatar(id); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (Picture == -1)
|
||||
{
|
||||
Result = EBlueprintAsyncResultSwitch::AsyncLoading;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SteamUtils()->GetImageSize(Picture, &Width, &Height);
|
||||
|
||||
// STOLEN FROM ANSWERHUB :p, then fixed because answerhub wasn't releasing the memory O.o
|
||||
// Also fixed image pixel format and switched to a memcpy instead of manual iteration.
|
||||
// At some point I should probably reply to that answerhub post with these fixes to prevent people killing their games.....
|
||||
|
||||
if (Width > 0 && Height > 0)
|
||||
{
|
||||
//Creating the buffer "oAvatarRGBA" and then filling it with the RGBA Stream from the Steam Avatar
|
||||
uint8 *oAvatarRGBA = new uint8[Width * Height * 4];
|
||||
|
||||
|
||||
//Filling the buffer with the RGBA Stream from the Steam Avatar and creating a UTextur2D to parse the RGBA Steam in
|
||||
SteamUtils()->GetImageRGBA(Picture, (uint8*)oAvatarRGBA, 4 * Height * Width * sizeof(char));
|
||||
|
||||
|
||||
// Removed as I changed the image bit code to be RGB, I think the original author was unaware that there were different pixel formats
|
||||
/*
|
||||
//Swap R and B channels because for some reason the games whack
|
||||
for (uint32 i = 0; i < (Width * Height * 4); i += 4)
|
||||
{
|
||||
uint8 Temp = oAvatarRGBA[i + 0];
|
||||
oAvatarRGBA[i + 0] = oAvatarRGBA[i + 2];
|
||||
oAvatarRGBA[i + 2] = Temp;
|
||||
}*/
|
||||
|
||||
UTexture2D* Avatar = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8);
|
||||
// Switched to a Memcpy instead of byte by byte transer
|
||||
|
||||
if (FTexturePlatformData* PlatformData = Avatar->GetPlatformData())
|
||||
{
|
||||
uint8* MipData = (uint8*)PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
|
||||
FMemory::Memcpy(MipData, (void*)oAvatarRGBA, Height * Width * 4);
|
||||
PlatformData->Mips[0].BulkData.Unlock();
|
||||
|
||||
//Setting some Parameters for the Texture and finally returning it
|
||||
PlatformData->SetNumSlices(1);
|
||||
Avatar->NeverStream = true;
|
||||
//Avatar->CompressionSettings = TC_EditorIcon;
|
||||
}
|
||||
|
||||
// Free RGBA buffer regardless of whether it was used or not
|
||||
delete[] oAvatarRGBA;
|
||||
|
||||
Avatar->UpdateResource();
|
||||
|
||||
Result = EBlueprintAsyncResultSwitch::OnSuccess;
|
||||
return Avatar;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("Bad Height / Width with steam avatar!"));
|
||||
}
|
||||
|
||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("STEAM Couldn't be verified as initialized"));
|
||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool UAdvancedSteamFriendsLibrary::InitTextFiltering()
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
return SteamUtils()->InitFilterText();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UAdvancedSteamFriendsLibrary::FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText)
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint32 BufferLen = TextToFilter.Len() + 10; // Docs say 1 byte excess min, going with 10
|
||||
char* OutText = new char[BufferLen];
|
||||
|
||||
uint64 id = 0;
|
||||
|
||||
if (TextSourceID.IsValid())
|
||||
{
|
||||
id = *((uint64*)TextSourceID.UniqueNetId->GetBytes());
|
||||
}
|
||||
|
||||
int FilterCount = SteamUtils()->FilterText((ETextFilteringContext)Context, id, TCHAR_TO_ANSI(*TextToFilter), OutText, BufferLen);
|
||||
|
||||
if (FilterCount > 0)
|
||||
{
|
||||
FilteredText = FString(UTF8_TO_TCHAR(OutText));
|
||||
delete[] OutText;
|
||||
return true;
|
||||
}
|
||||
|
||||
delete[] OutText;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
FilteredText = TextToFilter;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UAdvancedSteamFriendsLibrary::IsSteamInBigPictureMode()
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
return SteamUtils()->IsSteamInBigPictureMode();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
//#include "StandAlonePrivatePCH.h"
|
||||
#include "AdvancedSteamSessions.h"
|
||||
|
||||
void AdvancedSteamSessions::StartupModule()
|
||||
{
|
||||
}
|
||||
|
||||
void AdvancedSteamSessions::ShutdownModule()
|
||||
{
|
||||
}
|
||||
|
||||
IMPLEMENT_MODULE(AdvancedSteamSessions, AdvancedSteamSessions)
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
#include "AdvancedSteamWorkshopLibrary.h"
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
//General Log
|
||||
DEFINE_LOG_CATEGORY(AdvancedSteamWorkshopLog);
|
||||
|
||||
|
||||
void UAdvancedSteamWorkshopLibrary::GetNumSubscribedWorkshopItems(int32 & NumberOfItems)
|
||||
{
|
||||
NumberOfItems = 0;
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
NumberOfItems = SteamUGC()->GetNumSubscribedItems();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetNumSubscribedWorkshopItemCount : SteamAPI is not Inited!"));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetNumSubscribedWorkshopItemCount : Called on an incompatible platform"));
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
TArray<FBPSteamWorkshopID> UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopItems(int32 & NumberOfItems)
|
||||
{
|
||||
TArray<FBPSteamWorkshopID> outArray;
|
||||
NumberOfItems = 0;
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint32 NumItems = SteamUGC()->GetNumSubscribedItems();
|
||||
|
||||
if (NumItems == 0)
|
||||
return outArray;
|
||||
|
||||
// Not using the actual variable above in case someone somehow goes past int32 limits
|
||||
// Don't want to go negative on the iteration.
|
||||
NumberOfItems = NumItems;
|
||||
|
||||
PublishedFileId_t *fileIds = new PublishedFileId_t[NumItems];
|
||||
|
||||
uint32 subItems = SteamUGC()->GetSubscribedItems(fileIds, NumItems);
|
||||
|
||||
for (uint32 i = 0; i < subItems; ++i)
|
||||
{
|
||||
outArray.Add(FBPSteamWorkshopID(fileIds[i]));
|
||||
}
|
||||
|
||||
delete[] fileIds;
|
||||
|
||||
return outArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetSubscribedWorkshopItemCount : SteamAPI is not Inited!"));
|
||||
return outArray;
|
||||
}
|
||||
#else
|
||||
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetSubscribedWorkshopItemCount : Called on an incompatible platform"));
|
||||
return outArray;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "SteamRequestGroupOfficersCallbackProxy.h"
|
||||
#include "Online/CoreOnline.h"
|
||||
#include "AdvancedSteamFriendsLibrary.h"
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
#include "steam/isteamfriends.h"
|
||||
#endif
|
||||
//#include "OnlineSubsystemSteamTypes.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// UEndSessionCallbackProxy
|
||||
|
||||
USteamRequestGroupOfficersCallbackProxy::USteamRequestGroupOfficersCallbackProxy(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
}
|
||||
|
||||
USteamRequestGroupOfficersCallbackProxy::~USteamRequestGroupOfficersCallbackProxy()
|
||||
{
|
||||
}
|
||||
|
||||
USteamRequestGroupOfficersCallbackProxy* USteamRequestGroupOfficersCallbackProxy::GetSteamGroupOfficerList(UObject* WorldContextObject, FBPUniqueNetId GroupUniqueNetID)
|
||||
{
|
||||
USteamRequestGroupOfficersCallbackProxy* Proxy = NewObject<USteamRequestGroupOfficersCallbackProxy>();
|
||||
|
||||
Proxy->GroupUniqueID = GroupUniqueNetID;
|
||||
return Proxy;
|
||||
}
|
||||
|
||||
void USteamRequestGroupOfficersCallbackProxy::Activate()
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
|
||||
SteamAPICall_t hSteamAPICall = SteamFriends()->RequestClanOfficerList(id);
|
||||
|
||||
m_callResultGroupOfficerRequestDetails.Set(hSteamAPICall, this, &USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
TArray<FBPSteamGroupOfficer> EmptyArray;
|
||||
OnFailure.Broadcast(EmptyArray);
|
||||
}
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure)
|
||||
{
|
||||
TArray<FBPSteamGroupOfficer> OfficerArray;
|
||||
|
||||
//FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
|
||||
|
||||
if (bIOFailure || !pResult || !pResult->m_bSuccess)
|
||||
{
|
||||
//if (SteamSubsystem != nullptr)
|
||||
{
|
||||
// SteamSubsystem->ExecuteNextTick([this]()
|
||||
//{
|
||||
TArray<FBPSteamGroupOfficer> FailureArray;
|
||||
OnFailure.Broadcast(FailureArray);
|
||||
//});
|
||||
}
|
||||
//OnFailure.Broadcast(OfficerArray);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
|
||||
|
||||
FBPSteamGroupOfficer Officer;
|
||||
CSteamID ClanOwner = SteamFriends()->GetClanOwner(id);
|
||||
|
||||
Officer.bIsOwner = true;
|
||||
|
||||
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(ClanOwner));
|
||||
Officer.OfficerUniqueNetID.SetUniqueNetId(ValueID);
|
||||
OfficerArray.Add(Officer);
|
||||
|
||||
for (int i = 0; i < pResult->m_cOfficers; i++)
|
||||
{
|
||||
CSteamID OfficerSteamID = SteamFriends()->GetClanOfficerByIndex(id, i);
|
||||
|
||||
Officer.bIsOwner = false;
|
||||
|
||||
TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam2(OfficerSteamID));
|
||||
Officer.OfficerUniqueNetID.SetUniqueNetId(newValueID);
|
||||
|
||||
OfficerArray.Add(Officer);
|
||||
}
|
||||
|
||||
//if (SteamSubsystem != nullptr)
|
||||
//{
|
||||
//SteamSubsystem->ExecuteNextTick([OfficerArray, this]()
|
||||
//{
|
||||
OnSuccess.Broadcast(OfficerArray);
|
||||
//});
|
||||
//}
|
||||
|
||||
//OnSuccess.Broadcast(OfficerArray);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (SteamSubsystem != nullptr)
|
||||
{
|
||||
//SteamSubsystem->ExecuteNextTick([this]()
|
||||
//{
|
||||
TArray<FBPSteamGroupOfficer> FailureArray;
|
||||
OnFailure.Broadcast(FailureArray);
|
||||
//});
|
||||
}
|
||||
}
|
||||
|
||||
// Should never hit this anyway
|
||||
//OnFailure.Broadcast(OfficerArray);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "SteamWSRequestUGCDetailsCallbackProxy.h"
|
||||
#include "OnlineSubSystemHeader.h"
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
#include "steam/isteamugc.h"
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// UEndSessionCallbackProxy
|
||||
|
||||
USteamWSRequestUGCDetailsCallbackProxy::USteamWSRequestUGCDetailsCallbackProxy(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
USteamWSRequestUGCDetailsCallbackProxy* USteamWSRequestUGCDetailsCallbackProxy::GetWorkshopItemDetails(UObject* WorldContextObject, FBPSteamWorkshopID WorkShopID/*, int32 NumSecondsBeforeTimeout*/)
|
||||
{
|
||||
USteamWSRequestUGCDetailsCallbackProxy* Proxy = NewObject<USteamWSRequestUGCDetailsCallbackProxy>();
|
||||
|
||||
Proxy->WorkShopID = WorkShopID;
|
||||
return Proxy;
|
||||
}
|
||||
|
||||
void USteamWSRequestUGCDetailsCallbackProxy::Activate()
|
||||
{
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
// #TODO: Support arrays instead in the future?
|
||||
UGCQueryHandle_t hQueryHandle = SteamUGC()->CreateQueryUGCDetailsRequest((PublishedFileId_t *)&WorkShopID.SteamWorkshopID, 1);
|
||||
// #TODO: add search settings here by calling into the handle?
|
||||
SteamAPICall_t hSteamAPICall = SteamUGC()->SendQueryUGCRequest(hQueryHandle);
|
||||
|
||||
// Need to release the query
|
||||
SteamUGC()->ReleaseQueryUGCRequest(hQueryHandle);
|
||||
|
||||
if (hSteamAPICall == k_uAPICallInvalid)
|
||||
{
|
||||
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||
return;
|
||||
}
|
||||
|
||||
m_callResultUGCRequestDetails.Set(hSteamAPICall, this, &USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||
}
|
||||
|
||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||
void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure)
|
||||
{
|
||||
//FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
|
||||
|
||||
if (bIOFailure || !pResult || pResult->m_unNumResultsReturned <= 0)
|
||||
{
|
||||
//if (SteamSubsystem != nullptr)
|
||||
{
|
||||
// SteamSubsystem->ExecuteNextTick([this]()
|
||||
//{
|
||||
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||
//});
|
||||
}
|
||||
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||
return;
|
||||
}
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
SteamUGCDetails_t Details;
|
||||
if (SteamUGC()->GetQueryUGCResult(pResult->m_handle, 0, &Details))
|
||||
{
|
||||
//if (SteamSubsystem != nullptr)
|
||||
{
|
||||
//SteamSubsystem->ExecuteNextTick([Details, this]()
|
||||
//{
|
||||
OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
|
||||
//});
|
||||
}
|
||||
|
||||
//OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (SteamSubsystem != nullptr)
|
||||
{
|
||||
//SteamSubsystem->ExecuteNextTick([this]()
|
||||
//{
|
||||
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||
//});
|
||||
}
|
||||
}
|
||||
|
||||
// Not needed, should never hit here
|
||||
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
Copyright Joshua Statzer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
### How do I use it? ###
|
||||
|
||||
**KantanDocGen Automatic Documentation ([KantanDocGen](http://kantandev.com/free/kantan-doc-gen))**
|
||||
|
||||
**[AdvancedSessions](https://vreue4.com/generated-node-documentation?section=advanced-sessions-plugin)**
|
||||
|
||||
**[AdvancedSteamSessions](https://vreue4.com/generated-node-documentation?section=advanced-steam-sessions-plugin)**
|
||||
|
|
@ -5,6 +5,9 @@ public class AdvancedSessions : ModuleRules
|
|||
{
|
||||
public AdvancedSessions(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
DefaultBuildSettings = BuildSettingsVersion.Latest;
|
||||
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
|
||||
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
//bEnforceIWYU = true;
|
||||
|
||||
|
|
@ -44,6 +44,16 @@ public:
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedVoiceInterface)
|
||||
bool bEnableTalkingStatusDelegate;
|
||||
|
||||
// If true we will auto join a session we have accepted in the overlay.
|
||||
// This can get in the way of Beacon Sessions, you may want to disable it.
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedFriendsInterface)
|
||||
bool bAutoJoinSessionOnAcceptedUserInviteReceived = false;
|
||||
|
||||
// If true we will auto travel to a game session when an invite is received.
|
||||
// This can get in the way of Beacon Sessions, you may want to disable it.
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedFriendsInterface)
|
||||
bool bAutoTravelOnAcceptedUserInviteReceived = false;
|
||||
|
||||
//virtual void PostLoad() override;
|
||||
virtual void Shutdown() override;
|
||||
virtual void Init() override;
|
||||
|
|
@ -52,6 +62,13 @@ public:
|
|||
FOnSessionInviteReceivedDelegate SessionInviteReceivedDelegate;
|
||||
FDelegateHandle SessionInviteReceivedDelegateHandle;
|
||||
|
||||
// custom handle to join directly from steam ui "Join Game"
|
||||
FDelegateHandle OnJoinSessionCompleteDelegateHandle;
|
||||
// custom Steam UI Join User function #Self invite#
|
||||
void OnSessionUserInviteAccepted(const bool bWasSuccessful, const int32 ControllerId, FUniqueNetIdPtr UserId, const FOnlineSessionSearchResult& InviteResult);
|
||||
// custom Steam UI function to client travel #Self invite#
|
||||
void OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result);
|
||||
|
||||
//const FUniqueNetId& /*UserId*/, const FUniqueNetId& /*FromId*/, const FString& /*AppId*/, const FOnlineSessionSearchResult& /*InviteResult*/
|
||||
void OnSessionInviteReceivedMaster(const FUniqueNetId & PersonInvited, const FUniqueNetId & PersonInviting, const FString & AppId, const FOnlineSessionSearchResult& SessionToJoin);
|
||||
|
||||
|
|
@ -160,6 +160,10 @@ public:
|
|||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||
static void GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId);
|
||||
|
||||
// Get the unique net id of a network player attached to the given controller
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||
static void GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId);
|
||||
|
||||
// Get the unique net id of a network player who is assigned the the given player state
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||
static void GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId);
|
||||
|
|
@ -23,14 +23,14 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
|||
* Creates a session with the default online subsystem with advanced optional inputs, for dedicated servers leave UsePresence as false and set IsDedicatedServer to true. Dedicated servers don't use presence.
|
||||
* @param PublicConnections When doing a 'listen' server, this must be >=2 (ListenServer itself counts as a connection)
|
||||
* @param bUseLAN When you want to play LAN, the level to play on must be loaded with option 'bIsLanMatch'
|
||||
* @param bUsePresence Must be true for a 'listen' server (Map must be loaded with option 'listen'), false for a 'dedicated' server.
|
||||
* @param bUseLobbiesIfAvailable Used to flag the subsystem to use a lobby api instead of general hosting if the API supports it, generally true on steam for listen servers and false for dedicated
|
||||
* Must be true for a 'listen' server (Map must be loaded with option 'listen'), false for a 'dedicated' server.
|
||||
* @param bShouldAdvertise Set to true when the OnlineSubsystem should list your server when someone is searching for servers. Otherwise the server is hidden and only join via invite is possible.
|
||||
* @param bUseLobbiesVoiceChatIfAvailable Set to true to setup voice chat lobbies if the API supports it
|
||||
* @param bStartAfterCreate Set to true to start the session after it's created. If false you need to manually call StartSession when ready.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
|
||||
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, bool bUsePresence = true, bool bUseLobbiesIfAvailable = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true, bool bUseLobbiesVoiceChatIfAvailable = false, bool bStartAfterCreate = true);
|
||||
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, /*bool bUsePresence = true,*/ bool bUseLobbiesIfAvailable = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true, bool bUseLobbiesVoiceChatIfAvailable = false, bool bStartAfterCreate = true);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
|
|
@ -28,7 +28,7 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
|||
|
||||
// Searches for advertised sessions with the default online subsystem and includes an array of filters
|
||||
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AutoCreateRefTerm="Filters"), Category = "Online|AdvancedSessions")
|
||||
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, bool bSearchLobbies = true, int MinSlotsAvailable = 0);
|
||||
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, /*bool bSearchLobbies = true,*/ int MinSlotsAvailable = 0);
|
||||
|
||||
static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux Comparator);
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ private:
|
|||
bool bSecureServersOnly;
|
||||
|
||||
// Search through lobbies
|
||||
bool bSearchLobbies;
|
||||
//bool bSearchLobbies;
|
||||
|
||||
// Min slots requires to search
|
||||
int MinSlotsAvailable;
|
||||
|
|
@ -21,7 +21,7 @@ class UUpdateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
|||
|
||||
// Creates a session with the default online subsystem with advanced optional inputs, you MUST fill in all categories or it will pass in values that you didn't want as default values
|
||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
|
||||
static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = false, bool bAllowJoinInProgress = false, bool bRefreshOnlineData = true, bool bIsDedicatedServer = false, bool bShouldAdvertise = true);
|
||||
static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = false, bool bAllowJoinInProgress = false, bool bRefreshOnlineData = true, bool bIsDedicatedServer = false, bool bShouldAdvertise = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false);
|
||||
|
||||
// UOnlineBlueprintCallProxyBase interface
|
||||
virtual void Activate() override;
|
||||
|
|
@ -58,6 +58,12 @@ private:
|
|||
// Allow joining in progress
|
||||
bool bAllowJoinInProgress = true;
|
||||
|
||||
// Allow joining in progress
|
||||
bool bAllowJoinViaPresence = true;
|
||||
|
||||
// Allow joining in progress
|
||||
bool bAllowJoinViaPresenceFriendsOnly = false;
|
||||
|
||||
// Update whether this is a dedicated server or not
|
||||
bool bDedicatedServer = false;
|
||||
|
||||
|
|
@ -20,6 +20,61 @@ UAdvancedFriendsGameInstance::UAdvancedFriendsGameInstance(const FObjectInitiali
|
|||
{
|
||||
}
|
||||
|
||||
void UAdvancedFriendsGameInstance::OnSessionUserInviteAccepted(const bool bWasSuccessful, const int32 ControllerId, FUniqueNetIdPtr UserId, const FOnlineSessionSearchResult& InviteResult)
|
||||
{
|
||||
if (!bAutoJoinSessionOnAcceptedUserInviteReceived)
|
||||
return;
|
||||
|
||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
|
||||
if (SessionInterface.IsValid())
|
||||
{
|
||||
// Eventually call this?, would need another call back to run through
|
||||
//SessionInterface->DestroySession(NAME_GameSession);
|
||||
|
||||
SessionInterface->ClearOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegateHandle);
|
||||
OnJoinSessionCompleteDelegateHandle = SessionInterface->AddOnJoinSessionCompleteDelegate_Handle(
|
||||
FOnJoinSessionCompleteDelegate::CreateUObject(this, &UAdvancedFriendsGameInstance::OnJoinSessionComplete));
|
||||
|
||||
// Temp for 5.5, they aren't filling in the struct correctly
|
||||
if (!InviteResult.Session.SessionSettings.bIsDedicated)
|
||||
{
|
||||
FOnlineSessionSearchResult ModResult = InviteResult;
|
||||
ModResult.Session.SessionSettings.bUsesPresence = true;
|
||||
ModResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||
SessionInterface->JoinSession(0, NAME_GameSession, ModResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
SessionInterface->JoinSession(0, NAME_GameSession, InviteResult);
|
||||
}
|
||||
}
|
||||
UE_LOG(AdvancedFriendsInterfaceLog, Log, TEXT("Called Join Session for Steam Friends List UI InviteResults: %s, UserId: %s"), *InviteResult.GetSessionIdStr(), *UserId->ToString());
|
||||
}
|
||||
|
||||
void UAdvancedFriendsGameInstance::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
|
||||
{
|
||||
|
||||
// If we don't want to auto travel to the session instance then exit out
|
||||
if (!bAutoTravelOnAcceptedUserInviteReceived)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
|
||||
if (SessionInterface.IsValid())
|
||||
{
|
||||
FString ConnectInfo;
|
||||
if (SessionInterface->GetResolvedConnectString(NAME_GameSession, ConnectInfo))
|
||||
{
|
||||
APlayerController* PlayerController = GetFirstLocalPlayerController();
|
||||
if (PlayerController)
|
||||
{
|
||||
PlayerController->ClientTravel(ConnectInfo, ETravelType::TRAVEL_Absolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UAdvancedFriendsGameInstance::Shutdown()
|
||||
{
|
||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
|
||||
|
|
@ -34,6 +89,7 @@ void UAdvancedFriendsGameInstance::Shutdown()
|
|||
// Clear all of the delegate handles here
|
||||
SessionInterface->ClearOnSessionUserInviteAcceptedDelegate_Handle(SessionInviteAcceptedDelegateHandle);
|
||||
SessionInterface->ClearOnSessionInviteReceivedDelegate_Handle(SessionInviteReceivedDelegateHandle);
|
||||
SessionInterface->ClearOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegateHandle);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -80,6 +136,9 @@ void UAdvancedFriendsGameInstance::Init()
|
|||
SessionInviteAcceptedDelegateHandle = SessionInterface->AddOnSessionUserInviteAcceptedDelegate_Handle(SessionInviteAcceptedDelegate);
|
||||
|
||||
SessionInviteReceivedDelegateHandle = SessionInterface->AddOnSessionInviteReceivedDelegate_Handle(SessionInviteReceivedDelegate);
|
||||
|
||||
// Custom steam join game delegate
|
||||
SessionInterface->OnSessionUserInviteAcceptedDelegates.AddUObject(this, &UAdvancedFriendsGameInstance::OnSessionUserInviteAccepted);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -271,6 +330,13 @@ void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNe
|
|||
}
|
||||
}
|
||||
|
||||
// Temp for 5.5, they aren't filling in the struct correctly
|
||||
if (!BluePrintResult.OnlineResult.Session.SessionSettings.bIsDedicated)
|
||||
{
|
||||
BluePrintResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
|
||||
BluePrintResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||
}
|
||||
|
||||
OnSessionInviteReceived(LocalPlayer, PInviting, AppId, BluePrintResult);
|
||||
|
||||
//IAdvancedFriendsInterface* TheInterface = NULL;
|
||||
|
|
@ -307,6 +373,13 @@ void UAdvancedFriendsGameInstance::OnSessionInviteAcceptedMaster(const bool bWas
|
|||
FBPUniqueNetId PInvited;
|
||||
PInvited.SetUniqueNetId(PersonInvited);
|
||||
|
||||
// Temp for 5.5, they aren't filling in the struct correctly
|
||||
if (!BluePrintResult.OnlineResult.Session.SessionSettings.bIsDedicated)
|
||||
{
|
||||
BluePrintResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
|
||||
BluePrintResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||
}
|
||||
|
||||
OnSessionInviteAccepted(LocalPlayer,PInvited, BluePrintResult);
|
||||
|
||||
APlayerController* Player = UGameplayStatics::GetPlayerController(GetWorld(), LocalPlayer);
|
||||
|
|
@ -151,7 +151,9 @@ void UAdvancedFriendsLibrary::GetFriend(APlayerController *PlayerController, con
|
|||
Friend.PresenceInfo.bIsPlaying = pres.bIsPlaying;
|
||||
Friend.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;
|
||||
Friend.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
|
||||
|
||||
// #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
|
||||
// OnlineFriendPresenceInterfaceSteam has the issue
|
||||
//Friend.PresenceInfo.StatusString = pres.Status.StatusStr;
|
||||
}
|
||||
}
|
||||
|
|
@ -266,6 +268,7 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont
|
|||
BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying;
|
||||
BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
|
||||
// #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
|
||||
// OnlineFriendPresenceInterfaceSteam has the issue
|
||||
//BPF.PresenceInfo.StatusString = pres.Status.StatusStr;
|
||||
BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable;
|
||||
BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;
|
||||
|
|
@ -451,6 +451,17 @@ void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerControlle
|
|||
}
|
||||
}
|
||||
|
||||
void UAdvancedSessionsLibrary::GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId)
|
||||
{
|
||||
FBPUniqueNetId ReturnID;
|
||||
if (SessionResult.OnlineResult.IsValid())
|
||||
{
|
||||
ReturnID.SetUniqueNetId(SessionResult.OnlineResult.Session.OwningUserId);
|
||||
}
|
||||
|
||||
UniqueNetId = ReturnID;
|
||||
}
|
||||
|
||||
void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId)
|
||||
{
|
||||
if (!PlayerState)
|
||||
|
|
@ -83,6 +83,8 @@ void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSucce
|
|||
{
|
||||
OnFailure.Broadcast();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OnFailure.Broadcast();
|
||||
|
|
@ -13,7 +13,7 @@ UCreateSessionCallbackProxyAdvanced::UCreateSessionCallbackProxyAdvanced(const F
|
|||
{
|
||||
}
|
||||
|
||||
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, bool bUsePresence, bool bUseLobbiesIfAvailable, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise, bool bUseLobbiesVoiceChatIfAvailable, bool bStartAfterCreate)
|
||||
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, /*bool bUsePresence,*/ bool bUseLobbiesIfAvailable, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise, bool bUseLobbiesVoiceChatIfAvailable, bool bStartAfterCreate)
|
||||
{
|
||||
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
|
||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||
|
|
@ -24,7 +24,7 @@ UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::Create
|
|||
Proxy->bAllowInvites = bAllowInvites;
|
||||
Proxy->ExtraSettings = ExtraSettings;
|
||||
Proxy->bDedicatedServer = bIsDedicatedServer;
|
||||
Proxy->bUsePresence = bUsePresence;
|
||||
/*Proxy->bUsePresence = bUsePresence;*/
|
||||
Proxy->bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||
|
|
@ -61,13 +61,13 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||
|
||||
if (bDedicatedServer)
|
||||
{
|
||||
Settings.bUsesPresence = false;
|
||||
Settings.bUseLobbiesIfAvailable = false;
|
||||
Settings.bUsesPresence = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.bUsesPresence = bUsePresence;
|
||||
Settings.bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||
Settings.bUsesPresence = bUseLobbiesIfAvailable;
|
||||
}
|
||||
|
||||
Settings.bUseLobbiesVoiceChatIfAvailable = bUseLobbiesIfAvailable ? bUseLobbiesVoiceChatIfAvailable : false;
|
||||
|
|
@ -102,6 +102,14 @@ void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPl
|
|||
{
|
||||
FBlueprintSessionResult BSesh;
|
||||
BSesh.OnlineResult = Sesh;
|
||||
|
||||
// Temp for 5.5, force the values if epic isn't setting them, lobbies should always have these true
|
||||
if (!BSesh.OnlineResult.Session.SessionSettings.bIsDedicated)
|
||||
{
|
||||
BSesh.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||
BSesh.OnlineResult.Session.SessionSettings.bUsesPresence = true;
|
||||
}
|
||||
|
||||
Result.Add(BSesh);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ UFindSessionsCallbackProxyAdvanced::UFindSessionsCallbackProxyAdvanced(const FOb
|
|||
bIsOnSecondSearch = false;
|
||||
}
|
||||
|
||||
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, bool bSearchLobbies, int MinSlotsAvailable)
|
||||
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, /*bool bSearchLobbies,*/ int MinSlotsAvailable)
|
||||
{
|
||||
UFindSessionsCallbackProxyAdvanced* Proxy = NewObject<UFindSessionsCallbackProxyAdvanced>();
|
||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||
|
|
@ -28,7 +28,7 @@ UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSess
|
|||
Proxy->bEmptyServersOnly = bEmptyServersOnly,
|
||||
Proxy->bNonEmptyServersOnly = bNonEmptyServersOnly;
|
||||
Proxy->bSecureServersOnly = bSecureServersOnly;
|
||||
Proxy->bSearchLobbies = bSearchLobbies;
|
||||
//Proxy->bSearchLobbies = bSearchLobbies;
|
||||
Proxy->MinSlotsAvailable = MinSlotsAvailable;
|
||||
return Proxy;
|
||||
}
|
||||
|
|
@ -86,7 +86,6 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||
/** #define SEARCH_SWITCH_SELECTION_METHOD FName(TEXT("SWITCHSELECTIONMETHOD"))*/
|
||||
/** Whether to use lobbies vs sessions */
|
||||
/** #define SEARCH_LOBBIES FName(TEXT("LOBBYSEARCH"))*/
|
||||
|
||||
if (bEmptyServersOnly)
|
||||
tem.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals);
|
||||
|
||||
|
|
@ -114,9 +113,9 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||
|
||||
case EBPServerPresenceSearchType::ClientServersOnly:
|
||||
{
|
||||
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||
//tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||
|
||||
if (bSearchLobbies && !IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
||||
//if (bSearchLobbies)// && !IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
||||
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
|
||||
}
|
||||
break;
|
||||
|
|
@ -140,9 +139,9 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||
|
||||
FOnlineSearchSettingsEx DedicatedOnly = tem;
|
||||
|
||||
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||
//tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||
|
||||
if (bSearchLobbies && !IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
||||
//if (bSearchLobbies)// && !IOnlineSubsystem::DoesInstanceExist("STEAM"))
|
||||
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
|
||||
|
||||
//DedicatedOnly.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);
|
||||
|
|
@ -225,6 +224,14 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess)
|
|||
|
||||
FBlueprintSessionResult BPResult;
|
||||
BPResult.OnlineResult = Result;
|
||||
|
||||
// Temp for 5.5, force the values if epic isn't setting them, lobbies should always have these true
|
||||
if (ServerSearchType != EBPServerPresenceSearchType::DedicatedServersOnly )
|
||||
{
|
||||
BPResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||
BPResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
|
||||
}
|
||||
|
||||
SessionSearchResults.AddUnique(BPResult);
|
||||
}
|
||||
if (!bRunSecondSearch)
|
||||
|
|
@ -12,7 +12,7 @@ UUpdateSessionCallbackProxyAdvanced::UUpdateSessionCallbackProxyAdvanced(const F
|
|||
{
|
||||
}
|
||||
|
||||
UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise)
|
||||
UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly)
|
||||
{
|
||||
UUpdateSessionCallbackProxyAdvanced* Proxy = NewObject<UUpdateSessionCallbackProxyAdvanced>();
|
||||
Proxy->NumPublicConnections = PublicConnections;
|
||||
|
|
@ -25,6 +25,8 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update
|
|||
Proxy->bAllowJoinInProgress = bAllowJoinInProgress;
|
||||
Proxy->bDedicatedServer = bIsDedicatedServer;
|
||||
Proxy->bShouldAdvertise = bShouldAdvertise;
|
||||
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||
return Proxy;
|
||||
}
|
||||
|
||||
|
|
@ -65,11 +67,14 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
|||
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
|
||||
Settings->bIsLANMatch = bUseLAN;
|
||||
//Settings->bUsesPresence = true;
|
||||
//Settings->bAllowJoinViaPresence = true;
|
||||
Settings->bAllowInvites = bAllowInvites;
|
||||
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
|
||||
Settings->bIsDedicated = bDedicatedServer;
|
||||
|
||||
// Added in 5.6
|
||||
Settings->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||
Settings->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||
|
||||
FOnlineSessionSetting * fSetting = NULL;
|
||||
FOnlineSessionSetting ExtraSetting;
|
||||
for (int i = 0; i < ExtraSettings.Num(); i++)
|
||||
Loading…
Add table
Add a link
Reference in a new issue