Skip to content

Commit

Permalink
Add Unreal Engine 5.5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
slonopotamus committed Nov 15, 2024
1 parent a66ca30 commit 4953514
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Source/UEST/Private/ScopedGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "GameMapsSettings.h"
#include "Iris/ReplicationSystem/ObjectReplicationBridge.h"
#include "Iris/ReplicationSystem/ReplicationSystem.h"
#include "Misc/PlayInEditorLoadingScope.h"
#include "Net/OnlineEngineInterface.h"
#include "UESTGameInstance.h"

Expand Down Expand Up @@ -109,6 +110,22 @@ FScopedGameInstance::~FScopedGameInstance()
}
}

#if ENGINE_MAJOR_VERSION > 5 || (ENGINE_MAJOR_VERSION == 5 && ENGINE_MAJOR_VERSION >= 5)
struct FGPlayInEditorIDGuard final : UE::Core::Private::FPlayInEditorLoadingScope
{
explicit FGPlayInEditorIDGuard(const int32 PlayInEditorID)
: FPlayInEditorLoadingScope(PlayInEditorID)
{}
};
#else
struct FGPlayInEditorIDGuard final : TGuardValue<int32>
{
explicit FGPlayInEditorIDGuard(const int32 PlayInEditorID)
: TGuardValue(GPlayInEditorID, PlayInEditorID)
{}
};
#endif

UGameInstance* FScopedGameInstance::CreateGame(const EScopedGameType Type, const FString& MapToLoad, const bool bWaitForConnect)
{
if (!ensureAlwaysMsgf(!FreePIEInstances.IsEmpty(), TEXT("Attempt to create too many games at the same time!")))
Expand Down Expand Up @@ -167,7 +184,7 @@ UGameInstance* FScopedGameInstance::CreateGame(const EScopedGameType Type, const
}

const TGuardValue GIsPlayInEditorWorldGuard(GIsPlayInEditorWorld, false);
const TGuardValue GPlayInEditorIDGuard(GPlayInEditorID, Game->GetWorldContext()->PIEInstance);
const FGPlayInEditorIDGuard GPlayInEditorIDGuard(Game->GetWorldContext()->PIEInstance);
const FGWorldGuard GWorldGuard;

FString Error;
Expand Down Expand Up @@ -320,7 +337,7 @@ void FScopedGameInstance::TickInternal(const float DeltaSeconds, const ELevelTic
for (const auto& Game : Games)
{
const TGuardValue GIsPlayInEditorWorldGuard(GIsPlayInEditorWorld, false);
const TGuardValue GPlayInEditorIDGuard(GPlayInEditorID, Game->GetWorldContext()->PIEInstance);
const FGPlayInEditorIDGuard GPlayInEditorIDGuard(Game->GetWorldContext()->PIEInstance);
const FGWorldGuard GWorldGuard;

Game->GetEngine()->TickWorldTravel(*Game->GetWorldContext(), DeltaSeconds);
Expand Down
7 changes: 7 additions & 0 deletions Source/UEST/Private/UEST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ uint32 FUESTTestBase::GetRequiredDeviceNum() const
return 1;
}

#if ENGINE_MAJOR_VERSION > 5 || (ENGINE_MAJOR_VERSION == 5 && ENGINE_MAJOR_VERSION >= 5)
EAutomationTestFlags FUESTTestBase::GetTestFlags() const
{
return EAutomationTestFlags_ApplicationContextMask | EAutomationTestFlags::ProductFilter;
}
#else
uint32 FUESTTestBase::GetTestFlags() const
{
return EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter;
}
#endif

void FUESTTestBase::GetTests(TArray<FString>& OutBeautifiedNames, TArray<FString>& OutTestCommands) const
{
Expand Down
4 changes: 4 additions & 0 deletions Source/UEST/Public/UEST.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,11 @@ class UEST_API FUESTTestBase : public FAutomationTestBase

virtual uint32 GetRequiredDeviceNum() const override;

#if ENGINE_MAJOR_VERSION > 5 || (ENGINE_MAJOR_VERSION == 5 && ENGINE_MAJOR_VERSION >= 5)
virtual EAutomationTestFlags GetTestFlags() const override;
#else
virtual uint32 GetTestFlags() const override;
#endif

virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray<FString>& OutTestCommands) const override;

Expand Down

0 comments on commit 4953514

Please sign in to comment.