From 18fe898a0a2cb7d4e814d48828578aa3d6bf855c Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Sun, 6 Jul 2025 15:58:28 +0300 Subject: [PATCH 1/5] Add clang-format config that matches Epics codestyle as much as possible --- .clang-format | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..41ab52a --- /dev/null +++ b/.clang-format @@ -0,0 +1,52 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +IndentWidth: 4 +TabWidth: 4 +UseTab: ForIndentation +Standard: Cpp11 +FixNamespaceComments: true +NamespaceIndentation: All +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignEscapedNewlines: DontAlign +AlignTrailingComments: true +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: InlineOnly +BreakConstructorInitializersBeforeComma: true +RemoveSemicolon: true +InsertBraces: true +InsertNewlineAtEOF: true + +# We have to to set BeforeLambdaBody = false, because in other case it makes incorrect indention +BreakBeforeBraces: Custom + +BraceWrapping: + AfterEnum: true + AfterStruct: true + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterFunction: true + AfterNamespace: true + AfterUnion: true + AfterExternBlock: true + BeforeElse: true + BeforeCatch: true + SplitEmptyFunction: false + IndentBraces: false + +AllowShortLambdasOnASingleLine: Inline +ColumnLimit: 0 +PointerAlignment: Left +SpaceAfterTemplateKeyword: false +SpacesInAngles: false +ContinuationIndentWidth: 4 +IndentCaseLabels: true +IncludeBlocks: Merge +IncludeCategories: + - Regex: '.*\.generated\.h' + Priority: 2 + - Regex: '.*' + Priority: 1 +... From 4570c4da9663bf965ab7894c82044a2b0489a28d Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Sun, 6 Jul 2025 15:59:09 +0300 Subject: [PATCH 2/5] Add ClangFormat.sh script that can be used on Linux, macOS and Windows (via Git Bash) to reformat the code according to project codestyle --- ClangFormat.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 ClangFormat.sh diff --git a/ClangFormat.sh b/ClangFormat.sh new file mode 100755 index 0000000..f45ec4e --- /dev/null +++ b/ClangFormat.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# http://redsymbol.net/articles/unofficial-bash-strict-mode/ +set -euo pipefail +IFS=$'\n\t' + +PROJECT_DIR="$(dirname "${BASH_SOURCE[0]}")" + +NC='\033[0m' # No Color +RED='\033[0;31m' +YELLOW='\033[0;33m' + +function win_setup() { + local vswhere + vswhere="$(cygpath -u "/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe")" + + if [ ! -f "${vswhere}" ] + then + printf "${YELLOW}Warning: %s not found${NC}\n" "${vswhere}" + return + fi + + local clang_format + clang_format="$("${vswhere}" -products '*' -latest -find VC/Tools/Llvm/bin/clang-format.exe)" + + local clang_format_dir + clang_format_dir="$(cygpath -u "$(dirname "${clang_format}")")" + export PATH="${clang_format_dir}:${PATH}" +} + +case "${OSTYPE}" in + "darwin"*) + function nproc { + sysctl -n hw.logicalcpu + } + ;; + "msys") + win_setup + ;; +esac + +# Print clang-format version so it is visible in CI logs and such +clang-format --version + +find "${PROJECT_DIR}" \( -name "*.h" -o -name "*.cpp" \) -print0 | xargs -0 -P "$(nproc)" -n 100 clang-format -i From ae92e9e3c3f57d296c4589ccedef51b574436b88 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Sun, 6 Jul 2025 15:59:50 +0300 Subject: [PATCH 3/5] Add CI job to verify that all code adheres to codestyle --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..64954be --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,8 @@ +name: CI +on: [push, pull_request] +jobs: + clang-format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DoozyX/clang-format-lint-action@v0.20 From ae6e910d222c2d24f2ec7b800fa801d0639a37ad Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Sun, 6 Jul 2025 16:00:43 +0300 Subject: [PATCH 4/5] Add Dependabot config to create PRs when clang-format CI action receives updates --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..914813e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" From b96c0faa1332fe3aec36fc4d2d2db9c8d640001d Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Sun, 6 Jul 2025 16:00:57 +0300 Subject: [PATCH 5/5] Reformat everything according to codestyle --- .../Classes/AdvancedExternalUILibrary.h | 37 +- .../Classes/AdvancedFriendsGameInstance.h | 35 +- .../Classes/AdvancedFriendsInterface.h | 21 +- .../Classes/AdvancedFriendsLibrary.h | 32 +- .../Classes/AdvancedGameSession.h | 16 +- .../Classes/AdvancedIdentityLibrary.h | 45 +-- .../Classes/AdvancedSessions.h | 4 +- .../Classes/AdvancedSessionsLibrary.h | 353 ++++++++-------- .../Classes/AdvancedVoiceLibrary.h | 26 +- .../Classes/AutoLoginUserCallbackProxy.h | 6 +- .../Classes/BlueprintDataDefinitions.h | 100 +++-- .../Classes/CancelFindSessionsCallbackProxy.h | 4 +- .../CreateSessionCallbackProxyAdvanced.h | 7 +- .../Classes/EndSessionCallbackProxy.h | 4 +- .../Classes/FindFriendSessionCallbackProxy.h | 9 +- .../FindSessionsCallbackProxyAdvanced.h | 20 +- .../Classes/GetFriendsCallbackProxy.h | 7 +- .../Classes/GetRecentPlayersCallbackProxy.h | 11 +- .../Classes/GetUserPrivilegeCallbackProxy.h | 8 +- .../Classes/LoginUserCallbackProxy.h | 6 +- .../Classes/LogoutUserCallbackProxy.h | 6 +- .../Classes/OnlineSubSystemHeader.h | 33 +- .../Classes/SendFriendInviteCallbackProxy.h | 10 +- .../StartSessionCallbackProxyAdvanced.h | 9 +- .../UpdateSessionCallbackProxyAdvanced.h | 7 +- .../Private/AdvancedExternalUILibrary.cpp | 23 +- .../Private/AdvancedFriendsGameInstance.cpp | 117 +++--- .../Private/AdvancedFriendsInterface.cpp | 6 +- .../Private/AdvancedFriendsLibrary.cpp | 37 +- .../Private/AdvancedIdentityLibrary.cpp | 38 +- .../Private/AdvancedSessions.cpp | 8 +- .../Private/AdvancedSessionsLibrary.cpp | 86 ++-- .../Private/AdvancedVoiceLibrary.cpp | 11 +- .../Private/AutoLoginUserCallbackProxy.cpp | 10 +- .../CancelFindSessionsCallbackProxy.cpp | 7 +- .../CreateSessionCallbackProxyAdvanced.cpp | 34 +- .../Private/EndSessionCallbackProxy.cpp | 7 +- .../FindFriendSessionCallbackProxy.cpp | 16 +- .../FindSessionsCallbackProxyAdvanced.cpp | 380 ++++++++++-------- .../Private/GetFriendsCallbackProxy.cpp | 16 +- .../Private/GetRecentPlayersCallbackProxy.cpp | 20 +- .../Private/GetUserPrivilegeCallbackProxy.cpp | 5 +- .../Private/LoginUserCallbackProxy.cpp | 5 +- .../Private/LogoutUserCallbackProxy.cpp | 5 +- .../Private/SendFriendInviteCallbackProxy.cpp | 17 +- .../StartSessionCallbackProxyAdvanced.cpp | 8 +- .../UpdateSessionCallbackProxyAdvanced.cpp | 29 +- .../Classes/AdvancedSteamFriendsLibrary.h | 197 +++++---- .../Classes/AdvancedSteamSessions.h | 4 +- .../Classes/AdvancedSteamWorkshopLibrary.h | 223 +++++----- .../Classes/SteamNotificationsSubsystem.h | 17 +- .../SteamRequestGroupOfficersCallbackProxy.h | 28 +- .../SteamWSRequestUGCDetailsCallbackProxy.h | 22 +- .../Private/AdvancedSteamFriendsLibrary.cpp | 153 ++++--- .../Private/AdvancedSteamSessions.cpp | 8 +- .../Private/AdvancedSteamWorkshopLibrary.cpp | 15 +- ...SteamRequestGroupOfficersCallbackProxy.cpp | 47 ++- .../SteamWSRequestUGCDetailsCallbackProxy.cpp | 38 +- 58 files changed, 1184 insertions(+), 1269 deletions(-) diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedExternalUILibrary.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedExternalUILibrary.h index 6153ed3..2be2d30 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedExternalUILibrary.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedExternalUILibrary.h @@ -1,26 +1,24 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" +#include "Engine/LocalPlayer.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "Online.h" -#include "Engine/LocalPlayer.h" #include "OnlineSubsystem.h" -#include "BlueprintDataDefinitions.h" -//#include "OnlineFriendsInterface.h" -//#include "OnlineUserInterface.h" -//#include "OnlineMessageInterface.h" -//#include "OnlinePresenceInterface.h" -//#include "Engine/GameInstance.h" +// #include "OnlineFriendsInterface.h" +// #include "OnlineUserInterface.h" +// #include "OnlineMessageInterface.h" +// #include "OnlinePresenceInterface.h" +// #include "Engine/GameInstance.h" #include "Interfaces/OnlineSessionInterface.h" -//#include "UObjectIterator.h" +// #include "UObjectIterator.h" #include "AdvancedExternalUILibrary.generated.h" - -//General Advanced Sessions Log +// General Advanced Sessions Log DECLARE_LOG_CATEGORY_EXTERN(AdvancedExternalUILog, Log, All); UCLASS() @@ -28,36 +26,33 @@ class UAdvancedExternalUILibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: - //********* External UI Functions *************// // Show the UI that handles the Friends list UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void ShowFriendsUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result); + static void ShowFriendsUI(UObject* WorldContextObject, APlayerController* PlayerController, EBlueprintResultSwitch& Result); // Show the UI that handles inviting people to your game UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void ShowInviteUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result); + static void ShowInviteUI(UObject* WorldContextObject, APlayerController* PlayerController, EBlueprintResultSwitch& Result); // Show the UI that shows the leaderboard (doesn't work with steam) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch &Result); + static void ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch& Result); // Show the UI that shows a web URL UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", AutoCreateRefTerm = "AllowedDomains", WorldContext = "WorldContextObject")) - static void ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch &Result, TArray& AllowedDomains, bool bEmbedded = false , bool bShowBackground = false, bool bShowCloseButton = false, int32 OffsetX = 0, int32 OffsetY = 0, int32 SizeX = 0, int32 SizeY = 0); + static void ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch& Result, TArray& AllowedDomains, bool bEmbedded = false, bool bShowBackground = false, bool bShowCloseButton = false, int32 OffsetX = 0, int32 OffsetY = 0, int32 SizeX = 0, int32 SizeY = 0); // Show the UI that shows a web URL UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (WorldContext = "WorldContextObject")) static void CloseWebURLUI(UObject* WorldContextObject); - // Show the UI that shows the profile of a uniquenetid UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result); + static void ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch& Result); // Show the UI that shows the account upgrade UI (doesn't work with steam) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result); - -}; + static void ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch& Result); +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsGameInstance.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsGameInstance.h index 29d5018..16ffa59 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsGameInstance.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsGameInstance.h @@ -1,27 +1,25 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once +#include "AdvancedFriendsInterface.h" +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" #include "Engine/Engine.h" -#include "BlueprintDataDefinitions.h" -#include "Kismet/BlueprintFunctionLibrary.h" -#include "Online.h" -#include "OnlineSubsystem.h" +#include "Engine/GameInstance.h" +#include "Engine/LocalPlayer.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 "Interfaces/OnlineSessionInterface.h" +#include "Interfaces/OnlineUserInterface.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Online.h" #include "OnlineSessionSettings.h" +#include "OnlineSubsystem.h" #include "UObject/UObjectIterator.h" -#include "AdvancedFriendsInterface.h" - #include "AdvancedFriendsGameInstance.generated.h" - -//General Advanced Sessions Log +// General Advanced Sessions Log DECLARE_LOG_CATEGORY_EXTERN(AdvancedFriendsInterfaceLog, Log, All); UCLASS() @@ -29,7 +27,6 @@ class ADVANCEDSESSIONS_API UAdvancedFriendsGameInstance : public UGameInstance { GENERATED_BODY() public: - UAdvancedFriendsGameInstance(const FObjectInitializer& ObjectInitializer); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedFriendsInterface) @@ -44,7 +41,7 @@ class ADVANCEDSESSIONS_API UAdvancedFriendsGameInstance : public UGameInstance UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedVoiceInterface) bool bEnableTalkingStatusDelegate; - //virtual void PostLoad() override; + // virtual void PostLoad() override; virtual void Shutdown() override; virtual void Init() override; @@ -59,8 +56,8 @@ class ADVANCEDSESSIONS_API UAdvancedFriendsGameInstance : public UGameInstance // 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); + // 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); // After a session invite has been accepted by the local player this event is triggered, call JoinSession on the session result to join it UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends") @@ -77,7 +74,6 @@ class ADVANCEDSESSIONS_API UAdvancedFriendsGameInstance : public UGameInstance UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends") void OnSessionInviteAccepted(int32 LocalPlayerNum, FBPUniqueNetId PersonInvited, const FBlueprintSessionResult& SessionToJoin); - // After a voice status has changed this event is triggered if the bEnableTalkingStatusDelegate property is true UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedVoice") void OnPlayerTalkingStateChanged(FBPUniqueNetId PlayerId, bool bIsTalking); @@ -87,9 +83,8 @@ class ADVANCEDSESSIONS_API UAdvancedFriendsGameInstance : public UGameInstance FOnPlayerTalkingStateChangedDelegate PlayerTalkingStateChangedDelegate; FDelegateHandle PlayerTalkingStateChangedDelegateHandle; - // Called when the designated LocalUser has changed login state - UFUNCTION(BlueprintImplementableEvent , Category = "AdvancedIdentity", meta = (DisplayName = "OnPlayerLoginChanged")) + UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedIdentity", meta = (DisplayName = "OnPlayerLoginChanged")) void OnPlayerLoginChanged(int32 PlayerNum); void OnPlayerLoginChangedMaster(int32 PlayerNum); @@ -100,11 +95,10 @@ class ADVANCEDSESSIONS_API UAdvancedFriendsGameInstance : public UGameInstance UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedIdentity", meta = (DisplayName = "OnPlayerLoginStatusChanged")) void OnPlayerLoginStatusChanged(int32 PlayerNum, EBPLoginStatus PreviousStatus, EBPLoginStatus NewStatus, FBPUniqueNetId NewPlayerUniqueNetID); - void OnPlayerLoginStatusChangedMaster(int32 PlayerNum, ELoginStatus::Type PreviousStatus, ELoginStatus::Type NewStatus, const FUniqueNetId & NewPlayerUniqueNetID); + void OnPlayerLoginStatusChangedMaster(int32 PlayerNum, ELoginStatus::Type PreviousStatus, ELoginStatus::Type NewStatus, const FUniqueNetId& NewPlayerUniqueNetID); FOnLoginStatusChangedDelegate PlayerLoginStatusChangedDelegate; FDelegateHandle PlayerLoginStatusChangedDelegateHandle; - //*** Session Invite Received From Friend ***// // REMOVED BECAUSE IT NEVER GETS CALLED /*FOnSessionInviteReceivedDelegate SessionInviteReceivedDelegate; @@ -149,4 +143,3 @@ class ADVANCEDSESSIONS_API UAdvancedFriendsGameInstance : public UGameInstance UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends") void OnRemovedByFriend(const FBPUniqueNetId &InvitedPlayer, const FBPUniqueNetId &FriendRemoved);*/ }; - diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsInterface.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsInterface.h index 44cfc0b..c96f1e1 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsInterface.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsInterface.h @@ -1,22 +1,21 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" -#include "Kismet/BlueprintFunctionLibrary.h" -#include "Online.h" -#include "OnlineSubsystem.h" +#include "Engine/GameInstance.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 "Interfaces/OnlineUserInterface.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Online.h" #include "OnlineSessionSettings.h" +#include "OnlineSubsystem.h" #include "UObject/UObjectIterator.h" -#include "BlueprintDataDefinitions.h" #include "AdvancedFriendsInterface.generated.h" - UINTERFACE(MinimalAPI) class UAdvancedFriendsInterface : public UInterface { @@ -27,7 +26,6 @@ class IAdvancedFriendsInterface { GENERATED_IINTERFACE_BODY() public: - // Called when the designated LocalUser has accepted a session invite, use JoinSession on result to connect UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "OnSessionInviteReceived")) void OnSessionInviteReceived(FBPUniqueNetId PersonInviting, const FBlueprintSessionResult& SearchResult); @@ -50,7 +48,6 @@ class IAdvancedFriendsInterface // REMOVED BECAUSE IT WAS NEVER BEING CALLED // Called when the designated LocalUser has received a session invite, use JoinSession on result to connect - //UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "OnSessionInviteReceived")) - //void OnSessionInviteReceived(const FBPUniqueNetId &FriendInviting, const FBlueprintSessionResult &Session); - -}; + // UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "OnSessionInviteReceived")) + // void OnSessionInviteReceived(const FBPUniqueNetId &FriendInviting, const FBlueprintSessionResult &Session); +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsLibrary.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsLibrary.h index fedf2c1..8425266 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsLibrary.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedFriendsLibrary.h @@ -1,25 +1,22 @@ // 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 "CoreMinimal.h" +#include "Engine/GameInstance.h" #include "Engine/LocalPlayer.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 "Interfaces/OnlineUserInterface.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Online.h" +#include "OnlineSubsystem.h" #include "UObject/UObjectIterator.h" - #include "AdvancedFriendsLibrary.generated.h" - -//General Advanced Sessions Log +// General Advanced Sessions Log DECLARE_LOG_CATEGORY_EXTERN(AdvancedFriendsLog, Log, All); UCLASS() @@ -27,30 +24,29 @@ class UAdvancedFriendsLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: - //********* Friend List Functions *************// // Sends an Invite to the current online session to a list of friends UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList", meta = (ExpandEnumAsExecs = "Result")) - static void SendSessionInviteToFriends(APlayerController *PlayerController, const TArray &Friends, EBlueprintResultSwitch &Result); + static void SendSessionInviteToFriends(APlayerController* PlayerController, const TArray& Friends, EBlueprintResultSwitch& Result); // Sends an Invite to the current online session to a friend UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList", meta = (ExpandEnumAsExecs = "Result")) - static void SendSessionInviteToFriend(APlayerController *PlayerController, const FBPUniqueNetId &FriendUniqueNetId, EBlueprintResultSwitch &Result); + static void SendSessionInviteToFriend(APlayerController* PlayerController, const FBPUniqueNetId& FriendUniqueNetId, EBlueprintResultSwitch& Result); // Get a friend from the previously read/saved friends list (Must Call GetFriends first for this to return anything) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList") - static void GetFriend(APlayerController *PlayerController, const FBPUniqueNetId FriendUniqueNetId, FBPFriendInfo &Friend); + static void GetFriend(APlayerController* PlayerController, const FBPUniqueNetId FriendUniqueNetId, FBPFriendInfo& Friend); // Get the previously read/saved friends list (Must Call GetFriends first for this to return anything) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|FriendsList") - static void GetStoredFriendsList(APlayerController *PlayerController, TArray &FriendsList); + static void GetStoredFriendsList(APlayerController* PlayerController, TArray& FriendsList); // Get the previously read/saved recent players list (Must Call GetRecentPlayers first for this to return anything) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|RecentPlayersList") - static void GetStoredRecentPlayersList(FBPUniqueNetId UniqueNetId, TArray &PlayersList); + static void GetStoredRecentPlayersList(FBPUniqueNetId UniqueNetId, TArray& PlayersList); // Check if a UniqueNetId is a friend UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|FriendsList") - static void IsAFriend(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, bool &IsFriend); -}; + static void IsAFriend(APlayerController* PlayerController, const FBPUniqueNetId UniqueNetId, bool& IsFriend); +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedGameSession.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedGameSession.h index 179d857..f67d9a4 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedGameSession.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedGameSession.h @@ -3,20 +3,17 @@ #pragma once #include "CoreMinimal.h" #include "Engine/Engine.h" -#include "Online.h" -#include "OnlineSubsystem.h" #include "Engine/GameInstance.h" #include "GameFramework/GameModeBase.h" #include "GameFramework/GameSession.h" #include "GameFramework/PlayerState.h" +#include "Online.h" +#include "OnlineSubsystem.h" -//#include "UObjectIterator.h" +// #include "UObjectIterator.h" #include "AdvancedGameSession.generated.h" - - - /** A quick wrapper around the game session to add a partial ban implementation. Just bans for the duration of the current session */ @@ -26,7 +23,6 @@ class AAdvancedGameSession : public AGameSession GENERATED_UCLASS_BODY() public: - UPROPERTY(Transient) TMap BanList; @@ -45,7 +41,7 @@ class AAdvancedGameSession : public AGameSession return bWasKicked; } - + return false; } @@ -66,6 +62,6 @@ class AAdvancedGameSession : public AGameSession }; AAdvancedGameSession::AAdvancedGameSession(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) + : Super(ObjectInitializer) { -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedIdentityLibrary.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedIdentityLibrary.h index 5f0dc15..bbdb4d5 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedIdentityLibrary.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedIdentityLibrary.h @@ -1,23 +1,20 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" +#include "Engine/GameInstance.h" +#include "Engine/LocalPlayer.h" +#include "Interfaces/OnlineIdentityInterface.h" +#include "Interfaces/OnlinePresenceInterface.h" +#include "Interfaces/OnlineUserInterface.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "Online.h" #include "OnlineSubsystem.h" -#include "Interfaces/OnlineIdentityInterface.h" -#include "Interfaces/OnlineUserInterface.h" -#include "Interfaces/OnlinePresenceInterface.h" -#include "Engine/GameInstance.h" -#include "Engine/LocalPlayer.h" - #include "UObject/UObjectIterator.h" - #include "AdvancedIdentityLibrary.generated.h" - -//General Advanced Sessions Log +// General Advanced Sessions Log DECLARE_LOG_CATEGORY_EXTERN(AdvancedIdentityLog, Log, All); UCLASS() @@ -29,53 +26,51 @@ class UAdvancedIdentityLibrary : public UBlueprintFunctionLibrary // Get the login status of a local player UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result); + static void GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetID, EBPLoginStatus& LoginStatus, EBlueprintResultSwitch& Result); // Get the auth token for a local player UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void GetPlayerAuthToken(UObject* WorldContextObject, APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result); + static void GetPlayerAuthToken(UObject* WorldContextObject, APlayerController* PlayerController, FString& AuthToken, EBlueprintResultSwitch& Result); // Get a players nickname UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity", meta = (WorldContext = "WorldContextObject")) - static void GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname); + static void GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetID, FString& PlayerNickname); //********* User Account Functions *************// // Get a users account UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result); + static void GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId, FBPUserOnlineAccount& AccountInfo, EBlueprintResultSwitch& Result); // Get all known users accounts UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject")) - static void GetAllUserAccounts(UObject* WorldContextObject, TArray & AccountInfos, EBlueprintResultSwitch &Result); + static void GetAllUserAccounts(UObject* WorldContextObject, TArray& AccountInfos, EBlueprintResultSwitch& Result); // Get a user account access token UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity|UserAccount") - static void GetUserAccountAccessToken(const FBPUserOnlineAccount & AccountInfo, FString & AccessToken); + static void GetUserAccountAccessToken(const FBPUserOnlineAccount& AccountInfo, FString& AccessToken); // Get a user account Auth attribute (depends on subsystem) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result")) - static void GetUserAccountAuthAttribute(const FBPUserOnlineAccount & AccountInfo, const FString & AttributeName, FString & AuthAttribute, EBlueprintResultSwitch &Result); + static void GetUserAccountAuthAttribute(const FBPUserOnlineAccount& AccountInfo, const FString& AttributeName, FString& AuthAttribute, EBlueprintResultSwitch& Result); // Set a user account attribute (depends on subsystem) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result")) - static void SetUserAccountAttribute(const FBPUserOnlineAccount & AccountInfo, const FString & AttributeName, const FString & NewAttributeValue, EBlueprintResultSwitch &Result); + static void SetUserAccountAttribute(const FBPUserOnlineAccount& AccountInfo, const FString& AttributeName, const FString& NewAttributeValue, EBlueprintResultSwitch& Result); // Get user ID UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity|UserAccount") - static void GetUserID(const FBPUserOnlineAccount & AccountInfo, FBPUniqueNetId & UniqueNetID); + static void GetUserID(const FBPUserOnlineAccount& AccountInfo, FBPUniqueNetId& UniqueNetID); // Get user accounts real name if possible UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity|UserAccount") - static void GetUserAccountRealName(const FBPUserOnlineAccount & AccountInfo, FString & UserName); + static void GetUserAccountRealName(const FBPUserOnlineAccount& AccountInfo, FString& UserName); // Get user account display name if possible UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity|UserAccount") - static void GetUserAccountDisplayName(const FBPUserOnlineAccount & AccountInfo, FString & DisplayName); + static void GetUserAccountDisplayName(const FBPUserOnlineAccount& AccountInfo, FString& DisplayName); // Get user account attribute (depends on subsystem) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result")) - static void GetUserAccountAttribute(const FBPUserOnlineAccount & AccountInfo, const FString & AttributeName, FString & AttributeValue, EBlueprintResultSwitch &Result); - - -}; + static void GetUserAccountAttribute(const FBPUserOnlineAccount& AccountInfo, const FString& AttributeName, FString& AttributeValue, EBlueprintResultSwitch& Result); +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessions.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessions.h index 6218cd0..82e9e64 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessions.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessions.h @@ -1,5 +1,5 @@ #pragma once - + #include "Modules/ModuleManager.h" class AdvancedSessions : public IModuleInterface @@ -8,4 +8,4 @@ class AdvancedSessions : public IModuleInterface /** IModuleInterface implementation */ void StartupModule(); void ShutdownModule(); -}; \ No newline at end of file +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h index 78284e8..a5dcf97 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h @@ -1,213 +1,204 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" #include "Engine/Engine.h" -#include "BlueprintDataDefinitions.h" -#include "Kismet/BlueprintFunctionLibrary.h" -#include "Online.h" -#include "OnlineSubsystem.h" +#include "Engine/GameInstance.h" +#include "GameFramework/GameModeBase.h" +#include "GameFramework/GameSession.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 "Interfaces/OnlineUserInterface.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Online.h" +#include "OnlineSubsystem.h" -#include "GameFramework/GameModeBase.h" -#include "GameFramework/GameSession.h" - -//#include "UObjectIterator.h" +// #include "UObjectIterator.h" #include "AdvancedSessionsLibrary.generated.h" - -//General Advanced Sessions Log +// General Advanced Sessions Log DECLARE_LOG_CATEGORY_EXTERN(AdvancedSessionsLog, Log, All); - UCLASS() class UAdvancedSessionsLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: - //********* Session Admin Functions *************// - - // Kick a player from the currently active game session, only available on the server - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject")) - static bool KickPlayer(UObject* WorldContextObject, APlayerController* PlayerToKick, FText KickReason); - - // Ban a player from the currently active game session, only available on the server - // Note that the default gamesession class does not implement an actual ban list and just kicks when this is called - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject")) - static bool BanPlayer(UObject* WorldContextObject, APlayerController* PlayerToBan, FText BanReason); - - //********* Session Search Functions *************// - - // Adds or modifies session settings in an existing array depending on if they exist already or not - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") - static void AddOrModifyExtraSettings(UPARAM(ref) TArray & SettingsArray, UPARAM(ref) TArray & NewOrChangedSettings, TArray & ModifiedSettingsArray); - - // Get an array of the session settings from a session search result - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") - static void GetExtraSettings(FBlueprintSessionResult SessionResult, TArray & ExtraSettings); - - // Get the current session state - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject")) - static void GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState); + //********* Session Admin Functions *************// + + // Kick a player from the currently active game session, only available on the server + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject")) + static bool KickPlayer(UObject* WorldContextObject, APlayerController* PlayerToKick, FText KickReason); + + // Ban a player from the currently active game session, only available on the server + // Note that the default gamesession class does not implement an actual ban list and just kicks when this is called + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject")) + static bool BanPlayer(UObject* WorldContextObject, APlayerController* PlayerToBan, FText BanReason); + + //********* Session Search Functions *************// + + // Adds or modifies session settings in an existing array depending on if they exist already or not + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") + static void AddOrModifyExtraSettings(UPARAM(ref) TArray& SettingsArray, UPARAM(ref) TArray& NewOrChangedSettings, TArray& ModifiedSettingsArray); + + // Get an array of the session settings from a session search result + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") + static void GetExtraSettings(FBlueprintSessionResult SessionResult, TArray& ExtraSettings); + + // Get the current session state + 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", WorldContext = "WorldContextObject")) + static void GetSessionSettings(UObject* WorldContextObject, int32& NumConnections, int32& NumPrivateConnections, bool& bIsLAN, bool& bIsDedicated, bool& bAllowInvites, bool& bAllowJoinInProgress, bool& bIsAnticheatEnabled, int32& BuildUniqueID, TArray& ExtraSettings, EBlueprintResultSwitch& Result); + + // Check if someone is in the current session + 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") + static FSessionsSearchSetting MakeLiteralSessionSearchProperty(FSessionPropertyKeyPair SessionSearchProperty, EOnlineComparisonOpRedux ComparisonOp); + + //********* Session Information Functions ***********// + + // Check if a session result is valid or not + 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); + + // Get the Unique Build ID from a session search result + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo") + static void GetUniqueBuildID(FBlueprintSessionResult SessionResult, int32& UniqueBuildId); + + // Thanks CriErr for submission + + // Get session property Key Name value + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") + static FName GetSessionPropertyKey(const FSessionPropertyKeyPair& SessionProperty); + + // Find session property by Name + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result")) + static void FindSessionPropertyByName(const TArray& ExtraSettings, FName SettingsName, EBlueprintResultSwitch& Result, FSessionPropertyKeyPair& OutProperty); + + // Find session property index by Name + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result")) + static void FindSessionPropertyIndexByName(const TArray& ExtraSettings, FName SettingName, EBlueprintResultSwitch& Result, int32& OutIndex); + + /// Removed the Index_None part of the last function, that isn't accessible in blueprint, better to return success/failure + // End Thanks CriErr :p + + // Get session custom information key/value as Byte (For Enums) + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) + static void GetSessionPropertyByte(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, uint8& SettingValue); + + // Get session custom information key/value as Bool + // Steam only currently supports Int,Float,String,BYTE values for search filtering!!! + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) + static void GetSessionPropertyBool(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, bool& SettingValue); + + // Get session custom information key/value as String + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) + static void GetSessionPropertyString(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, FString& SettingValue); + + // Get session custom information key/value as Int + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) + static void GetSessionPropertyInt(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, int32& SettingValue); + + // Get session custom information key/value as Float + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) + static void GetSessionPropertyFloat(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, float& SettingValue); + + // Make a literal session custom information key/value pair from Byte (For Enums) + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") + static FSessionPropertyKeyPair MakeLiteralSessionPropertyByte(FName Key, uint8 Value); + + // Make a literal session custom information key/value pair from Bool + // Steam only currently supports Int,Float,String,BYTE values for search filtering! + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") + static FSessionPropertyKeyPair MakeLiteralSessionPropertyBool(FName Key, bool Value); + + // Make a literal session custom information key/value pair from String + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") + static FSessionPropertyKeyPair MakeLiteralSessionPropertyString(FName Key, FString Value); + + // Make a literal session custom information key/value pair from Int + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") + static FSessionPropertyKeyPair MakeLiteralSessionPropertyInt(FName Key, int32 Value); + + // Make a literal session custom information key/value pair from Float + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") + static FSessionPropertyKeyPair MakeLiteralSessionPropertyFloat(FName Key, float Value); + + //******* Player ID functions *********// + + // Get the unique net id of a network player attached to the given controller + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") + static void GetUniqueNetID(APlayerController* PlayerController, 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); + + // Return True if Unique Net ID is valid + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") + static bool IsValidUniqueNetID(const FBPUniqueNetId& UniqueNetId); - // Get the current session settings - 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 &ExtraSettings, EBlueprintResultSwitch &Result); + /* Returns true if the values are equal (A == B) */ + UFUNCTION(BlueprintPure, meta = (DisplayName = "Equal Unique Net ID", CompactNodeTitle = "==", Keywords = "== equal"), Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") + static bool EqualEqual_UNetIDUnetID(const FBPUniqueNetId& A, const FBPUniqueNetId& B); - // Check if someone is in the current session - 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") - static FSessionsSearchSetting MakeLiteralSessionSearchProperty(FSessionPropertyKeyPair SessionSearchProperty, EOnlineComparisonOpRedux ComparisonOp); - - - //********* Session Information Functions ***********// - - // Check if a session result is valid or not - 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); - - // Get the Unique Build ID from a session search result - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo") - static void GetUniqueBuildID(FBlueprintSessionResult SessionResult, int32 &UniqueBuildId); - - - // Thanks CriErr for submission + /** Converts a FBPUniqueNetID into a FUniqueNetID_Repl */ + UFUNCTION(BlueprintPure, meta = (DisplayName = "ToUniqueNetIDRepl (Unique Net ID)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") + static FUniqueNetIdRepl Conv_BPUniqueIDToUniqueNetIDRepl(const FBPUniqueNetId& InUniqueID); + // Check if a UniqueNetId is a friend + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|UniqueNetId") + static void UniqueNetIdToString(const FBPUniqueNetId& UniqueNetId, FString& String); - // Get session property Key Name value - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo") - static FName GetSessionPropertyKey(const FSessionPropertyKeyPair& SessionProperty); - - // Find session property by Name - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result")) - static void FindSessionPropertyByName(const TArray& ExtraSettings, FName SettingsName, EBlueprintResultSwitch &Result, FSessionPropertyKeyPair& OutProperty); - - // Find session property index by Name - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result")) - static void FindSessionPropertyIndexByName(const TArray& ExtraSettings, FName SettingName, EBlueprintResultSwitch &Result, int32& OutIndex); - - /// Removed the Index_None part of the last function, that isn't accessible in blueprint, better to return success/failure - // End Thanks CriErr :p + //******** Player Name Functions **********// - // Get session custom information key/value as Byte (For Enums) - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) - static void GetSessionPropertyByte(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, uint8 &SettingValue); - - // Get session custom information key/value as Bool - // Steam only currently supports Int,Float,String,BYTE values for search filtering!!! - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) - static void GetSessionPropertyBool(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, bool &SettingValue); - - // Get session custom information key/value as String - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) - static void GetSessionPropertyString(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, FString &SettingValue); - - // Get session custom information key/value as Int - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) - static void GetSessionPropertyInt(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, int32 &SettingValue); - - // Get session custom information key/value as Float - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult")) - static void GetSessionPropertyFloat(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, float &SettingValue); - - - // Make a literal session custom information key/value pair from Byte (For Enums) - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") - static FSessionPropertyKeyPair MakeLiteralSessionPropertyByte(FName Key, uint8 Value); - - // Make a literal session custom information key/value pair from Bool - // Steam only currently supports Int,Float,String,BYTE values for search filtering! - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") - static FSessionPropertyKeyPair MakeLiteralSessionPropertyBool(FName Key, bool Value); + // Get the player name of a network player attached to the given controller + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerName") + static void GetPlayerName(APlayerController* PlayerController, FString& PlayerName); - // Make a literal session custom information key/value pair from String - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") - static FSessionPropertyKeyPair MakeLiteralSessionPropertyString(FName Key, FString Value); - - // Make a literal session custom information key/value pair from Int - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") - static FSessionPropertyKeyPair MakeLiteralSessionPropertyInt(FName Key, int32 Value); - - // Make a literal session custom information key/value pair from Float - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals") - static FSessionPropertyKeyPair MakeLiteralSessionPropertyFloat(FName Key, float Value); - - - //******* Player ID functions *********// - - // Get the unique net id of a network player attached to the given controller - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") - static void GetUniqueNetID(APlayerController *PlayerController, 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); - - // Return True if Unique Net ID is valid - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") - static bool IsValidUniqueNetID(const FBPUniqueNetId &UniqueNetId); + // Set the player name of a network player attached to the given controller + UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|PlayerInfo|PlayerName") + static void SetPlayerName(APlayerController* PlayerController, FString PlayerName); - /* Returns true if the values are equal (A == B) */ - UFUNCTION(BlueprintPure, meta = (DisplayName = "Equal Unique Net ID", CompactNodeTitle = "==", Keywords = "== equal"), Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") - static bool EqualEqual_UNetIDUnetID(const FBPUniqueNetId &A, const FBPUniqueNetId &B); - - /** Converts a FBPUniqueNetID into a FUniqueNetID_Repl */ - UFUNCTION(BlueprintPure, meta = (DisplayName = "ToUniqueNetIDRepl (Unique Net ID)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Online|AdvancedSessions|PlayerInfo|PlayerID") - static FUniqueNetIdRepl Conv_BPUniqueIDToUniqueNetIDRepl(const FBPUniqueNetId& InUniqueID); - - // Check if a UniqueNetId is a friend - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|UniqueNetId") - static void UniqueNetIdToString(const FBPUniqueNetId &UniqueNetId, FString &String); - - //******** Player Name Functions **********// - - // Get the player name of a network player attached to the given controller - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerName") - static void GetPlayerName(APlayerController *PlayerController, FString &PlayerName); - - // Set the player name of a network player attached to the given controller - UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|PlayerInfo|PlayerName") - static void SetPlayerName(APlayerController *PlayerController, FString PlayerName); + //********** Misc Player Info Functions *********// - //********** Misc Player Info Functions *********// + // Get the number of network players + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|Misc", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", DisplayName = "GetNumNetworkPlayers")) + static void GetNumberOfNetworkPlayers(UObject* WorldContextObject, int32& NumNetPlayers); - // Get the number of network players - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|Misc", meta = (bIgnoreSelf = "true", WorldContext = "WorldContextObject", DisplayName = "GetNumNetworkPlayers")) - static void GetNumberOfNetworkPlayers(UObject* WorldContextObject, int32 &NumNetPlayers); - - // Get the network player index of the given controller - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|Misc") - static void GetNetPlayerIndex(APlayerController *PlayerController, int32 &NetPlayerIndex); + // Get the network player index of the given controller + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|Misc") + static void GetNetPlayerIndex(APlayerController* PlayerController, int32& NetPlayerIndex); - // Checks if the stated session subsystem is active - UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc") - static bool HasOnlineSubsystem(FName SubSystemName); + // Checks if the stated session subsystem is active + UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc") + static bool HasOnlineSubsystem(FName SubSystemName); - //**** Seamless travel Functions ****// + //**** Seamless travel Functions ****// - //Exposes Server travel to blueprint - UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject")) - static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify); - -}; + // Exposes Server travel to blueprint + UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject")) + static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify); +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedVoiceLibrary.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedVoiceLibrary.h index da1128d..445ef15 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedVoiceLibrary.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedVoiceLibrary.h @@ -1,39 +1,35 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" +#include "Interfaces/VoiceInterface.h" #include "Kismet/BlueprintFunctionLibrary.h" -#include "BlueprintDataDefinitions.h" #include "Online.h" #include "OnlineSubsystem.h" -#include "Interfaces/VoiceInterface.h" -//#include "OnlineFriendsInterface.h" -//#include "OnlineUserInterface.h" -//#include "OnlineMessageInterface.h" -//#include "OnlinePresenceInterface.h" +// #include "OnlineFriendsInterface.h" +// #include "OnlineUserInterface.h" +// #include "OnlineMessageInterface.h" +// #include "OnlinePresenceInterface.h" #include "Engine/GameInstance.h" -//#include "OnlineSessionInterface.h" +// #include "OnlineSessionInterface.h" #include "UObject/UObjectIterator.h" - #include "AdvancedVoiceLibrary.generated.h" - -//General Advanced Sessions Log +// General Advanced Sessions Log DECLARE_LOG_CATEGORY_EXTERN(AdvancedVoiceLog, Log, All); - UCLASS() class UAdvancedVoiceLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: - //********* Voice Library Functions *************// // Get if a headset is present for the specified local user UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo", meta = (WorldContext = "WorldContextObject")) - static void IsHeadsetPresent(UObject* WorldContextObject, bool & bHasHeadset, uint8 LocalPlayerNum = 0); + static void IsHeadsetPresent(UObject* WorldContextObject, bool& bHasHeadset, uint8 LocalPlayerNum = 0); // Starts networked voice, allows push to talk in coordination with StopNetworkedVoice UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject")) @@ -95,5 +91,5 @@ class UAdvancedVoiceLibrary : public UBlueprintFunctionLibrary // Gets the number of local talkers for this system UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo", meta = (WorldContext = "WorldContextObject")) - static void GetNumLocalTalkers(UObject* WorldContextObject, int32 & NumLocalTalkers); -}; + static void GetNumLocalTalkers(UObject* WorldContextObject, int32& NumLocalTalkers); +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AutoLoginUserCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AutoLoginUserCallbackProxy.h index d07a666..fccf81a 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AutoLoginUserCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AutoLoginUserCallbackProxy.h @@ -1,10 +1,10 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" -#include "Interfaces/OnlineIdentityInterface.h" +#include "CoreMinimal.h" #include "Engine/LocalPlayer.h" +#include "Interfaces/OnlineIdentityInterface.h" #include "AutoLoginUserCallbackProxy.generated.h" UCLASS(MinimalAPI) @@ -29,7 +29,7 @@ class UAutoLoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase * @param LocalUserNum the controller number of the associated user * */ - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedIdentity") static UAutoLoginUserCallbackProxy* AutoLoginUser(UObject* WorldContextObject, int32 LocalUserNum); // UOnlineBlueprintCallProxyBase interface diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/BlueprintDataDefinitions.h b/AdvancedSessions/Source/AdvancedSessions/Classes/BlueprintDataDefinitions.h index b5dc438..6f45fc5 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/BlueprintDataDefinitions.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/BlueprintDataDefinitions.h @@ -1,20 +1,20 @@ #pragma once #include "CoreMinimal.h" -//#include "EngineMinimal.h" +// #include "EngineMinimal.h" #include "Engine/Engine.h" #include "GameFramework/PlayerState.h" -//#include "Core.h" +// #include "Core.h" +#include "GameFramework/PlayerController.h" #include "Interfaces/OnlineSessionInterface.h" -#include "OnlineSessionSettings.h" +#include "Modules/ModuleManager.h" #include "OnlineDelegateMacros.h" +#include "OnlineSessionSettings.h" #include "OnlineSubsystem.h" #include "OnlineSubsystemImpl.h" #include "OnlineSubsystemUtils.h" -#include "OnlineSubsystemUtilsModule.h" -#include "GameFramework/PlayerController.h" -#include "Modules/ModuleManager.h" #include "OnlineSubsystemUtilsClasses.h" -#include "BlueprintDataDefinitions.generated.h" +#include "OnlineSubsystemUtilsModule.h" +#include "BlueprintDataDefinitions.generated.h" UENUM(BlueprintType) enum class EBPUserPrivileges : uint8 @@ -29,7 +29,6 @@ enum class EBPUserPrivileges : uint8 CanUseUserGeneratedContent }; - UENUM(BlueprintType) enum class EBPLoginStatus : uint8 { @@ -41,7 +40,6 @@ enum class EBPLoginStatus : uint8 LoggedIn }; - USTRUCT(BlueprintType) struct FBPUserOnlineAccount { @@ -52,7 +50,6 @@ struct FBPUserOnlineAccount FBPUserOnlineAccount() { - } FBPUserOnlineAccount(TSharedPtr UserAccount) @@ -152,19 +149,18 @@ struct FBPUniqueNetId private: bool bUseDirectPointer; - public: TSharedPtr UniqueNetId; - const FUniqueNetId * UniqueNetIdPtr; + const FUniqueNetId* UniqueNetIdPtr; - void SetUniqueNetId(const TSharedPtr &ID) + void SetUniqueNetId(const TSharedPtr& ID) { bUseDirectPointer = false; UniqueNetIdPtr = nullptr; UniqueNetId = ID; } - void SetUniqueNetId(const FUniqueNetId *ID) + void SetUniqueNetId(const FUniqueNetId* ID) { bUseDirectPointer = true; UniqueNetIdPtr = ID; @@ -181,8 +177,9 @@ struct FBPUniqueNetId return true; } else + { return false; - + } } const FUniqueNetId* GetUniqueNetId() const @@ -190,14 +187,16 @@ struct FBPUniqueNetId if (bUseDirectPointer && UniqueNetIdPtr != nullptr) { // No longer converting to non const as all functions now pass const UniqueNetIds - return /*const_cast*/(UniqueNetIdPtr); + return /*const_cast*/ (UniqueNetIdPtr); } else if (UniqueNetId.IsValid()) { return UniqueNetId.Get(); } else + { return nullptr; + } } // Adding in a compare operator so that std functions will work with this struct @@ -225,11 +224,11 @@ struct FBPOnlineUser public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - FBPUniqueNetId UniqueNetId; + FBPUniqueNetId UniqueNetId; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - FString DisplayName; + FString DisplayName; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - FString RealName; + FString RealName; }; USTRUCT(BluePrintType) @@ -239,31 +238,29 @@ struct FBPOnlineRecentPlayer : public FBPOnlineUser public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - FString LastSeen; + FString LastSeen; }; - USTRUCT(BlueprintType) struct FBPFriendPresenceInfo { GENERATED_USTRUCT_BODY() public: - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - bool bIsOnline = false; + bool bIsOnline = false; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - bool bIsPlaying = false; + bool bIsPlaying = false; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - bool bIsPlayingThisGame = false; + bool bIsPlayingThisGame = false; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - bool bIsJoinable = false; + bool bIsJoinable = false; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - bool bHasVoiceSupport = false; + bool bHasVoiceSupport = false; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - EBPOnlinePresenceState PresenceState = EBPOnlinePresenceState::Offline; + EBPOnlinePresenceState PresenceState = EBPOnlinePresenceState::Offline; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") - FString StatusString; + FString StatusString; FBPFriendPresenceInfo() { @@ -282,7 +279,6 @@ struct FBPFriendInfo GENERATED_USTRUCT_BODY() public: - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") FString DisplayName; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend") @@ -303,7 +299,6 @@ struct FBPFriendInfo } }; - /** The types of comparison operations for a given search query */ // Used to compare session properties UENUM(BlueprintType) @@ -317,7 +312,6 @@ enum class EOnlineComparisonOpRedux : uint8 LessThanEquals, }; - // Used to store session properties before converting to FVariantData USTRUCT(BlueprintType) struct FSessionPropertyKeyPair @@ -328,14 +322,12 @@ struct FSessionPropertyKeyPair FVariantData Data; }; - // Sent to the FindSessionsAdvanced to filter the end results USTRUCT(BlueprintType) struct FSessionsSearchSetting { GENERATED_USTRUCT_BODY() - //UPROPERTY() - + // UPROPERTY() // Had to make a copy of this to account for the original not being exposed to blueprints /** How is this session setting compared on the backend searches */ @@ -351,8 +343,8 @@ struct FOnlineSubsystemBPCallHelperAdvanced { public: FOnlineSubsystemBPCallHelperAdvanced(const TCHAR* CallFunctionContext, UWorld* World, FName SystemName = NAME_None) - : OnlineSub(Online::GetSubsystem(World, SystemName)) - , FunctionContext(CallFunctionContext) + : OnlineSub(Online::GetSubsystem(World, SystemName)) + , FunctionContext(CallFunctionContext) { if (OnlineSub == nullptr) { @@ -363,7 +355,7 @@ struct FOnlineSubsystemBPCallHelperAdvanced void QueryIDFromPlayerController(APlayerController* PlayerController) { UserID.Reset(); - //return const_cast(UniqueNetIdPtr); + // return const_cast(UniqueNetIdPtr); if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL) { UserID = PlayerState->GetUniqueId().GetUniqueNetId(); @@ -378,14 +370,13 @@ struct FOnlineSubsystemBPCallHelperAdvanced } } - bool IsValid() const { return UserID.IsValid() && (OnlineSub != nullptr); } public: - //TSharedPtr& GetUniqueNetId() + // TSharedPtr& GetUniqueNetId() TSharedPtr UserID; IOnlineSubsystem* const OnlineSub; const TCHAR* FunctionContext; @@ -393,14 +384,13 @@ struct FOnlineSubsystemBPCallHelperAdvanced class FOnlineSearchSettingsEx : public FOnlineSearchSettings { /** - * Sets a key value pair combination that defines a search parameter - * - * @param Key key for the setting - * @param Value value of the setting - * @param InType type of comparison - */ + * Sets a key value pair combination that defines a search parameter + * + * @param Key key for the setting + * @param Value value of the setting + * @param InType type of comparison + */ public: - void HardSet(FName Key, const FVariantData& Value, EOnlineComparisonOpRedux CompOp) { FOnlineSessionSearchParam* SearchParam = SearchParams.Find(Key); @@ -409,13 +399,13 @@ class FOnlineSearchSettingsEx : public FOnlineSearchSettings switch (CompOp) { - case EOnlineComparisonOpRedux::Equals: op = EOnlineComparisonOp::Equals; break; - case EOnlineComparisonOpRedux::GreaterThan: op = EOnlineComparisonOp::GreaterThan; break; - case EOnlineComparisonOpRedux::GreaterThanEquals: op = EOnlineComparisonOp::GreaterThanEquals; break; - case EOnlineComparisonOpRedux::LessThan: op = EOnlineComparisonOp::LessThan; break; - case EOnlineComparisonOpRedux::LessThanEquals: op = EOnlineComparisonOp::LessThanEquals; break; - case EOnlineComparisonOpRedux::NotEquals: op = EOnlineComparisonOp::NotEquals; break; - default: op = EOnlineComparisonOp::Equals; break; + case EOnlineComparisonOpRedux::Equals: op = EOnlineComparisonOp::Equals; break; + case EOnlineComparisonOpRedux::GreaterThan: op = EOnlineComparisonOp::GreaterThan; break; + case EOnlineComparisonOpRedux::GreaterThanEquals: op = EOnlineComparisonOp::GreaterThanEquals; break; + case EOnlineComparisonOpRedux::LessThan: op = EOnlineComparisonOp::LessThan; break; + case EOnlineComparisonOpRedux::LessThanEquals: op = EOnlineComparisonOp::LessThanEquals; break; + case EOnlineComparisonOpRedux::NotEquals: op = EOnlineComparisonOp::NotEquals; break; + default: op = EOnlineComparisonOp::Equals; break; } if (SearchParam) @@ -432,4 +422,4 @@ class FOnlineSearchSettingsEx : public FOnlineSearchSettings } }; -#define INVALID_INDEX -1 \ No newline at end of file +#define INVALID_INDEX -1 diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/CancelFindSessionsCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/CancelFindSessionsCallbackProxy.h index 58d2ea0..30776a6 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/CancelFindSessionsCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/CancelFindSessionsCallbackProxy.h @@ -1,9 +1,9 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" #include "Engine/Engine.h" #include "Interfaces/OnlineSessionInterface.h" -#include "BlueprintDataDefinitions.h" #include "CancelFindSessionsCallbackProxy.generated.h" UCLASS(MinimalAPI) @@ -20,7 +20,7 @@ class UCancelFindSessionsCallbackProxy : public UOnlineBlueprintCallProxyBase FEmptyOnlineDelegate OnFailure; // Cancels finding sessions - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedSessions") static UCancelFindSessionsCallbackProxy* CancelFindSessions(UObject* WorldContextObject, class APlayerController* PlayerController); // UOnlineBlueprintCallProxyBase interface diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/CreateSessionCallbackProxyAdvanced.h b/AdvancedSessions/Source/AdvancedSessions/Classes/CreateSessionCallbackProxyAdvanced.h index 448c587..600615e 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/CreateSessionCallbackProxyAdvanced.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/CreateSessionCallbackProxyAdvanced.h @@ -1,9 +1,9 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" #include "Engine/Engine.h" -#include "BlueprintDataDefinitions.h" #include "CreateSessionCallbackProxyAdvanced.generated.h" UCLASS(MinimalAPI) @@ -29,8 +29,8 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase * @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& 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); + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AutoCreateRefTerm = "ExtraSettings"), Category = "Online|AdvancedSessions") + static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray& 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; @@ -104,4 +104,3 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase // The world context object in which this call is taking place TWeakObjectPtr WorldContextObject; }; - diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/EndSessionCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/EndSessionCallbackProxy.h index e527c58..2d5d6f6 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/EndSessionCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/EndSessionCallbackProxy.h @@ -1,9 +1,9 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" #include "Engine/Engine.h" #include "Interfaces/OnlineSessionInterface.h" -#include "BlueprintDataDefinitions.h" #include "EndSessionCallbackProxy.generated.h" UCLASS(MinimalAPI) @@ -23,7 +23,7 @@ class UEndSessionCallbackProxy : public UOnlineBlueprintCallProxyBase * Ends the current sessions, Generally for almost all uses you should be using the engines native Destroy Session node instead. * This exists for people using StartSession and optionally hand managing the session state. */ - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedSessions") static UEndSessionCallbackProxy* EndSession(UObject* WorldContextObject, class APlayerController* PlayerController); // UOnlineBlueprintCallProxyBase interface diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/FindFriendSessionCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/FindFriendSessionCallbackProxy.h index 58ef8f5..db3db16 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/FindFriendSessionCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/FindFriendSessionCallbackProxy.h @@ -1,14 +1,14 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" #include "Engine/LocalPlayer.h" #include "FindFriendSessionCallbackProxy.generated.h" DECLARE_LOG_CATEGORY_EXTERN(AdvancedFindFriendSessionLog, Log, All); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintFindFriendSessionDelegate, const TArray &, SessionInfo); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintFindFriendSessionDelegate, const TArray&, SessionInfo); UCLASS(MinimalAPI) class UFindFriendSessionCallbackProxy : public UOnlineBlueprintCallProxyBase @@ -24,8 +24,8 @@ class UFindFriendSessionCallbackProxy : public UOnlineBlueprintCallProxyBase FBlueprintFindFriendSessionDelegate OnFailure; // Attempts to get the current session that a friend is in - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends") - static UFindFriendSessionCallbackProxy* FindFriendSession(UObject* WorldContextObject, APlayerController *PlayerController, const FBPUniqueNetId &FriendUniqueNetId); + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedFriends") + static UFindFriendSessionCallbackProxy* FindFriendSession(UObject* WorldContextObject, APlayerController* PlayerController, const FBPUniqueNetId& FriendUniqueNetId); virtual void Activate() override; @@ -48,4 +48,3 @@ class UFindFriendSessionCallbackProxy : public UOnlineBlueprintCallProxyBase // The world context object in which this call is taking place TWeakObjectPtr WorldContextObject; }; - diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h b/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h index 5d225d8..839457c 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h @@ -1,13 +1,12 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" #include "Engine/Engine.h" -#include "Interfaces/OnlineSessionInterface.h" #include "FindSessionsCallbackProxy.h" -#include "BlueprintDataDefinitions.h" +#include "Interfaces/OnlineSessionInterface.h" #include "FindSessionsCallbackProxyAdvanced.generated.h" - FORCEINLINE bool operator==(const FBlueprintSessionResult& A, const FBlueprintSessionResult& B) { return (A.OnlineResult.IsValid() == B.OnlineResult.IsValid() && (A.OnlineResult.GetSessionIdStr() == B.OnlineResult.GetSessionIdStr())); @@ -27,15 +26,15 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase FBlueprintFindSessionsResultDelegate OnFailure; // 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 &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, /*bool bSearchLobbies = true,*/ int MinSlotsAvailable = 0); + 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& 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); - static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux Comparator); - // Filters an array of session results by the given search parameters, returns a new array with the filtered results UFUNCTION(BluePrintCallable, meta = (Category = "Online|AdvancedSessions")) - static void FilterSessionResults(const TArray &SessionResults, const TArray &Filters, TArray &FilteredResults); - + static void FilterSessionResults(const TArray& SessionResults, const TArray& Filters, TArray& FilteredResults); + // Removed, the default built in versions work fine in the normal FindSessionsCallbackProxy /*UFUNCTION(BlueprintPure, Category = "Online|Session") static int32 GetPingInMs(const FBlueprintSessionResult& Result); @@ -49,7 +48,6 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase UFUNCTION(BlueprintPure, Category = "Online|Session") static int32 GetMaxPlayers(const FBlueprintSessionResult& Result);*/ - // UOnlineBlueprintCallProxyBase interface virtual void Activate() override; // End of UOnlineBlueprintCallProxyBase interface @@ -99,7 +97,7 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase bool bSecureServersOnly; // Search through lobbies - //bool bSearchLobbies; + // bool bSearchLobbies; // Min slots requires to search int MinSlotsAvailable; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/GetFriendsCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/GetFriendsCallbackProxy.h index 844bef6..532f8ac 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/GetFriendsCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/GetFriendsCallbackProxy.h @@ -1,8 +1,8 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" #include "Engine/LocalPlayer.h" #include "GetFriendsCallbackProxy.generated.h" @@ -24,7 +24,7 @@ class UGetFriendsCallbackProxy : public UOnlineBlueprintCallProxyBase FBlueprintGetFriendsListDelegate OnFailure; // Gets the players list of friends from the OnlineSubsystem and returns it, can be retrieved later with GetStoredFriendsList - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedFriends") static UGetFriendsCallbackProxy* GetAndStoreFriendsList(UObject* WorldContextObject, class APlayerController* PlayerController); virtual void Activate() override; @@ -41,9 +41,8 @@ class UGetFriendsCallbackProxy : public UOnlineBlueprintCallProxyBase // The Type of friends list to get // Removed because all but the facebook interfaces don't even currently support anything but the default friends list. - //EBPFriendsLists FriendListToGet; + // EBPFriendsLists FriendListToGet; // The world context object in which this call is taking place TWeakObjectPtr WorldContextObject; }; - diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/GetRecentPlayersCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/GetRecentPlayersCallbackProxy.h index 2b12c9f..5ede487 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/GetRecentPlayersCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/GetRecentPlayersCallbackProxy.h @@ -1,8 +1,8 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" #include "GetRecentPlayersCallbackProxy.generated.h" DECLARE_LOG_CATEGORY_EXTERN(AdvancedGetRecentPlayersLog, Log, All); @@ -23,19 +23,19 @@ class UGetRecentPlayersCallbackProxy : public UOnlineBlueprintCallProxyBase FBlueprintGetRecentPlayersDelegate OnFailure; // Gets the list of recent players from the OnlineSubsystem and returns it, can be retrieved later with GetStoredRecentPlayersList, can fail if no recent players are found - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends") - static UGetRecentPlayersCallbackProxy* GetAndStoreRecentPlayersList(UObject* WorldContextObject, const FBPUniqueNetId &UniqueNetId); + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedFriends") + static UGetRecentPlayersCallbackProxy* GetAndStoreRecentPlayersList(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId); virtual void Activate() override; private: // Internal callback when the friends list is retrieved - void OnQueryRecentPlayersCompleted(const FUniqueNetId &UserID, const FString &Namespace, bool bWasSuccessful, const FString& ErrorString); + void OnQueryRecentPlayersCompleted(const FUniqueNetId& UserID, const FString& Namespace, bool bWasSuccessful, const FString& ErrorString); // Handle to the registered OnFindSessionsComplete delegate FDelegateHandle DelegateHandle; // The player controller triggering things - //TWeakObjectPtr PlayerControllerWeakPtr; + // TWeakObjectPtr PlayerControllerWeakPtr; // The UniqueNetID of the person to get recent players for FBPUniqueNetId cUniqueNetId; @@ -46,4 +46,3 @@ class UGetRecentPlayersCallbackProxy : public UOnlineBlueprintCallProxyBase // The world context object in which this call is taking place TWeakObjectPtr WorldContextObject; }; - diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/GetUserPrivilegeCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/GetUserPrivilegeCallbackProxy.h index f47d2a5..7c61aac 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/GetUserPrivilegeCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/GetUserPrivilegeCallbackProxy.h @@ -1,12 +1,12 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" #include "Interfaces/OnlineIdentityInterface.h" #include "GetUserPrivilegeCallbackProxy.generated.h" -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FBlueprintGetUserPrivilegeDelegate,/* const &FBPUniqueNetId, PlayerID,*/ EBPUserPrivileges, QueriedPrivilege, bool, HadPrivilege); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FBlueprintGetUserPrivilegeDelegate, /* const &FBPUniqueNetId, PlayerID,*/ EBPUserPrivileges, QueriedPrivilege, bool, HadPrivilege); UCLASS(MinimalAPI) class UGetUserPrivilegeCallbackProxy : public UOnlineBlueprintCallProxyBase @@ -22,8 +22,8 @@ class UGetUserPrivilegeCallbackProxy : public UOnlineBlueprintCallProxyBase FEmptyOnlineDelegate OnFailure; // Gets the privilage of the user - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity") - static UGetUserPrivilegeCallbackProxy* GetUserPrivilege(UObject* WorldContextObject, const EBPUserPrivileges & PrivilegeToCheck, const FBPUniqueNetId & PlayerUniqueNetID); + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedIdentity") + static UGetUserPrivilegeCallbackProxy* GetUserPrivilege(UObject* WorldContextObject, const EBPUserPrivileges& PrivilegeToCheck, const FBPUniqueNetId& PlayerUniqueNetID); // UOnlineBlueprintCallProxyBase interface virtual void Activate() override; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/LoginUserCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/LoginUserCallbackProxy.h index ba65b68..274c725 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/LoginUserCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/LoginUserCallbackProxy.h @@ -1,10 +1,10 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" -#include "Interfaces/OnlineIdentityInterface.h" +#include "CoreMinimal.h" #include "Engine/LocalPlayer.h" +#include "Interfaces/OnlineIdentityInterface.h" #include "LoginUserCallbackProxy.generated.h" UCLASS(MinimalAPI) @@ -21,7 +21,7 @@ class ULoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase FEmptyOnlineDelegate OnFailure; // Logs into the identity interface - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject", AdvancedDisplay = "AuthType"), Category = "Online|AdvancedIdentity") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AdvancedDisplay = "AuthType"), Category = "Online|AdvancedIdentity") static ULoginUserCallbackProxy* LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken, FString AuthType); // UOnlineBlueprintCallProxyBase interface diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/LogoutUserCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/LogoutUserCallbackProxy.h index 5f85b0a..7927451 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/LogoutUserCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/LogoutUserCallbackProxy.h @@ -1,10 +1,10 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" -#include "Interfaces/OnlineIdentityInterface.h" +#include "CoreMinimal.h" #include "Engine/LocalPlayer.h" +#include "Interfaces/OnlineIdentityInterface.h" #include "LogoutUserCallbackProxy.generated.h" UCLASS(MinimalAPI) @@ -21,7 +21,7 @@ class ULogoutUserCallbackProxy : public UOnlineBlueprintCallProxyBase FEmptyOnlineDelegate OnFailure; // Logs out of the identity interface - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedIdentity") static ULogoutUserCallbackProxy* LogoutUser(UObject* WorldContextObject, class APlayerController* PlayerController); // UOnlineBlueprintCallProxyBase interface diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/OnlineSubSystemHeader.h b/AdvancedSessions/Source/AdvancedSessions/Classes/OnlineSubSystemHeader.h index ad4b18f..216e2ed 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/OnlineSubSystemHeader.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/OnlineSubSystemHeader.h @@ -1,18 +1,17 @@ #pragma once -//#include "EngineMinimal.h" -//#include "Core.h" -//#include "OnlineSessionInterface.h" -//#include "OnlineSessionSettings.h" -//#include "OnlineDelegateMacros.h" -//#include "OnlineSubsystem.h" -//#include "OnlineSubsystemImpl.h" -//#include "OnlineSubsystemUtils.h" -//#include "OnlineSubsystemUtilsModule.h" -//#include "ModuleManager.h" -//#include "OnlineSubsystemUtilsClasses.h" -//#include "BlueprintDataDefinitions.h" - +// #include "EngineMinimal.h" +// #include "Core.h" +// #include "OnlineSessionInterface.h" +// #include "OnlineSessionSettings.h" +// #include "OnlineDelegateMacros.h" +// #include "OnlineSubsystem.h" +// #include "OnlineSubsystemImpl.h" +// #include "OnlineSubsystemUtils.h" +// #include "OnlineSubsystemUtilsModule.h" +// #include "ModuleManager.h" +// #include "OnlineSubsystemUtilsClasses.h" +// #include "BlueprintDataDefinitions.h" /*#include "VoiceEngineImpl.h" #include "VoiceInterfaceImpl.h" @@ -21,7 +20,7 @@ // Found this in the steam controller, seems like a nice thought since steam is throwing errors // Disable crazy warnings that claim that standard C library is "deprecated". -//#ifdef _MSC_VER -//#pragma warning(push) -//#pragma warning(disable:4996) -//#endif +// #ifdef _MSC_VER +// #pragma warning(push) +// #pragma warning(disable:4996) +// #endif diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/SendFriendInviteCallbackProxy.h b/AdvancedSessions/Source/AdvancedSessions/Classes/SendFriendInviteCallbackProxy.h index e878f51..76902f9 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/SendFriendInviteCallbackProxy.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/SendFriendInviteCallbackProxy.h @@ -1,8 +1,8 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" #include "Engine/LocalPlayer.h" #include "SendFriendInviteCallbackProxy.generated.h" @@ -24,15 +24,14 @@ class USendFriendInviteCallbackProxy : public UOnlineBlueprintCallProxyBase FBlueprintSendFriendInviteDelegate OnFailure; // Adds a friend who is using the defined UniqueNetId, some interfaces do now allow this function to be called (INCLUDING STEAM) - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedFriends") - static USendFriendInviteCallbackProxy* SendFriendInvite(UObject* WorldContextObject, APlayerController *PlayerController, const FBPUniqueNetId &UniqueNetIDInvited); + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedFriends") + static USendFriendInviteCallbackProxy* SendFriendInvite(UObject* WorldContextObject, APlayerController* PlayerController, const FBPUniqueNetId& UniqueNetIDInvited); virtual void Activate() override; private: // Internal callback when the friends list is retrieved - void OnSendInviteComplete(int32 LocalPlayerNum, bool bWasSuccessful, const FUniqueNetId &InvitedPlayer, const FString &ListName, const FString &ErrorString); - + void OnSendInviteComplete(int32 LocalPlayerNum, bool bWasSuccessful, const FUniqueNetId& InvitedPlayer, const FString& ListName, const FString& ErrorString); // The player controller triggering things TWeakObjectPtr PlayerControllerWeakPtr; @@ -46,4 +45,3 @@ class USendFriendInviteCallbackProxy : public UOnlineBlueprintCallProxyBase // The world context object in which this call is taking place TWeakObjectPtr WorldContextObject; }; - diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/StartSessionCallbackProxyAdvanced.h b/AdvancedSessions/Source/AdvancedSessions/Classes/StartSessionCallbackProxyAdvanced.h index e82cce8..da1c85f 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/StartSessionCallbackProxyAdvanced.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/StartSessionCallbackProxyAdvanced.h @@ -1,7 +1,7 @@ #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" #include "StartSessionCallbackProxyAdvanced.generated.h" UCLASS(MinimalAPI) @@ -21,10 +21,7 @@ class UStartSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase * @param WorldContextObject */ UFUNCTION( - BlueprintCallable - , meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject") - , Category = "Online|AdvancedSessions" - ) + BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedSessions") static UStartSessionCallbackProxyAdvanced* StartAdvancedSession(UObject* WorldContextObject); // UOnlineBlueprintCallProxyBase interface @@ -43,4 +40,4 @@ class UStartSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase // The world context object in which this call is taking place TWeakObjectPtr WorldContextObject; -}; \ No newline at end of file +}; diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h b/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h index afdc181..55fa0bd 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h @@ -1,9 +1,9 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once +#include "BlueprintDataDefinitions.h" #include "CoreMinimal.h" #include "Engine/Engine.h" -#include "BlueprintDataDefinitions.h" #include "UpdateSessionCallbackProxyAdvanced.generated.h" UCLASS(MinimalAPI) @@ -20,8 +20,8 @@ class UUpdateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase FEmptyOnlineDelegate OnFailure; // 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 &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); + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AutoCreateRefTerm = "ExtraSettings"), Category = "Online|AdvancedSessions") + static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray& 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); // UOnlineBlueprintCallProxyBase interface virtual void Activate() override; @@ -66,4 +66,3 @@ class UUpdateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase // The world context object in which this call is taking place TWeakObjectPtr WorldContextObject; }; - diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedExternalUILibrary.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedExternalUILibrary.cpp index a1792a1..b774ac3 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedExternalUILibrary.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedExternalUILibrary.cpp @@ -2,11 +2,10 @@ #include "AdvancedExternalUILibrary.h" #include "Engine/LocalPlayer.h" - -//General Log +// General Log DEFINE_LOG_CATEGORY(AdvancedExternalUILog); -void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result) +void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch& Result) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); @@ -29,7 +28,7 @@ void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(UObject* WorldContextObjec Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedExternalUILibrary::ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result) +void UAdvancedExternalUILibrary::ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch& Result) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); @@ -47,14 +46,12 @@ void UAdvancedExternalUILibrary::ShowProfileUI(UObject* WorldContextObject, cons Result = EBlueprintResultSwitch::OnFailure; return; } - + ExternalUIInterface->ShowProfileUI(*PlayerViewingProfile.GetUniqueNetId(), *PlayerToViewProfileOf.GetUniqueNetId(), NULL); Result = EBlueprintResultSwitch::OnSuccess; } - - -void UAdvancedExternalUILibrary::ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch &Result, TArray& AllowedDomains, bool bEmbedded, bool bShowBackground, bool bShowCloseButton, int32 OffsetX, int32 OffsetY, int32 SizeX, int32 SizeY) +void UAdvancedExternalUILibrary::ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch& Result, TArray& AllowedDomains, bool bEmbedded, bool bShowBackground, bool bShowCloseButton, int32 OffsetX, int32 OffsetY, int32 SizeX, int32 SizeY) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); if (!IsValid(World)) @@ -108,7 +105,7 @@ void UAdvancedExternalUILibrary::CloseWebURLUI(UObject* WorldContextObject) ExternalUIInterface->CloseWebURL(); } -void UAdvancedExternalUILibrary::ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch &Result) +void UAdvancedExternalUILibrary::ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch& Result) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); if (!IsValid(World)) @@ -128,11 +125,9 @@ void UAdvancedExternalUILibrary::ShowLeaderBoardUI(UObject* WorldContextObject, ExternalUIInterface->ShowLeaderboardUI(LeaderboardName); Result = EBlueprintResultSwitch::OnSuccess; - } - -void UAdvancedExternalUILibrary::ShowInviteUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result) +void UAdvancedExternalUILibrary::ShowInviteUI(UObject* WorldContextObject, APlayerController* PlayerController, EBlueprintResultSwitch& Result) { if (!PlayerController) { @@ -170,7 +165,7 @@ void UAdvancedExternalUILibrary::ShowInviteUI(UObject* WorldContextObject, APlay Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedExternalUILibrary::ShowFriendsUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result) +void UAdvancedExternalUILibrary::ShowFriendsUI(UObject* WorldContextObject, APlayerController* PlayerController, EBlueprintResultSwitch& Result) { if (!PlayerController) { @@ -206,4 +201,4 @@ void UAdvancedExternalUILibrary::ShowFriendsUI(UObject* WorldContextObject, APla ExternalUIInterface->ShowFriendsUI(Player->GetControllerId()); Result = EBlueprintResultSwitch::OnSuccess; -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsGameInstance.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsGameInstance.cpp index 61633b4..f76c9a2 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsGameInstance.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsGameInstance.cpp @@ -1,22 +1,22 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedFriendsGameInstance.h" -#include "Kismet/GameplayStatics.h" #include "GameFramework/PlayerController.h" +#include "Kismet/GameplayStatics.h" -//General Log +// General Log DEFINE_LOG_CATEGORY(AdvancedFriendsInterfaceLog); -UAdvancedFriendsGameInstance::UAdvancedFriendsGameInstance(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , bCallFriendInterfaceEventsOnPlayerControllers(true) - , bCallIdentityInterfaceEventsOnPlayerControllers(true) - , bCallVoiceInterfaceEventsOnPlayerControllers(true) - , bEnableTalkingStatusDelegate(true) - , SessionInviteReceivedDelegate(FOnSessionInviteReceivedDelegate::CreateUObject(this, &ThisClass::OnSessionInviteReceivedMaster)) - , SessionInviteAcceptedDelegate(FOnSessionUserInviteAcceptedDelegate::CreateUObject(this, &ThisClass::OnSessionInviteAcceptedMaster)) - , PlayerTalkingStateChangedDelegate(FOnPlayerTalkingStateChangedDelegate::CreateUObject(this, &ThisClass::OnPlayerTalkingStateChangedMaster)) - , PlayerLoginChangedDelegate(FOnLoginChangedDelegate::CreateUObject(this, &ThisClass::OnPlayerLoginChangedMaster)) - , PlayerLoginStatusChangedDelegate(FOnLoginStatusChangedDelegate::CreateUObject(this, &ThisClass::OnPlayerLoginStatusChangedMaster)) +UAdvancedFriendsGameInstance::UAdvancedFriendsGameInstance(const FObjectInitializer& ObjectInitializer) + : Super(ObjectInitializer) + , bCallFriendInterfaceEventsOnPlayerControllers(true) + , bCallIdentityInterfaceEventsOnPlayerControllers(true) + , bCallVoiceInterfaceEventsOnPlayerControllers(true) + , bEnableTalkingStatusDelegate(true) + , SessionInviteReceivedDelegate(FOnSessionInviteReceivedDelegate::CreateUObject(this, &ThisClass::OnSessionInviteReceivedMaster)) + , SessionInviteAcceptedDelegate(FOnSessionUserInviteAcceptedDelegate::CreateUObject(this, &ThisClass::OnSessionInviteAcceptedMaster)) + , PlayerTalkingStateChangedDelegate(FOnPlayerTalkingStateChangedDelegate::CreateUObject(this, &ThisClass::OnPlayerTalkingStateChangedMaster)) + , PlayerLoginChangedDelegate(FOnLoginChangedDelegate::CreateUObject(this, &ThisClass::OnPlayerLoginChangedMaster)) + , PlayerLoginStatusChangedDelegate(FOnLoginStatusChangedDelegate::CreateUObject(this, &ThisClass::OnPlayerLoginStatusChangedMaster)) { } @@ -27,7 +27,7 @@ void UAdvancedFriendsGameInstance::OnSessionUserInviteAccepted(const bool bWasSu { SessionInterface->ClearOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegateHandle); OnJoinSessionCompleteDelegateHandle = SessionInterface->AddOnJoinSessionCompleteDelegate_Handle( - FOnJoinSessionCompleteDelegate::CreateUObject(this, &UAdvancedFriendsGameInstance::OnJoinSessionComplete)); + FOnJoinSessionCompleteDelegate::CreateUObject(this, &UAdvancedFriendsGameInstance::OnJoinSessionComplete)); // Temp for 5.5, they aren't filling in the struct correctly if (!InviteResult.Session.SessionSettings.bIsDedicated) @@ -65,11 +65,11 @@ void UAdvancedFriendsGameInstance::OnJoinSessionComplete(FName SessionName, EOnJ void UAdvancedFriendsGameInstance::Shutdown() { IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld()); - + if (!SessionInterface.IsValid()) { UE_LOG(AdvancedFriendsInterfaceLog, Warning, TEXT("UAdvancedFriendsGameInstance Failed to get session system!")); - //return; + // return; } else { @@ -79,7 +79,6 @@ void UAdvancedFriendsGameInstance::Shutdown() SessionInterface->ClearOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegateHandle); } - if (bEnableTalkingStatusDelegate) { IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld()); @@ -100,19 +99,17 @@ void UAdvancedFriendsGameInstance::Shutdown() if (IdentityInterface.IsValid()) { IdentityInterface->ClearOnLoginChangedDelegate_Handle(PlayerLoginChangedDelegateHandle); - // I am just defaulting to player 1 IdentityInterface->ClearOnLoginStatusChangedDelegate_Handle(0, PlayerLoginStatusChangedDelegateHandle); } - Super::Shutdown(); } void UAdvancedFriendsGameInstance::Init() { - IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());//OnlineSub->GetSessionInterface(); + IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld()); // OnlineSub->GetSessionInterface(); if (SessionInterface.IsValid()) { @@ -123,14 +120,14 @@ 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 { UE_LOG(AdvancedFriendsInterfaceLog, Warning, TEXT("UAdvancedFriendsInstance Failed to get session interface!")); - //return; + // return; } // Beginning work on the voice interface @@ -163,57 +160,54 @@ void UAdvancedFriendsGameInstance::Init() UE_LOG(AdvancedFriendsInterfaceLog, Warning, TEXT("UAdvancedFriendsInstance Failed to get identity interface!")); } - Super::Init(); } /*void UAdvancedFriendsGameInstance::PostLoad() { - Super::PostLoad(); + Super::PostLoad(); }*/ - // Removed because it never gets called by the online subsystems /*void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNetId &InvitedPlayer, const FUniqueNetId &FriendInviting, const FOnlineSessionSearchResult& Session) { - // Just call the blueprint event to let the user handle this + // Just call the blueprint event to let the user handle this - FBPUniqueNetId IP, FI; + FBPUniqueNetId IP, FI; - IP.SetUniqueNetId(&InvitedPlayer); + IP.SetUniqueNetId(&InvitedPlayer); - FI.SetUniqueNetId(&FriendInviting); + FI.SetUniqueNetId(&FriendInviting); - FBlueprintSessionResult BPS; - BPS.OnlineResult = Session; - OnSessionInviteReceived(IP,FI,BPS); + FBlueprintSessionResult BPS; + BPS.OnlineResult = Session; + OnSessionInviteReceived(IP,FI,BPS); - TArray& PlayerArray = GetWorld()->GetGameState()->PlayerArray; - const TArray&ControllerArray = this->GetLocalPlayers(); + TArray& PlayerArray = GetWorld()->GetGameState()->PlayerArray; + const TArray&ControllerArray = this->GetLocalPlayers(); - for (int i = 0; i < ControllerArray.Num(); i++) - { - if (*PlayerArray[ControllerArray[i]->PlayerController->NetPlayerIndex]->UniqueId.GetUniqueNetId().Get() == InvitedPlayer) - { - //Run the Event specific to the actor, if the actor has the interface, otherwise ignore - if (ControllerArray[i]->PlayerController->GetClass()->ImplementsInterface(UAdvancedFriendsInterface::StaticClass())) - { - IAdvancedFriendsInterface::Execute_OnSessionInviteReceived(ControllerArray[i]->PlayerController, FI, BPS); - } - break; - } - } + for (int i = 0; i < ControllerArray.Num(); i++) + { + if (*PlayerArray[ControllerArray[i]->PlayerController->NetPlayerIndex]->UniqueId.GetUniqueNetId().Get() == InvitedPlayer) + { + //Run the Event specific to the actor, if the actor has the interface, otherwise ignore + if (ControllerArray[i]->PlayerController->GetClass()->ImplementsInterface(UAdvancedFriendsInterface::StaticClass())) + { + IAdvancedFriendsInterface::Execute_OnSessionInviteReceived(ControllerArray[i]->PlayerController, FI, BPS); + } + break; + } + } }*/ -void UAdvancedFriendsGameInstance::OnPlayerLoginStatusChangedMaster(int32 PlayerNum, ELoginStatus::Type PreviousStatus, ELoginStatus::Type NewStatus, const FUniqueNetId & NewPlayerUniqueNetID) +void UAdvancedFriendsGameInstance::OnPlayerLoginStatusChangedMaster(int32 PlayerNum, ELoginStatus::Type PreviousStatus, ELoginStatus::Type NewStatus, const FUniqueNetId& NewPlayerUniqueNetID) { EBPLoginStatus OrigStatus = (EBPLoginStatus)PreviousStatus; EBPLoginStatus CurrentStatus = (EBPLoginStatus)NewStatus; FBPUniqueNetId PlayerID; PlayerID.SetUniqueNetId(&NewPlayerUniqueNetID); - OnPlayerLoginStatusChanged(PlayerNum, OrigStatus,CurrentStatus,PlayerID); - + OnPlayerLoginStatusChanged(PlayerNum, OrigStatus, CurrentStatus, PlayerID); if (bCallIdentityInterfaceEventsOnPlayerControllers) { @@ -221,7 +215,7 @@ void UAdvancedFriendsGameInstance::OnPlayerLoginStatusChangedMaster(int32 Player if (Player != NULL) { - //Run the Event specific to the actor, if the actor has the interface, otherwise ignore + // Run the Event specific to the actor, if the actor has the interface, otherwise ignore if (Player->GetClass()->ImplementsInterface(UAdvancedFriendsInterface::StaticClass())) { IAdvancedFriendsInterface::Execute_OnPlayerLoginStatusChanged(Player, OrigStatus, CurrentStatus, PlayerID); @@ -244,7 +238,7 @@ void UAdvancedFriendsGameInstance::OnPlayerLoginChangedMaster(int32 PlayerNum) if (Player != NULL) { - //Run the Event specific to the actor, if the actor has the interface, otherwise ignore + // Run the Event specific to the actor, if the actor has the interface, otherwise ignore if (Player->GetClass()->ImplementsInterface(UAdvancedFriendsInterface::StaticClass())) { IAdvancedFriendsInterface::Execute_OnPlayerLoginChanged(Player, PlayerNum); @@ -273,7 +267,7 @@ void UAdvancedFriendsGameInstance::OnPlayerTalkingStateChangedMaster(TSharedRef< if (Player != NULL) { - //Run the Event specific to the actor, if the actor has the interface, otherwise ignore + // Run the Event specific to the actor, if the actor has the interface, otherwise ignore if (Player->GetClass()->ImplementsInterface(UAdvancedFriendsInterface::StaticClass())) { IAdvancedFriendsInterface::Execute_OnPlayerVoiceStateChanged(Player, PlayerTalking, bIsTalking); @@ -287,7 +281,7 @@ void UAdvancedFriendsGameInstance::OnPlayerTalkingStateChangedMaster(TSharedRef< } } -void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNetId & PersonInvited, const FUniqueNetId & PersonInviting, const FString& AppId, const FOnlineSessionSearchResult& SessionToJoin) +void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNetId& PersonInvited, const FUniqueNetId& PersonInviting, const FString& AppId, const FOnlineSessionSearchResult& SessionToJoin) { if (SessionToJoin.IsValid()) { @@ -300,7 +294,6 @@ void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNe FBPUniqueNetId PInviting; PInviting.SetUniqueNetId(&PersonInviting); - TArray PlayerList; GEngine->GetAllLocalPlayerControllers(PlayerList); @@ -326,11 +319,11 @@ void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNe OnSessionInviteReceived(LocalPlayer, PInviting, AppId, BluePrintResult); - //IAdvancedFriendsInterface* TheInterface = NULL; + // IAdvancedFriendsInterface* TheInterface = NULL; if (Player != NULL) { - //Run the Event specific to the actor, if the actor has the interface, otherwise ignore + // Run the Event specific to the actor, if the actor has the interface, otherwise ignore if (Player->GetClass()->ImplementsInterface(UAdvancedFriendsInterface::StaticClass())) { IAdvancedFriendsInterface::Execute_OnSessionInviteReceived(Player, PInviting, BluePrintResult); @@ -367,22 +360,22 @@ void UAdvancedFriendsGameInstance::OnSessionInviteAcceptedMaster(const bool bWas BluePrintResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true; } - OnSessionInviteAccepted(LocalPlayer,PInvited, BluePrintResult); + OnSessionInviteAccepted(LocalPlayer, PInvited, BluePrintResult); APlayerController* Player = UGameplayStatics::GetPlayerController(GetWorld(), LocalPlayer); - //IAdvancedFriendsInterface* TheInterface = NULL; + // IAdvancedFriendsInterface* TheInterface = NULL; if (Player != NULL) { - //Run the Event specific to the actor, if the actor has the interface, otherwise ignore + // Run the Event specific to the actor, if the actor has the interface, otherwise ignore if (Player->GetClass()->ImplementsInterface(UAdvancedFriendsInterface::StaticClass())) { - IAdvancedFriendsInterface::Execute_OnSessionInviteAccepted(Player,PInvited, BluePrintResult); + IAdvancedFriendsInterface::Execute_OnSessionInviteAccepted(Player, PInvited, BluePrintResult); } } else - { + { UE_LOG(AdvancedFriendsInterfaceLog, Warning, TEXT("UAdvancedFriendsInstance Failed to get a controller with the specified index in OnSessionInviteAccepted!")); } } @@ -391,4 +384,4 @@ void UAdvancedFriendsGameInstance::OnSessionInviteAcceptedMaster(const bool bWas UE_LOG(AdvancedFriendsInterfaceLog, Warning, TEXT("UAdvancedFriendsInstance Return a bad search result in OnSessionInviteAccepted!")); } } -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsInterface.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsInterface.cpp index 92e5138..c273f15 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsInterface.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsInterface.cpp @@ -1,9 +1,7 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedFriendsInterface.h" - - UAdvancedFriendsInterface::UAdvancedFriendsInterface(const class FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) + : Super(ObjectInitializer) { -} +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp index 5df1a94..428f151 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedFriendsLibrary.cpp @@ -1,14 +1,12 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedFriendsLibrary.h" - - // This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro -//General Log +// General Log DEFINE_LOG_CATEGORY(AdvancedFriendsLog); -void UAdvancedFriendsLibrary::SendSessionInviteToFriends(APlayerController *PlayerController, const TArray &Friends, EBlueprintResultSwitch &Result) +void UAdvancedFriendsLibrary::SendSessionInviteToFriends(APlayerController* PlayerController, const TArray& Friends, EBlueprintResultSwitch& Result) { if (!PlayerController) { @@ -46,7 +44,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriends(APlayerController *Play for (int i = 0; i < Friends.Num(); i++) { TSharedRef val(Friends[i].UniqueNetId.ToSharedRef()); - //TSharedRef val(Friends[i].GetUniqueNetId()); + // TSharedRef val(Friends[i].GetUniqueNetId()); List.Add(val); } @@ -60,7 +58,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriends(APlayerController *Play return; } -void UAdvancedFriendsLibrary::SendSessionInviteToFriend(APlayerController *PlayerController, const FBPUniqueNetId &FriendUniqueNetId, EBlueprintResultSwitch &Result) +void UAdvancedFriendsLibrary::SendSessionInviteToFriend(APlayerController* PlayerController, const FBPUniqueNetId& FriendUniqueNetId, EBlueprintResultSwitch& Result) { if (!PlayerController) { @@ -104,7 +102,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriend(APlayerController *Playe return; } -void UAdvancedFriendsLibrary::GetFriend(APlayerController *PlayerController, const FBPUniqueNetId FriendUniqueNetId, FBPFriendInfo &Friend) +void UAdvancedFriendsLibrary::GetFriend(APlayerController* PlayerController, const FBPUniqueNetId FriendUniqueNetId, FBPFriendInfo& Friend) { if (!PlayerController) @@ -152,11 +150,11 @@ void UAdvancedFriendsLibrary::GetFriend(APlayerController *PlayerController, con 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 - //Friend.PresenceInfo.StatusString = pres.Status.StatusStr; + // Friend.PresenceInfo.StatusString = pres.Status.StatusStr; } } -void UAdvancedFriendsLibrary::IsAFriend(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, bool &IsFriend) +void UAdvancedFriendsLibrary::IsAFriend(APlayerController* PlayerController, const FBPUniqueNetId UniqueNetId, bool& IsFriend) { if (!PlayerController) { @@ -189,10 +187,10 @@ void UAdvancedFriendsLibrary::IsAFriend(APlayerController *PlayerController, con IsFriend = FriendsInterface->IsFriend(Player->GetControllerId(), *UniqueNetId.GetUniqueNetId(), EFriendsLists::ToString(EFriendsLists::Default)); } -void UAdvancedFriendsLibrary::GetStoredRecentPlayersList(FBPUniqueNetId UniqueNetId, TArray &PlayersList) +void UAdvancedFriendsLibrary::GetStoredRecentPlayersList(FBPUniqueNetId UniqueNetId, TArray& PlayersList) { IOnlineFriendsPtr FriendsInterface = Online::GetFriendsInterface(); - + if (!FriendsInterface.IsValid()) { UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetRecentPlayersList Failed to get friends interface!")); @@ -205,10 +203,10 @@ void UAdvancedFriendsLibrary::GetStoredRecentPlayersList(FBPUniqueNetId UniqueNe return; } - TArray< TSharedRef > PlayerList; - + TArray> PlayerList; + // For now getting all namespaces - FriendsInterface->GetRecentPlayers(*(UniqueNetId.GetUniqueNetId()),"", PlayerList); + FriendsInterface->GetRecentPlayers(*(UniqueNetId.GetUniqueNetId()), "", PlayerList); for (int32 i = 0; i < PlayerList.Num(); i++) { @@ -221,7 +219,7 @@ void UAdvancedFriendsLibrary::GetStoredRecentPlayersList(FBPUniqueNetId UniqueNe } } -void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerController, TArray &FriendsList) +void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController* PlayerController, TArray& FriendsList) { if (!PlayerController) @@ -231,7 +229,7 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont } IOnlineFriendsPtr FriendsInterface = Online::GetFriendsInterface(); - + if (!FriendsInterface.IsValid()) { UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetFriendsList Failed to get friends interface!")); @@ -246,8 +244,7 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont return; } - - TArray< TSharedRef > FriendList; + TArray> FriendList; if (FriendsInterface->GetFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendList)) { for (int32 i = 0; i < FriendList.Num(); i++) @@ -266,7 +263,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 - //BPF.PresenceInfo.StatusString = pres.Status.StatusStr; + // BPF.PresenceInfo.StatusString = pres.Status.StatusStr; BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable; BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame; @@ -278,4 +275,4 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetFriendsList Failed to get any friends!")); return; -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedIdentityLibrary.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedIdentityLibrary.cpp index 47a554b..6fe3cee 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedIdentityLibrary.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedIdentityLibrary.cpp @@ -1,11 +1,10 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedIdentityLibrary.h" -//General Log +// General Log DEFINE_LOG_CATEGORY(AdvancedIdentityLog); - -void UAdvancedIdentityLibrary::GetPlayerAuthToken(UObject* WorldContextObject, APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result) +void UAdvancedIdentityLibrary::GetPlayerAuthToken(UObject* WorldContextObject, APlayerController* PlayerController, FString& AuthToken, EBlueprintResultSwitch& Result) { if (!PlayerController) { @@ -43,8 +42,8 @@ void UAdvancedIdentityLibrary::GetPlayerAuthToken(UObject* WorldContextObject, A Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedIdentityLibrary::GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname) -{ +void UAdvancedIdentityLibrary::GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetID, FString& PlayerNickname) +{ if (!UniqueNetID.IsValid()) { UE_LOG(AdvancedIdentityLog, Warning, TEXT("GetPlayerNickname was passed a bad player uniquenetid!")); @@ -67,8 +66,7 @@ void UAdvancedIdentityLibrary::GetPlayerNickname(UObject* WorldContextObject, co PlayerNickname = IdentityInterface->GetPlayerNickname(*UniqueNetID.GetUniqueNetId()); } - -void UAdvancedIdentityLibrary::GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result) +void UAdvancedIdentityLibrary::GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetID, EBPLoginStatus& LoginStatus, EBlueprintResultSwitch& Result) { if (!UniqueNetID.IsValid()) { @@ -97,8 +95,7 @@ void UAdvancedIdentityLibrary::GetLoginStatus(UObject* WorldContextObject, const Result = EBlueprintResultSwitch::OnSuccess; } - -void UAdvancedIdentityLibrary::GetAllUserAccounts(UObject* WorldContextObject, TArray & AccountInfos, EBlueprintResultSwitch &Result) +void UAdvancedIdentityLibrary::GetAllUserAccounts(UObject* WorldContextObject, TArray& AccountInfos, EBlueprintResultSwitch& Result) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); @@ -127,7 +124,7 @@ void UAdvancedIdentityLibrary::GetAllUserAccounts(UObject* WorldContextObject, T Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedIdentityLibrary::GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result) +void UAdvancedIdentityLibrary::GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId, FBPUserOnlineAccount& AccountInfo, EBlueprintResultSwitch& Result) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); @@ -139,7 +136,7 @@ void UAdvancedIdentityLibrary::GetUserAccount(UObject* WorldContextObject, const IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World); - if(!UniqueNetId.IsValid()) + if (!UniqueNetId.IsValid()) { UE_LOG(AdvancedIdentityLog, Warning, TEXT("GetUserAccount was passed a bad unique net id!")); Result = EBlueprintResultSwitch::OnFailure; @@ -166,7 +163,7 @@ void UAdvancedIdentityLibrary::GetUserAccount(UObject* WorldContextObject, const Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedIdentityLibrary::GetUserAccountAccessToken(const FBPUserOnlineAccount & AccountInfo, FString & AccessToken) +void UAdvancedIdentityLibrary::GetUserAccountAccessToken(const FBPUserOnlineAccount& AccountInfo, FString& AccessToken) { if (!AccountInfo.UserAccountInfo.IsValid()) { @@ -177,7 +174,7 @@ void UAdvancedIdentityLibrary::GetUserAccountAccessToken(const FBPUserOnlineAcco AccessToken = AccountInfo.UserAccountInfo->GetAccessToken(); } -void UAdvancedIdentityLibrary::GetUserAccountAuthAttribute(const FBPUserOnlineAccount & AccountInfo, const FString & AttributeName, FString & AuthAttribute, EBlueprintResultSwitch &Result) +void UAdvancedIdentityLibrary::GetUserAccountAuthAttribute(const FBPUserOnlineAccount& AccountInfo, const FString& AttributeName, FString& AuthAttribute, EBlueprintResultSwitch& Result) { if (!AccountInfo.UserAccountInfo.IsValid()) { @@ -196,7 +193,7 @@ void UAdvancedIdentityLibrary::GetUserAccountAuthAttribute(const FBPUserOnlineAc Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedIdentityLibrary::SetUserAccountAttribute(const FBPUserOnlineAccount & AccountInfo, const FString & AttributeName, const FString & NewAttributeValue, EBlueprintResultSwitch &Result) +void UAdvancedIdentityLibrary::SetUserAccountAttribute(const FBPUserOnlineAccount& AccountInfo, const FString& AttributeName, const FString& NewAttributeValue, EBlueprintResultSwitch& Result) { if (!AccountInfo.UserAccountInfo.IsValid()) { @@ -215,7 +212,7 @@ void UAdvancedIdentityLibrary::SetUserAccountAttribute(const FBPUserOnlineAccoun Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedIdentityLibrary::GetUserID(const FBPUserOnlineAccount & AccountInfo, FBPUniqueNetId & UniqueNetID) +void UAdvancedIdentityLibrary::GetUserID(const FBPUserOnlineAccount& AccountInfo, FBPUniqueNetId& UniqueNetID) { if (!AccountInfo.UserAccountInfo.IsValid()) { @@ -223,11 +220,10 @@ void UAdvancedIdentityLibrary::GetUserID(const FBPUserOnlineAccount & AccountInf return; } - UniqueNetID.SetUniqueNetId(AccountInfo.UserAccountInfo->GetUserId()); } -void UAdvancedIdentityLibrary::GetUserAccountRealName(const FBPUserOnlineAccount & AccountInfo, FString & UserName) +void UAdvancedIdentityLibrary::GetUserAccountRealName(const FBPUserOnlineAccount& AccountInfo, FString& UserName) { if (!AccountInfo.UserAccountInfo.IsValid()) { @@ -235,11 +231,10 @@ void UAdvancedIdentityLibrary::GetUserAccountRealName(const FBPUserOnlineAccount return; } - UserName = AccountInfo.UserAccountInfo->GetRealName(); } -void UAdvancedIdentityLibrary::GetUserAccountDisplayName(const FBPUserOnlineAccount & AccountInfo, FString & DisplayName) +void UAdvancedIdentityLibrary::GetUserAccountDisplayName(const FBPUserOnlineAccount& AccountInfo, FString& DisplayName) { if (!AccountInfo.UserAccountInfo.IsValid()) { @@ -247,11 +242,10 @@ void UAdvancedIdentityLibrary::GetUserAccountDisplayName(const FBPUserOnlineAcco return; } - DisplayName = AccountInfo.UserAccountInfo->GetDisplayName(); } -void UAdvancedIdentityLibrary::GetUserAccountAttribute(const FBPUserOnlineAccount & AccountInfo, const FString & AttributeName, FString & AttributeValue, EBlueprintResultSwitch &Result) +void UAdvancedIdentityLibrary::GetUserAccountAttribute(const FBPUserOnlineAccount& AccountInfo, const FString& AttributeName, FString& AttributeValue, EBlueprintResultSwitch& Result) { if (!AccountInfo.UserAccountInfo.IsValid()) { @@ -268,4 +262,4 @@ void UAdvancedIdentityLibrary::GetUserAccountAttribute(const FBPUserOnlineAccoun } Result = EBlueprintResultSwitch::OnSuccess; -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessions.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessions.cpp index 8a12271..70af8d0 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessions.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessions.cpp @@ -1,12 +1,12 @@ -//#include "StandAlonePrivatePCH.h" +// #include "StandAlonePrivatePCH.h" #include "AdvancedSessions.h" void AdvancedSessions::StartupModule() { } - + void AdvancedSessions::ShutdownModule() { } - -IMPLEMENT_MODULE(AdvancedSessions, AdvancedSessions) \ No newline at end of file + +IMPLEMENT_MODULE(AdvancedSessions, AdvancedSessions) diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp index 6e007f7..e8e96b6 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp @@ -1,12 +1,11 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedSessionsLibrary.h" -#include "GameFramework/PlayerState.h" #include "GameFramework/GameStateBase.h" +#include "GameFramework/PlayerState.h" -//General Log +// General Log DEFINE_LOG_CATEGORY(AdvancedSessionsLog); - bool UAdvancedSessionsLibrary::KickPlayer(UObject* WorldContextObject, APlayerController* PlayerToKick, FText KickReason) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); @@ -43,12 +42,12 @@ bool UAdvancedSessionsLibrary::BanPlayer(UObject* WorldContextObject, APlayerCon return false; } -bool UAdvancedSessionsLibrary::IsValidSession(const FBlueprintSessionResult & SessionResult) +bool UAdvancedSessionsLibrary::IsValidSession(const FBlueprintSessionResult& SessionResult) { return SessionResult.OnlineResult.IsValid(); } -void UAdvancedSessionsLibrary::GetSessionID_AsString(const FBlueprintSessionResult & SessionResult, FString& SessionID) +void UAdvancedSessionsLibrary::GetSessionID_AsString(const FBlueprintSessionResult& SessionResult, FString& SessionID) { const TSharedPtr SessionInfo = SessionResult.OnlineResult.Session.SessionInfo; if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid()) @@ -66,7 +65,7 @@ void UAdvancedSessionsLibrary::GetCurrentSessionID_AsString(UObject* WorldContex UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); - if (!SessionInterface.IsValid()) + if (!SessionInterface.IsValid()) { UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetCurrentSessionID_AsString couldn't get the session interface!")); SessionID.Empty(); @@ -74,10 +73,10 @@ void UAdvancedSessionsLibrary::GetCurrentSessionID_AsString(UObject* WorldContex } const FNamedOnlineSession* Session = SessionInterface->GetNamedSession(NAME_GameSession); - if (Session != nullptr) + if (Session != nullptr) { const TSharedPtr SessionInfo = Session->SessionInfo; - if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid()) + if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid()) { SessionID = SessionInfo->GetSessionId().ToString(); return; @@ -88,12 +87,12 @@ void UAdvancedSessionsLibrary::GetCurrentSessionID_AsString(UObject* WorldContex SessionID.Empty(); } -void UAdvancedSessionsLibrary::GetCurrentUniqueBuildID(int32 &UniqueBuildId) +void UAdvancedSessionsLibrary::GetCurrentUniqueBuildID(int32& UniqueBuildId) { UniqueBuildId = GetBuildUniqueId(); } -void UAdvancedSessionsLibrary::GetUniqueBuildID(FBlueprintSessionResult SessionResult, int32 &UniqueBuildId) +void UAdvancedSessionsLibrary::GetUniqueBuildID(FBlueprintSessionResult SessionResult, int32& UniqueBuildId) { UniqueBuildId = SessionResult.OnlineResult.Session.SessionSettings.BuildUniqueId; } @@ -103,9 +102,9 @@ FName UAdvancedSessionsLibrary::GetSessionPropertyKey(const FSessionPropertyKeyP return SessionProperty.Key; } -void UAdvancedSessionsLibrary::FindSessionPropertyByName(const TArray& ExtraSettings, FName SettingName, EBlueprintResultSwitch &Result, FSessionPropertyKeyPair& OutProperty) +void UAdvancedSessionsLibrary::FindSessionPropertyByName(const TArray& ExtraSettings, FName SettingName, EBlueprintResultSwitch& Result, FSessionPropertyKeyPair& OutProperty) { - const FSessionPropertyKeyPair* prop = ExtraSettings.FindByPredicate([&](const FSessionPropertyKeyPair& it) {return it.Key == SettingName; }); + const FSessionPropertyKeyPair* prop = ExtraSettings.FindByPredicate([&](const FSessionPropertyKeyPair& it) { return it.Key == SettingName; }); if (prop) { Result = EBlueprintResultSwitch::OnSuccess; @@ -116,14 +115,14 @@ void UAdvancedSessionsLibrary::FindSessionPropertyByName(const TArray& ExtraSettings, FName SettingName, EBlueprintResultSwitch &Result, int32& OutIndex) +void UAdvancedSessionsLibrary::FindSessionPropertyIndexByName(const TArray& ExtraSettings, FName SettingName, EBlueprintResultSwitch& Result, int32& OutIndex) { - OutIndex = ExtraSettings.IndexOfByPredicate([&](const FSessionPropertyKeyPair& it) {return it.Key == SettingName; }); + OutIndex = ExtraSettings.IndexOfByPredicate([&](const FSessionPropertyKeyPair& it) { return it.Key == SettingName; }); Result = OutIndex != INDEX_NONE ? EBlueprintResultSwitch::OnSuccess : EBlueprintResultSwitch::OnFailure; -} +} -void UAdvancedSessionsLibrary::AddOrModifyExtraSettings(UPARAM(ref) TArray & SettingsArray, UPARAM(ref) TArray & NewOrChangedSettings, TArray & ModifiedSettingsArray) +void UAdvancedSessionsLibrary::AddOrModifyExtraSettings(UPARAM(ref) TArray& SettingsArray, UPARAM(ref) TArray& NewOrChangedSettings, TArray& ModifiedSettingsArray) { ModifiedSettingsArray = SettingsArray; @@ -133,7 +132,7 @@ void UAdvancedSessionsLibrary::AddOrModifyExtraSettings(UPARAM(ref) TArray & ExtraSettings) +void UAdvancedSessionsLibrary::GetExtraSettings(FBlueprintSessionResult SessionResult, TArray& ExtraSettings) { FSessionPropertyKeyPair NewSetting; for (auto& Elem : SessionResult.OnlineResult.Session.SessionSettings.Settings) @@ -163,7 +161,7 @@ void UAdvancedSessionsLibrary::GetExtraSettings(FBlueprintSessionResult SessionR } } -void UAdvancedSessionsLibrary::GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState) +void UAdvancedSessionsLibrary::GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState& SessionState) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); @@ -177,7 +175,7 @@ void UAdvancedSessionsLibrary::GetSessionState(UObject* WorldContextObject, EBPO SessionState = ((EBPOnlineSessionState)SessionInterface->GetSessionState(NAME_GameSession)); } -void UAdvancedSessionsLibrary::GetSessionSettings(UObject* WorldContextObject, int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray &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& ExtraSettings, EBlueprintResultSwitch& Result) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); @@ -218,7 +216,7 @@ void UAdvancedSessionsLibrary::GetSessionSettings(UObject* WorldContextObject, i Result = EBlueprintResultSwitch::OnSuccess; } -void UAdvancedSessionsLibrary::IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession) +void UAdvancedSessionsLibrary::IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId& PlayerToCheck, bool& bIsInSession) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World); @@ -282,7 +280,7 @@ FSessionPropertyKeyPair UAdvancedSessionsLibrary::MakeLiteralSessionPropertyFloa return Prop; } -void UAdvancedSessionsLibrary::GetSessionPropertyByte(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, uint8 &SettingValue) +void UAdvancedSessionsLibrary::GetSessionPropertyByte(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, uint8& SettingValue) { for (FSessionPropertyKeyPair itr : ExtraSettings) { @@ -307,7 +305,7 @@ void UAdvancedSessionsLibrary::GetSessionPropertyByte(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, bool &SettingValue) +void UAdvancedSessionsLibrary::GetSessionPropertyBool(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, bool& SettingValue) { for (FSessionPropertyKeyPair itr : ExtraSettings) { @@ -330,7 +328,7 @@ void UAdvancedSessionsLibrary::GetSessionPropertyBool(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, FString &SettingValue) +void UAdvancedSessionsLibrary::GetSessionPropertyString(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, FString& SettingValue) { for (FSessionPropertyKeyPair itr : ExtraSettings) { @@ -353,7 +351,7 @@ void UAdvancedSessionsLibrary::GetSessionPropertyString(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, int32 &SettingValue) +void UAdvancedSessionsLibrary::GetSessionPropertyInt(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, int32& SettingValue) { for (FSessionPropertyKeyPair itr : ExtraSettings) { @@ -376,7 +374,7 @@ void UAdvancedSessionsLibrary::GetSessionPropertyInt(const TArray & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, float &SettingValue) +void UAdvancedSessionsLibrary::GetSessionPropertyFloat(const TArray& ExtraSettings, FName SettingName, ESessionSettingSearchResult& SearchResult, float& SettingValue) { for (FSessionPropertyKeyPair itr : ExtraSettings) { @@ -399,13 +397,12 @@ void UAdvancedSessionsLibrary::GetSessionPropertyFloat(const TArrayToString(); + } } - -void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId) +void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController* PlayerController, FBPUniqueNetId& UniqueNetId) { if (!PlayerController) { @@ -451,7 +449,7 @@ void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerControlle } } -void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId) +void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState* PlayerState, FBPUniqueNetId& UniqueNetId) { if (!PlayerState) { @@ -467,13 +465,13 @@ void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *Playe return; } -bool UAdvancedSessionsLibrary::IsValidUniqueNetID(const FBPUniqueNetId &UniqueNetId) +bool UAdvancedSessionsLibrary::IsValidUniqueNetID(const FBPUniqueNetId& UniqueNetId) { return UniqueNetId.IsValid(); } -bool UAdvancedSessionsLibrary::EqualEqual_UNetIDUnetID(const FBPUniqueNetId &A, const FBPUniqueNetId &B) -{ +bool UAdvancedSessionsLibrary::EqualEqual_UNetIDUnetID(const FBPUniqueNetId& A, const FBPUniqueNetId& B) +{ return ((A.IsValid() && B.IsValid()) && (*A.GetUniqueNetId() == *B.GetUniqueNetId())); } @@ -482,7 +480,7 @@ FUniqueNetIdRepl UAdvancedSessionsLibrary::Conv_BPUniqueIDToUniqueNetIDRepl(cons return FUniqueNetIdRepl(InUniqueID.GetUniqueNetId()->AsShared()); } -void UAdvancedSessionsLibrary::SetPlayerName(APlayerController *PlayerController, FString PlayerName) +void UAdvancedSessionsLibrary::SetPlayerName(APlayerController* PlayerController, FString PlayerName) { if (!PlayerController) { @@ -501,7 +499,7 @@ void UAdvancedSessionsLibrary::SetPlayerName(APlayerController *PlayerController } } -void UAdvancedSessionsLibrary::GetPlayerName(APlayerController *PlayerController, FString &PlayerName) +void UAdvancedSessionsLibrary::GetPlayerName(APlayerController* PlayerController, FString& PlayerName) { if (!PlayerController) { @@ -520,9 +518,9 @@ void UAdvancedSessionsLibrary::GetPlayerName(APlayerController *PlayerController } } -void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextObject, int32 &NumNetPlayers) +void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextObject, int32& NumNetPlayers) { - //Get World + // Get World UWorld* TheWorld = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); if (!TheWorld) @@ -541,7 +539,7 @@ bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const F return false; } - //using a context object to get the world + // using a context object to get the world UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull); if (World) { @@ -549,4 +547,4 @@ bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const F } return false; -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedVoiceLibrary.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedVoiceLibrary.cpp index f6321c1..532a768 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedVoiceLibrary.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedVoiceLibrary.cpp @@ -1,11 +1,10 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedVoiceLibrary.h" - -//General Log +// General Log DEFINE_LOG_CATEGORY(AdvancedVoiceLog); -void UAdvancedVoiceLibrary::IsHeadsetPresent(UObject* WorldContextObject, bool & bHasHeadset, uint8 LocalPlayerNum) +void UAdvancedVoiceLibrary::IsHeadsetPresent(UObject* WorldContextObject, bool& bHasHeadset, uint8 LocalPlayerNum) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); @@ -105,7 +104,6 @@ void UAdvancedVoiceLibrary::RegisterAllLocalTalkers(UObject* WorldContextObject) VoiceInterface->RegisterLocalTalkers(); } - void UAdvancedVoiceLibrary::UnRegisterLocalTalker(UObject* WorldContextObject, uint8 LocalPlayerNum) { @@ -336,8 +334,7 @@ bool UAdvancedVoiceLibrary::UnMuteRemoteTalker(UObject* WorldContextObject, uint return VoiceInterface->UnmuteRemoteTalker(LocalUserNum, *UniqueNetId.GetUniqueNetId(), bIsSystemWide); } - -void UAdvancedVoiceLibrary::GetNumLocalTalkers(UObject* WorldContextObject, int32 & NumLocalTalkers) +void UAdvancedVoiceLibrary::GetNumLocalTalkers(UObject* WorldContextObject, int32& NumLocalTalkers) { UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull); @@ -356,4 +353,4 @@ void UAdvancedVoiceLibrary::GetNumLocalTalkers(UObject* WorldContextObject, int3 } NumLocalTalkers = VoiceInterface->GetNumLocalTalkers(); -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AutoLoginUserCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AutoLoginUserCallbackProxy.cpp index 9046773..67524ca 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AutoLoginUserCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AutoLoginUserCallbackProxy.cpp @@ -2,15 +2,14 @@ #include "AutoLoginUserCallbackProxy.h" #include "Kismet/GameplayStatics.h" - #include "Online.h" ////////////////////////////////////////////////////////////////////////// // ULoginUserCallbackProxy UAutoLoginUserCallbackProxy::UAutoLoginUserCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , Delegate(FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) + : Super(ObjectInitializer) + , Delegate(FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) { } @@ -26,7 +25,7 @@ void UAutoLoginUserCallbackProxy::Activate() { FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("AutoLoginUser"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull)); - + if (Helper.OnlineSub != nullptr) { auto Identity = Helper.OnlineSub->GetIdentityInterface(); @@ -46,7 +45,7 @@ void UAutoLoginUserCallbackProxy::Activate() void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& ErrorVal) { FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("AutoLoginUser"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull)); - + if (Helper.OnlineSub != nullptr) { auto Identity = Helper.OnlineSub->GetIdentityInterface(); @@ -74,7 +73,6 @@ void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSucce } } - if (bWasSuccessful) { OnSuccess.Broadcast(); diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/CancelFindSessionsCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/CancelFindSessionsCallbackProxy.cpp index 600187e..3d9a7a2 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/CancelFindSessionsCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/CancelFindSessionsCallbackProxy.cpp @@ -1,13 +1,12 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "CancelFindSessionsCallbackProxy.h" - ////////////////////////////////////////////////////////////////////////// // UCancelFindSessionsCallbackProxy UCancelFindSessionsCallbackProxy::UCancelFindSessionsCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , Delegate(FOnCancelFindSessionsCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) + : Super(ObjectInitializer) + , Delegate(FOnCancelFindSessionsCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) { } @@ -27,7 +26,7 @@ void UCancelFindSessionsCallbackProxy::Activate() if (Helper.IsValid()) { auto Sessions = Helper.OnlineSub->GetSessionInterface(); - if (Sessions.IsValid()) + if (Sessions.IsValid()) { DelegateHandle = Sessions->AddOnCancelFindSessionsCompleteDelegate_Handle(Delegate); Sessions->CancelFindSessions(); diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/CreateSessionCallbackProxyAdvanced.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/CreateSessionCallbackProxyAdvanced.cpp index 6b07bf1..4bc5af0 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/CreateSessionCallbackProxyAdvanced.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/CreateSessionCallbackProxyAdvanced.cpp @@ -1,15 +1,14 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "CreateSessionCallbackProxyAdvanced.h" - ////////////////////////////////////////////////////////////////////////// // UCreateSessionCallbackProxyAdvanced UCreateSessionCallbackProxyAdvanced::UCreateSessionCallbackProxyAdvanced(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , CreateCompleteDelegate(FOnCreateSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnCreateCompleted)) - , StartCompleteDelegate(FOnStartSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnStartCompleted)) - , NumPublicConnections(1) + : Super(ObjectInitializer) + , CreateCompleteDelegate(FOnCreateSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnCreateCompleted)) + , StartCompleteDelegate(FOnStartSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnStartCompleted)) + , NumPublicConnections(1) { } @@ -39,9 +38,11 @@ UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::Create void UCreateSessionCallbackProxyAdvanced::Activate() { FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CreateSession"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull)); - - if (PlayerControllerWeakPtr.IsValid() ) + + if (PlayerControllerWeakPtr.IsValid()) + { Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get()); + } if (Helper.OnlineSub != nullptr) { @@ -49,7 +50,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate() if (Sessions.IsValid()) { CreateCompleteDelegateHandle = Sessions->AddOnCreateSessionCompleteDelegate_Handle(CreateCompleteDelegate); - + FOnlineSessionSettings Settings; Settings.NumPublicConnections = NumPublicConnections; Settings.NumPrivateConnections = NumPrivateConnections; @@ -77,7 +78,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate() // These are about the only changes over the standard Create Sessions Node Settings.bAllowInvites = bAllowInvites; - + FOnlineSessionSetting ExtraSetting; for (int i = 0; i < ExtraSettings.Num(); i++) { @@ -86,9 +87,8 @@ void UCreateSessionCallbackProxyAdvanced::Activate() ExtraSetting.AdvertisementType = EOnlineDataAdvertisementType::ViaOnlineService; Settings.Settings.Add(ExtraSettings[i].Key, ExtraSetting); } - - - if (!bDedicatedServer ) + + if (!bDedicatedServer) { if (PlayerControllerWeakPtr.IsValid() && Helper.UserID.IsValid()) { @@ -98,13 +98,15 @@ void UCreateSessionCallbackProxyAdvanced::Activate() { FFrame::KismetExecutionMessage(TEXT("Invalid Player controller when attempting to start a session"), ELogVerbosity::Warning); Sessions->ClearOnCreateSessionCompleteDelegate_Handle(CreateCompleteDelegateHandle); - + // Fail immediately OnFailure.Broadcast(); } } else + { Sessions->CreateSession(0, NAME_GameSession, Settings); + } // OnCreateCompleted will get called, nothing more to do now return; @@ -122,7 +124,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate() void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, bool bWasSuccessful) { FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CreateSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull)); - //Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get()); + // Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get()); if (Helper.OnlineSub != nullptr) { @@ -130,7 +132,7 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b if (Sessions.IsValid()) { Sessions->ClearOnCreateSessionCompleteDelegate_Handle(CreateCompleteDelegateHandle); - + if (bWasSuccessful) { if (this->bStartAfterCreate) @@ -160,7 +162,7 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b void UCreateSessionCallbackProxyAdvanced::OnStartCompleted(FName SessionName, bool bWasSuccessful) { FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("StartSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull)); - //Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get()); + // Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get()); if (Helper.OnlineSub != nullptr) { diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/EndSessionCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/EndSessionCallbackProxy.cpp index ddb248c..e640baa 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/EndSessionCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/EndSessionCallbackProxy.cpp @@ -1,13 +1,12 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "EndSessionCallbackProxy.h" - ////////////////////////////////////////////////////////////////////////// // UEndSessionCallbackProxy UEndSessionCallbackProxy::UEndSessionCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , Delegate(FOnEndSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) + : Super(ObjectInitializer) + , Delegate(FOnEndSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) { } @@ -31,7 +30,7 @@ void UEndSessionCallbackProxy::Activate() { FNamedOnlineSession* Session = Sessions->GetNamedSession(NAME_GameSession); if (Session && - Session->SessionState == EOnlineSessionState::InProgress) + Session->SessionState == EOnlineSessionState::InProgress) { DelegateHandle = Sessions->AddOnEndSessionCompleteDelegate_Handle(Delegate); Sessions->EndSession(NAME_GameSession); diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/FindFriendSessionCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/FindFriendSessionCallbackProxy.cpp index 719bed9..d1f32a2 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/FindFriendSessionCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/FindFriendSessionCallbackProxy.cpp @@ -1,18 +1,17 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "FindFriendSessionCallbackProxy.h" - ////////////////////////////////////////////////////////////////////////// // UGetRecentPlayersCallbackProxy DEFINE_LOG_CATEGORY(AdvancedFindFriendSessionLog); UFindFriendSessionCallbackProxy::UFindFriendSessionCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , OnFindFriendSessionCompleteDelegate(FOnFindFriendSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnFindFriendSessionCompleted)) + : Super(ObjectInitializer) + , OnFindFriendSessionCompleteDelegate(FOnFindFriendSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnFindFriendSessionCompleted)) { } -UFindFriendSessionCallbackProxy* UFindFriendSessionCallbackProxy::FindFriendSession(UObject* WorldContextObject, APlayerController *PlayerController, const FBPUniqueNetId &FriendUniqueNetId) +UFindFriendSessionCallbackProxy* UFindFriendSessionCallbackProxy::FindFriendSession(UObject* WorldContextObject, APlayerController* PlayerController, const FBPUniqueNetId& FriendUniqueNetId) { UFindFriendSessionCallbackProxy* Proxy = NewObject(); Proxy->PlayerControllerWeakPtr = PlayerController; @@ -55,9 +54,9 @@ void UFindFriendSessionCallbackProxy::Activate() IOnlineSessionPtr Sessions = Helper.OnlineSub->GetSessionInterface(); if (Sessions.IsValid()) - { + { ULocalPlayer* Player = Cast(PlayerControllerWeakPtr->Player); - + if (!Player) { // Fail immediately @@ -79,7 +78,6 @@ void UFindFriendSessionCallbackProxy::Activate() OnFailure.Broadcast(EmptyResult); } - void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPlayer, bool bWasSuccessful, const TArray& SessionInfo) { FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("EndSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull)); @@ -90,7 +88,9 @@ void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPl IOnlineSessionPtr Sessions = Helper.OnlineSub->GetSessionInterface(); if (Sessions.IsValid()) + { Sessions->ClearOnFindFriendSessionCompleteDelegate_Handle(LocalPlayer, FindFriendSessionCompleteDelegateHandle); + } if (bWasSuccessful) { @@ -115,7 +115,9 @@ void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPl } if (Result.Num() > 0) + { OnSuccess.Broadcast(Result); + } else { UE_LOG(AdvancedFindFriendSessionLog, Warning, TEXT("FindFriendSession Failed, returned an invalid session.")); diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp index e031688..8a88678 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp @@ -1,24 +1,22 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "FindSessionsCallbackProxyAdvanced.h" - #include "Online/OnlineSessionNames.h" ////////////////////////////////////////////////////////////////////////// // UFindSessionsCallbackProxyAdvanced - UFindSessionsCallbackProxyAdvanced::UFindSessionsCallbackProxyAdvanced(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , Delegate(FOnFindSessionsCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) - , bUseLAN(false) + : Super(ObjectInitializer) + , Delegate(FOnFindSessionsCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) + , bUseLAN(false) { bRunSecondSearch = false; bIsOnSecondSearch = false; } -UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray &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& Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, /*bool bSearchLobbies,*/ int MinSlotsAvailable) { - UFindSessionsCallbackProxyAdvanced* Proxy = NewObject(); + UFindSessionsCallbackProxyAdvanced* Proxy = NewObject(); Proxy->PlayerControllerWeakPtr = PlayerController; Proxy->bUseLAN = bUseLAN; Proxy->MaxResults = MaxResults; @@ -28,7 +26,7 @@ UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSess Proxy->bEmptyServersOnly = bEmptyServersOnly, Proxy->bNonEmptyServersOnly = bNonEmptyServersOnly; Proxy->bSecureServersOnly = bSecureServersOnly; - //Proxy->bSearchLobbies = bSearchLobbies; + // Proxy->bSearchLobbies = bSearchLobbies; Proxy->MinSlotsAvailable = MinSlotsAvailable; return Proxy; } @@ -52,7 +50,7 @@ void UFindSessionsCallbackProxyAdvanced::Activate() SearchObject = MakeShareable(new FOnlineSessionSearch); SearchObject->MaxSearchResults = MaxResults; SearchObject->bIsLanQuery = bUseLAN; - //SearchObject->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals); + // SearchObject->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals); // Create temp filter variable, because I had to re-define a blueprint version of this, it is required. FOnlineSearchSettingsEx tem; @@ -87,16 +85,24 @@ void UFindSessionsCallbackProxyAdvanced::Activate() /** Whether to use lobbies vs sessions */ /** #define SEARCH_LOBBIES FName(TEXT("LOBBYSEARCH"))*/ if (bEmptyServersOnly) + { tem.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals); + } if (bNonEmptyServersOnly) + { tem.Set(SEARCH_NONEMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals); + } if (bSecureServersOnly) + { tem.Set(SEARCH_SECURE_SERVERS_ONLY, true, EOnlineComparisonOp::Equals); + } if (MinSlotsAvailable != 0) + { tem.Set(SEARCH_MINSLOTSAVAILABLE, MinSlotsAvailable, EOnlineComparisonOp::GreaterThanEquals); + } // Filter results if (SearchSettings.Num() > 0) @@ -111,44 +117,44 @@ void UFindSessionsCallbackProxyAdvanced::Activate() switch (ServerSearchType) { - case EBPServerPresenceSearchType::ClientServersOnly: - { - //tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals); - - //if (bSearchLobbies)// && !IOnlineSubsystem::DoesInstanceExist("STEAM")) + case EBPServerPresenceSearchType::ClientServersOnly: + { + // tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals); + + // if (bSearchLobbies)// && !IOnlineSubsystem::DoesInstanceExist("STEAM")) tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals); - } - break; + } + break; - case EBPServerPresenceSearchType::DedicatedServersOnly: - { - //tem.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals); - } - break; + case EBPServerPresenceSearchType::DedicatedServersOnly: + { + // tem.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals); + } + break; - case EBPServerPresenceSearchType::AllServers: - default: - { - //if (IOnlineSubsystem::DoesInstanceExist("STEAM")) - //{ - bRunSecondSearch = true; + case EBPServerPresenceSearchType::AllServers: + default: + { + // if (IOnlineSubsystem::DoesInstanceExist("STEAM")) + //{ + bRunSecondSearch = true; - SearchObjectDedicated = MakeShareable(new FOnlineSessionSearch); - SearchObjectDedicated->MaxSearchResults = MaxResults; - SearchObjectDedicated->bIsLanQuery = bUseLAN; + SearchObjectDedicated = MakeShareable(new FOnlineSessionSearch); + SearchObjectDedicated->MaxSearchResults = MaxResults; + SearchObjectDedicated->bIsLanQuery = bUseLAN; - FOnlineSearchSettingsEx DedicatedOnly = tem; + 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); - SearchObjectDedicated->QuerySettings = DedicatedOnly; - //} - } - break; + // DedicatedOnly.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals); + SearchObjectDedicated->QuerySettings = DedicatedOnly; + //} + } + break; } // Copy the derived temp variable over to it's base class @@ -226,7 +232,7 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess) 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 ) + if (ServerSearchType != EBPServerPresenceSearchType::DedicatedServersOnly) { BPResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true; BPResult.OnlineResult.Session.SessionSettings.bUsesPresence = true; @@ -248,9 +254,13 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess) { // Need to account for only one of the searches failing if (SessionSearchResults.Num() > 0) + { OnSuccess.Broadcast(SessionSearchResults); + } else + { OnFailure.Broadcast(SessionSearchResults); + } return; } } @@ -265,14 +275,17 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess) else // We lost our player controller { if (bSuccess && SessionSearchResults.Num() > 0) + { OnSuccess.Broadcast(SessionSearchResults); + } else + { OnFailure.Broadcast(SessionSearchResults); + } } } - -void UFindSessionsCallbackProxyAdvanced::FilterSessionResults(const TArray &SessionResults, const TArray &Filters, TArray &FilteredResults) +void UFindSessionsCallbackProxyAdvanced::FilterSessionResults(const TArray& SessionResults, const TArray& Filters, TArray& FilteredResults) { for (int j = 0; j < SessionResults.Num(); j++) { @@ -281,14 +294,16 @@ void UFindSessionsCallbackProxyAdvanced::FilterSessionResults(const TArray 0) { - const FOnlineSessionSetting * setting; + const FOnlineSessionSetting* setting; for (int i = 0; i < Filters.Num(); i++) { setting = SessionResults[j].OnlineResult.Session.SessionSettings.Settings.Find(Filters[i].PropertyKeyPair.Key); // Couldn't find this key if (!setting) + { continue; + } if (!CompareVariants(setting->Data, Filters[i].PropertyKeyPair.Data, Filters[i].ComparisonOp)) { @@ -299,153 +314,188 @@ void UFindSessionsCallbackProxyAdvanced::FilterSessionResults(const TArray bB); break; - case EOnlineComparisonOpRedux::LessThanEquals: - return (bA == bB || bA < bB); break; - case EOnlineComparisonOpRedux::GreaterThan: - return bA > bB; break; - case EOnlineComparisonOpRedux::LessThan: - return bA < bB; break; - default: - return false; break; + double bA, bB; + A.GetValue(bA); + B.GetValue(bB); + switch (Comparator) + { + case EOnlineComparisonOpRedux::Equals: + return bA == bB; + break; + case EOnlineComparisonOpRedux::NotEquals: + return bA != bB; + break; + case EOnlineComparisonOpRedux::GreaterThanEquals: + return (bA == bB || bA > bB); + break; + case EOnlineComparisonOpRedux::LessThanEquals: + return (bA == bB || bA < bB); + break; + case EOnlineComparisonOpRedux::GreaterThan: + return bA > bB; + break; + case EOnlineComparisonOpRedux::LessThan: + return bA < bB; + break; + default: + return false; + break; + } } - } - case EOnlineKeyValuePairDataType::Float: - { - float tbA, tbB; - double bA, bB; - A.GetValue(tbA); - B.GetValue(tbB); - bA = (double)tbA; - bB = (double)tbB; - switch (Comparator) + case EOnlineKeyValuePairDataType::Float: { - case EOnlineComparisonOpRedux::Equals: - return bA == bB; break; - case EOnlineComparisonOpRedux::NotEquals: - return bA != bB; break; - case EOnlineComparisonOpRedux::GreaterThanEquals: - return (bA == bB || bA > bB); break; - case EOnlineComparisonOpRedux::LessThanEquals: - return (bA == bB || bA < bB); break; - case EOnlineComparisonOpRedux::GreaterThan: - return bA > bB; break; - case EOnlineComparisonOpRedux::LessThan: - return bA < bB; break; - default: - return false; break; + float tbA, tbB; + double bA, bB; + A.GetValue(tbA); + B.GetValue(tbB); + bA = (double)tbA; + bB = (double)tbB; + switch (Comparator) + { + case EOnlineComparisonOpRedux::Equals: + return bA == bB; + break; + case EOnlineComparisonOpRedux::NotEquals: + return bA != bB; + break; + case EOnlineComparisonOpRedux::GreaterThanEquals: + return (bA == bB || bA > bB); + break; + case EOnlineComparisonOpRedux::LessThanEquals: + return (bA == bB || bA < bB); + break; + case EOnlineComparisonOpRedux::GreaterThan: + return bA > bB; + break; + case EOnlineComparisonOpRedux::LessThan: + return bA < bB; + break; + default: + return false; + break; + } } - } - case EOnlineKeyValuePairDataType::Int32: - { - int32 bA, bB; - A.GetValue(bA); - B.GetValue(bB); - switch (Comparator) + case EOnlineKeyValuePairDataType::Int32: { - case EOnlineComparisonOpRedux::Equals: - return bA == bB; break; - case EOnlineComparisonOpRedux::NotEquals: - return bA != bB; break; - case EOnlineComparisonOpRedux::GreaterThanEquals: - return (bA == bB || bA > bB); break; - case EOnlineComparisonOpRedux::LessThanEquals: - return (bA == bB || bA < bB); break; - case EOnlineComparisonOpRedux::GreaterThan: - return bA > bB; break; - case EOnlineComparisonOpRedux::LessThan: - return bA < bB; break; - default: - return false; break; + int32 bA, bB; + A.GetValue(bA); + B.GetValue(bB); + switch (Comparator) + { + case EOnlineComparisonOpRedux::Equals: + return bA == bB; + break; + case EOnlineComparisonOpRedux::NotEquals: + return bA != bB; + break; + case EOnlineComparisonOpRedux::GreaterThanEquals: + return (bA == bB || bA > bB); + break; + case EOnlineComparisonOpRedux::LessThanEquals: + return (bA == bB || bA < bB); + break; + case EOnlineComparisonOpRedux::GreaterThan: + return bA > bB; + break; + case EOnlineComparisonOpRedux::LessThan: + return bA < bB; + break; + default: + return false; + break; + } } - } - case EOnlineKeyValuePairDataType::Int64: - { - uint64 bA, bB; - A.GetValue(bA); - B.GetValue(bB); - switch (Comparator) + case EOnlineKeyValuePairDataType::Int64: { - case EOnlineComparisonOpRedux::Equals: - return bA == bB; break; - case EOnlineComparisonOpRedux::NotEquals: - return bA != bB; break; - case EOnlineComparisonOpRedux::GreaterThanEquals: - return (bA == bB || bA > bB); break; - case EOnlineComparisonOpRedux::LessThanEquals: - return (bA == bB || bA < bB); break; - case EOnlineComparisonOpRedux::GreaterThan: - return bA > bB; break; - case EOnlineComparisonOpRedux::LessThan: - return bA < bB; break; - default: - return false; break; + uint64 bA, bB; + A.GetValue(bA); + B.GetValue(bB); + switch (Comparator) + { + case EOnlineComparisonOpRedux::Equals: + return bA == bB; + break; + case EOnlineComparisonOpRedux::NotEquals: + return bA != bB; + break; + case EOnlineComparisonOpRedux::GreaterThanEquals: + return (bA == bB || bA > bB); + break; + case EOnlineComparisonOpRedux::LessThanEquals: + return (bA == bB || bA < bB); + break; + case EOnlineComparisonOpRedux::GreaterThan: + return bA > bB; + break; + case EOnlineComparisonOpRedux::LessThan: + return bA < bB; + break; + default: + return false; + break; + } } - } - case EOnlineKeyValuePairDataType::String: - { - FString bA, bB; - A.GetValue(bA); - B.GetValue(bB); - switch (Comparator) + case EOnlineKeyValuePairDataType::String: { - case EOnlineComparisonOpRedux::Equals: - return bA == bB; break; - case EOnlineComparisonOpRedux::NotEquals: - return bA != bB; break; - default: - return false; break; + FString bA, bB; + A.GetValue(bA); + B.GetValue(bB); + switch (Comparator) + { + case EOnlineComparisonOpRedux::Equals: + return bA == bB; + break; + case EOnlineComparisonOpRedux::NotEquals: + return bA != bB; + break; + default: + return false; + break; + } } - } - case EOnlineKeyValuePairDataType::Empty: - case EOnlineKeyValuePairDataType::Blob: - default: - return false; break; + case EOnlineKeyValuePairDataType::Empty: + case EOnlineKeyValuePairDataType::Blob: + default: + return false; + break; } - - - -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp index 2d1d738..1d44758 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/GetFriendsCallbackProxy.cpp @@ -1,17 +1,16 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "GetFriendsCallbackProxy.h" - -#include "Online.h" #include "Interfaces/OnlineFriendsInterface.h" #include "Interfaces/OnlinePresenceInterface.h" +#include "Online.h" ////////////////////////////////////////////////////////////////////////// // UGetFriendsCallbackProxy DEFINE_LOG_CATEGORY(AdvancedGetFriendsLog); UGetFriendsCallbackProxy::UGetFriendsCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , FriendListReadCompleteDelegate(FOnReadFriendsListComplete::CreateUObject(this, &ThisClass::OnReadFriendsListCompleted)) + : Super(ObjectInitializer) + , FriendListReadCompleteDelegate(FOnReadFriendsListComplete::CreateUObject(this, &ThisClass::OnReadFriendsListCompleted)) { } @@ -72,10 +71,10 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo if (Friends.IsValid()) { // Not actually needed anymore, plus was not being validated and causing a crash - //ULocalPlayer* Player = Cast(PlayerControllerWeakPtr->Player); + // ULocalPlayer* Player = Cast(PlayerControllerWeakPtr->Player); TArray FriendsListOut; - TArray< TSharedRef > FriendList; + TArray> FriendList; if (Friends->GetFriendsList(LocalUserNum, ListName, FriendList)) { for (int32 i = 0; i < FriendList.Num(); i++) @@ -92,13 +91,12 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport; 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 - //BPF.PresenceInfo.StatusString = pres.Status.StatusStr; + // BPF.PresenceInfo.StatusString = pres.Status.StatusStr; BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable; BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame; - FriendsListOut.Add(BPF); } } diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/GetRecentPlayersCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/GetRecentPlayersCallbackProxy.cpp index 84bdcec..917a11a 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/GetRecentPlayersCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/GetRecentPlayersCallbackProxy.cpp @@ -1,6 +1,5 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "GetRecentPlayersCallbackProxy.h" - #include "Online.h" ////////////////////////////////////////////////////////////////////////// @@ -8,8 +7,8 @@ DEFINE_LOG_CATEGORY(AdvancedGetRecentPlayersLog); UGetRecentPlayersCallbackProxy::UGetRecentPlayersCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , QueryRecentPlayersCompleteDelegate(FOnQueryRecentPlayersCompleteDelegate::CreateUObject(this, &ThisClass::OnQueryRecentPlayersCompleted)) + : Super(ObjectInitializer) + , QueryRecentPlayersCompleteDelegate(FOnQueryRecentPlayersCompleteDelegate::CreateUObject(this, &ThisClass::OnQueryRecentPlayersCompleted)) { } @@ -43,7 +42,7 @@ void UGetRecentPlayersCallbackProxy::Activate() IOnlineFriendsPtr Friends = Helper.OnlineSub->GetFriendsInterface(); if (Friends.IsValid()) - { + { DelegateHandle = Friends->AddOnQueryRecentPlayersCompleteDelegate_Handle(QueryRecentPlayersCompleteDelegate); // Testing with null namespace @@ -55,9 +54,9 @@ void UGetRecentPlayersCallbackProxy::Activate() OnFailure.Broadcast(EmptyArray); } -void UGetRecentPlayersCallbackProxy::OnQueryRecentPlayersCompleted(const FUniqueNetId &UserID, const FString &Namespace, bool bWasSuccessful, const FString& ErrorString) +void UGetRecentPlayersCallbackProxy::OnQueryRecentPlayersCompleted(const FUniqueNetId& UserID, const FString& Namespace, bool bWasSuccessful, const FString& ErrorString) { - + FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("GetRecentPlayers"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull)); if (!Helper.OnlineSub) @@ -69,20 +68,21 @@ void UGetRecentPlayersCallbackProxy::OnQueryRecentPlayersCompleted(const FUnique IOnlineFriendsPtr Friends = Helper.OnlineSub->GetFriendsInterface(); if (Friends.IsValid()) + { Friends->ClearOnQueryRecentPlayersCompleteDelegate_Handle(DelegateHandle); - + } if (bWasSuccessful) { // WHOOPS - //IOnlineFriendsPtr Friends = Online::GetFriendsInterface(); + // IOnlineFriendsPtr Friends = Online::GetFriendsInterface(); if (Friends.IsValid()) { TArray PlayersListOut; - TArray< TSharedRef > PlayerList; + TArray> PlayerList; Friends->GetRecentPlayers(*(cUniqueNetId.GetUniqueNetId()), "", PlayerList); - + for (int32 i = 0; i < PlayerList.Num(); i++) { TSharedRef Player = PlayerList[i]; diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/GetUserPrivilegeCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/GetUserPrivilegeCallbackProxy.cpp index 7b1ef39..6d8af5d 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/GetUserPrivilegeCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/GetUserPrivilegeCallbackProxy.cpp @@ -1,18 +1,17 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "GetUserPrivilegeCallbackProxy.h" - #include "Online.h" ////////////////////////////////////////////////////////////////////////// // UGetUserPrivilegeCallbackProxy UGetUserPrivilegeCallbackProxy::UGetUserPrivilegeCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) + : Super(ObjectInitializer) { } -UGetUserPrivilegeCallbackProxy* UGetUserPrivilegeCallbackProxy::GetUserPrivilege(UObject* WorldContextObject, const EBPUserPrivileges & PrivilegeToCheck, const FBPUniqueNetId & PlayerUniqueNetID) +UGetUserPrivilegeCallbackProxy* UGetUserPrivilegeCallbackProxy::GetUserPrivilege(UObject* WorldContextObject, const EBPUserPrivileges& PrivilegeToCheck, const FBPUniqueNetId& PlayerUniqueNetID) { UGetUserPrivilegeCallbackProxy* Proxy = NewObject(); Proxy->PlayerUniqueNetID.SetUniqueNetId(PlayerUniqueNetID.GetUniqueNetId()); diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp index 584edc5..d3a45dc 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp @@ -1,15 +1,14 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "LoginUserCallbackProxy.h" - #include "Online.h" ////////////////////////////////////////////////////////////////////////// // ULoginUserCallbackProxy ULoginUserCallbackProxy::ULoginUserCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , Delegate(FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) + : Super(ObjectInitializer) + , Delegate(FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) { } diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/LogoutUserCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/LogoutUserCallbackProxy.cpp index 07bc666..bd4d049 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/LogoutUserCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/LogoutUserCallbackProxy.cpp @@ -1,15 +1,14 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "LogoutUserCallbackProxy.h" - #include "Online.h" ////////////////////////////////////////////////////////////////////////// // ULogoutUserCallbackProxy ULogoutUserCallbackProxy::ULogoutUserCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , Delegate(FOnLogoutCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) + : Super(ObjectInitializer) + , Delegate(FOnLogoutCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted)) { } diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/SendFriendInviteCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/SendFriendInviteCallbackProxy.cpp index 7c407c4..04c2e9b 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/SendFriendInviteCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/SendFriendInviteCallbackProxy.cpp @@ -1,6 +1,5 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "SendFriendInviteCallbackProxy.h" - #include "Online.h" ////////////////////////////////////////////////////////////////////////// @@ -8,12 +7,12 @@ DEFINE_LOG_CATEGORY(AdvancedSendFriendInviteLog); USendFriendInviteCallbackProxy::USendFriendInviteCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , OnSendInviteCompleteDelegate(FOnSendInviteComplete::CreateUObject(this, &ThisClass::OnSendInviteComplete)) + : Super(ObjectInitializer) + , OnSendInviteCompleteDelegate(FOnSendInviteComplete::CreateUObject(this, &ThisClass::OnSendInviteComplete)) { } -USendFriendInviteCallbackProxy* USendFriendInviteCallbackProxy::SendFriendInvite(UObject* WorldContextObject, APlayerController *PlayerController, const FBPUniqueNetId &UniqueNetIDInvited) +USendFriendInviteCallbackProxy* USendFriendInviteCallbackProxy::SendFriendInvite(UObject* WorldContextObject, APlayerController* PlayerController, const FBPUniqueNetId& UniqueNetIDInvited) { USendFriendInviteCallbackProxy* Proxy = NewObject(); Proxy->PlayerControllerWeakPtr = PlayerController; @@ -50,9 +49,9 @@ void USendFriendInviteCallbackProxy::Activate() auto Friends = Helper.OnlineSub->GetFriendsInterface(); if (Friends.IsValid()) - { + { ULocalPlayer* Player = Cast(PlayerControllerWeakPtr->Player); - + if (!Player) { // Fail immediately @@ -68,10 +67,10 @@ void USendFriendInviteCallbackProxy::Activate() OnFailure.Broadcast(); } -void USendFriendInviteCallbackProxy::OnSendInviteComplete(int32 LocalPlayerNum, bool bWasSuccessful, const FUniqueNetId &InvitedPlayer, const FString &ListName, const FString &ErrorString) +void USendFriendInviteCallbackProxy::OnSendInviteComplete(int32 LocalPlayerNum, bool bWasSuccessful, const FUniqueNetId& InvitedPlayer, const FString& ListName, const FString& ErrorString) { - if ( bWasSuccessful ) - { + if (bWasSuccessful) + { OnSuccess.Broadcast(); } else diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/StartSessionCallbackProxyAdvanced.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/StartSessionCallbackProxyAdvanced.cpp index d41e428..300041a 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/StartSessionCallbackProxyAdvanced.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/StartSessionCallbackProxyAdvanced.cpp @@ -1,13 +1,13 @@ #include "StartSessionCallbackProxyAdvanced.h" UStartSessionCallbackProxyAdvanced::UStartSessionCallbackProxyAdvanced(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , StartCompleteDelegate(FOnStartSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnStartCompleted)) + : Super(ObjectInitializer) + , StartCompleteDelegate(FOnStartSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnStartCompleted)) { } UStartSessionCallbackProxyAdvanced* UStartSessionCallbackProxyAdvanced::StartAdvancedSession( - UObject* WorldContextObject) + UObject* WorldContextObject) { UStartSessionCallbackProxyAdvanced* Proxy = NewObject(); Proxy->WorldContextObject = WorldContextObject; @@ -55,4 +55,4 @@ void UStartSessionCallbackProxyAdvanced::OnStartCompleted(FName SessionName, boo { OnFailure.Broadcast(); } -} \ No newline at end of file +} diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp index 31aa9d9..717d596 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp @@ -1,18 +1,17 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "UpdateSessionCallbackProxyAdvanced.h" - ////////////////////////////////////////////////////////////////////////// // UUpdateSessionCallbackProxyAdvanced UUpdateSessionCallbackProxyAdvanced::UUpdateSessionCallbackProxyAdvanced(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , OnUpdateSessionCompleteDelegate(FOnUpdateSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnUpdateCompleted)) - , NumPublicConnections(1) + : Super(ObjectInitializer) + , OnUpdateSessionCompleteDelegate(FOnUpdateSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnUpdateCompleted)) + , NumPublicConnections(1) { -} +} -UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise) +UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray& ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise) { UUpdateSessionCallbackProxyAdvanced* Proxy = NewObject(); Proxy->NumPublicConnections = PublicConnections; @@ -25,7 +24,7 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update Proxy->bAllowJoinInProgress = bAllowJoinInProgress; Proxy->bDedicatedServer = bIsDedicatedServer; Proxy->bShouldAdvertise = bShouldAdvertise; - return Proxy; + return Proxy; } void UUpdateSessionCallbackProxyAdvanced::Activate() @@ -45,7 +44,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate() } // This gets the actual session itself - //FNamedOnlineSession * curSession = Sessions->GetNamedSession(NAME_GameSession); + // FNamedOnlineSession * curSession = Sessions->GetNamedSession(NAME_GameSession); FOnlineSessionSettings* Settings = Sessions->GetSessionSettings(NAME_GameSession); if (!Settings) @@ -57,20 +56,20 @@ void UUpdateSessionCallbackProxyAdvanced::Activate() OnUpdateSessionCompleteDelegateHandle = Sessions->AddOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegate); - // FOnlineSessionSettings Settings; - //Settings->BuildUniqueId = GetBuildUniqueId(); + // FOnlineSessionSettings Settings; + // Settings->BuildUniqueId = GetBuildUniqueId(); Settings->NumPublicConnections = NumPublicConnections; Settings->NumPrivateConnections = NumPrivateConnections; Settings->bShouldAdvertise = bShouldAdvertise; Settings->bAllowJoinInProgress = bAllowJoinInProgress; Settings->bIsLANMatch = bUseLAN; - //Settings->bUsesPresence = true; - //Settings->bAllowJoinViaPresence = true; + // Settings->bUsesPresence = true; + // Settings->bAllowJoinViaPresence = true; Settings->bAllowInvites = bAllowInvites; Settings->bAllowJoinInProgress = bAllowJoinInProgress; Settings->bIsDedicated = bDedicatedServer; - FOnlineSessionSetting * fSetting = NULL; + FOnlineSessionSetting* fSetting = NULL; FOnlineSessionSetting ExtraSetting; for (int i = 0; i < ExtraSettings.Num(); i++) { @@ -113,7 +112,7 @@ void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, b if (Sessions.IsValid()) { Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle); - + if (bWasSuccessful) { OnSuccess.Broadcast(); @@ -127,4 +126,4 @@ void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, b OnFailure.Broadcast(); GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("WAS NOT SUCCESSFUL")); } -} \ No newline at end of file +} diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamFriendsLibrary.h b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamFriendsLibrary.h index 83de461..beb893b 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamFriendsLibrary.h +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamFriendsLibrary.h @@ -1,18 +1,17 @@ // 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 "CoreMinimal.h" +#include "Engine/GameInstance.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 "Interfaces/OnlineUserInterface.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Online.h" +#include "OnlineSubsystem.h" #include "UObject/UObjectIterator.h" // This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro @@ -20,9 +19,9 @@ // disable the warnings locally. Remove when this is fixed in the SDK #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4996) +#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.... +#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 @@ -33,17 +32,17 @@ #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(push)) MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS)) -#endif // USING_CODE_ANALYSIS +#endif // USING_CODE_ANALYSIS #include #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(pop)) -#endif // USING_CODE_ANALYSIS +#endif // USING_CODE_ANALYSIS -#include #include -//#include +#include +// #include #pragma pop_macro("ARRAY_COUNT") // @todo Steam: See above @@ -53,70 +52,68 @@ MSVC_PRAGMA(warning(pop)) // 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 + * Steam specific implementation of the unique net id + */ +class FUniqueNetIdSteam2 : public FUniqueNetId { -PACKAGE_SCOPE: - /** Holds the net id for a player */ - uint64 UniqueNetId; + PACKAGE_SCOPE : + /** Holds the net id for a player */ + uint64 UniqueNetId; /** Hidden on purpose */ - FUniqueNetIdSteam2() : - UniqueNetId(0) + FUniqueNetIdSteam2() + : UniqueNetId(0) { } /** - * Copy Constructor - * - * @param Src the id to copy - */ - explicit FUniqueNetIdSteam2(const FUniqueNetIdSteam2& Src) : - UniqueNetId(Src.UniqueNetId) + * 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 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 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 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()) + * 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()) { } @@ -126,52 +123,52 @@ class FUniqueNetIdSteam2 : } /** - * 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() - */ + * 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 - */ + * 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 - */ + * 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 - */ + * 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 - */ + * 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); @@ -194,7 +191,6 @@ class FUniqueNetIdSteam2 : } } - virtual uint32 GetTypeHash() const override { return ::GetTypeHash(UniqueNetId); @@ -234,8 +230,7 @@ class FUniqueNetIdSteam2 : #include "AdvancedSteamFriendsLibrary.generated.h" - -//General Advanced Sessions Log +// General Advanced Sessions Log DECLARE_LOG_CATEGORY_EXTERN(AdvancedSteamFriendsLog, Log, All); UENUM(Blueprintable) @@ -274,37 +269,36 @@ enum class ESteamUserOverlayType : uint8 static FString EnumToString(const FString& enumName, uint8 value) { - + const UEnum* EnumPtr = FindFirstObject(*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 + 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 = 0; + int32 numOnline = 0; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") - int32 numInGame = 0; + int32 numInGame = 0; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") - int32 numChatting = 0; - + int32 numChatting = 0; }; UENUM(Blueprintable) @@ -325,12 +319,11 @@ 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); + 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") @@ -338,11 +331,11 @@ class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary // 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); - + 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(); + 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") @@ -358,22 +351,22 @@ class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary // Retreives the local steam ID from steam UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI") - static FBPUniqueNetId GetLocalSteamIDFromSteam(); + 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. - */ + * 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") - static void GetSteamGroups(TArray & SteamGroups); + static void GetSteamGroups(TArray& 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(); + 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) @@ -381,9 +374,9 @@ class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary // 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); + 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(); -}; + static bool IsSteamInBigPictureMode(); +}; diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamSessions.h b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamSessions.h index 4a49251..b12478e 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamSessions.h +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamSessions.h @@ -1,5 +1,5 @@ #pragma once - + #include "CoreMinimal.h" #include "Modules/ModuleManager.h" @@ -9,4 +9,4 @@ class AdvancedSteamSessions : public IModuleInterface /** IModuleInterface implementation */ void StartupModule(); void ShutdownModule(); -}; \ No newline at end of file +}; diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamWorkshopLibrary.h b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamWorkshopLibrary.h index db56b35..6bd0185 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamWorkshopLibrary.h +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/AdvancedSteamWorkshopLibrary.h @@ -1,14 +1,14 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.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" +#include "steam/isteamugc.h" #endif #include "Interfaces/OnlineSessionInterface.h" @@ -16,9 +16,9 @@ // disable the warnings locally. Remove when this is fixed in the SDK #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4996) +#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.... +#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 @@ -29,14 +29,13 @@ #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(push)) MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS)) -#endif // USING_CODE_ANALYSIS +#endif // USING_CODE_ANALYSIS #include #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(pop)) -#endif // USING_CODE_ANALYSIS - +#endif // USING_CODE_ANALYSIS #pragma pop_macro("ARRAY_COUNT") @@ -47,14 +46,11 @@ MSVC_PRAGMA(warning(pop)) #pragma warning(pop) #endif - #include "AdvancedSteamWorkshopLibrary.generated.h" - -//General Advanced Sessions Log +// 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) @@ -63,12 +59,10 @@ struct FBPSteamWorkshopID GENERATED_USTRUCT_BODY() public: - uint64 SteamWorkshopID; FBPSteamWorkshopID() { - } FBPSteamWorkshopID(uint64 ID) @@ -77,104 +71,103 @@ struct FBPSteamWorkshopID } }; - // 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_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_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_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_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 + 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 @@ -208,7 +201,6 @@ struct FBPSteamWorkshopItemDetails GENERATED_USTRUCT_BODY() public: - FBPSteamWorkshopItemDetails() { ResultOfRequest = FBPSteamResult::k_EResultOK; @@ -224,7 +216,7 @@ struct FBPSteamWorkshopItemDetails } #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED - FBPSteamWorkshopItemDetails(SteamUGCDetails_t &hUGCDetails) + FBPSteamWorkshopItemDetails(SteamUGCDetails_t& hUGCDetails) { ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult; FileType = (FBPWorkshopFileType)hUGCDetails.m_eFileType; @@ -243,7 +235,7 @@ struct FBPSteamWorkshopItemDetails CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner); } - FBPSteamWorkshopItemDetails(const SteamUGCDetails_t &hUGCDetails) + FBPSteamWorkshopItemDetails(const SteamUGCDetails_t& hUGCDetails) { ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult; FileType = (FBPWorkshopFileType)hUGCDetails.m_eFileType; @@ -265,29 +257,29 @@ struct FBPSteamWorkshopItemDetails // Result of obtaining the details UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - FBPSteamResult ResultOfRequest; + FBPSteamResult ResultOfRequest; // Type of file UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - FBPWorkshopFileType FileType; + 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; + int32 CreatorAppID; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - int32 ConsumerAppID; + int32 ConsumerAppID; // Title of item UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - FString Title; + FString Title; // Description of item UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - FString Description; - - //Url for a video of website + FString Description; + + // Url for a video of website UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - FString ItemUrl; + FString ItemUrl; // Votes will be unlikely to go above signed limited UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") @@ -301,12 +293,12 @@ struct FBPSteamWorkshopItemDetails // whether the file was banned UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - bool bBanned; - + bool bBanned; + // developer has specifically flagged this item as accepted in the Workshop UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop") - bool bAcceptedForUse; - + 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; @@ -330,7 +322,6 @@ struct FBPSteamWorkshopItemDetails 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() @@ -338,14 +329,12 @@ 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 GetSubscribedWorkshopItems(int32 & NumberOfItems); + static TArray GetSubscribedWorkshopItems(int32& NumberOfItems); UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSteamWorkshop") - static void GetNumSubscribedWorkshopItems(int32 & NumberOfItems); - -}; + static void GetNumSubscribedWorkshopItems(int32& NumberOfItems); +}; diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamNotificationsSubsystem.h b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamNotificationsSubsystem.h index 7b6948c..a8b8c52 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamNotificationsSubsystem.h +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamNotificationsSubsystem.h @@ -21,14 +21,13 @@ class ADVANCEDSTEAMSESSIONS_API USteamNotificationsSubsystem : public UGameInsta GENERATED_BODY() public: - // Event thrown when the steam overlay switches states UPROPERTY(BlueprintAssignable, Category = "SteamEvents") - FOnSteamOverlayActivated OnSteamOverlayActivated_Bind; - - USteamNotificationsSubsystem() : Super() - { + FOnSteamOverlayActivated OnSteamOverlayActivated_Bind; + USteamNotificationsSubsystem() + : Super() + { } class cSteamEventsStore @@ -54,13 +53,13 @@ class ADVANCEDSTEAMSESSIONS_API USteamNotificationsSubsystem : public UGameInsta #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED cSteamEventsStore() {} - //: + //: /*OnExternalUITriggeredCallback(this, &cSteamEventsStore::OnExternalUITriggered) { }*/ #else - //cSteamEventsStore() + // cSteamEventsStore() //{ //} @@ -70,7 +69,7 @@ class ADVANCEDSTEAMSESSIONS_API USteamNotificationsSubsystem : public UGameInsta private: #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED - //STEAM_CALLBACK(cSteamEventsStore, OnExternalUITriggered, GameOverlayActivated_t, OnExternalUITriggeredCallback); + // STEAM_CALLBACK(cSteamEventsStore, OnExternalUITriggered, GameOverlayActivated_t, OnExternalUITriggeredCallback); STEAM_CALLBACK_MANUAL(cSteamEventsStore, OnExternalUITriggered, GameOverlayActivated_t, OnExternalUITriggeredCallback); #endif }; @@ -98,4 +97,4 @@ void USteamNotificationsSubsystem::cSteamEventsStore::OnExternalUITriggered(Game ParentSubsystem->OnSteamOverlayActivated_Bind.Broadcast((bool)CallbackData->m_bActive); } } -#endif \ No newline at end of file +#endif diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamRequestGroupOfficersCallbackProxy.h b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamRequestGroupOfficersCallbackProxy.h index 73955dd..f3c17b2 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamRequestGroupOfficersCallbackProxy.h +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamRequestGroupOfficersCallbackProxy.h @@ -1,8 +1,8 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" // This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro @@ -10,14 +10,14 @@ // disable the warnings locally. Remove when this is fixed in the SDK #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4996) +#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.... +#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" +// #include "OnlineSubsystemSteam.h" #pragma push_macro("ARRAY_COUNT") #undef ARRAY_COUNT @@ -25,14 +25,13 @@ #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(push)) MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS)) -#endif // USING_CODE_ANALYSIS +#endif // USING_CODE_ANALYSIS #include #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(pop)) -#endif // USING_CODE_ANALYSIS - +#endif // USING_CODE_ANALYSIS #pragma pop_macro("ARRAY_COUNT") @@ -51,16 +50,13 @@ struct FBPSteamGroupOfficer GENERATED_USTRUCT_BODY() public: - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") - FBPUniqueNetId OfficerUniqueNetID; // Uint64 representation + FBPUniqueNetId OfficerUniqueNetID; // Uint64 representation UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups") - bool bIsOwner = false; - + bool bIsOwner = false; }; - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintGroupOfficerDetailsDelegate, const TArray &, OfficerList); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintGroupOfficerDetailsDelegate, const TArray&, OfficerList); UCLASS(MinimalAPI) class USteamRequestGroupOfficersCallbackProxy : public UOnlineBlueprintCallProxyBase @@ -78,7 +74,7 @@ class USteamRequestGroupOfficersCallbackProxy : public UOnlineBlueprintCallProxy FBlueprintGroupOfficerDetailsDelegate OnFailure; // Returns a list of steam group officers - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|SteamAPI|SteamGroups") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|SteamAPI|SteamGroups") static USteamRequestGroupOfficersCallbackProxy* GetSteamGroupOfficerList(UObject* WorldContextObject, FBPUniqueNetId GroupUniqueNetID); // UOnlineBlueprintCallProxyBase interface @@ -86,15 +82,13 @@ class USteamRequestGroupOfficersCallbackProxy : public UOnlineBlueprintCallProxy // End of UOnlineBlueprintCallProxyBase interface private: - #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED - void OnRequestGroupOfficerDetails( ClanOfficerListResponse_t *pResult, bool bIOFailure); + void OnRequestGroupOfficerDetails(ClanOfficerListResponse_t* pResult, bool bIOFailure); CCallResult m_callResultGroupOfficerRequestDetails; #endif private: - FBPUniqueNetId GroupUniqueID; UObject* WorldContextObject; }; diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamWSRequestUGCDetailsCallbackProxy.h b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamWSRequestUGCDetailsCallbackProxy.h index 0adee7e..cb5bbb2 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamWSRequestUGCDetailsCallbackProxy.h +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Classes/SteamWSRequestUGCDetailsCallbackProxy.h @@ -1,9 +1,9 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" #include "AdvancedSteamWorkshopLibrary.h" #include "BlueprintDataDefinitions.h" +#include "CoreMinimal.h" // This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro @@ -11,14 +11,14 @@ // disable the warnings locally. Remove when this is fixed in the SDK #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4996) +#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.... +#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" +// #include "OnlineSubsystemSteam.h" #pragma push_macro("ARRAY_COUNT") #undef ARRAY_COUNT @@ -26,14 +26,13 @@ #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(push)) MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS)) -#endif // USING_CODE_ANALYSIS +#endif // USING_CODE_ANALYSIS #include #if USING_CODE_ANALYSIS MSVC_PRAGMA(warning(pop)) -#endif // USING_CODE_ANALYSIS - +#endif // USING_CODE_ANALYSIS #pragma pop_macro("ARRAY_COUNT") @@ -44,7 +43,6 @@ MSVC_PRAGMA(warning(pop)) #pragma warning(pop) #endif - #include "SteamWSRequestUGCDetailsCallbackProxy.generated.h" DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintWorkshopDetailsDelegate, const FBPSteamWorkshopItemDetails&, WorkShopDetails); @@ -63,7 +61,7 @@ class USteamWSRequestUGCDetailsCallbackProxy : public UOnlineBlueprintCallProxyB FBlueprintWorkshopDetailsDelegate OnFailure; // Ends the current session - UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSteamWorkshop") + UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject"), Category = "Online|AdvancedSteamWorkshop") static USteamWSRequestUGCDetailsCallbackProxy* GetWorkshopItemDetails(UObject* WorldContextObject, FBPSteamWorkshopID WorkShopID); // UOnlineBlueprintCallProxyBase interface @@ -71,17 +69,15 @@ class USteamWSRequestUGCDetailsCallbackProxy : public UOnlineBlueprintCallProxyB // 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); + + void OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t* pResult, bool bIOFailure); CCallResult m_callResultUGCRequestDetails; #endif private: - FBPSteamWorkshopID WorkShopID; UObject* WorldContextObject; }; diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamFriendsLibrary.cpp b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamFriendsLibrary.cpp index 45e031f..88bc858 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamFriendsLibrary.cpp +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamFriendsLibrary.cpp @@ -1,68 +1,67 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedSteamFriendsLibrary.h" -#include "OnlineSubSystemHeader.h" #include "Engine/Texture.h" #include "Engine/Texture2D.h" -#include "TextureResource.h" +#include "OnlineSubSystemHeader.h" #include "PixelFormat.h" +#include "TextureResource.h" -//General Log +// 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); - } + 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; + return 0; }*/ -void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray & SteamGroups) +void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray& SteamGroups) { - + #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED if (SteamAPI_Init()) @@ -73,8 +72,10 @@ void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray & St { CSteamID SteamGroupID = SteamFriends()->GetClanByIndex(i); - if(!SteamGroupID.IsValid()) + if (!SteamGroupID.IsValid()) + { continue; + } FBPSteamGroupInfo GroupInfo; @@ -88,10 +89,9 @@ void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray & 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) && STEAM_SDK_INSTALLED @@ -120,13 +120,12 @@ void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId if (Len != -1) // Invalid { - GameName = FString(UTF8_TO_TCHAR(NameBuffer)); + GameName = FString(UTF8_TO_TCHAR(NameBuffer)); }*/ Result = EBlueprintResultSwitch::OnSuccess; return; } - } #endif @@ -178,7 +177,7 @@ FString UAdvancedSteamFriendsLibrary::GetSteamPersonaName(const FBPUniqueNetId U FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FString SteamID64) { FBPUniqueNetId netId; - + #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED if (!(SteamID64.Len() > 0)) { @@ -190,8 +189,8 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri { // Already does the conversion TSharedPtr ValueID(new const FUniqueNetIdSteam2(SteamID64)); - //FCString::Atoi64(*SteamID64)); - + // FCString::Atoi64(*SteamID64)); + netId.SetUniqueNetId(ValueID); return netId; } @@ -236,7 +235,6 @@ bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId U return false; } - bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType) { #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED @@ -279,7 +277,7 @@ bool UAdvancedSteamFriendsLibrary::IsOverlayEnabled() return false; } -UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize) +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) @@ -294,19 +292,18 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN if (SteamAPI_Init()) { - //Getting the PictureID from the SteamAPI and getting the Size with the ID - //virtual bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) = 0; + // 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) + + 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; + 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) @@ -323,22 +320,20 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN 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]; - + // 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 + // 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; + uint8 Temp = oAvatarRGBA[i + 0]; + oAvatarRGBA[i + 0] = oAvatarRGBA[i + 2]; + oAvatarRGBA[i + 2] = Temp; }*/ UTexture2D* Avatar = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8); @@ -350,10 +345,10 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN FMemory::Memcpy(MipData, (void*)oAvatarRGBA, Height * Width * 4); PlatformData->Mips[0].BulkData.Unlock(); - //Setting some Parameters for the Texture and finally returning it + // Setting some Parameters for the Texture and finally returning it PlatformData->SetNumSlices(1); Avatar->NeverStream = true; - //Avatar->CompressionSettings = TC_EditorIcon; + // Avatar->CompressionSettings = TC_EditorIcon; } // Free RGBA buffer regardless of whether it was used or not @@ -401,14 +396,14 @@ bool UAdvancedSteamFriendsLibrary::FilterText(FString TextToFilter, EBPTextFilte { 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) @@ -439,4 +434,4 @@ bool UAdvancedSteamFriendsLibrary::IsSteamInBigPictureMode() #endif return false; -} \ No newline at end of file +} diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamSessions.cpp b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamSessions.cpp index 34d9ff5..2a1a926 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamSessions.cpp +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamSessions.cpp @@ -1,12 +1,12 @@ -//#include "StandAlonePrivatePCH.h" +// #include "StandAlonePrivatePCH.h" #include "AdvancedSteamSessions.h" void AdvancedSteamSessions::StartupModule() { } - + void AdvancedSteamSessions::ShutdownModule() { } - -IMPLEMENT_MODULE(AdvancedSteamSessions, AdvancedSteamSessions) \ No newline at end of file + +IMPLEMENT_MODULE(AdvancedSteamSessions, AdvancedSteamSessions) diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamWorkshopLibrary.cpp b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamWorkshopLibrary.cpp index 03eb780..b8e5ec6 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamWorkshopLibrary.cpp +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/AdvancedSteamWorkshopLibrary.cpp @@ -1,11 +1,10 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AdvancedSteamWorkshopLibrary.h" #include "OnlineSubSystemHeader.h" -//General Log +// General Log DEFINE_LOG_CATEGORY(AdvancedSteamWorkshopLog); - -void UAdvancedSteamWorkshopLibrary::GetNumSubscribedWorkshopItems(int32 & NumberOfItems) +void UAdvancedSteamWorkshopLibrary::GetNumSubscribedWorkshopItems(int32& NumberOfItems) { NumberOfItems = 0; #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED @@ -26,7 +25,7 @@ void UAdvancedSteamWorkshopLibrary::GetNumSubscribedWorkshopItems(int32 & Number #endif } -TArray UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopItems(int32 & NumberOfItems) +TArray UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopItems(int32& NumberOfItems) { TArray outArray; NumberOfItems = 0; @@ -36,16 +35,18 @@ TArray UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopI 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]; - + PublishedFileId_t* fileIds = new PublishedFileId_t[NumItems]; + uint32 subItems = SteamUGC()->GetSubscribedItems(fileIds, NumItems); for (uint32 i = 0; i < subItems; ++i) diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamRequestGroupOfficersCallbackProxy.cpp b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamRequestGroupOfficersCallbackProxy.cpp index 44bcc75..f41c300 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamRequestGroupOfficersCallbackProxy.cpp +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamRequestGroupOfficersCallbackProxy.cpp @@ -1,19 +1,19 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "SteamRequestGroupOfficersCallbackProxy.h" -#include "Online/CoreOnline.h" #include "AdvancedSteamFriendsLibrary.h" +#include "Online/CoreOnline.h" #include "OnlineSubSystemHeader.h" #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED #include "steam/isteamfriends.h" #endif -//#include "OnlineSubsystemSteamTypes.h" +// #include "OnlineSubsystemSteamTypes.h" ////////////////////////////////////////////////////////////////////////// // UEndSessionCallbackProxy USteamRequestGroupOfficersCallbackProxy::USteamRequestGroupOfficersCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) + : Super(ObjectInitializer) { } @@ -36,7 +36,7 @@ void USteamRequestGroupOfficersCallbackProxy::Activate() { uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes()); SteamAPICall_t hSteamAPICall = SteamFriends()->RequestClanOfficerList(id); - + m_callResultGroupOfficerRequestDetails.Set(hSteamAPICall, this, &USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails); return; } @@ -46,23 +46,23 @@ void USteamRequestGroupOfficersCallbackProxy::Activate() } #if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED -void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure) +void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t* pResult, bool bIOFailure) { TArray OfficerArray; - - //FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM)); + + // FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM)); if (bIOFailure || !pResult || !pResult->m_bSuccess) { - //if (SteamSubsystem != nullptr) + // if (SteamSubsystem != nullptr) { - // SteamSubsystem->ExecuteNextTick([this]() + // SteamSubsystem->ExecuteNextTick([this]() //{ - TArray FailureArray; - OnFailure.Broadcast(FailureArray); + TArray FailureArray; + OnFailure.Broadcast(FailureArray); //}); } - //OnFailure.Broadcast(OfficerArray); + // OnFailure.Broadcast(OfficerArray); return; } @@ -91,31 +91,30 @@ void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanO OfficerArray.Add(Officer); } - //if (SteamSubsystem != nullptr) + // if (SteamSubsystem != nullptr) //{ - //SteamSubsystem->ExecuteNextTick([OfficerArray, this]() - //{ - OnSuccess.Broadcast(OfficerArray); - //}); + // SteamSubsystem->ExecuteNextTick([OfficerArray, this]() + //{ + OnSuccess.Broadcast(OfficerArray); + //}); //} - //OnSuccess.Broadcast(OfficerArray); + // OnSuccess.Broadcast(OfficerArray); return; } else { - //if (SteamSubsystem != nullptr) + // if (SteamSubsystem != nullptr) { - //SteamSubsystem->ExecuteNextTick([this]() + // SteamSubsystem->ExecuteNextTick([this]() //{ - TArray FailureArray; - OnFailure.Broadcast(FailureArray); + TArray FailureArray; + OnFailure.Broadcast(FailureArray); //}); } } // Should never hit this anyway - //OnFailure.Broadcast(OfficerArray); + // OnFailure.Broadcast(OfficerArray); } #endif - diff --git a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamWSRequestUGCDetailsCallbackProxy.cpp b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamWSRequestUGCDetailsCallbackProxy.cpp index daf3b07..fce356a 100644 --- a/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamWSRequestUGCDetailsCallbackProxy.cpp +++ b/AdvancedSteamSessions/Source/AdvancedSteamSessions/Private/SteamWSRequestUGCDetailsCallbackProxy.cpp @@ -10,12 +10,11 @@ // UEndSessionCallbackProxy USteamWSRequestUGCDetailsCallbackProxy::USteamWSRequestUGCDetailsCallbackProxy(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) + : Super(ObjectInitializer) { } - -USteamWSRequestUGCDetailsCallbackProxy* USteamWSRequestUGCDetailsCallbackProxy::GetWorkshopItemDetails(UObject* WorldContextObject, FBPSteamWorkshopID WorkShopID/*, int32 NumSecondsBeforeTimeout*/) +USteamWSRequestUGCDetailsCallbackProxy* USteamWSRequestUGCDetailsCallbackProxy::GetWorkshopItemDetails(UObject* WorldContextObject, FBPSteamWorkshopID WorkShopID /*, int32 NumSecondsBeforeTimeout*/) { USteamWSRequestUGCDetailsCallbackProxy* Proxy = NewObject(); @@ -29,7 +28,7 @@ void USteamWSRequestUGCDetailsCallbackProxy::Activate() if (SteamAPI_Init()) { // #TODO: Support arrays instead in the future? - UGCQueryHandle_t hQueryHandle = SteamUGC()->CreateQueryUGCDetailsRequest((PublishedFileId_t *)&WorkShopID.SteamWorkshopID, 1); + UGCQueryHandle_t hQueryHandle = SteamUGC()->CreateQueryUGCDetailsRequest((PublishedFileId_t*)&WorkShopID.SteamWorkshopID, 1); // #TODO: add search settings here by calling into the handle? SteamAPICall_t hSteamAPICall = SteamUGC()->SendQueryUGCRequest(hQueryHandle); @@ -50,20 +49,20 @@ void USteamWSRequestUGCDetailsCallbackProxy::Activate() } #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)); +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) + // if (SteamSubsystem != nullptr) { - // SteamSubsystem->ExecuteNextTick([this]() + // SteamSubsystem->ExecuteNextTick([this]() //{ - OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); + OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); //}); } - //OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); + // OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); return; } if (SteamAPI_Init()) @@ -71,31 +70,30 @@ void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQuer SteamUGCDetails_t Details; if (SteamUGC()->GetQueryUGCResult(pResult->m_handle, 0, &Details)) { - //if (SteamSubsystem != nullptr) + // if (SteamSubsystem != nullptr) { - //SteamSubsystem->ExecuteNextTick([Details, this]() + // SteamSubsystem->ExecuteNextTick([Details, this]() //{ - OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details)); + OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details)); //}); } - //OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details)); + // OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details)); return; } } else { - //if (SteamSubsystem != nullptr) + // if (SteamSubsystem != nullptr) { - //SteamSubsystem->ExecuteNextTick([this]() + // SteamSubsystem->ExecuteNextTick([this]() //{ - OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); + OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); //}); } } // Not needed, should never hit here - //OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); + // OnFailure.Broadcast(FBPSteamWorkshopItemDetails()); } #endif -