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.
|
|
|
|
|
*/
|
2022-06-01 02:12:33 -04:00
|
|
|
class FFilePackageStoreBackend
|
|
|
|
|
: public IPackageStoreBackend
|
2021-09-28 04:00:33 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2022-06-01 02:12:33 -04:00
|
|
|
FFilePackageStoreBackend();
|
|
|
|
|
virtual ~FFilePackageStoreBackend();
|
2021-09-28 04:00:33 -04:00
|
|
|
|
2022-06-01 02:12:33 -04:00
|
|
|
virtual void OnMounted(TSharedRef<const FPackageStoreBackendContext>) override
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void BeginRead() override;
|
|
|
|
|
virtual void EndRead() 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;
|
|
|
|
|
};
|
2022-05-11 13:16:30 -04:00
|
|
|
#endif //if WITH_EDITOR
|
2022-01-19 18:28:42 -05:00
|
|
|
|
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);
|
2022-05-11 13:16:30 -04:00
|
|
|
uint64 RemoveUncookedPackagesFromRoot(const TSet<FString>& RootPath);
|
|
|
|
|
#endif //if WITH_EDITOR
|
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;
|
2022-05-11 13:16:30 -04:00
|
|
|
FDelegateHandle OnContentPathDismountedDelegateHandle;
|
2022-01-19 18:28:42 -05:00
|
|
|
FCriticalSection UncookedPackageRootsLock;
|
2022-05-11 13:16:30 -04:00
|
|
|
TSet<FString> PendingAddUncookedPackageRoots;
|
|
|
|
|
TSet<FString> PendingRemoveUncookedPackageRoots;
|
2022-01-19 18:28:42 -05:00
|
|
|
TMap<FPackageId, FUncookedPackage> UncookedPackagesMap;
|
2022-04-25 07:37:07 -04:00
|
|
|
TMap<FPackageId, const FFilePackageStoreEntry*> OptionalSegmentStoreEntriesMap;
|
2022-05-11 13:16:30 -04:00
|
|
|
#endif //if WITH_EDITOR
|
2022-01-19 18:28:42 -05:00
|
|
|
|
2021-09-28 04:00:33 -04:00
|
|
|
};
|