Skip to content

Commit

Permalink
Merge pull request #5 from gogcom/ue5_support
Browse files Browse the repository at this point in the history
Add UE5 support
  • Loading branch information
mannkin authored Jan 31, 2023
2 parents 84ad0a7 + fa54ccf commit f6d0394
Show file tree
Hide file tree
Showing 27 changed files with 119 additions and 100 deletions.
38 changes: 21 additions & 17 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
jenkins:
stage: test
variables:
GIT_STRATEGY: none
JENKINS_VERIFIER_CONFIGURATION: >
{
"job" : "ue4-test-game-ci",
"parameters" : {
"PLUGIN_REFSPEC" : "${CI_COMMIT_REF_NAME}",
"GAME_REFSPEC" : "master"
}
}
script:
- verify_on_jenkins
except:
- master
- tags
stages:
- start
- trigger-demo-game

include:
- project: galaxy-sdk/build-scripts/gitlab-ci
file:
- /common-ci.yml

start:
stage: start
script: env

verify-plugin:
stage: trigger-demo-game
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "pipeline"'
trigger:
project: galaxy-sdk/galaxy-ue4-test-game
branch: "master"
strategy: depend
10 changes: 6 additions & 4 deletions OnlineSubsystemGOG.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

"FriendlyName": "Online Subsystem GOG",
"Version": 1,
"VersionName": "0.8.6",
"VersionName": "0.9.0",
"VersionDescription": "Fix achievements descriptions fetching",
"SupportedEngineAssociation": ["4.16", "4.17", "4.18", "4.19", "4.20", "4.21", "4.22", "4.23", "4.24", "4.25", "4.26", "4.27"],
"SupportedEngineAssociation": ["4.16", "4.17", "4.18", "4.19", "4.20", "4.21", "4.22", "4.23", "4.24", "4.25", "4.26", "4.27", "5.0", "5.1"],
"GalaxySDKVersion": "1.148.3",
"Description": "GOG online features",
"Category": "Online Platform",
Expand All @@ -22,7 +22,8 @@
"Win64",
"Mac",
"XboxOne",
"PS4"
"PS4",
"PS5"
],
"Modules":
[
Expand All @@ -35,7 +36,8 @@
"Win64",
"Mac",
"XboxOne",
"PS4"
"PS4",
"PS5"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Supported baseline:
- UnrealEngine 4.16, 4.17, 4.18, 4.19, 4.20, 4.21, 4.22, 4.23, 4.24, 4.25, 4.26
- Galaxy SDK 1.148.2
- UnrealEngine 4.16, 4.17, 4.18, 4.19, 4.20, 4.21, 4.22, 4.23, 4.24, 4.25, 4.26, 4.27, 5.0, 5.1
- Galaxy SDK 1.148.3
- Compiler:
- Windows: Visual Studio 15 Update 3 or later
- Mac: Xcode 9.4 or later
Expand Down
4 changes: 2 additions & 2 deletions Source/OnlineSubsystemGOG/Classes/NetConnectionGOG.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class UNetConnectionGOG

void InitLocalConnection(UNetDriver* InDriver, class FSocket* InSocket, const FURL& InURL, EConnectionState InState, int32 InMaxPacket = 0, int32 InPacketOverhead = 0) override;

#if ENGINE_MINOR_VERSION >= 21
#if ENGINE_MINOR_VERSION >= 21 || ENGINE_MAJOR_VERSION > 4
void LowLevelSend(void* InData, int32 InCountBits, FOutPacketTraits& OutTraits) override;

#if ENGINE_MINOR_VERSION < 23
#if ENGINE_MINOR_VERSION < 23 && ENGINE_MAJOR_VERSION < 5
TSharedPtr<FInternetAddr> GetInternetAddr() override;

#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/OnlineSubsystemGOG/Classes/NetDriverGOG.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class UNetDriverGOG

void TickDispatch(float InDeltaTime) override;

#if ENGINE_MINOR_VERSION >= 23
#if ENGINE_MINOR_VERSION >= 23 || ENGINE_MAJOR_VERSION > 4
void LowLevelSend(TSharedPtr<const FInternetAddr> InAddress, void* InData, int32 InCountBits, FOutPacketTraits& OutTraits) override;
#elif ENGINE_MINOR_VERSION >= 21
void LowLevelSend(FString InAddress, void* InData, int32 InCountBits, FOutPacketTraits& OutTraits) override;
Expand Down
2 changes: 1 addition & 1 deletion Source/OnlineSubsystemGOG/Private/CommonGOG.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "UObject/CoreOnline.h"
#include "Online/CoreOnline.h"
#include "OnlineSubsystem.h"

#include <galaxy/GalaxyApi.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ const FString& FOnlineFriendsGOG::GetDefaultFriendsListName()
return defaultFriendsListName;
}

