uemanifest

package module
v0.0.0-...-3eee0c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 7 Imported by: 0

README

UE Manifest

an Unreal Engine's manifest parser

Installation

go get github.com/gounreal/uemanifest

Usage

package main

import (
    "fmt"

    "github.com/gounreal/uemanifest"
)

func main() {
    var r io.ReadSeeker = ...

	manifest, err := uemanifest.Parse(r)
	handleError(err)

	fmt.Println(manifest.ManifestMeta.AppName)
}

Credit

The initial creation of this project used JFortniteParse & egmanifest as a reference, so huge thanks to them.

Documentation

Index

Constants

View Source
const BinaryMagic = 0x44BEC00C

Variables

This section is empty.

Functions

This section is empty.

Types

type EFeatureLevel

type EFeatureLevel int32

An enum type to describe supported features of a certain manifest.

const (
	EFeatureLevelOriginal                                     EFeatureLevel = iota // The original version.
	EFeatureLevelCustomFields                                                      // Support for custom fields.
	EFeatureLevelStartStoringVersion                                               // Started storing the version number.
	EFeatureLevelDataFileRenames                                                   // Made after data files where renamed to include the hash value, these chunks now go to ChunksV2.
	EFeatureLevelStoresIfChunkOrFileData                                           // Manifest stores whether build was constructed with chunk or file data.
	EFeatureLevelStoresDataGroupNumbers                                            // Manifest stores group number for each chunk/file data for reference so that external readers don't need to know how to calculate them.
	EFeatureLevelChunkCompressionSupport                                           // Added support for chunk compression, these chunks now go to ChunksV3. NB: Not File Data Compression yet.
	EFeatureLevelStoresPrerequisitesInfo                                           // Manifest stores product prerequisites info.
	EFeatureLevelStoresChunkFileSizes                                              // Manifest stores chunk download sizes.
	EFeatureLevelStoredAsCompressedUClass                                          // Manifest can optionally be stored using UObject serialization and compressed.
	EFeatureLevelUNUSED_0                                                          // These two features were removed and never used.
	EFeatureLevelUNUSED_1                                                          // These two features were removed and never used.
	EFeatureLevelStoresChunkDataShaHashes                                          // Manifest stores chunk data SHA1 hash to use in place of data compare, for faster generation.
	EFeatureLevelStoresPrerequisiteIds                                             // Manifest stores Prerequisite Ids.
	EFeatureLevelStoredAsBinaryData                                                // The first minimal binary format was added. UObject classes will no longer be saved out when binary selected.
	EFeatureLevelVariableSizeChunksWithoutWindowSizeChunkInfo                      // Temporary level where manifest can reference chunks with dynamic window size, but did not serialize them. Chunks from here onwards are stored in ChunksV4.
	EFeatureLevelVariableSizeChunks                                                // Manifest can reference chunks with dynamic window size, and also serializes them.
	EFeatureLevelUsesRuntimeGeneratedBuildId                                       // Manifest uses a build id generated from its metadata.
	EFeatureLevelUsesBuildTimeGeneratedBuildId                                     // Manifest uses a build id generated unique at build time, and stored in manifest.

	EFeatureLevelLatestPlusOne                                                  // !! Always after the latest version entry, signifies the latest version plus 1 to allow the following Latest alias.
	EFeatureLevelLatest              = (EFeatureLevelLatestPlusOne - 1)         // An alias for the actual latest version value.
	EFeatureLevelLatestNoChunks      = EFeatureLevelStoresChunkFileSizes        // An alias to provide the latest version of a manifest supported by file data (nochunks).
	EFeatureLevelLatestJson          = EFeatureLevelStoresPrerequisiteIds       // An alias to provide the latest version of a manifest supported by a json serialized format.
	EFeatureLevelFirstOptimisedDelta = EFeatureLevelUsesRuntimeGeneratedBuildId // An alias to provide the first available version of optimised delta manifest saving.

	EFeatureLevelStoresUniqueBuildId = EFeatureLevelUsesRuntimeGeneratedBuildId // More aliases, but this time for values that have been renamed

	// JSON manifests were stored with a version of 255 during a certain CL range due to a bug.
	// We will treat this as being StoresChunkFileSizes in code.
	EFeatureLevelBrokenJsonVersion EFeatureLevel = 255
	EFeatureLevelInvalid           EFeatureLevel = -1 // This is for UObject default, so that we always serialize it.
)

type EFileMetaFlags

type EFileMetaFlags uint8

Declares flags for manifest headers which specify storage types.

