5#include "Containers/Array.h"
8#include "Containers/Map.h"
9#include "Containers/Set.h"
35#include "Misc/Optional.h"
54#ifndef ENABLE_PAKFILE_USE_DIRECTORY_TREE
55#define ENABLE_PAKFILE_USE_DIRECTORY_TREE 1
67 class FPakFileDirectoryVisitorBase;
68 struct FHandleMountPaksExDelegate;
70 template<
bool bInAllowDuplicateKeys = false>
71 struct FPakEntryFilenameSetKeyFuncs;
73namespace UE::IoStore {
class IFileIoDispatcherBackend; }
85#ifndef ENABLE_PAKFILE_RUNTIME_PRUNING
86#define ENABLE_PAKFILE_RUNTIME_PRUNING 1
88#define ENABLE_PAKFILE_RUNTIME_PRUNING_VALIDATE ENABLE_PAKFILE_RUNTIME_PRUNING && !UE_BUILD_SHIPPING
91#define PAKHASH_USE_CRC 1
132UE_DEPRECATED(
"5.1",
"Use FPakPrincipalSignatureTableCheckFailureHandler instead")
142 PakFile_Magic = 0x5A6F12E1,
144 MaxChunkDataSize = 64*1024,
146 CompressionMethodNameLen = 32,
148 MaxNumCompressionMethods=5,
154 PakFile_Version_Initial = 1,
155 PakFile_Version_NoTimestamps = 2,
156 PakFile_Version_CompressionEncryption = 3,
157 PakFile_Version_IndexEncryption = 4,
158 PakFile_Version_RelativeChunkOffsets = 5,
159 PakFile_Version_DeleteRecords = 6,
160 PakFile_Version_EncryptionKeyGuid = 7,
161 PakFile_Version_FNameBasedCompressionMethod = 8,
162 PakFile_Version_FrozenIndex = 9,
163 PakFile_Version_PathHashIndex = 10,
164 PakFile_Version_Fnv64BugFix = 11,
165 PakFile_Version_Utf8PakDirectory = 12,
170 PakFile_Version_Latest = PakFile_Version_Last - 1
194 : Magic(PakFile_Magic)
195 , Version(PakFile_Version_Latest)
211 int64 Size =
sizeof(Magic) +
sizeof(Version) +
sizeof(IndexOffset) +
sizeof(IndexSize) +
sizeof(IndexHash) +
sizeof(bEncryptedIndex);
212 if (
InVersion >= PakFile_Version_EncryptionKeyGuid)
Size +=
sizeof(EncryptionKeyGuid);
213 if (
InVersion >= PakFile_Version_FNameBasedCompressionMethod)
Size += CompressionMethodNameLen * MaxNumCompressionMethods;
223 return Version >= PakFile_Version_RelativeChunkOffsets;
241 Ar << EncryptionKeyGuid;
243 Ar << bEncryptedIndex;
245 if (Magic != PakFile_Magic)
259 if (Version < PakFile_Version_IndexEncryption)
261 bEncryptedIndex =
false;
264 if (Version < PakFile_Version_EncryptionKeyGuid)
270 if (Version >= PakFile_Version_FrozenIndex && Version < PakFile_Version_PathHashIndex)
276 UE_LOG(
LogPakFile,
Fatal,
TEXT(
"PakFile was frozen with version FPakInfo::PakFile_Version_FrozenIndex, which is no longer supported. Regenerate Paks."));
280 if (Version < PakFile_Version_FNameBasedCompressionMethod)
285 CompressionMethods.
Add(
TEXT(
"Oodle"));
290 const int32 BufferSize = CompressionMethodNameLen * MaxNumCompressionMethods;
326 if (CompressionMethods[
Index] == CompressionMethod)
332 checkf(CompressionMethod.
ToString().Len() < CompressionMethodNameLen,
TEXT(
"Compression method name, %s, is too long for pak file serialization. You can increase CompressionMethodNameLen, but then will have to handle version management."), *CompressionMethod.
ToString());
334 checkf(CompressionMethods.
Num() <= MaxNumCompressionMethods,
TEXT(
"Too many unique compression methods in one pak file. You can increase MaxNumCompressionMethods, but then will have to handle version management."));
337 return CompressionMethods.
Add(CompressionMethod);
342 return CompressionMethods[
Index];
372 return !(*
this ==
B);
378 Ar <<
Block.CompressedStart;
379 Ar <<
Block.CompressedEnd;
443 SerializedSize +=
sizeof(
int32);
457 SerializedSize +=
sizeof(
int64);
459 return SerializedSize;
476 return !(*
this ==
B);
484 return Size ==
B.Size &&
538 UE_LOG(
LogPakFile,
Fatal,
TEXT(
"Found an unknown compression type in pak file, will need to be supported for legacy files"));
715 explicit operator bool()
const {
return Archive !=
nullptr; }
731#if ENABLE_PAKFILE_USE_DIRECTORY_TREE
770#if ENABLE_PAKFILE_RUNTIME_PRUNING
775#if ENABLE_PAKFILE_RUNTIME_PRUNING
778 PakFile.DirectoryIndexLock.ReadLock();
782#if ENABLE_PAKFILE_RUNTIME_PRUNING
787 PakFile.DirectoryIndexLock.ReadUnlock();
809 FName PakFilenameName;
815 std::atomic<int32> CurrentlyUsedReaders = 0;
831#if ENABLE_PAKFILE_RUNTIME_PRUNING
836 mutable FRWLock DirectoryIndexLock;
851 int64 CachedTotalSize;
857 bool bHasPathHashIndex;
859 bool bHasFullDirectoryIndex;
860#if ENABLE_PAKFILE_RUNTIME_PRUNING
862 bool bWillPruneDirectoryIndex;
864 bool bNeedsLegacyPruning;
866#if ENABLE_PAKFILE_USE_DIRECTORY_TREE
867 bool bUseDirectoryTree;
880 bool UnderlyingCacheTrimDisabled;
922 return PakchunkIndex;
929 Visitor.CallShouldVisitAndVisit(*It.Filename(),
false);
1011 return PakFilenameName;
1016 return CachedTotalSize;
1082 template <
class ContainerType>
1083 UE_DEPRECATED(5.4,
"Use version that takes a TArray<FString>& instead.")
1085 bool bIncludeFiles =
true,
bool bIncludeDirectories =
false,
bool bRecursive =
false)
const
1089 for (FString&
File : LocalFiles)
1108 bool bIncludeFiles =
true,
bool bIncludeDirectories =
false,
bool bRecursive =
false)
const;
1168#if ENABLE_PAKFILE_USE_DIRECTORY_TREE
1181 mutable FString CachedFilename;
1187 bool bIncludeDeleted;
1188#if ENABLE_PAKFILE_RUNTIME_PRUNING
1190 bool bRequiresDirectoryIndexLock;
1216#if ENABLE_PAKFILE_RUNTIME_PRUNING
1229 void AdvanceToValid();
1232 FPathHashIndex::TConstIterator& GetPathHashIt();
1233 const FPathHashIndex::TConstIterator& GetPathHashIt()
const;
1239 bool IsDirectoryItValid()
const;
1240 void IncrementDirectoryIt();
1243 FPakDirectory::TConstIterator& GetFileIt();
1244 const FPakDirectory::TConstIterator& GetFileIt()
const;
1247 FDirectoryIndex::TConstIterator& GetDirectoryIndexIt();
1248 const FDirectoryIndex::TConstIterator& GetDirectoryIndexIt()
const;
1250#if ENABLE_PAKFILE_USE_DIRECTORY_TREE
1323 return bHasFullDirectoryIndex;
1404 if (Path.Len() > 0 && Path[Path.Len() - 1] !=
'/')
1412 return Path.Len() > 0 && Path[Path.Len() - 1] ==
TEXT(
'/');
1438 if (!
Child.StartsWith(MountPoint))
1443 if (
Child.IsEmpty())
1458 if (!
Child.StartsWith(MountPoint))
1498 struct FIndexSettings;
1500 static FIndexSettings& GetIndexSettings();
1507 static bool IsPakValidatePruning();
1513 static bool IsPakDelayPruning();
1515#if ENABLE_PAKFILE_RUNTIME_PRUNING
1517 static bool bSomePakNeedsPruning;
1524 PAKFILE_API bool RequiresDirectoryIndexLock()
const;
1529 PAKFILE_API bool ShouldValidatePrunedDirectory()
const;
1552 FDirectoryTreeIndex* DirectoryTreeIndex,
FPathHashIndex* PathHashIndex,
1579 void AddSpecialFile(
const FPakEntry& Entry,
const FString& Filename);
1583 FDirectoryTreeIndex* PrunedDirectoryTreeIndex,
const FString& MountPoint);
1585 template <
typename ShouldVisitFunc>
1590 bool bIncludeFiles =
true;
1591 bool bIncludeDirectories =
false;
1592 bool bRecursive =
false;
1595 template <
typename ShouldVisitFunc,
class ContainerType>
1610 template <
typename ShouldVisitFunc,
class ContainerType>
1615#if ENABLE_PAKFILE_USE_DIRECTORY_TREE
1616 template <
typename ShouldVisitFunc,
class ContainerType>
1621#if !UE_BUILD_SHIPPING
1622 template <
class ContainerType>
1627 template <
typename ShouldVisitFunc,
class ContainerType>
1632 template <
typename ShouldVisitFunc,
class ContainerType>
1648#if ENABLE_PAKFILE_RUNTIME_PRUNING_VALIDATE
1681template<
typename EncryptionPolicy = FPakNoEncryption >
1709 FGuid EncryptionKeyGuid =
PakFile.GetInfo().EncryptionKeyGuid;
1710 const constexpr int64 Alignment = (
int64)EncryptionPolicy::Alignment;
1712 uint8 TempBuffer[Alignment];
1720 PakReader->
Serialize(TempBuffer, Alignment);
1721 EncryptionPolicy::DecryptBlock(TempBuffer, Alignment, EncryptionKeyGuid);
1723 V = (
void*)((
uint8*)V + CopySize);
1735 EncryptionPolicy::DecryptBlock(V, CopySize, EncryptionKeyGuid);
1737 V = (
void*)((
uint8*)V + CopySize);
1741 PakReader->
Serialize(TempBuffer, Alignment);
1742 EncryptionPolicy::DecryptBlock(TempBuffer, Alignment, EncryptionKeyGuid);
1751template<
typename ReaderPolicy = FPakReaderPolicy<> >
1821 if (ReadInternal(Destination, BytesToRead, ReadPos))
1823 ReadPos += BytesToRead;
1833 if (BytesToRead < 0 ||
Offset < 0 || (BytesToRead +
Offset) > Reader.FileSize())
1838 return ReadInternal(Destination, BytesToRead,
Offset);
1847 return Reader.FileSize();
1865 if (!Reader.PakEntry.Verified)
1869 PakReader->
Seek(Reader.PakEntry.Offset);
1873 Reader.PakEntry.Verified =
true;
1881 if (Reader.FileSize() >= (
Offset + BytesToRead))
1883 Reader.Serialize(
Offset, Destination, BytesToRead);
1915 struct FPakListEntry
1925 inline bool operator < (
const FPakListEntry& RHS)
const
1927 return ReadOrder > RHS.ReadOrder;
1931 template<
bool bInAllowDuplicateKeys>
1934 struct FPakListDeferredEntry
1939 FGuid EncryptionKeyGuid;
1940 int32 PakchunkIndex;
1956 FString IniFileExtension;
1958 FString GameUserSettingsIniFilename;
1964#if !UE_BUILD_SHIPPING
1967 bool bLookLooseFirst =
false;
1976 Paks.Append(PakFiles);
2028 PAKFILE_API bool HandleUnmountPakDelegate(
const FString& PakFilePath);
2084 return TEXT(
"PakFile");
2114 for (FPakListEntry& Entry : PakFiles)
2127 for (FPakListEntry& Entry : PakFiles)
2140 for (FPakListEntry& Entry : PakFiles)
2142 OutChunkIds.Add(Entry.PakFile->PakGetPakchunkIndex());
2275 bool Result =
false;
2276 if (IsNonPakFilenameAllowed(Filename))
2293 if (IsNonPakFilenameAllowed(Filename))
2295 Result = LowerLevel->
FileSize(Filename);
2308 bool Result =
false;
2309 if (IsNonPakFilenameAllowed(Filename))
2324 bool Result =
false;
2325 if (IsNonPakFilenameAllowed(Filename))
2340 bool Result =
false;
2341 if (IsNonPakFilenameAllowed(From))
2343 Result = LowerLevel->
MoveFile(To, From);
2358 if (IsNonPakFilenameAllowed(Filename))
2371 return PakFile->GetTimestamp();
2375 if (IsNonPakFilenameAllowed(Filename))
2418 if (IsNonPakFilenameAllowed(Filename))
2431 return PakFile->GetTimestamp();
2435 if (IsNonPakFilenameAllowed(Filename))
2454 for (FPakDirectory::TConstIterator FileIt(*
PakDirectory); FileIt; ++FileIt)
2465#if ENABLE_PAKFILE_RUNTIME_PRUNING_VALIDATE
2467 if (
PakFile->ShouldValidatePrunedDirectory())
2480 if (IsNonPakFilenameAllowed(Filename))
2512 const TCHAR* Directory,
const TCHAR* FileExtension)
override;
2514 const TCHAR* Directory,
const TCHAR* FileExtension)
override;
2629#if !UE_BUILD_SHIPPING
2650 bool IterateDirectoryInPakFiles(
const TCHAR* Directory,
2653 bool IterateDirectoryStatInternal(
const TCHAR* Directory,
2656 const TCHAR* Directory,
const TCHAR* FileExtension,
bool bRecursive);
2698 DecryptedHash = ComputeCurrentPrincipalHash();
2711 uint32 FileMagic = Magic;
2714 if (Ar.
IsLoading() && FileMagic != Magic)
2716 Version = EVersion::Invalid;
2717 EncryptedHash.
Empty();
2718 ChunkHashes.
Empty();
2723 Ar << EncryptedHash;
2732 if (Version == EVersion::Invalid)
2773 UE_DEPRECATED(
"5.1",
"Use ComputeCurrentPrincipalHash instead")
2776 return ComputeCurrentPrincipalHash();
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define NULL
Definition oodle2base.h:134
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
@ COMPRESS_None
Definition CompressionFlags.h:15
@ COMPRESS_Custom_DEPRECATED
Definition CompressionFlags.h:22
@ COMPRESS_GZIP_DEPRECATED
Definition CompressionFlags.h:20
@ COMPRESS_ZLIB_DEPRECATED
Definition CompressionFlags.h:18
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define INC_DWORD_STAT(StatId)
Definition Stats.h:696
#define DEC_DWORD_STAT(StatId)
Definition Stats.h:701
#define DECLARE_DWORD_ACCUMULATOR_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:684
#define SCOPE_SECONDS_ACCUMULATOR(Stat)
Definition Stats.h:663
#define DECLARE_FLOAT_ACCUMULATOR_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:683
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
#define DECLARE_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type)
Definition DelegateCombinations.h:54
#define DECLARE_DELEGATE_ThreeParams(DelegateName, Param1Type, Param2Type, Param3Type)
Definition DelegateCombinations.h:66
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:49
return true
Definition ExternalRpcRegistry.cpp:601
const TCHAR * LexToString(EAnalyticsRecordEventMode Mode)
Definition IAnalyticsProvider.cpp:5
void * FRSAKeyHandle
Definition IEngineCrypto.h:9
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
#define UE_LOG_ACTIVE(CategoryName, Verbosity)
Definition LogMacros.h:255
#define UE_LOG(CategoryName, Verbosity, Format,...)
Definition LogMacros.h:270
const bool
Definition NetworkReplayStreaming.h:178
#define MAX_int32
Definition NumericLimits.h:25
#define MIN_int32
Definition NumericLimits.h:16
#define TCHAR_TO_ANSI(str)
Definition StringConv.h:1019
::FCriticalSection FTransactionallySafeCriticalSection
Definition TransactionallySafeCriticalSection.h:16
#define UE_ARRAY_COUNT(array)
Definition UnrealTemplate.h:212
uint32 Offset
Definition VulkanMemory.cpp:4033
uint32 Size
Definition VulkanMemory.cpp:4034
Definition Archive.h:1208
virtual void Serialize(void *V, int64 Length)
Definition Archive.h:1689
UE_FORCEINLINE_HINT bool IsLoading() const
Definition Archive.h:236
virtual int64 Tell()
Definition Archive.h:149
virtual int64 TotalSize()
Definition Archive.h:155
UE_FORCEINLINE_HINT bool IsSaving() const
Definition Archive.h:248
virtual void Seek(int64 InPos)
Definition Archive.h:1753
Definition SignedArchiveReader.h:103
Definition IoDispatcherFileBackend.h:109
Definition FilePackageStore.h:89
Definition NameTypes.h:617
CORE_API FString ToString() const
Definition UnrealNames.cpp:3537
Definition UnrealTemplate.h:321
Definition UnrealType.h:3087
Definition OutputDevice.h:133
Definition IPlatformFilePak.h:1753
virtual int64 Size() override
Definition IPlatformFilePak.h:1845
virtual bool Truncate(int64 NewSize) override
Definition IPlatformFilePak.h:1854
virtual bool ReadAt(uint8 *Destination, int64 BytesToRead, int64 Offset) override
Definition IPlatformFilePak.h:1831
FPakFileHandle(const TRefCountPtr< const FPakFile > &InPakFile, const FPakEntry &InPakEntry, FArchive *InPakReader)
Definition IPlatformFilePak.h:1785
virtual int64 Tell() override
Definition IPlatformFilePak.h:1802
virtual bool SeekFromEnd(int64 NewPositionRelativeToEnd) override
Definition IPlatformFilePak.h:1815
virtual bool Flush(const bool bFullFlush=false) override
Definition IPlatformFilePak.h:1849
virtual bool Write(const uint8 *Source, int64 BytesToWrite) override
Definition IPlatformFilePak.h:1840
virtual bool Seek(int64 NewPosition) override
Definition IPlatformFilePak.h:1806
virtual ~FPakFileHandle()
Definition IPlatformFilePak.h:1796
FPakFileHandle(const TRefCountPtr< const FPakFile > &InPakFile, const FPakEntry &InPakEntry, TAcquirePakReaderFunction &InAcquirePakReaderFunction)
Definition IPlatformFilePak.h:1770
virtual bool Read(uint8 *Destination, int64 BytesToRead) override
Definition IPlatformFilePak.h:1819
Definition IPlatformFilePak.h:1162
FBaseIterator & operator=(FBaseIterator &&)=default
PAKFILE_API FPakEntryLocation GetPakEntryIndex() const
Definition PakFile.cpp:2596
PAKFILE_API ~FBaseIterator()
FBaseIterator(const FBaseIterator &)=delete
PAKFILE_API const FPakEntry & Info() const
Definition PakFile.cpp:2515
PAKFILE_API bool operator!() const
Definition PakFile.cpp:2510
FBaseIterator & operator=(const FBaseIterator &)=delete
FBaseIterator(FBaseIterator &&)=default
PAKFILE_API FBaseIterator & operator++()
Definition PakFile.cpp:2469
PAKFILE_API bool HasFilename() const
Definition PakFile.cpp:2521
PAKFILE_API const FString & Filename() const
Definition PakFile.cpp:2579
Definition IPlatformFilePak.h:1281
FFilenameIterator(const FPakFile &InPakFile, bool bInIncludeDeleted=false)
Definition IPlatformFilePak.h:1288
Definition IPlatformFilePak.h:1259
const FString * TryGetFilename() const
Definition IPlatformFilePak.h:1266
FPakEntryIterator(const FPakFile &InPakFile, bool bInIncludeDeleted=false)
Definition IPlatformFilePak.h:1261
Definition IPlatformFilePak.h:752
static PAKFILE_API void SaveIndexInternal_DirectoryIndex(FArchive &Ar, const FDirectoryIndex &DirectoryTMap)
Definition PakFile.cpp:764
const FString & GetFilename() const
Definition IPlatformFilePak.h:1005
PAKFILE_API void ReleaseOldReaders(double MaxAgeSeconds)
Definition PakFile.cpp:2261
const FDateTime & GetTimestamp() const
Definition IPlatformFilePak.h:1311
PAKFILE_API void ReturnSharedReader(FArchive *SharedReader)
Definition PakFile.cpp:2254
PAKFILE_API void GetPrunedFilenames(TArray< FString > &OutFileList) const
Definition PakFile.cpp:2050
TMap< uint64, FPakEntryLocation > FPathHashIndex
Definition IPlatformFilePak.h:755
ECacheType
Definition IPlatformFilePak.h:761
void SetIsMounted(bool bInIsMounted)
Definition IPlatformFilePak.h:946
void SetCacheType(ECacheType InCacheType)
Definition IPlatformFilePak.h:942
static PAKFILE_API void PruneDirectoryIndex(FDirectoryIndex &InOutDirectoryIndex, FDirectoryIndex *PrunedDirectoryIndex, const FString &MountPoint)
Definition PakFile.cpp:977
PAKFILE_API void GetPrunedFilenamesInChunk(const TArray< int32 > &InChunkIDs, TArray< FString > &OutFileList) const
Definition PakFile.cpp:2058
virtual int32 PakGetPakchunkIndex() const override
Definition IPlatformFilePak.h:920
ECacheType GetCacheType(void)
Definition IPlatformFilePak.h:943
virtual const FString & PakGetPakFilename() const override
Definition IPlatformFilePak.h:910
TMap< FString, FPakDirectory > FDirectoryIndex
Definition IPlatformFilePak.h:757
static bool SplitPathInline(FStringView &InOutPath, FStringView &OutFilename)
Definition PakFile.cpp:1329
const FString & GetMountPoint() const
Definition IPlatformFilePak.h:1077
PAKFILE_API bool PassedSignatureChecks() const
Definition PakFile.cpp:201
void ReadHashFromPayload(const FPakEntry &PakEntry, uint8 *OutBuffer)
Definition IPlatformFilePak.h:1334
int64 TotalSize() const
Definition IPlatformFilePak.h:1014
static PAKFILE_API bool IsPakWritePathHashIndex()
Definition PakFile.cpp:1459
static PAKFILE_API bool IsPakWriteFullDirectoryIndex()
Definition PakFile.cpp:1465
bool GetUnderlyingCacheTrimDisabled(void)
Definition IPlatformFilePak.h:940
bool DirectoryExistsInPruned(const TCHAR *InPath) const
Definition IPlatformFilePak.h:1134
void FindPrunedFilesAtPath(ContainerType &OutFiles, const TCHAR *InPath, bool bIncludeFiles=true, bool bIncludeDirectories=false, bool bRecursive=false) const
Definition IPlatformFilePak.h:1084
static bool SplitPathInline(FString &InOutPath, FString &OutFilename)
Definition IPlatformFilePak.h:1422
virtual const FString & PakGetMountPoint() const override
Definition IPlatformFilePak.h:933
bool IsValid() const
Definition IPlatformFilePak.h:988
PAKFILE_API FSharedPakReader GetSharedReader(IPlatformFile *LowerLevel)
Definition PakFile.cpp:2227
bool GetIsMounted() const
Definition IPlatformFilePak.h:947
EIteratorType
Definition IPlatformFilePak.h:1155
bool HasFilenames() const
Definition IPlatformFilePak.h:1321
virtual void PakVisitPrunedFilenames(IPlatformFile::FDirectoryVisitor &Visitor) const override
Definition IPlatformFilePak.h:925
static bool IsPathInDirectoryFormat(const FString &Path)
Definition IPlatformFilePak.h:1410
static PAKFILE_API void EncodePakEntriesIntoIndex(int32 InNumEntries, const ReadNextEntryFunction &InReadNextEntry, const TCHAR *InPakFilename, const FPakInfo &InPakInfo, const FString &MountPoint, int32 &OutNumEncodedEntries, int32 &OutNumDeletedEntries, uint64 *OutPathHashSeed, FDirectoryIndex *OutDirectoryIndex, FPathHashIndex *OutPathHashIndex, TArray< uint8 > &OutEncodedPakEntries, TArray< FPakEntry > &OutNonEncodableEntries, TMap< uint64, FString > *InOutCollisionDetection, int32 PakFileVersion)
Definition PakFile.cpp:921
static const TCHAR * GetRelativeFilePathFromMountPointer(const FString &Child, const FString &MountPoint)
Definition IPlatformFilePak.h:1456
static void MakeDirectoryFromPath(FString &Path)
Definition IPlatformFilePak.h:1402
PAKFILE_API bool RecreatePakReaders(IPlatformFile *LowerLevel)
Definition PakFile.cpp:2195
void SetCacheIndex(int32 InCacheIndex)
Definition IPlatformFilePak.h:944
int32 GetCacheIndex(void)
Definition IPlatformFilePak.h:945
static PAKFILE_API EFindResult GetPakEntry(const FPakEntryLocation &FPakEntryLocation, FPakEntry *OutEntry, const TArray< uint8 > &EncodedPakEntries, const TArray< FPakEntry > &Files, const FPakInfo &Info)
Definition PakFile.cpp:1384
static PAKFILE_API const FPakEntryLocation * FindLocationFromIndex(const FString &FullPath, const FString &MountPoint, const FPathHashIndex &PathHashIndex, uint64 PathHashSeed, int32 PakFileVersion)
Definition PakFile.cpp:2288
EFindResult
Definition IPlatformFilePak.h:1054
const FPakDirectory * FindPrunedDirectory(const TCHAR *InPath) const
Definition IPlatformFilePak.h:1116
static FString PakPathCombine(FStringView Parent, FStringView Child)
Definition PakFile.cpp:1319
static PAKFILE_API uint64 HashPath(const TCHAR *RelativePathFromMount, uint64 Seed, int32 PakFileVersion)
Definition PakFile.cpp:907
void SetUnderlyingCacheTrimDisabled(bool InUnderlyingCacheTrimDisabled)
Definition IPlatformFilePak.h:939
static PAKFILE_API bool IsPakKeepFullDirectory()
Definition PakFile.cpp:1437
void SetMountPoint(const TCHAR *Path)
Definition IPlatformFilePak.h:1066
static bool GetRelativePathFromMountInline(FString &Child, const FString &MountPoint)
Definition IPlatformFilePak.h:1436
PAKFILE_API bool Check()
Definition PakFile.cpp:1941
FName GetFilenameName() const
Definition IPlatformFilePak.h:1009
virtual bool PakContains(const FString &FullPath) const override
Definition IPlatformFilePak.h:915
const FPakInfo & GetInfo() const
Definition IPlatformFilePak.h:1301
virtual int32 GetNumFiles() const override
Definition IPlatformFilePak.h:1022
Definition IPlatformFilePak.h:1658
@ Alignment
Definition IPlatformFilePak.h:1662
static void DecryptBlock(void *Data, int64 Size, const FGuid &EncryptionKeyGuid)
Definition IPlatformFilePak.h:1670
static int64 AlignReadRequest(int64 Size)
Definition IPlatformFilePak.h:1665
Definition IPlatformFilePak.h:1683
TAcquirePakReaderFunction AcquirePakReader
Definition IPlatformFilePak.h:1690
const FPakFile & PakFile
Definition IPlatformFilePak.h:1686
FPakReaderPolicy(const FPakFile &InPakFile, const FPakEntry &InPakEntry, TAcquirePakReaderFunction &InAcquirePakReader)
Definition IPlatformFilePak.h:1694
FPakEntry PakEntry
Definition IPlatformFilePak.h:1688
int64 OffsetToFile
Definition IPlatformFilePak.h:1692
void Serialize(int64 DesiredPosition, void *V, int64 Length) const
Definition IPlatformFilePak.h:1707
int64 FileSize() const
Definition IPlatformFilePak.h:1702
static CORE_API FString GetPath(const FString &InPath)
Definition Paths.cpp:1043
Definition RefCounting.h:213
static CORE_API void HashBuffer(const void *Data, uint64 DataSize, uint8 *OutHash)
Definition SecureHash.cpp:1281
Definition SecureHash.h:226
FString ToString() const
Definition SecureHash.h:242
uint8 Hash[20]
Definition SecureHash.h:228
Definition IPlatformFilePak.h:699
bool operator==(TYPE_OF_NULLPTR)
Definition IPlatformFilePak.h:716
FSharedPakReader & operator=(const FSharedPakReader &Other)=delete
FArchive * operator->()
Definition IPlatformFilePak.h:718
FSharedPakReader(const FSharedPakReader &Other)=delete
bool operator!=(TYPE_OF_NULLPTR)
Definition IPlatformFilePak.h:717
FArchive & GetArchive()
Definition IPlatformFilePak.h:722
PAKFILE_API ~FSharedPakReader()
Definition IPlatformFilePak.cpp:4379
Definition AsyncFileHandle.h:211
Definition GenericPlatformFile.h:117
Definition MappedFileHandle.h:115
Definition GenericPlatformFile.h:1020
Definition PakFile.Build.cs:6
Definition ArrayView.h:139
UE_REWRITE SizeType Num() const
Definition Array.h:1144
void Reset(SizeType NewSize=0)
Definition Array.h:2246
UE_NODEBUG UE_FORCEINLINE_HINT ElementType * GetData() UE_LIFETIMEBOUND
Definition Array.h:1027
void SetNum(SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2308
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
void Append(const TArray< OtherElementType, OtherAllocatorType > &Source)
Definition Array.h:2412
void Empty(SizeType Slack=0)
Definition Array.h:2273
Definition DirectoryTree.h:85
Definition AssetRegistryState.h:50
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition RefCounting.h:454
Definition SharedPointer.h:692
Definition UniquePtr.h:107
Definition ValueOrError.h:58
Definition IPlatformFilePak.cpp:302
Definition ScopeLock.h:21
Type
Definition GenericPlatformChunkInstall.h:32
NO_LOGGING.
Definition Client.h:20
Definition IPlatformFilePak.cpp:246
TDirectoryTree< FPakDirectory > FDirectoryTreeIndex
Definition IPlatformFilePak.h:732
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
static double Seconds()
Definition AndroidPlatformTime.h:20
static FDateTime MinValue()
Definition DateTime.h:668
Definition GenericPlatformFile.h:195
void Invalidate()
Definition Guid.h:305
static UE_FORCEINLINE_HINT void * Memzero(void *Dest, SIZE_T Count)
Definition UnrealMemory.h:131
static UE_FORCEINLINE_HINT int32 Memcmp(const void *Buf1, const void *Buf2, SIZE_T Count)
Definition UnrealMemory.h:114
static UE_FORCEINLINE_HINT void * Memcpy(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:160
static UE_FORCEINLINE_HINT void * Memset(void *Dest, uint8 Char, SIZE_T Count)
Definition UnrealMemory.h:119
Definition IPlatformFilePak.h:109
TPakChunkHash ReceivedHash
Definition IPlatformFilePak.h:120
int32 ChunkIndex
Definition IPlatformFilePak.h:118
FPakChunkSignatureCheckFailedData(const FString &InPakFilename, const TPakChunkHash &InExpectedHash, const TPakChunkHash &InReceivedHash, int32 InChunkIndex)
Definition IPlatformFilePak.h:110
FString PakFilename
Definition IPlatformFilePak.h:117
TPakChunkHash ExpectedHash
Definition IPlatformFilePak.h:119
FPakChunkSignatureCheckFailedData()
Definition IPlatformFilePak.h:122
Definition IPlatformFilePak.h:359
int64 CompressedStart
Definition IPlatformFilePak.h:361
bool operator!=(const FPakCompressedBlock &B) const
Definition IPlatformFilePak.h:370
bool operator==(const FPakCompressedBlock &B) const
Definition IPlatformFilePak.h:365
int64 CompressedEnd
Definition IPlatformFilePak.h:363
Definition IPlatformFilePak.h:600
static FPakEntryLocation CreateFromListIndex(int32 ListIndex)
Definition IPlatformFilePak.h:628
FPakEntryLocation(const FPakEntryLocation &Other)=default
bool IsInvalid() const
Definition IPlatformFilePak.h:634
int32 GetAsOffsetIntoEncoded() const
Definition IPlatformFilePak.h:649
static const int32 Invalid
Definition IPlatformFilePak.h:608
int32 GetAsListIndex() const
Definition IPlatformFilePak.h:660
bool IsListIndex() const
Definition IPlatformFilePak.h:644
static FPakEntryLocation CreateInvalid()
Definition IPlatformFilePak.h:617
FPakEntryLocation & operator=(const FPakEntryLocation &other)=default
static FPakEntryLocation CreateFromOffsetIntoEncoded(int32 Offset)
Definition IPlatformFilePak.h:622
static const int32 MaxIndex
Definition IPlatformFilePak.h:609
bool IsOffsetIntoEncoded() const
Definition IPlatformFilePak.h:639
void Serialize(FArchive &Ar)
Definition IPlatformFilePak.h:672
bool operator==(const FPakEntryLocation &Other) const
Definition IPlatformFilePak.h:677
FPakEntryLocation()
Definition IPlatformFilePak.h:611
Definition IPlatformFilePak.h:743
FString Filename
Definition IPlatformFilePak.h:744
FPakEntry Info
Definition IPlatformFilePak.h:745
Definition IPlatformFilePak.h:396
void SetEncrypted(bool bEncrypted)
Definition IPlatformFilePak.h:580
int64 Offset
Definition IPlatformFilePak.h:402
bool operator!=(const FPakEntry &B) const
Definition IPlatformFilePak.h:474
static const uint8 Flag_Deleted
Definition IPlatformFilePak.h:399
int64 Size
Definition IPlatformFilePak.h:404
uint32 CompressionMethodIndex
Definition IPlatformFilePak.h:414
bool IsDeleteRecord() const
Definition IPlatformFilePak.h:582
void Serialize(FArchive &Ar, int32 Version)
Definition IPlatformFilePak.h:511
bool IsEncrypted() const
Definition IPlatformFilePak.h:579
bool GetFlag(uint8 InFlag) const
Definition IPlatformFilePak.h:574
void Reset()
Definition IPlatformFilePak.h:492
int64 GetSerializedSize(int32 Version) const
Definition IPlatformFilePak.h:433
uint8 Flags
Definition IPlatformFilePak.h:416
static const uint8 Flag_Encrypted
Definition IPlatformFilePak.h:398
void SetDeleteRecord(bool bDeleteRecord)
Definition IPlatformFilePak.h:583
static bool VerifyPakEntriesMatch(const FPakEntry &FileEntryA, const FPakEntry &FileEntryB)
Definition IPlatformFilePak.cpp:4344
TArray< FPakCompressedBlock > CompressionBlocks
Definition IPlatformFilePak.h:410
uint8 Hash[20]
Definition IPlatformFilePak.h:408
void SetFlag(uint8 InFlag, bool bValue)
Definition IPlatformFilePak.h:562
bool operator==(const FPakEntry &B) const
Definition IPlatformFilePak.h:465
bool IndexDataEquals(const FPakEntry &B) const
Definition IPlatformFilePak.h:479
int64 UncompressedSize
Definition IPlatformFilePak.h:406
bool Verified
Definition IPlatformFilePak.h:418
static const uint8 Flag_None
Definition IPlatformFilePak.h:397
FPakEntry()
Definition IPlatformFilePak.h:423
uint32 CompressionBlockSize
Definition IPlatformFilePak.h:412
Definition IPlatformFilePak.h:799
TUniquePtr< FArchive > Archive
Definition IPlatformFilePak.h:800
double LastAccessTime
Definition IPlatformFilePak.h:801
Definition IPlatformFilePak.h:768
bool bRequiresDirectoryIndexLock
Definition IPlatformFilePak.h:791
~FScopedPakDirectoryIndexAccess()
Definition IPlatformFilePak.h:783
const FPakFile & PakFile
Definition IPlatformFilePak.h:790
FScopedPakDirectoryIndexAccess(const FPakFile &InPakFile)
Definition IPlatformFilePak.h:769
Definition IPlatformFilePak.h:138
FGuid EncryptionKeyGuid
Definition IPlatformFilePak.h:186
@ PakFile_Version_NoTimestamps
Definition IPlatformFilePak.h:155
@ PakFile_Version_Initial
Definition IPlatformFilePak.h:154
@ PakFile_Version_Invalid
Definition IPlatformFilePak.h:169
@ PakFile_Version_FNameBasedCompressionMethod
Definition IPlatformFilePak.h:161
@ PakFile_Version_Last
Definition IPlatformFilePak.h:168
@ PakFile_Version_CompressionEncryption
Definition IPlatformFilePak.h:156
void Serialize(FArchive &Ar, int32 InVersion)
Definition IPlatformFilePak.h:231
int32 GetCompressionMethodIndex(FName CompressionMethod)
Definition IPlatformFilePak.h:321
uint8 bEncryptedIndex
Definition IPlatformFilePak.h:184
int64 GetSerializedSize(int32 InVersion=PakFile_Version_Latest) const
Definition IPlatformFilePak.h:209
int64 IndexOffset
Definition IPlatformFilePak.h:178
int64 HasRelativeCompressedChunkOffsets() const
Definition IPlatformFilePak.h:221
FPakInfo()
Definition IPlatformFilePak.h:193
FSHAHash IndexHash
Definition IPlatformFilePak.h:182
TOptional< FName > TryGetCompressionMethod(uint32 Index) const
Definition IPlatformFilePak.h:345
FName GetCompressionMethod(uint32 Index) const
Definition IPlatformFilePak.h:340
int64 IndexSize
Definition IPlatformFilePak.h:180
TArray< FName > CompressionMethods
Definition IPlatformFilePak.h:188
int32 Version
Definition IPlatformFilePak.h:176
uint32 Magic
Definition IPlatformFilePak.h:174
Definition IPlatformFilePak.h:1897
uint32 PakOrder
Definition IPlatformFilePak.h:1901
bool bLoadIndex
Definition IPlatformFilePak.h:1907
const TCHAR * Path
Definition IPlatformFilePak.h:1903
const TCHAR * PakFilename
Definition IPlatformFilePak.h:1899
FPakMountOptions MountOptions
Definition IPlatformFilePak.h:1905
Definition GenericPlatformFile.h:1041
Definition IPlatformFilePak.h:2663
void Serialize(FArchive &Ar)
Definition IPlatformFilePak.h:2709
bool DecryptSignatureAndValidate(const FRSAKeyHandle InKey, const FString &InFilename)
Definition IPlatformFilePak.h:2730
TArray< uint8 > EncryptedHash
Definition IPlatformFilePak.h:2680
FSHAHash DecryptedHash
Definition IPlatformFilePak.h:2683
EVersion
Definition IPlatformFilePak.h:2668
TArray< uint8 > SignatureData
Definition IPlatformFilePak.h:2686
FSHAHash ComputeCurrentPrincipalHash() const
Definition IPlatformFilePak.h:2766
TArray< TPakChunkHash > ChunkHashes
Definition IPlatformFilePak.h:2689
void SetChunkHashesAndSign(const TArray< TPakChunkHash > &InChunkHashes, const TArrayView< uint8 > &InSignatureData, const FRSAKeyHandle InKey)
Definition IPlatformFilePak.h:2694
static RSA_API int32 DecryptPublic(const TArrayView< const uint8 > InSource, TArray< uint8 > &OutDestination, const FRSAKeyHandle InKey)
Definition RSA.cpp:74
static RSA_API int32 EncryptPrivate(const TArrayView< const uint8 > InSource, TArray< uint8 > &OutDestination, const FRSAKeyHandle InKey)
Definition RSA.cpp:64
static CharType * Strncpy(CharType *Dest, const CharType *Src, SIZE_T MaxLen)
Definition CString.h:991
Definition DirectoryTree.h:216
Definition Optional.h:131
Definition IPlatformFilePak.cpp:4512
Definition IPlatformFilePak.cpp:6436