#if ENGINE_MINOR_VERSION >= 21
#if ENGINE_MINOR_VERSION >= 21 || ENGINE_MAJOR_VERSION > 4
void FOnlineFriendsGOG::DumpRecentPlayers() const
{
UE_LOG_ONLINE_FRIEND(Warning, TEXT("FOnlineFriendsGOG::DumpRecentPlayers() is not supported"));
}
#endif

#if ENGINE_MINOR_VERSION >= 24
#if ENGINE_MINOR_VERSION >= 24 || ENGINE_MAJOR_VERSION > 4
void FOnlineFriendsGOG::SetFriendAlias(
int32 InLocalUserNum,
const FUniqueNetId& InFriendId,
Expand Down Expand Up @@ -429,7 +429,7 @@ void FOnlineFriendsGOG::OnFriendAdded(galaxy::api::GalaxyID InFriendID, galaxy::
TriggerOnInviteAcceptedDelegates(*ownUserOnlineAccount->GetUserId(), FUniqueNetIdGOG{InFriendID});
}

#if ENGINE_MINOR_VERSION >= 25
#if ENGINE_MINOR_VERSION >= 25 || ENGINE_MAJOR_VERSION > 4
void FOnlineFriendsGOG::DeleteFriendAlias(int32 LocalUserNum, const FUniqueNetId& FriendId, const FString& ListName, const FOnDeleteFriendAliasComplete& Delegate)
{
UE_LOG_ONLINE_FRIEND(Warning, TEXT("FOnlineFriendsOculus::DeleteFriendAlias is not implemented"));
Expand Down
6 changes: 3 additions & 3 deletions Source/OnlineSubsystemGOG/Private/Friends/OnlineFriendsGOG.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ class FOnlineFriendsGOG

static const FString& GetDefaultFriendsListName();

#if ENGINE_MINOR_VERSION >= 21
#if ENGINE_MINOR_VERSION >= 21 || ENGINE_MAJOR_VERSION > 4
void DumpRecentPlayers() const override;
#endif

#if ENGINE_MINOR_VERSION >= 24
#if ENGINE_MINOR_VERSION >= 24 || ENGINE_MAJOR_VERSION > 4
void SetFriendAlias(
int32 InLocalUserNum,
const FUniqueNetId& InFriendId,
Expand All @@ -70,7 +70,7 @@ class FOnlineFriendsGOG
const FOnSetFriendAliasComplete& InDelegate = FOnSetFriendAliasComplete()) override;
#endif

#if ENGINE_MINOR_VERSION >= 25
#if ENGINE_MINOR_VERSION >= 25 || ENGINE_MAJOR_VERSION > 4
void DeleteFriendAlias(int32 LocalUserNum, const FUniqueNetId& FriendId, const FString& ListName, const FOnDeleteFriendAliasComplete& Delegate) override;
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ UGOGLoginCallbackProxy::UGOGLoginCallbackProxy(const FObjectInitializer& ObjectI

UGOGLoginCallbackProxy* UGOGLoginCallbackProxy::Login(UObject* InWorldContextObject, class APlayerController* InPlayerController, FString AuthType, FString InUserID, FString InUserToken)
{
#if ENGINE_MINOR_VERSION >= 17
#if ENGINE_MINOR_VERSION >= 17 || ENGINE_MAJOR_VERSION > 4
auto onlineSubsystem = Online::GetSubsystem(GEngine->GetWorldFromContextObject(InWorldContextObject, EGetWorldErrorMode::ReturnNull));
#else
auto onlineSubsystem = Online::GetSubsystem(GEngine->GetWorldFromContextObject(InWorldContextObject, true));
Expand Down Expand Up @@ -110,14 +110,21 @@ bool UGOGLoginCallbackProxy::UpdatePlayerUniqueNetID(int32 InLocalUserNum) const
FFrame::KismetExecutionMessage(TEXT("Cannot update Player UniqueNetID: invalid PlayerController."), ELogVerbosity::Error);
return false;
}

#if ENGINE_MAJOR_VERSION > 4
TObjectPtr<APlayerState> playerState = playerControllerWeakPtr->PlayerState;
#else
auto* playerState = playerControllerWeakPtr->PlayerState;
#endif

if (!playerState)
{
FFrame::KismetExecutionMessage(TEXT("Cannot update Player UniqueNetID: invalid PlayerState object for given PlayerController."), ELogVerbosity::Error);
return false;
}

#if ENGINE_MAJOR_VERSION > 4
playerState->SetUniqueId(FUniqueNetIdRepl(onlineIdentity->GetUniquePlayerId(InLocalUserNum)));
#else
playerState->SetUniqueId(onlineIdentity->GetUniquePlayerId(InLocalUserNum));
#endif
return true;
}
10 changes: 7 additions & 3 deletions Source/OnlineSubsystemGOG/Private/Identity/OnlineIdentityGOG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void FOnlineIdentityGOG::GetUserPrivilege(const FUniqueNetId& InUserId, EUserPri
InDelegate.ExecuteIfBound(InUserId, InPrivilege, privilegeResult);
}

#if ENGINE_MINOR_VERSION >= 18
#if ENGINE_MINOR_VERSION >= 18 || ENGINE_MAJOR_VERSION > 4
FPlatformUserId FOnlineIdentityGOG::GetPlatformUserIdFromUniqueNetId(const FUniqueNetId& InUniqueNetId) const
#else
FPlatformUserId FOnlineIdentityGOG::GetPlatformUserIdFromUniqueNetId(const FUniqueNetId& InUniqueNetId)
Expand All @@ -358,10 +358,14 @@ FPlatformUserId FOnlineIdentityGOG::GetPlatformUserIdFromUniqueNetId(const FUniq
if(InUniqueNetId != *ownUserOnlineAccount->GetUserId())
UE_LOG_ONLINE_IDENTITY(Error, TEXT("Only single local player is supported"));

#if ENGINE_MAJOR_VERSION > 4
return FPlatformMisc::GetPlatformUserForUserIndex(LOCAL_USER_NUM);
#else
return LOCAL_USER_NUM;
#endif
}

#if ENGINE_MINOR_VERSION >= 18
#if ENGINE_MINOR_VERSION >= 18 || ENGINE_MAJOR_VERSION > 4
void FOnlineIdentityGOG::RevokeAuthToken(const FUniqueNetId& InUserId, const FOnRevokeAuthTokenCompleteDelegate& InDelegate)
{
UE_LOG_ONLINE_IDENTITY(Display, TEXT("FOnlineIdentityGOG::RevokeAuthToken()"));
Expand All @@ -379,7 +383,7 @@ void FOnlineIdentityGOG::RevokeAuthToken(const FUniqueNetId& InUserId, const FOn
{
UE_LOG_ONLINE_IDENTITY(Error, TEXT("Failed to get access token: %s; %s"), UTF8_TO_TCHAR(err->GetName()), UTF8_TO_TCHAR(err->GetMsg()));
InDelegate.ExecuteIfBound(InUserId, FOnlineError{
#if ENGINE_MINOR_VERSION >= 19
#if ENGINE_MINOR_VERSION >= 19 || ENGINE_MAJOR_VERSION > 4
501
#else
"501"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FOnlineIdentityGOG

void GetUserPrivilege(const FUniqueNetId& InUserId, EUserPrivileges::Type InPrivilege, const FOnGetUserPrivilegeCompleteDelegate& InDelegate) override;

#if ENGINE_MINOR_VERSION >= 18
#if ENGINE_MINOR_VERSION >= 18 || ENGINE_MAJOR_VERSION > 4
FPlatformUserId GetPlatformUserIdFromUniqueNetId(const FUniqueNetId& InUniqueNetId) const override;

void RevokeAuthToken(const FUniqueNetId& InUserId, const FOnRevokeAuthTokenCompleteDelegate& InDelegate) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace
FString playerNickname;
if (!UserInfoUtils::GetPlayerNickname(*userID, playerNickname))
return false;
#if ENGINE_MINOR_VERSION >= 19
#if ENGINE_MINOR_VERSION >= 19 || ENGINE_MAJOR_VERSION > 4
auto& newEntry = InOutReadLeaderboard->Rows.Emplace_GetRef(MoveTemp(playerNickname), MoveTemp(userID));
#else
const auto newEntryIdx = InOutReadLeaderboard->Rows.Emplace(MoveTemp(playerNickname), MoveTemp(userID));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <limits>
#include <algorithm>

#if ! PLATFORM_PS4
#pragma warning (disable: 4868)
#endif
#pragma warning (disable : 4668)
FReadLeaderboardAroundRankListener::FReadLeaderboardAroundRankListener(
class FOnlineLeaderboardsGOG& InLeaderboardsInterface,
int32 InRank,
Expand All @@ -19,9 +17,7 @@ FReadLeaderboardAroundRankListener::FReadLeaderboardAroundRankListener(
if (rank <= 0)
UE_LOG_ONLINE_LEADERBOARD(Error, TEXT("Rank cannot be negative or zero"));
}
#if ! PLATFORM_PS4
#pragma warning (default: 4868)
#endif
#pragma warning (default : 4668)

void FReadLeaderboardAroundRankListener::RequestLeaderboardEntries()
{
Expand Down
2 changes: 1 addition & 1 deletion Source/OnlineSubsystemGOG/Private/Loggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DEFINE_LOG_CATEGORY(LogNetworkingGOG);
DEFINE_LOG_CATEGORY(LogTrafficGOG);

#if ENGINE_MINOR_VERSION < 20
#if ENGINE_MINOR_VERSION < 20 && ENGINE_MAJOR_VERSION < 5
DEFINE_LOG_CATEGORY(LogOnlineAchievements);
DEFINE_LOG_CATEGORY(LogOnlineFriend);
DEFINE_LOG_CATEGORY(LogOnlineIdentity);
Expand Down
2 changes: 1 addition & 1 deletion Source/OnlineSubsystemGOG/Private/Loggers.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DECLARE_LOG_CATEGORY_EXTERN(LogTrafficGOG, Log, All);
#define UE_LOG_NETWORKING(Verbosity, Format, ...) UE_LOG(LogNetworkingGOG, Verbosity, Format, ##__VA_ARGS__)
#define UE_LOG_TRAFFIC(Verbosity, Format, ...) UE_LOG(LogTrafficGOG, Verbosity, Format, ##__VA_ARGS__)

#if ENGINE_MINOR_VERSION < 20
#if ENGINE_MINOR_VERSION < 20 && ENGINE_MAJOR_VERSION < 5
DECLARE_LOG_CATEGORY_EXTERN(LogOnlineAchievements, Log, All);
DECLARE_LOG_CATEGORY_EXTERN(LogOnlineFriend, Log, All);
DECLARE_LOG_CATEGORY_EXTERN(LogOnlineIdentity, Log, All);
Expand Down
6 changes: 3 additions & 3 deletions Source/OnlineSubsystemGOG/Private/Network/InternetAddrGOG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FInternetAddrGOG::FInternetAddrGOG(FUniqueNetIdGOG InUniqueNetID)
: uniqueNetID{MoveTemp(InUniqueNetID)}
{}

#if ENGINE_MINOR_VERSION >= 21
#if ENGINE_MINOR_VERSION >= 21 || ENGINE_MAJOR_VERSION > 4
TArray<uint8> FInternetAddrGOG::GetRawIp() const
{
return {uniqueNetID.GetBytes(), uniqueNetID.GetSize()};
Expand All @@ -30,7 +30,7 @@ bool FInternetAddrGOG::operator==(const FInternetAddr& InOther) const
return GetRawIp() == InOther.GetRawIp();
}

#if ENGINE_MINOR_VERSION >= 22
#if ENGINE_MINOR_VERSION >= 22 || ENGINE_MAJOR_VERSION > 4
uint32 FInternetAddrGOG::GetTypeHash() const
#else
uint32 FInternetAddrGOG::GetTypeHash()
Expand All @@ -46,7 +46,7 @@ bool FInternetAddrGOG::operator==(const FInternetAddr& InOther) const
}
#endif

#if ENGINE_MINOR_VERSION >= 23
#if ENGINE_MINOR_VERSION >= 23 || ENGINE_MAJOR_VERSION > 4
FName FInternetAddrGOG::GetProtocolType() const
{
return TEXT_GOG;
Expand Down
6 changes: 3 additions & 3 deletions Source/OnlineSubsystemGOG/Private/Network/InternetAddrGOG.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class FInternetAddrGOG : public FInternetAddr

bool operator==(const FInternetAddr& InOther) const override;

#if ENGINE_MINOR_VERSION >= 21
#if ENGINE_MINOR_VERSION >= 21 || ENGINE_MAJOR_VERSION > 4
TArray<uint8> GetRawIp() const override;

void SetRawIp(const TArray<uint8>& InRawAddr) override;

TSharedRef<FInternetAddr> Clone() const override;

void SetLoopbackAddress() override;
#if ENGINE_MINOR_VERSION >= 22
#if ENGINE_MINOR_VERSION >= 22 || ENGINE_MAJOR_VERSION > 4

uint32 GetTypeHash() const override;
#else
Expand All @@ -52,7 +52,7 @@ class FInternetAddrGOG : public FInternetAddr
#endif
#endif

#if ENGINE_MINOR_VERSION >= 23
#if ENGINE_MINOR_VERSION >= 23 || ENGINE_MAJOR_VERSION > 4
FName GetProtocolType() const override;
#endif

Expand Down
12 changes: 6 additions & 6 deletions Source/OnlineSubsystemGOG/Private/Network/NetConnectionGOG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void UNetConnectionGOG::InitRemoteConnection(UNetDriver* InDriver, class FSocket

InitBase(InDriver, InSocket, InURL, InState, InMaxPacket, InPacketOverhead);

#if ENGINE_MINOR_VERSION >= 23
#if ENGINE_MINOR_VERSION >= 23 || ENGINE_MAJOR_VERSION > 4
RemoteAddr = InRemoteAddr.Clone();
#endif

Expand All @@ -58,8 +58,8 @@ void UNetConnectionGOG::InitRemoteConnection(UNetDriver* InDriver, class FSocket
SetExpectedClientLoginMsgType(NMT_Hello);
}

#if ENGINE_MINOR_VERSION >= 21
#if ENGINE_MINOR_VERSION < 23
#if ENGINE_MINOR_VERSION >= 21 || ENGINE_MAJOR_VERSION > 4
#if ENGINE_MINOR_VERSION < 23 && ENGINE_MAJOR_VERSION < 5
TSharedPtr<FInternetAddr> UNetConnectionGOG::GetInternetAddr()
{
// FInternetAddr is used by the engine for fast connection mapping, mainly to prevent DDoS when using IpNetDriver.
Expand All @@ -86,7 +86,7 @@ void UNetConnectionGOG::LowLevelSend(void* InData, int32 /*InCountBytes*/, int32

if (Handler.IsValid() && !Handler->GetRawSend())
{
#if ENGINE_MINOR_VERSION >= 21
#if ENGINE_MINOR_VERSION >= 21 || ENGINE_MAJOR_VERSION > 4
const auto processedDataPacket = Handler->Outgoing(dataToSend, InCountBits, OutTraits);
#else
const auto processedDataPacket = Handler->Outgoing(dataToSend, InCountBits);
Expand All @@ -103,7 +103,7 @@ void UNetConnectionGOG::LowLevelSend(void* InData, int32 /*InCountBytes*/, int32

auto bytesToSend = FMath::DivideAndRoundUp(InCountBits, 8);

#if ENGINE_MINOR_VERSION >= 18 && !UE_BUILD_SHIPPING
#if (ENGINE_MINOR_VERSION >= 18 || ENGINE_MAJOR_VERSION > 4) && !UE_BUILD_SHIPPING
bool bBlockSend = false;
LowLevelSendDel.ExecuteIfBound(InData, bytesToSend, bBlockSend);
if (bBlockSend)
Expand All @@ -126,7 +126,7 @@ void UNetConnectionGOG::LowLevelSend(void* InData, int32 /*InCountBytes*/, int32
remotePeerID,
dataToSend,
bytesToSend,
#if ENGINE_MINOR_VERSION >= 25
#if ENGINE_MINOR_VERSION >= 25 || ENGINE_MAJOR_VERSION > 4
IsInternalAck()
#else
InternalAck
Expand Down
Loading

0 comments on commit f6d0394

Please sign in to comment.