engine
 
载入中...
搜索中...
未找到
类 | Public 类型 | Public 成员函数 | 静态 Public 成员函数 | 友元 | 所有成员列表
FPakFile类 参考

Pak file. 更多...

#include <IPlatformFilePak.h>

+ 类 FPakFile 继承关系图:

类

class  FBaseIterator
 Base functionality for iterating over the DirectoryIndex. 更多...
 
class  FFilenameIterator
 Iterator class used to iterate over just the files in the pak for which we have filenames. 更多...
 
class  FPakEntryIterator
 Iterator class for every FPakEntry in the FPakFile, but does not provide filenames unless the PakFile has an unpruned DirectoryIndex. 更多...
 
struct  FScopedPakDirectoryIndexAccess
 A ReadLock wrapper that must be used to prevent threading errors around any call to FindPrunedDirectory or internal uses of DirectoryIndex 更多...
 

Public 类型

enum class  ECacheType : uint8
 Pak files can share a cache or have their own
 
enum class  EFindResult : uint8
 Finds an entry in the pak file matching the given filename. 更多...
 
typedef TMap< FString, FPakDirectory > FDirectoryIndex
 Index data that keeps an in-memory directoryname/filename tree to map a Filename to an FPakEntryLocation
 
typedef TMap< uint64, FPakEntryLocation > FPathHashIndex
 Index data that provides a map from the hash of a Filename to an FPakEntryLocation
 
typedef TFunction< FPakEntryPair &()> ReadNextEntryFunction
 Read a list of (Filename, FPakEntry) pairs from a provided enumeration, attempt to encode each one, store each one in the appropriate given encoded and/or unencoded array, and populate the given Directories to map each filename to the location for the FPakEntry 更多...
 

Public 成员函数

bool Check ()
 Checks the validity of the pak data by reading out the data for every file in the pak 更多...
 
bool DirectoryExistsInPruned (const TCHAR *InPath) const
 Checks if a directory exists in pak file. 更多...
 
const FPakDirectory * FindDirectory (const TCHAR *InPath) const
 Finds a directory in pak file. 更多...
 
template<class ContainerType >
void FindPrunedFilesAtPath (ContainerType &OutFiles, const TCHAR *InPath, bool bIncludeFiles=true, bool bIncludeDirectories=false, bool bRecursive=false) const
 Looks for files or directories within the Pruned DirectoryIndex of the pak file. 更多...
 
 FPakFile (IPlatformFile *LowerLevel, const TCHAR *Filename, bool bIsSigned, bool bLoadIndex=true)
 Creates a pak file using the supplied file handle. 更多...
 
const FString & GetFilename () const
 Gets pak filename. 更多...
 
const TMap< FString, FPakDirectory > & GetIndex () const
 Gets pak file index. 更多...
 
const FPakInfo & GetInfo () const
 Gets this pak file info. 更多...
 
const FString & GetMountPoint () const
 Gets pak file mount point. 更多...
 
virtual int32 GetNumFiles () const override
 Gets the number of files in this pak.
 
void GetPrunedFilenames (TArray< FString > &OutFileList) const
 Returns the FullPath (includes Mount) Filename found in Pruned DirectoryIndex
 
void GetPrunedFilenamesInChunk (const TArray< int32 > &InChunkIDs, TArray< FString > &OutFileList) const
 Returns the RelativePathFromMount Filename for every Filename found in the Pruned DirectoryIndex that points to a PakEntry in the given Chunk
 
FArchive * GetSharedReader (IPlatformFile *LowerLevel)
 Gets shared pak file archive for given thread. 更多...
 
const FDateTime & GetTimestamp () const
 Gets this pak file's tiemstamp. 更多...
 
bool HasFilenames () const
 Returns whether filenames currently exist in the DirectoryIndex for all files in the Pak. 更多...
 
bool IsValid () const
 Checks if the pak file is valid. 更多...
 
bool PassedSignatureChecks () const
 Checks if the pak has valid chunk signature checking data, and that the data passed the initial signing check 更多...
 
bool RecreatePakReaders (IPlatformFile *LowerLevel)
 Recreates the pak reader for each thread
 
void SetMountPoint (const TCHAR *Path)
 Sets the pak file mount point. 更多...
 
virtual ~FPakFile ()
 Creates a pak file using the supplied archive. 更多...
 

静态 Public 成员函数

static const FPakEntryLocation * FindLocationFromIndex (const FString &FullPath, const FString &MountPoint, const FDirectoryIndex &DirectoryIndex)
 Lookup the FPakEntryLocation stored in the given DirectoryIndex, return nullptr if not found
 
static const FPakEntryLocation * FindLocationFromIndex (const FString &FullPath, const FString &MountPoint, const FPathHashIndex &PathHashIndex, uint64 PathHashSeed, int32 PakFileVersion)
 Lookup the FPakEntryLocation stored in the given PathHashIndex, return nullptr if not found
 
static EFindResult GetPakEntry (const FPakEntryLocation &FPakEntryLocation, FPakEntry *OutEntry, const TArray< uint8 > &EncodedPakEntries, const TArray< FPakEntry > &Files, const FPakInfo &Info)
 Returns the FPakEntry pointed to by the given FPakEntryLocation inside the given EncodedPakEntries or Files Can return Found or Deleted; if the FPakEntryLocation is invalid this function assumes the FPakEntry exists in this pack but as a deleted file If OutEntry is non-null, populates it with a copy of the FPakEntry found, or sets it to an FPakEntry with SetDeleteRecord(true) if not found
 
static const TCHAR * GetRelativeFilePathFromMountPointer (const FString &Child, const FString &MountPoint)
 Helper function to return Filename's relative path from the mount point. 更多...
 
static bool GetRelativePathFromMountInline (FString &Child, const FString &MountPoint)
 Helper function to return Child's relative path from the mount point. 更多...
 
static uint64 HashPath (const TCHAR *RelativePathFromMount, uint64 Seed, int32 PakFileVersion)
 Hash the given full-path filename using the hash function used by FPakFiles, with the given FPakFile-specific seed, with version provided for legacy pak files that used different hash function
 
static void PruneDirectoryIndex (FDirectoryIndex &InOutDirectoryIndex, FDirectoryIndex *PrunedDirectoryIndex, const FString &MountPoint)
 Given a directory index, remove entries from it that are directed by ini to not have filenames kept at runtime. 更多...
 
static bool SplitPathInline (FString &InOutPath, FString &OutFilename)
 Helper function to split a PakDirectoryIndex-Formatted PathName into its PakDirectoryIndex-Formatted parent directory and the CleanFileName
 

友元

class FPakPlatformFile
 

详细描述

Pak file.

成员类型定义说明

◆ ReadNextEntryFunction

typedef TFunction<FPakEntryPair & ()> FPakFile::ReadNextEntryFunction

Read a list of (Filename, FPakEntry) pairs from a provided enumeration, attempt to encode each one, store each one in the appropriate given encoded and/or unencoded array, and populate the given Directories to map each filename to the location for the FPakEntry

参数
InNumEntriesHow many entries will be read from ReadNextEntryFunction
ReadNextEntryFunctionCallback called repeatedly to enumerate the (Filename,FPakEntry) pairs to be encoded
InPakFilenameFilename for the pak containing the files, used to create the hashseed for the given pak
InPakInfoPakInfo for the given pak, used for serialization flags
MountPointDirectory into which the pak will be mounted, used to create the Directory and PathHash indexes
OutNumEncodedEntriesHow many entries were written to the bytes in OutEncodedPakEntries
OutNumDeletedEntriesHow many entries were skipped and not stored because the input FPakEntry was a Delete record
OutPathHashSeedoptional out param to get a copy of the pakfile-specific hashseed
OutDirectoryIndexoptional output FDirectoryIndex
OutPathHashIndexoptional output FPathHashIndex
OutEncodedPakEntriesarray of bytes into which the encoded FPakEntries are stored. Values in OutDirectoryIndex and OutPathHashIndex can be offsets into this array indicated the start point for the encoding of the given FPakEntry
OutNonEncodableEntriesA list of all the FPakEntries that could not be encoded. Values in OutDirectoryIndex and OutPathHashIndex can be indices into this list.
InOutCollisionDetectionOptional parameter to detect hash collisions. If present, each hashed filename will be check()'d for a collision against a different filename in InOutCollisionDetection, and will be added into InOutCollisionDetection
PakFileVersionVersion of the pakfile containing the index, to support legacy formats

成员枚举类型说明

◆ EFindResult

enum class FPakFile::EFindResult : uint8
strong

Finds an entry in the pak file matching the given filename.

参数
FilenameFile to find.
OutEntryThe optional address of an FPakEntry instance where the found file information should be stored. Pass NULL to only check for file existence.
返回
Returns true if the file was found, false otherwise.

构造及析构函数说明

◆ FPakFile()

FPakFile::FPakFile ( IPlatformFile *  LowerLevel,
const TCHAR *  Filename,
bool  bIsSigned,
bool  bLoadIndex = true 
)

Creates a pak file using the supplied file handle.

参数
LowerLevelLower level platform file.
FilenameFilename.
bIsSigned= true if the pak is signed.

◆ ~FPakFile()

virtual FPakFile::~FPakFile ( )
virtual

Creates a pak file using the supplied archive.

参数
ArchivePointer to the archive which contains the pak file data.

成员函数说明

◆ Check()

bool FPakFile::Check ( )

Checks the validity of the pak data by reading out the data for every file in the pak

返回
true if the pak file is valid

◆ DirectoryExistsInPruned()

bool FPakFile::DirectoryExistsInPruned ( const TCHAR *  InPath) const
inline