const (
	EFileMetaFlagsNone           EFileMetaFlags = 0
	EFileMetaFlagsReadOnly       EFileMetaFlags = 1      // Flag for readonly file.
	EFileMetaFlagsCompressed     EFileMetaFlags = 1 << 1 // Flag for natively compressed.
	EFileMetaFlagsUnixExecutable EFileMetaFlags = 1 << 2 // Flag for unix executable.
)

type EManifestMetaVersion

type EManifestMetaVersion uint8

Enum which describes the FManifestMeta data version.

const (
	EManifestMetaVersionOriginal EManifestMetaVersion = iota
	EManifestMetaVersionSerialisesBuildId

	// Always after the latest version, signifies the latest version plus 1 to allow initialization simplicity.
	EManifestMetaVersionLatestPlusOne
	EManifestMetaVersionLatest EManifestMetaVersion = (EManifestMetaVersionLatestPlusOne - 1)
)

type EManifestStorageFlags

type EManifestStorageFlags uint8

A flags enum for manifest headers which specify storage types.

const (
	EManifestStorageFlagsNone       EManifestStorageFlags = 0      // Stored as raw data.
	EManifestStorageFlagsCompressed EManifestStorageFlags = 1      // Flag for compressed data.
	EManifestStorageFlagsEncrypted  EManifestStorageFlags = 1 << 1 // Flag for encrypted. If also compressed, decrypt first. Encryption will ruin compressibility.
)

type FChunkInfo

type FChunkInfo struct {
	Guid        uuid.UUID // The GUID for this data.
	Hash        uint64    // The FRollingHash hashed value for this chunk data.
	ShaHash     [20]byte  // The FSHA hashed value for this chunk data.
	GroupNumber uint8     // The group number this chunk divides into.
	WindowSize  uint32    // The window size for this chunk.
	FileSize    int64     // The file download size for this chunk.
}

type FChunkPart

type FChunkPart struct {
	Guid   uuid.UUID // The GUID of the chunk containing this part.
	Offset uint32    // The offset of the first byte into the chunk.
	Size   uint32    // The size of this part.
}

type FFileManifest

type FFileManifest struct {
	Filename      string         // The build relative filename.
	SymlinkTarget string         // Whether this is a symlink to another file.
	FileHash      [20]byte       // The file SHA1.
	FileMetaFlags EFileMetaFlags // The flags for this file.
	InstallTags   []string       // The install tags for this file.
	ChunkParts    []FChunkPart   // The list of chunk parts to stitch.
	FileSize      uint64         // The size of this file.
}

type FManifestHeader

type FManifestHeader struct {
	HeaderSize           uint32                // The size of this header.
	DataSizeUncompressed uint32                // The size of this data uncompressed.
	DataSizeCompressed   uint32                // The size of this data compressed.
	SHAHash              [20]byte              // The SHA1 hash for the manifest data that follows.
	StoredAs             EManifestStorageFlags // How the chunk data is stored.
	Version              EFeatureLevel         // The version of this header and manifest data format, driven by the feature level.
}

type FManifestMeta

type FManifestMeta struct {
	FeatureLevel  EFeatureLevel // The feature level support this build was created with, regardless of the serialised format.
	IsFileData    bool          // Whether this is a legacy 'nochunks' build.
	AppID         uint32        // The app id provided at generation.
	AppName       string        // The app name string provided at generation.
	BuildVersion  string        // The build version string provided at generation.
	LaunchExe     string        // The file in this manifest designated the application executable of the build.
	LaunchCommand string        // The command line required when launching the application executable.
	PrereqIDs     []string      // The set of prerequisite ids for dependencies that this build's prerequisite installer will apply.
	PrereqName    string        // A display string for the prerequisite provided at generation.
	PrereqPath    string        // The file in this manifest designated the launch executable of the prerequisite installer.
	PrereqArgs    string        // The command line required when launching the prerequisite installer.
	BuildID       string        // A unique build id generated at original chunking time to identify an exact build.
}

type Manifest

type Manifest struct {
	ManifestMeta     FManifestMeta
	ChunkDataList    []FChunkInfo      // The list of chunks.
	FileManifestList []FFileManifest   // The list of files.
	CustomFields     map[string]string // The map of field name to field data.
}

func Parse

func Parse(r io.ReadSeeker) (*Manifest, error)

func ParseBinary

func ParseBinary(r io.ReadSeeker) (*Manifest, error)

func ParseJson

func ParseJson(r io.Reader) (*Manifest, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL