Open 3D Engine Archive Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Archive::ArchiveHeader Struct Reference

#include <ArchiveInterfaceStructs.h>

Classes

struct  TocOffsetU64
 

Public Member Functions

 ArchiveHeader (const ArchiveHeader &other)
 
ArchiveHeaderoperator= (const ArchiveHeader &other)
 
AZ::u64 GetUncompressedTocSize () const
 
AZ::u64 GetTocStoredSize () const
 

Public Attributes

const AZ::u32 m_magicBytes { ArchiveHeaderMagicBytes }
 
AZ::u16 m_minorVersion {}
 
AZ::u16 m_majorVersion {}
 
AZ::u16 m_revision {}
 
AZ::u16 m_layout {}
 
AZ::u32 m_fileCount {}
 
TocOffsetU64 m_tocOffset {}
 
AZ::u32 m_tocCompressedSize: 29
 
AZ::u32 m_tocCompressionAlgoIndex: 3
 
AZ::u32 m_tocFileMetadataTableUncompressedSize {}
 
AZ::u32 m_tocPathIndexTableUncompressedSize {}
 
AZ::u32 m_tocPathBlobUncompressedSize {}
 
AZ::u32 m_tocBlockOffsetTableUncompressedSize {}
 
AZ::u32 m_compressionThreshold { static_cast<AZ::u32>(ArchiveBlockSizeForCompression) }
 
AZStd::array< Compression::CompressionAlgorithmId, UncompressedAlgorithmIndex > m_compressionAlgorithmsIds
 
const AZ::u32 m_padding {}
 
AZ::u64 m_firstDeletedBlockOffset { DeletedBlockOffsetSentinel }
 

Static Public Attributes

static constexpr AZ::u32 MaxFileCount { (1 << 25) - 1 }
 total offset = 88
 

Detailed Description

Fixed size Header struct for the Archive format This suitable for directly reading the archive header into

Constructor & Destructor Documentation

◆ ArchiveHeader()

Archive::ArchiveHeader::ArchiveHeader ( const ArchiveHeader other)
inline

An actual implementation of the ArchiveHeader copy constructor is required as the const AZ::u32 m_magicBytes member causes the copy constructor to be implicitly deleted

Member Function Documentation

◆ GetTocStoredSize()

AZ::u64 Archive::ArchiveHeader::GetTocStoredSize ( ) const
inline

If on the Compression algorithm the TOC is using a compression algorithm index that is < UncompressedAlgorithmIndex then the compressed size of the toc is returned otherwise the uncompressed size of the toc is returned

◆ GetUncompressedTocSize()

AZ::u64 Archive::ArchiveHeader::GetUncompressedTocSize ( ) const
inline

Retrieves the Uncompressed Table of Contents(TOC) size by adding up the size of the TOC File Metadata table

  • TOC File Path Index table
  • TOC File Path Blob table
  • TOC Block Offset table

Member Data Documentation

◆ m_compressionAlgorithmsIds

AZStd::array<Compression::CompressionAlgorithmId, UncompressedAlgorithmIndex> Archive::ArchiveHeader::m_compressionAlgorithmsIds
Initial value:
=
[]() constexpr
{
AZStd::array<Compression::CompressionAlgorithmId, UncompressedAlgorithmIndex> compressionIdInitArray{};
compressionIdInitArray.fill(Compression::Invalid);
return compressionIdInitArray;
}()

Stores 32-bit IDS of up to 7 compression algorithms that this archive can use Each entry is initialized to the Invalid CompressionAlgorithmId The capacity of the array is the value of the uncompressed algorithm index offset = 48

◆ m_compressionThreshold

AZ::u32 Archive::ArchiveHeader::m_compressionThreshold { static_cast<AZ::u32>(ArchiveBlockSizeForCompression) }

Threshold value represents the cap on the size a block after it has been sent through the compression step to determine if it should be stored compressed

Due to block size defaulting to 2MiB, any blocks that are larger than 2_mib after compression will be stored uncompressed. So the maximum limit of this value is the Block Size offset = 44