Checks if a directory exists in pak file.

参数
InPathDirectory path.
返回
true if the given path exists in pak file, false otherwise.

◆ FindDirectory()

const FPakDirectory * FPakFile::FindDirectory ( const TCHAR *  InPath) const
inline

Finds a directory in pak file.

参数
InPathDirectory path.
返回
Pointer to a map with directory contents if the directory was found, NULL otherwise.

◆ FindPrunedFilesAtPath()

template<class ContainerType >
void FPakFile::FindPrunedFilesAtPath ( ContainerType &  OutFiles,
const TCHAR *  InPath,
bool  bIncludeFiles = true,
bool  bIncludeDirectories = false,
bool  bRecursive = false 
) const
inline

Looks for files or directories within the Pruned DirectoryIndex of the pak file.

The Pruned DirectoryIndex does not have entries for most Files in the pak; they were removed to save memory. A project can specify which FileNames and DirectoryNames can be marked to keep in the DirectoryIndex; see FPakFile::FIndexSettings and FPakFile::PruneDirectoryIndex Returned paths are full paths (include the mount point)

参数
OutFilesList of files or folder matching search criteria.
InPathPath to look for files or folder at.
bIncludeFilesIf true OutFiles will include matching files.
bIncludeDirectoriesIf true OutFiles will include matching folders.
bRecursiveIf true, sub-folders will also be checked.

◆ GetFilename()

const FString & FPakFile::GetFilename ( ) const
inline

Gets pak filename.

返回
Pak filename.

◆ GetIndex()

const TMap< FString, FPakDirectory > & FPakFile::GetIndex ( ) const
inline

Gets pak file index.

返回
Pak index.

◆ GetInfo()

const FPakInfo & FPakFile::GetInfo ( ) const
inline

Gets this pak file info.

返回
Info about this pak file.

◆ GetMountPoint()

const FString & FPakFile::GetMountPoint ( ) const
inline

Gets pak file mount point.

返回
Mount point path.

◆ GetRelativeFilePathFromMountPointer()

static const TCHAR * FPakFile::GetRelativeFilePathFromMountPointer ( const FString &  Child,
const FString &  MountPoint 
)
inlinestatic

Helper function to return Filename's relative path from the mount point.

Returns null if Child is not equal to MountPoint and is not a child path under MountPoint, else returns pointer to the offset within Child after the MountPoint. If child equals MountPoint, returns null; The MountPoint itself is not a valid Filename, since Filenames must have non-zero length and are added on to the MountPoint.

◆ GetRelativePathFromMountInline()

static bool FPakFile::GetRelativePathFromMountInline ( FString &  Child,
const FString &  MountPoint 
)
inlinestatic

Helper function to return Child's relative path from the mount point.

Returns false if Child is not equal to MountPoint and is not a child path under MountPoint, else returns true. Edits Child only if returning true, setting it to the relative path. If child equals MountPoint, returns true and sets Child to the relative path to the MountPoint, which is "/"

◆ GetSharedReader()

FArchive * FPakFile::GetSharedReader ( IPlatformFile *  LowerLevel)

Gets shared pak file archive for given thread.

返回
Pointer to pak file archive used to read data from pak.

◆ GetTimestamp()

const FDateTime & FPakFile::GetTimestamp ( ) const
inline

Gets this pak file's tiemstamp.

返回
Timestamp.

◆ HasFilenames()

bool FPakFile::HasFilenames ( ) const
inline

Returns whether filenames currently exist in the DirectoryIndex for all files in the Pak.

返回
true if filenames are present for all FPakEntry, false otherwise.

◆ IsValid()

bool FPakFile::IsValid ( ) const
inline

Checks if the pak file is valid.

返回
true if this pak file is valid, false otherwise.

◆ PassedSignatureChecks()

bool FPakFile::PassedSignatureChecks ( ) const

Checks if the pak has valid chunk signature checking data, and that the data passed the initial signing check

返回
true if this pak file has passed the initial signature checking phase

◆ PruneDirectoryIndex()

static void FPakFile::PruneDirectoryIndex ( FDirectoryIndex &  InOutDirectoryIndex,
FDirectoryIndex *  PrunedDirectoryIndex,
const FString &  MountPoint 
)
static

Given a directory index, remove entries from it that are directed by ini to not have filenames kept at runtime.

InOutDirectoryIndex - The full index from which to potentially remove entries OutDirectoryIndex - If null, InOutDirectoryIndex will have pruned entries removed. If non-null, InOutDirectoryIndex will not be modified, and PrunedDirectoryIndex will have kept values added. MountPoint The mount point for the pak containing the index, used to provide the fullpath for filenames in the DirectoryIndex for comparison against paths in ini

◆ SetMountPoint()

void FPakFile::SetMountPoint ( const TCHAR *  Path)
inline

Sets the pak file mount point.

参数
PathNew mount point path.

该类的文档由以下文件生成: