2021-09-28 04:00:33 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "IO/PackageId.h"
|
|
|
|
|
#include "IO/PackageStore.h"
|
2022-01-19 18:28:42 -05:00
|
|
|
#include "Misc/PackagePath.h"
|
2021-09-28 04:00:33 -04:00
|
|
|
|
|
|
|
|
struct FIoContainerHeader;
|
|
|
|
|
struct FFilePackageStoreEntry;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* File/container based package store.
|
|
|
|
|
*/
|
|
|
|
|
class FFilePackageStore
|
|
|
|
|
: public FPackageStoreBase
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FFilePackageStore();
|
2022-01-19 18:28:42 -05:00
|
|
|
virtual ~FFilePackageStore();
|
2021-09-28 04:00:33 -04:00
|
|
|
|
|
|
|
|
virtual void Initialize() override;
|
|
|
|
|
virtual void Lock() override;
|
|
|
|
|
virtual void Unlock() override;
|
|
|
|
|
virtual bool DoesPackageExist(FPackageId PackageId) override;
|
2021-10-12 21:21:22 -04:00
|
|
|
virtual EPackageStoreEntryStatus GetPackageStoreEntry(FPackageId PackageId, FPackageStoreEntry& OutPackageStoreEntry) override;
|
2021-09-28 04:00:33 -04:00
|
|
|
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;
|
2022-04-25 07:37:07 -04:00
|
|
|
uint32 Sequence;
|
2021-09-28 04:00:33 -04:00
|
|
|
};
|
|
|
|
|
|
2022-01-19 18:28:42 -05:00
|
|
|
#if WITH_EDITOR
|
|
|
|
|
struct FUncookedPackage
|
|
|
|
|
{
|
|
|
|
|
FName PackageName;
|
|
|
|
|
EPackageExtension HeaderExtension;
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-09-28 04:00:33 -04:00
|
|
|
void Update();
|
2022-01-19 18:28:42 -05:00
|
|
|
#if WITH_EDITOR
|
|
|
|
|
uint64 AddUncookedPackagesFromRoot(const FString& RootPath);
|
|
|
|
|
#endif
|
2021-09-28 04:00:33 -04:00
|
|
|
|
|
|
|
|
FRWLock EntriesLock;
|
|
|
|
|
FCriticalSection UpdateLock;
|
|
|
|
|
TArray<FMountedContainer> MountedContainers;
|
2022-04-25 07:37:07 -04:00
|
|
|
TAtomic<uint32> NextSequence{ 0 };
|
2021-09-28 04:00:33 -04:00
|
|
|
TMap<FPackageId, const FFilePackageStoreEntry*> StoreEntriesMap;
|
|
|
|
|
TMap<FPackageId, TTuple<FName, FPackageId>> RedirectsPackageMap;
|
2021-11-18 14:37:34 -05:00
|
|
|
TMap<FPackageId, FName> LocalizedPackages;
|
2021-09-28 04:00:33 -04:00
|
|
|
bool bNeedsUpdate = false;
|
|
|
|
|
|
2022-01-19 18:28:42 -05:00
|
|
|
#if WITH_EDITOR
|
|
|
|
|
FDelegateHandle OnContentPathMountedDelegateHandle;
|
|
|
|
|
FCriticalSection UncookedPackageRootsLock;
|
|
|
|
|
TSet<FString> PendingUncookedPackageRoots;
|
|
|
|
|
TMap<FPackageId, FUncookedPackage> UncookedPackagesMap;
|
|
|
|
|
#endif
|
2022-04-25 07:37:07 -04:00
|
|
|
#if WITH_EDITOR
|
|
|
|
|
TMap<FPackageId, const FFilePackageStoreEntry*> OptionalSegmentStoreEntriesMap;
|
|
|
|
|
#endif
|
2022-01-19 18:28:42 -05:00
|
|
|
|
|
|
|
|
static thread_local int32 LockedOnThreadCount;
|
2021-09-28 04:00:33 -04:00
|
|
|
};
|