mirror of
				https://github.com/mordentral/AdvancedSessionsPlugin.git
				synced 2025-10-27 18:34:07 +00:00 
			
		
		
		
	Compare commits
	
		
			25 Commits
		
	
	
		
			4.19_Locke
			...
			4.22_Locke
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 95044826af | ||
|   | b043ad1cf0 | ||
|   | 4c4de8e536 | ||
|   | 60d1d272a5 | ||
|   | c3f889c9c5 | ||
|   | 2e93c6095a | ||
|   | 6007506189 | ||
|   | 0952d9b18a | ||
|   | 438d0a69ba | ||
|   | 85e9b54fab | ||
|   | ba28fccfe0 | ||
|   | d71aaede8d | ||
|   | 38b5c96cbd | ||
|   | ad745512ac | ||
|   | ce7d8b1bf3 | ||
|   | abb9e5687c | ||
|   | 47c6981a2a | ||
|   | 20f99a5e10 | ||
|   | 289fa84dd5 | ||
|   | b8a5e7500b | ||
|   | 4cc84d68c4 | ||
|   | b553a8c3b6 | ||
|   | bc0e8f7d1b | ||
|   | 886b4c2f8a | ||
|   | 47775e70bf | 
| @@ -2,8 +2,8 @@ | ||||
|     "FileVersion" : 3, | ||||
|   | ||||
|     "FriendlyName" : "Advanced Sessions", | ||||
|     "Version" : 4.17, | ||||
|     "VersionName": "4.17", | ||||
|     "Version" : 4.22, | ||||
|     "VersionName": "4.22", | ||||
|     "Description" : "Adds new blueprint functions to handle more advanced session operations.", | ||||
|     "Category" : "Advanced Sessions Plugin", | ||||
|     "CreatedBy" : "Joshua Statzer", | ||||
|   | ||||
| @@ -10,8 +10,8 @@ public class AdvancedSessions : ModuleRules | ||||
|  | ||||
|         PublicDefinitions.Add("WITH_ADVANCED_SESSIONS=1"); | ||||
|  | ||||
|         PrivateIncludePaths.AddRange(new string[] { "AdvancedSessions/Private"/*, "OnlineSubsystemSteam/Private"*/ }); | ||||
|         PublicIncludePaths.AddRange(new string[] { "AdvancedSessions/Public" }); | ||||
|        // PrivateIncludePaths.AddRange(new string[] { "AdvancedSessions/Private"/*, "OnlineSubsystemSteam/Private"*/ }); | ||||
|        // PublicIncludePaths.AddRange(new string[] { "AdvancedSessions/Public" }); | ||||
|         PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OnlineSubsystem", "CoreUObject", "OnlineSubsystemUtils", "Networking", "Sockets"/*"Voice", "OnlineSubsystemSteam"*/ }); | ||||
|         PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "Sockets", "Networking", "OnlineSubsystemUtils" /*"Voice", "Steamworks","OnlineSubsystemSteam"*/}); | ||||
|     } | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
| //#include "OnlineMessageInterface.h" | ||||
| //#include "OnlinePresenceInterface.h" | ||||
| //#include "Engine/GameInstance.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
|  | ||||
| //#include "UObjectIterator.h" | ||||
|  | ||||
|   | ||||
| @@ -6,15 +6,15 @@ | ||||
| #include "Kismet/BlueprintFunctionLibrary.h" | ||||
| #include "Online.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineFriendsInterface.h" | ||||
| #include "OnlineUserInterface.h" | ||||
| #include "OnlineMessageInterface.h" | ||||
| #include "OnlinePresenceInterface.h" | ||||
| #include "Interfaces/OnlineFriendsInterface.h" | ||||
| #include "Interfaces/OnlineUserInterface.h" | ||||
| #include "Interfaces/OnlineMessageInterface.h" | ||||
| #include "Interfaces/OnlinePresenceInterface.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "Engine/LocalPlayer.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
| #include "OnlineSessionSettings.h" | ||||
| #include "UObjectIterator.h" | ||||
| #include "UObject/UObjectIterator.h" | ||||
| #include "AdvancedFriendsInterface.h" | ||||
|  | ||||
| #include "AdvancedFriendsGameInstance.generated.h" | ||||
|   | ||||
| @@ -5,14 +5,14 @@ | ||||
| #include "Kismet/BlueprintFunctionLibrary.h" | ||||
| #include "Online.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineFriendsInterface.h" | ||||
| #include "OnlineUserInterface.h" | ||||
| #include "OnlineMessageInterface.h" | ||||
| #include "OnlinePresenceInterface.h" | ||||
| #include "Interfaces/OnlineFriendsInterface.h" | ||||
| #include "Interfaces/OnlineUserInterface.h" | ||||
| #include "Interfaces/OnlineMessageInterface.h" | ||||
| #include "Interfaces/OnlinePresenceInterface.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
| #include "OnlineSessionSettings.h" | ||||
| #include "UObjectIterator.h" | ||||
| #include "UObject/UObjectIterator.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "AdvancedFriendsInterface.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -7,14 +7,14 @@ | ||||
| #include "Online.h" | ||||
| #include "Engine/LocalPlayer.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineFriendsInterface.h" | ||||
| #include "OnlineUserInterface.h" | ||||
| #include "OnlineMessageInterface.h" | ||||
| #include "OnlinePresenceInterface.h" | ||||
| #include "Interfaces/OnlineFriendsInterface.h" | ||||
| #include "Interfaces/OnlineUserInterface.h" | ||||
| #include "Interfaces/OnlineMessageInterface.h" | ||||
| #include "Interfaces/OnlinePresenceInterface.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
|  | ||||
| #include "UObjectIterator.h" | ||||
| #include "UObject/UObjectIterator.h" | ||||
|  | ||||
| #include "AdvancedFriendsLibrary.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -6,13 +6,13 @@ | ||||
| #include "Kismet/BlueprintFunctionLibrary.h" | ||||
| #include "Online.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineIdentityInterface.h" | ||||
| #include "OnlineUserInterface.h" | ||||
| #include "OnlinePresenceInterface.h" | ||||
| #include "Interfaces/OnlineIdentityInterface.h" | ||||
| #include "Interfaces/OnlineUserInterface.h" | ||||
| #include "Interfaces/OnlinePresenceInterface.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "Engine/LocalPlayer.h" | ||||
|  | ||||
| #include "UObjectIterator.h" | ||||
| #include "UObject/UObjectIterator.h" | ||||
|  | ||||
| #include "AdvancedIdentityLibrary.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| #pragma once | ||||
|   | ||||
| #include "ModuleManager.h" | ||||
| #include "Modules/ModuleManager.h" | ||||
|  | ||||
| class AdvancedSessions : public IModuleInterface | ||||
| { | ||||
|   | ||||
| @@ -6,12 +6,12 @@ | ||||
| #include "Kismet/BlueprintFunctionLibrary.h" | ||||
| #include "Online.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineFriendsInterface.h" | ||||
| #include "OnlineUserInterface.h" | ||||
| #include "OnlineMessageInterface.h" | ||||
| #include "OnlinePresenceInterface.h" | ||||
| #include "Interfaces/OnlineFriendsInterface.h" | ||||
| #include "Interfaces/OnlineUserInterface.h" | ||||
| #include "Interfaces/OnlineMessageInterface.h" | ||||
| #include "Interfaces/OnlinePresenceInterface.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
|  | ||||
| //#include "UObjectIterator.h" | ||||
|  | ||||
| @@ -38,16 +38,16 @@ public: | ||||
| 		static void GetExtraSettings(FBlueprintSessionResult SessionResult, TArray<FSessionPropertyKeyPair> & ExtraSettings); | ||||
|  | ||||
| 		// Get the current session state | ||||
| 		UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") | ||||
| 		static void GetSessionState(EBPOnlineSessionState &SessionState); | ||||
| 		UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject")) | ||||
| 		static void GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState); | ||||
|  | ||||
| 		// Get the current session settings | ||||
| 		UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result")) | ||||
| 		static void GetSessionSettings(int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result); | ||||
| 		UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) | ||||
| 		static void GetSessionSettings(UObject* WorldContextObject, int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result); | ||||
|  | ||||
| 		// Check if someone is in the current session | ||||
| 		UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") | ||||
| 		static void IsPlayerInSession(const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession); | ||||
| 		UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject")) | ||||
| 		static void IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession); | ||||
| 		 | ||||
| 		// Make a literal session search parameter | ||||
| 		UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") | ||||
| @@ -60,6 +60,14 @@ public: | ||||
| 		UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo") | ||||
| 		static bool IsValidSession(const FBlueprintSessionResult & SessionResult); | ||||
|  | ||||
| 		// Get a string copy of a session ID | ||||
| 		UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo") | ||||
| 		static void GetSessionID_AsString(const FBlueprintSessionResult & SessionResult, FString& SessionID); | ||||
|  | ||||
| 		// Get a string copy of the current session ID | ||||
| 		UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject")) | ||||
| 		static void GetCurrentSessionID_AsString(UObject* WorldContextObject, FString& SessionID); | ||||
|  | ||||
| 		// Get the Unique Current Build ID | ||||
| 		UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo") | ||||
| 		static void GetCurrentUniqueBuildID(int32 &UniqueBuildId); | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "Online.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "VoiceInterface.h" | ||||
| #include "Interfaces/VoiceInterface.h" | ||||
| //#include "OnlineFriendsInterface.h" | ||||
| //#include "OnlineUserInterface.h" | ||||
| //#include "OnlineMessageInterface.h" | ||||
| @@ -14,7 +14,7 @@ | ||||
| #include "Engine/GameInstance.h" | ||||
| //#include "OnlineSessionInterface.h" | ||||
|  | ||||
| #include "UObjectIterator.h" | ||||
| #include "UObject/UObjectIterator.h" | ||||
|  | ||||
| #include "AdvancedVoiceLibrary.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -1,17 +1,18 @@ | ||||
| #pragma once | ||||
| #include "CoreMinimal.h" | ||||
| #include "EngineMinimal.h" | ||||
| //#include "EngineMinimal.h" | ||||
| #include "Engine/Engine.h" | ||||
| #include "GameFramework/PlayerState.h" | ||||
| #include "Core.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| //#include "Core.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
| #include "OnlineSessionSettings.h" | ||||
| #include "OnlineDelegateMacros.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineSubsystemImpl.h" | ||||
| #include "OnlineSubsystemUtils.h" | ||||
| #include "OnlineSubsystemUtilsModule.h" | ||||
| #include "ModuleManager.h" | ||||
| #include "GameFramework/PlayerController.h" | ||||
| #include "Modules/ModuleManager.h" | ||||
| #include "OnlineSubsystemUtilsClasses.h" | ||||
| #include "BlueprintDataDefinitions.generated.h"	 | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. | ||||
| #pragma once | ||||
| #include "CoreMinimal.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "CancelFindSessionsCallbackProxy.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -18,7 +18,13 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase | ||||
| 	UPROPERTY(BlueprintAssignable) | ||||
| 	FEmptyOnlineDelegate OnFailure; | ||||
|  | ||||
| 	// 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. | ||||
| 	/** | ||||
| 	 *    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 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. | ||||
| 	 */ | ||||
| 	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 bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true); | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. | ||||
| #pragma once | ||||
| #include "CoreMinimal.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "EndSessionCallbackProxy.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. | ||||
| #pragma once | ||||
| #include "CoreMinimal.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
| #include "FindSessionsCallbackProxy.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "FindSessionsCallbackProxyAdvanced.generated.h" | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "OnlineIdentityInterface.h" | ||||
| #include "Interfaces/OnlineIdentityInterface.h" | ||||
| #include "GetUserPrivilegeCallbackProxy.generated.h" | ||||
|  | ||||
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FBlueprintGetUserPrivilegeDelegate,/* const &FBPUniqueNetId, PlayerID,*/ EBPUserPrivileges, QueriedPrivilege, bool, HadPrivilege); | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "OnlineIdentityInterface.h" | ||||
| #include "Interfaces/OnlineIdentityInterface.h" | ||||
| #include "Engine/LocalPlayer.h" | ||||
| #include "LoginUserCallbackProxy.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "OnlineIdentityInterface.h" | ||||
| #include "Interfaces/OnlineIdentityInterface.h" | ||||
| #include "Engine/LocalPlayer.h" | ||||
| #include "LogoutUserCallbackProxy.generated.h" | ||||
|  | ||||
|   | ||||
| @@ -124,7 +124,7 @@ void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerControlle | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	ExternalUIInterface->ShowInviteUI(Player->GetControllerId(), GameSessionName); | ||||
| 	ExternalUIInterface->ShowInviteUI(Player->GetControllerId(), NAME_GameSession); | ||||
| 	Result = EBlueprintResultSwitch::OnSuccess; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,7 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
| #include "AdvancedFriendsGameInstance.h" | ||||
| #include "Kismet/GameplayStatics.h" | ||||
| #include "GameFramework/PlayerController.h" | ||||
|  | ||||
| //General Log | ||||
| DEFINE_LOG_CATEGORY(AdvancedFriendsInterfaceLog); | ||||
| @@ -20,7 +22,7 @@ UAdvancedFriendsGameInstance::UAdvancedFriendsGameInstance(const FObjectInitiali | ||||
|  | ||||
| void UAdvancedFriendsGameInstance::Shutdown() | ||||
| { | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(); | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld()); | ||||
| 	 | ||||
| 	if (!SessionInterface.IsValid()) | ||||
| 	{ | ||||
| @@ -37,7 +39,7 @@ void UAdvancedFriendsGameInstance::Shutdown() | ||||
|  | ||||
| 	if (bEnableTalkingStatusDelegate) | ||||
| 	{ | ||||
| 		IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(); | ||||
| 		IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld()); | ||||
|  | ||||
| 		if (VoiceInterface.IsValid()) | ||||
| 		{ | ||||
| @@ -50,7 +52,7 @@ void UAdvancedFriendsGameInstance::Shutdown() | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(); | ||||
| 	IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(GetWorld()); | ||||
|  | ||||
| 	if (IdentityInterface.IsValid()) | ||||
| 	{ | ||||
| @@ -67,7 +69,7 @@ void UAdvancedFriendsGameInstance::Shutdown() | ||||
|  | ||||
| void UAdvancedFriendsGameInstance::Init() | ||||
| { | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();//OnlineSub->GetSessionInterface(); | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());//OnlineSub->GetSessionInterface(); | ||||
|  | ||||
| 	if (SessionInterface.IsValid()) | ||||
| 	{ | ||||
| @@ -88,7 +90,7 @@ void UAdvancedFriendsGameInstance::Init() | ||||
| 	// Beginning work on the voice interface | ||||
| 	if (bEnableTalkingStatusDelegate) | ||||
| 	{ | ||||
| 		IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(); | ||||
| 		IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld()); | ||||
|  | ||||
| 		if (VoiceInterface.IsValid()) | ||||
| 		{ | ||||
| @@ -101,7 +103,7 @@ void UAdvancedFriendsGameInstance::Init() | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(); | ||||
| 	IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(GetWorld()); | ||||
|  | ||||
| 	if (IdentityInterface.IsValid()) | ||||
| 	{ | ||||
|   | ||||
| @@ -50,7 +50,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriends(APlayerController *Play | ||||
| 		List.Add(val); | ||||
| 	} | ||||
|  | ||||
| 	if (SessionInterface->SendSessionInviteToFriends(Player->GetControllerId(), GameSessionName, List)) | ||||
| 	if (SessionInterface->SendSessionInviteToFriends(Player->GetControllerId(), NAME_GameSession, List)) | ||||
| 	{ | ||||
| 		Result = EBlueprintResultSwitch::OnSuccess; | ||||
| 		return; | ||||
| @@ -94,7 +94,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriend(APlayerController *Playe | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if (SessionInterface->SendSessionInviteToFriend(Player->GetControllerId(), GameSessionName, *FriendUniqueNetId.GetUniqueNetId())) | ||||
| 	if (SessionInterface->SendSessionInviteToFriend(Player->GetControllerId(), NAME_GameSession, *FriendUniqueNetId.GetUniqueNetId())) | ||||
| 	{ | ||||
| 		Result = EBlueprintResultSwitch::OnSuccess; | ||||
| 		return; | ||||
|   | ||||
| @@ -12,6 +12,46 @@ bool UAdvancedSessionsLibrary::IsValidSession(const FBlueprintSessionResult & Se | ||||
| 	return SessionResult.OnlineResult.IsValid(); | ||||
| } | ||||
|  | ||||
| void UAdvancedSessionsLibrary::GetSessionID_AsString(const FBlueprintSessionResult & SessionResult, FString& SessionID) | ||||
| { | ||||
| 	const TSharedPtr<class FOnlineSessionInfo> SessionInfo = SessionResult.OnlineResult.Session.SessionInfo; | ||||
| 	if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid()) | ||||
| 	{ | ||||
| 		SessionID = SessionInfo->GetSessionId().ToString(); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	// Zero the string out if we didn't have a valid one, in case this is called in c++ | ||||
| 	SessionID.Empty(); | ||||
| } | ||||
|  | ||||
| void UAdvancedSessionsLibrary::GetCurrentSessionID_AsString(UObject* WorldContextObject, FString& SessionID) | ||||
| { | ||||
| 	UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); | ||||
|  | ||||
| 	if (!SessionInterface.IsValid())  | ||||
| 	{ | ||||
| 		UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetCurrentSessionID_AsString couldn't get the session interface!")); | ||||
| 		SessionID.Empty(); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	const FNamedOnlineSession* Session = SessionInterface->GetNamedSession(NAME_GameSession); | ||||
| 	if (Session != nullptr)  | ||||
| 	{ | ||||
| 		const TSharedPtr<class FOnlineSessionInfo> SessionInfo = Session->SessionInfo; | ||||
| 		if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid())  | ||||
| 		{ | ||||
| 			SessionID = SessionInfo->GetSessionId().ToString(); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// Zero the string out if we didn't have a valid one, in case this is called in c++ | ||||
| 	SessionID.Empty(); | ||||
| } | ||||
|  | ||||
| void UAdvancedSessionsLibrary::GetCurrentUniqueBuildID(int32 &UniqueBuildId) | ||||
| { | ||||
| 	UniqueBuildId = GetBuildUniqueId(); | ||||
| @@ -87,9 +127,10 @@ void UAdvancedSessionsLibrary::GetExtraSettings(FBlueprintSessionResult SessionR | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void UAdvancedSessionsLibrary::GetSessionState(EBPOnlineSessionState &SessionState) | ||||
| void UAdvancedSessionsLibrary::GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState) | ||||
| { | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(); | ||||
| 	UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); | ||||
|  | ||||
| 	if (!SessionInterface.IsValid()) | ||||
| 	{ | ||||
| @@ -97,12 +138,13 @@ void UAdvancedSessionsLibrary::GetSessionState(EBPOnlineSessionState &SessionSta | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	SessionState = ((EBPOnlineSessionState)SessionInterface->GetSessionState(GameSessionName)); | ||||
| 	SessionState = ((EBPOnlineSessionState)SessionInterface->GetSessionState(NAME_GameSession)); | ||||
| } | ||||
|  | ||||
| void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result) | ||||
| void UAdvancedSessionsLibrary::GetSessionSettings(UObject* WorldContextObject, int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result) | ||||
| { | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(); | ||||
| 	UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); | ||||
|  | ||||
| 	if (!SessionInterface.IsValid()) | ||||
| 	{ | ||||
| @@ -111,7 +153,7 @@ void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 & | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	FOnlineSessionSettings* settings = SessionInterface->GetSessionSettings(GameSessionName); | ||||
| 	FOnlineSessionSettings* settings = SessionInterface->GetSessionSettings(NAME_GameSession); | ||||
| 	if (!settings) | ||||
| 	{ | ||||
| 		UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetSessionSettings couldn't get the session settings!")); | ||||
| @@ -140,9 +182,10 @@ void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 & | ||||
| 	Result = EBlueprintResultSwitch::OnSuccess; | ||||
| } | ||||
|  | ||||
| void UAdvancedSessionsLibrary::IsPlayerInSession(const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession) | ||||
| void UAdvancedSessionsLibrary::IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession) | ||||
| { | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(); | ||||
| 	UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); | ||||
| 	IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); | ||||
|  | ||||
| 	if (!SessionInterface.IsValid()) | ||||
| 	{ | ||||
| @@ -151,7 +194,7 @@ void UAdvancedSessionsLibrary::IsPlayerInSession(const FBPUniqueNetId &PlayerToC | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	bIsInSession = SessionInterface->IsPlayerInSession(GameSessionName, *PlayerToCheck.GetUniqueNetId()); | ||||
| 	bIsInSession = SessionInterface->IsPlayerInSession(NAME_GameSession, *PlayerToCheck.GetUniqueNetId()); | ||||
| } | ||||
|  | ||||
| FSessionsSearchSetting UAdvancedSessionsLibrary::MakeLiteralSessionSearchProperty(FSessionPropertyKeyPair SessionSearchProperty, EOnlineComparisonOpRedux ComparisonOp) | ||||
|   | ||||
| @@ -83,7 +83,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate() | ||||
| 			{ | ||||
| 				if (PlayerControllerWeakPtr.IsValid() && Helper.UserID.IsValid()) | ||||
| 				{ | ||||
| 					Sessions->CreateSession(*Helper.UserID, GameSessionName, Settings); | ||||
| 					Sessions->CreateSession(*Helper.UserID, NAME_GameSession, Settings); | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| @@ -95,7 +95,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate() | ||||
| 				} | ||||
| 			} | ||||
| 			else | ||||
| 				Sessions->CreateSession(0, GameSessionName, Settings); | ||||
| 				Sessions->CreateSession(0, NAME_GameSession, Settings); | ||||
|  | ||||
| 			// OnCreateCompleted will get called, nothing more to do now | ||||
| 			return; | ||||
| @@ -125,7 +125,7 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b | ||||
| 			if (bWasSuccessful) | ||||
| 			{ | ||||
| 				StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate); | ||||
| 				Sessions->StartSession(GameSessionName); | ||||
| 				Sessions->StartSession(NAME_GameSession); | ||||
|  | ||||
| 				// OnStartCompleted will get called, nothing more to do now | ||||
| 				return; | ||||
|   | ||||
| @@ -30,12 +30,12 @@ void UEndSessionCallbackProxy::Activate() | ||||
| 		auto Sessions = Helper.OnlineSub->GetSessionInterface(); | ||||
| 		if (Sessions.IsValid()) | ||||
| 		{ | ||||
| 			FNamedOnlineSession* Session = Sessions->GetNamedSession(GameSessionName); | ||||
| 			FNamedOnlineSession* Session = Sessions->GetNamedSession(NAME_GameSession); | ||||
| 			if (Session && | ||||
| 				Session->SessionState == EOnlineSessionState::InProgress) | ||||
| 			{ | ||||
| 				DelegateHandle = Sessions->AddOnEndSessionCompleteDelegate_Handle(Delegate); | ||||
| 				Sessions->EndSession(GameSessionName); | ||||
| 				Sessions->EndSession(NAME_GameSession); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
|   | ||||
| @@ -41,7 +41,7 @@ void UFindFriendSessionCallbackProxy::Activate() | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(); | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld()); | ||||
|  | ||||
| 	if (Sessions.IsValid()) | ||||
| 	{	 | ||||
| @@ -71,7 +71,7 @@ void UFindFriendSessionCallbackProxy::Activate() | ||||
|  | ||||
| void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPlayer, bool bWasSuccessful, const TArray<FOnlineSessionSearchResult>& SessionInfo) | ||||
| { | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(); | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld()); | ||||
|  | ||||
| 	if (Sessions.IsValid()) | ||||
| 		Sessions->ClearOnFindFriendSessionCompleteDelegate_Handle(LocalPlayer, FindFriendSessionCompleteDelegateHandle); | ||||
|   | ||||
| @@ -30,7 +30,7 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update | ||||
| void UUpdateSessionCallbackProxyAdvanced::Activate() | ||||
| { | ||||
|  | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(); | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld()); | ||||
|  | ||||
| 	if (Sessions.IsValid()) | ||||
| 	{ | ||||
| @@ -42,8 +42,8 @@ void UUpdateSessionCallbackProxyAdvanced::Activate() | ||||
| 		} | ||||
|  | ||||
| 		// This gets the actual session itself | ||||
| 		//FNamedOnlineSession * curSession = Sessions->GetNamedSession(GameSessionName); | ||||
| 		FOnlineSessionSettings* Settings = Sessions->GetSessionSettings(GameSessionName); | ||||
| 		//FNamedOnlineSession * curSession = Sessions->GetNamedSession(NAME_GameSession); | ||||
| 		FOnlineSessionSettings* Settings = Sessions->GetSessionSettings(NAME_GameSession); | ||||
|  | ||||
| 		if (!Settings) | ||||
| 		{ | ||||
| @@ -85,7 +85,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate() | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		Sessions->UpdateSession(GameSessionName, *Settings, bRefreshOnlineData); | ||||
| 		Sessions->UpdateSession(NAME_GameSession, *Settings, bRefreshOnlineData); | ||||
|  | ||||
| 		// OnUpdateCompleted will get called, nothing more to do now | ||||
| 		return; | ||||
| @@ -101,7 +101,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate() | ||||
|  | ||||
| void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, bool bWasSuccessful) | ||||
| { | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(); | ||||
| 	IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld()); | ||||
| 	if (Sessions.IsValid()) | ||||
| 	{ | ||||
| 		Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle); | ||||
|   | ||||
| @@ -2,8 +2,8 @@ | ||||
|     "FileVersion" : 3, | ||||
|   | ||||
|     "FriendlyName" : "Advanced Steam Sessions", | ||||
|     "Version" : 4.17, | ||||
|     "VersionName": "4.17", | ||||
|     "Version" : 4.22, | ||||
|     "VersionName": "4.22", | ||||
|     "Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS", | ||||
|     "Category" : "Advanced Sessions Plugin", | ||||
|     "CreatedBy" : "Joshua Statzer", | ||||
|   | ||||
| @@ -6,14 +6,232 @@ | ||||
| #include "Kismet/BlueprintFunctionLibrary.h" | ||||
| #include "Online.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineFriendsInterface.h" | ||||
| #include "OnlineUserInterface.h" | ||||
| #include "OnlineMessageInterface.h" | ||||
| #include "OnlinePresenceInterface.h" | ||||
| #include "Interfaces/OnlineFriendsInterface.h" | ||||
| #include "Interfaces/OnlineUserInterface.h" | ||||
| #include "Interfaces/OnlineMessageInterface.h" | ||||
| #include "Interfaces/OnlinePresenceInterface.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #include "Interfaces/OnlineSessionInterface.h" | ||||
| #include "BlueprintDataDefinitions.h" | ||||
| #include "UObject/UObjectIterator.h" | ||||
|  | ||||
| #include "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 | ||||
|  | ||||
| #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); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	/** Needed for TMap::GetTypeHash() */ | ||||
| 	friend uint32 GetTypeHash(const FUniqueNetIdSteam2& A) | ||||
| 	{ | ||||
| 		return GetTypeHash(A.UniqueNetId); | ||||
| 		//return (uint32)(A.UniqueNetId) + ((uint32)((A.UniqueNetId) >> 32) * 23); | ||||
| 	} | ||||
|  | ||||
| 	/** 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" | ||||
|  | ||||
| @@ -72,22 +290,20 @@ struct FBPSteamGroupInfo | ||||
| public: | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") | ||||
| 	FBPUniqueNetId GroupID; // Uint64 representation | ||||
| 		FBPUniqueNetId GroupID; // Uint64 representation | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") | ||||
| 	FString GroupName; | ||||
| 		FString GroupName; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") | ||||
| 	FString GroupTag; | ||||
| 		FString GroupTag; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") | ||||
| 	int32 numOnline; | ||||
| 		int32 numOnline; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") | ||||
| 	int32 numInGame; | ||||
| 		int32 numInGame; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") | ||||
| 	int32 numChatting; | ||||
| 		int32 numChatting; | ||||
|  | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary | ||||
| { | ||||
| @@ -120,12 +336,15 @@ public: | ||||
| 	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 | ||||
| 	*  The game name is retrieved from steamSDK AppList which isn't available to all game IDs without request, can use the AppID with the | ||||
| 	*  WebAPI GetAppList request as an alternative. | ||||
| 	*  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); | ||||
| 	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") | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| #pragma once | ||||
|   | ||||
| #include "CoreMinimal.h" | ||||
| #include "ModuleManager.h" | ||||
| #include "Modules/ModuleManager.h" | ||||
|  | ||||
| class AdvancedSteamSessions : public IModuleInterface | ||||
| { | ||||
|   | ||||
| @@ -6,7 +6,11 @@ | ||||
| #include "Kismet/BlueprintFunctionLibrary.h" | ||||
| #include "Online.h" | ||||
| #include "OnlineSubsystem.h" | ||||
| #include "OnlineSessionInterface.h" | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| #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 | ||||
| @@ -203,11 +207,22 @@ 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 | ||||
| 	FBPSteamWorkshopItemDetails(SteamUGCDetails_t &hUGCDetails) | ||||
| 	{ | ||||
| 		ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult; | ||||
| @@ -245,6 +260,7 @@ public: | ||||
|  | ||||
| 		CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	// Result of obtaining the details | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") | ||||
|   | ||||
| @@ -2,45 +2,6 @@ | ||||
| #include "AdvancedSteamFriendsLibrary.h" | ||||
| #include "OnlineSubSystemHeader.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 | ||||
|  | ||||
| #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") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| // @todo Steam: See above | ||||
| #ifdef _MSC_VER | ||||
| #pragma warning(pop) | ||||
| #endif | ||||
|  | ||||
| //General Log | ||||
| DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog); | ||||
|  | ||||
| @@ -97,6 +58,7 @@ DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog); | ||||
|  | ||||
| void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups) | ||||
| { | ||||
| 	 | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
|  | ||||
| 	if (SteamAPI_Init()) | ||||
| @@ -112,7 +74,7 @@ void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray<FBPSteamGroupInfo> & St | ||||
|  | ||||
| 			FBPSteamGroupInfo GroupInfo; | ||||
|  | ||||
| 			TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam(SteamGroupID)); | ||||
| 			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))); | ||||
| @@ -122,9 +84,10 @@ void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray<FBPSteamGroupInfo> & St | ||||
| 		} | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| } | ||||
|  | ||||
| void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result, FString & GameName, int32 & AppID) | ||||
| void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result/*, FString & GameName*/, int32 & AppID) | ||||
| { | ||||
|  | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| @@ -146,13 +109,15 @@ void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId | ||||
| 		{ | ||||
| 			AppID = GameInfo.m_gameID.AppID(); | ||||
|  | ||||
| 			char NameBuffer[512]; | ||||
| 			// 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; | ||||
| @@ -220,7 +185,7 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri | ||||
| 	if (SteamAPI_Init()) | ||||
| 	{ | ||||
| 		// Already does the conversion | ||||
| 		TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam(SteamID64)); | ||||
| 		TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(SteamID64)); | ||||
| 		//FCString::Atoi64(*SteamID64)); | ||||
| 		 | ||||
| 		netId.SetUniqueNetId(ValueID); | ||||
| @@ -231,6 +196,21 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri | ||||
| 	return netId; | ||||
| } | ||||
|  | ||||
| FBPUniqueNetId UAdvancedSteamFriendsLibrary::GetLocalSteamIDFromSteam() | ||||
| { | ||||
| 	FBPUniqueNetId netId; | ||||
|  | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| 	if (SteamAPI_Init()) | ||||
| 	{ | ||||
| 		TSharedPtr<const FUniqueNetId> SteamID(new const FUniqueNetIdSteam2(SteamUser()->GetSteamID())); | ||||
| 		netId.SetUniqueNetId(SteamID); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	return netId; | ||||
| } | ||||
|  | ||||
| bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly) | ||||
| { | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
|   | ||||
| @@ -1,9 +1,13 @@ | ||||
| // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. | ||||
|  | ||||
| #include "SteamRequestGroupOfficersCallbackProxy.h" | ||||
| #include "CoreOnline.h" | ||||
| #include "UObject/CoreOnline.h" | ||||
| #include "AdvancedSteamFriendsLibrary.h" | ||||
| #include "OnlineSubSystemHeader.h" | ||||
| #include "OnlineSubsystemSteamTypes.h" | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| #include "steam/isteamfriends.h" | ||||
| #endif | ||||
| //#include "OnlineSubsystemSteamTypes.h" | ||||
|  | ||||
| ////////////////////////////////////////////////////////////////////////// | ||||
| // UEndSessionCallbackProxy | ||||
| @@ -41,12 +45,11 @@ void USteamRequestGroupOfficersCallbackProxy::Activate() | ||||
| 	OnFailure.Broadcast(EmptyArray); | ||||
| } | ||||
|  | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure) | ||||
| { | ||||
| 	TArray<FBPSteamGroupOfficer> OfficerArray; | ||||
| 	 | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| 	 | ||||
| 	FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM)); | ||||
|  | ||||
| 	if (bIOFailure || !pResult || !pResult->m_bSuccess) | ||||
| @@ -72,7 +75,7 @@ void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanO | ||||
|  | ||||
| 		Officer.bIsOwner = true; | ||||
|  | ||||
| 		TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam(ClanOwner)); | ||||
| 		TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(ClanOwner)); | ||||
| 		Officer.OfficerUniqueNetID.SetUniqueNetId(ValueID); | ||||
| 		OfficerArray.Add(Officer); | ||||
|  | ||||
| @@ -82,7 +85,7 @@ void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanO | ||||
|  | ||||
| 			Officer.bIsOwner = false; | ||||
|  | ||||
| 			TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam(OfficerSteamID)); | ||||
| 			TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam2(OfficerSteamID)); | ||||
| 			Officer.OfficerUniqueNetID.SetUniqueNetId(newValueID); | ||||
|  | ||||
| 			OfficerArray.Add(Officer); | ||||
| @@ -110,9 +113,9 @@ void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanO | ||||
| 			}); | ||||
| 		} | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	// Should never hit this anyway | ||||
| 	//OnFailure.Broadcast(OfficerArray); | ||||
| } | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -2,6 +2,9 @@ | ||||
|  | ||||
| #include "SteamWSRequestUGCDetailsCallbackProxy.h" | ||||
| #include "OnlineSubSystemHeader.h" | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| #include "steam/isteamugc.h" | ||||
| #endif | ||||
|  | ||||
| ////////////////////////////////////////////////////////////////////////// | ||||
| // UEndSessionCallbackProxy | ||||
| @@ -46,10 +49,9 @@ void USteamWSRequestUGCDetailsCallbackProxy::Activate() | ||||
| 	OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); | ||||
| } | ||||
|  | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure) | ||||
| {	 | ||||
| #if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX | ||||
| 	 | ||||
| 	FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM)); | ||||
|  | ||||
| 	if (bIOFailure || !pResult || pResult->m_unNumResultsReturned <= 0) | ||||
| @@ -91,9 +93,9 @@ void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQuer | ||||
| 			}); | ||||
| 		} | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	// Not needed, should never hit here | ||||
| 	//OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); | ||||
| } | ||||
| #endif | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user