◆ m_fileCount

AZ::u32 Archive::ArchiveHeader::m_fileCount {}

Represents the number of files stored within the Archive Caps out at (2^25) or ~33 million files that can be represented offset = 12

◆ m_firstDeletedBlockOffset

AZ::u64 Archive::ArchiveHeader::m_firstDeletedBlockOffset { DeletedBlockOffsetSentinel }

Offset from the beginning of the file block section to the first deleted block. The first 8 bytes of each deleted block will contain the offset to the next deleted block or 0xffff'ffff'ffff'ffff if this is the last deleted block offset = 80 (aligned on 8 byte boundary)

◆ m_layout

AZ::u16 Archive::ArchiveHeader::m_layout {}

reserved for future memory configurations default layout is 2Mib blocks with 512 byte borders offset = 10

◆ m_magicBytes

const AZ::u32 Archive::ArchiveHeader::m_magicBytes { ArchiveHeaderMagicBytes }

The Magic Bytes used to identify the archive as being in the O3DE Archive format offset = 0

◆ m_minorVersion

AZ::u16 Archive::ArchiveHeader::m_minorVersion {}

Version number of archive format. Supports up to 2^16 revisions per entry offset = 4

◆ m_padding

const AZ::u32 Archive::ArchiveHeader::m_padding {}

Padding bytes added to ArchiveHeader to ensure byte offsets 76-79 contains bytes with a value '\0' This allows equivalent ArchiveHeader to be memcmp offset = 76

◆ m_tocBlockOffsetTableUncompressedSize

AZ::u32 Archive::ArchiveHeader::m_tocBlockOffsetTableUncompressedSize {}

Uncompressed size of the Table of Contents File Block offset table Contains compressed sizes of individual blocks of a file In Archive V1 layout the block size is 2MiB offset = 40

◆ m_tocCompressedSize

AZ::u32 Archive::ArchiveHeader::m_tocCompressedSize

Compressed Size of the Table of Contents Max size is 512MiB or 2^29 bytes The TOC offset + TOC compressed size is equal to total size of the Archive file If the Compression Algorithm is set to Uncompressed Then this value is 0 offset = 24

◆ m_tocCompressionAlgoIndex

AZ::u32 Archive::ArchiveHeader::m_tocCompressionAlgoIndex

Compression algorithm used for the Table of Contents The maximum 3-bit value of 7 is reserved for uncompressed Other values count as a offset in the Compression Algorithm ID table

◆ m_tocFileMetadataTableUncompressedSize

AZ::u32 Archive::ArchiveHeader::m_tocFileMetadataTableUncompressedSize {}

Uncompressed size of the Table of Contents File Metadata table. offset = 28

◆ m_tocOffset

TocOffsetU64 Archive::ArchiveHeader::m_tocOffset {}

The 64-bit offset from the start of the Archive File to the Table of Contents The table of contents offset also doubles as the offset to write new blocks of content that does not exist in any deleted blocks offset = 16

◆ m_tocPathBlobUncompressedSize

AZ::u32 Archive::ArchiveHeader::m_tocPathBlobUncompressedSize {}

Uncompressed size of the Table of Contents File Path table It contains a blob of FilePaths without any null-termination The File Path Index entries are used to look up a file path through using the path offset + size entry offset = 36

◆ m_tocPathIndexTableUncompressedSize

AZ::u32 Archive::ArchiveHeader::m_tocPathIndexTableUncompressedSize {}

Uncompressed size of the Table of Contents File Path index The File Path index is used to lookup the location for a file path within the archive offset = 32

◆ MaxFileCount

constexpr AZ::u32 Archive::ArchiveHeader::MaxFileCount { (1 << 25) - 1 }
staticconstexpr

total offset = 88

Max FileCount Up to 2^32 files can be stored, but is limited to 2^25 because around 640MiB of uncompressed data will need to be loaded into memory for an archive of containing ~33million files, and memory requirements would increase if the not limited. offset = 12


The documentation for this struct was generated from the following files: