2022-03-01 13:44:27 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "TestCommon/Initialization.h"
|
2022-03-24 13:28:25 -04:00
|
|
|
#include "TestCommon/CoreUtilities.h"
|
|
|
|
|
#include "TestCommon/CoreUObjectUtilities.h"
|
|
|
|
|
#include "TestCommon/EngineUtilities.h"
|
2023-02-24 15:27:37 -05:00
|
|
|
|
|
|
|
|
#include "GenericPlatform/GenericPlatformFile.h"
|
|
|
|
|
#include "HAL/PlatformFileManager.h"
|
2023-02-22 10:23:19 -05:00
|
|
|
#include "Misc/DelayedAutoRegister.h"
|
2022-03-01 13:44:27 -05:00
|
|
|
|
2023-02-24 15:27:37 -05:00
|
|
|
static IPlatformFile* DefaultPlatformFile;
|
|
|
|
|
|
2022-03-01 13:44:27 -05:00
|
|
|
void InitAllThreadPoolsEditorEx(bool MultiThreaded)
|
|
|
|
|
{
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
InitEditorThreadPools();
|
|
|
|
|
#endif // WITH_EDITOR
|
|
|
|
|
InitAllThreadPools(MultiThreaded);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InitStats()
|
|
|
|
|
{
|
|
|
|
|
#if STATS
|
|
|
|
|
FThreadStats::StartThread();
|
|
|
|
|
#endif // #if STATS
|
2023-02-22 10:23:19 -05:00
|
|
|
|
|
|
|
|
FDelayedAutoRegisterHelper::RunAndClearDelayedAutoRegisterDelegates(EDelayedRegisterRunPhase::StatSystemReady);
|
2022-03-01 13:44:27 -05:00
|
|
|
}
|
|
|
|
|
|
2023-02-24 15:27:37 -05:00
|
|
|
void UsePlatformFileStubIfRequired()
|
|
|
|
|
{
|
|
|
|
|
#if WITH_ENGINE && UE_LLT_USE_PLATFORM_FILE_STUB
|
|
|
|
|
if (IPlatformFile* WrapperFile = FPlatformFileManager::Get().GetPlatformFile(TEXT("PlatformFileStub")))
|
|
|
|
|
{
|
|
|
|
|
IPlatformFile* CurrentPlatformFile = &FPlatformFileManager::Get().GetPlatformFile();
|
|
|
|
|
WrapperFile->Initialize(CurrentPlatformFile, TEXT(""));
|
|
|
|
|
FPlatformFileManager::Get().SetPlatformFile(*WrapperFile);
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_ENGINE && UE_LLT_USE_PLATFORM_FILE_STUB
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveDefaultPlatformFile()
|
|
|
|
|
{
|
|
|
|
|
DefaultPlatformFile = &FPlatformFileManager::Get().GetPlatformFile();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UseDefaultPlatformFile()
|
|
|
|
|
{
|
|
|
|
|
FPlatformFileManager::Get().SetPlatformFile(*DefaultPlatformFile);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-01 13:44:27 -05:00
|
|
|
void InitAll(bool bAllowLogging, bool bMultithreaded)
|
|
|
|
|
{
|
2023-02-24 15:27:37 -05:00
|
|
|
SaveDefaultPlatformFile();
|
|
|
|
|
UsePlatformFileStubIfRequired();
|
2022-03-01 13:44:27 -05:00
|
|
|
InitAllThreadPools(bMultithreaded);
|
|
|
|
|
#if WITH_ENGINE
|
|
|
|
|
InitAsyncQueues();
|
|
|
|
|
#endif // WITH_ENGINE
|
|
|
|
|
InitTaskGraph();
|
|
|
|
|
#if WITH_ENGINE
|
2023-02-06 14:27:24 -05:00
|
|
|
InitGWarn();
|
|
|
|
|
InitEngine();
|
2022-03-01 13:44:27 -05:00
|
|
|
#endif // WITH_ENGINE
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
InitDerivedDataCache();
|
|
|
|
|
InitSlate();
|
|
|
|
|
InitForWithEditorOnlyData();
|
|
|
|
|
InitEditor();
|
|
|
|
|
#endif // WITH_EDITOR
|
|
|
|
|
#if WITH_COREUOBJECT
|
|
|
|
|
InitCoreUObject();
|
|
|
|
|
#endif
|
2023-03-16 17:08:41 -04:00
|
|
|
GIsRunning = true;
|
2022-03-01 13:44:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CleanupAll()
|
|
|
|
|
{
|
2023-02-06 14:27:24 -05:00
|
|
|
#if WITH_ENGINE
|
|
|
|
|
CleanupEngine();
|
|
|
|
|
#endif
|
2022-03-01 13:44:27 -05:00
|
|
|
#if WITH_COREUOBJECT
|
|
|
|
|
CleanupCoreUObject();
|
|
|
|
|
#endif
|
|
|
|
|
CleanupAllThreadPools();
|
|
|
|
|
CleanupTaskGraph();
|
|
|
|
|
}
|