Files
UnrealEngineUWP/Engine/Source/Runtime/PakFile/Private/FilePackageStore.h
CarlMagnus Nordin 3d5a2052dc AsyncLoading2: Add support for having multiple PackageStore backends
#preflight 6296fc872a1851b4ccae7e39
#rb pj.kack

[CL 20447121 by CarlMagnus Nordin in ue5-main branch]
2022-06-01 02:12:33 -04:00

77 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "IO/PackageId.h"
#include "IO/PackageStore.h"
#include "Misc/PackagePath.h"
struct FIoContainerHeader;
struct FFilePackageStoreEntry;
/*
* File/container based package store.
*/
class FFilePackageStoreBackend
: public IPackageStoreBackend
{
public:
FFilePackageStoreBackend();
virtual ~FFilePackageStoreBackend();
virtual void OnMounted(TSharedRef<const FPackageStoreBackendContext>) override
{
}
virtual void BeginRead() override;
virtual void EndRead() override;
virtual EPackageStoreEntryStatus GetPackageStoreEntry(FPackageId PackageId, FPackageStoreEntry& OutPackageStoreEntry) override;
virtual bool GetPackageRedirectInfo(FPackageId PackageId, FName& OutSourcePackageName, FPackageId& OutRedirectedToPackageId) override;
void Mount(const FIoContainerHeader* ContainerHeader, uint32 Order);
void Unmount(const FIoContainerHeader* ContainerHeader);
private:
struct FMountedContainer
{
const FIoContainerHeader* ContainerHeader;
uint32 Order;
uint32 Sequence;
};
#if WITH_EDITOR
struct FUncookedPackage
{
FName PackageName;
EPackageExtension HeaderExtension;
};
#endif //if WITH_EDITOR
void Update();
#if WITH_EDITOR
uint64 AddUncookedPackagesFromRoot(const FString& RootPath);
uint64 RemoveUncookedPackagesFromRoot(const TSet<FString>& RootPath);
#endif //if WITH_EDITOR
FRWLock EntriesLock;
FCriticalSection UpdateLock;
TArray<FMountedContainer> MountedContainers;
TAtomic<uint32> NextSequence{ 0 };
TMap<FPackageId, const FFilePackageStoreEntry*> StoreEntriesMap;
TMap<FPackageId, TTuple<FName, FPackageId>> RedirectsPackageMap;
TMap<FPackageId, FName> LocalizedPackages;
bool bNeedsUpdate = false;
#if WITH_EDITOR
FDelegateHandle OnContentPathMountedDelegateHandle;
FDelegateHandle OnContentPathDismountedDelegateHandle;
FCriticalSection UncookedPackageRootsLock;
TSet<FString> PendingAddUncookedPackageRoots;
TSet<FString> PendingRemoveUncookedPackageRoots;
TMap<FPackageId, FUncookedPackage> UncookedPackagesMap;
TMap<FPackageId, const FFilePackageStoreEntry*> OptionalSegmentStoreEntriesMap;
#endif //if WITH_EDITOR
};