首先是读取文件头:
文件头结构体:
Engine_Updating\Engine\Source\Runtime\CoreUObject\Public\UObject\Linker.h
/**
* A "table of contents" for an Unreal package file. Stored at the top of the file.
*/
struct FPackageFileSummary
{
/**
* Magic tag compared against PACKAGE_FILE_TAG to ensure that package is an Unreal package.
*/
int32 Tag;
private:
/* UE4 file version */
int32 FileVersionUE4;
/* Licensee file version */
int32 FileVersionLicenseeUE4;
/* Custom version numbers. Keyed off a unique tag for each custom component. */
FCustomVersionContainer CustomVersionContainer;
public:
/**
* Total size of all information that needs to be read in to create a FLinkerLoad. This includes
* the package file summary, name table and import & export maps.
*/
int32 TotalHeaderSize;
/**
* The flags for the package
*/
uint32 PackageFlags;
/**
* The Generic Browser folder name that this package lives in
*/
FString FolderName;
/**
* Number of names used in this package
*/
int32 NameCount;
/**
* Location into the file on disk for the name data
*/
int32 NameOffset;
/**
* Number of gatherable text data items in this package
*/
int32 GatherableTextDataCount;
/**
* Location into the file on disk for the gatherable text data items
*/
int32 GatherableTextDataOffset;
/**
* Number of exports contained in this package
*/
int32 ExportCount;
/**
* Location into the file on disk for the ExportMap data
*/
int32 ExportOffset;
/**
* Number of imports contained in this package
*/
int32 ImportCount;
/**
* Location into the file on disk for the ImportMap data
*/
int32 ImportOffset;
/**
* Location into the file on disk for the DependsMap data
*/
int32 DependsOffset;
/**
* Number of references contained in this package
*/
int32 StringAssetReferencesCount;
/**
* Location into the file on disk for the string asset references map data
*/
int32 StringAssetReferencesOffset;
/**
* Thumbnail table offset
*/
int32 ThumbnailTableOffset;
/**
* Current id for this package
*/
FGuid Guid;
/**
* Data about previous versions of this package
*/
TArray<FGenerationInfo> Generations;
/**
* Engine version this package was saved with. For hotfix releases and engine versions which maintain strict binary compatibility with another version, this may differ from CompatibleWithEngineVersion.
*/
FEngineVersion SavedByEngineVersion;
/**
* Engine version this package is compatible with. See S