DEKI/ENGINE docs
manual api reference
Deki 0.40.1
Modular C++ engine with a visual editor, for 2D and 3D
Loading...
Searching...
No Matches

Read-only pack of a game's files in one block of bytes, used where it lies. More...

#include <deki/FileImage.h>

Classes

struct  File
 One file to pack: its name in the image and its bytes. More...

Public Member Functions

bool Find (const char *name, size_t nameLength, const uint8_t *&data, size_t &size) const
 The file name (such as "assets/5a7800eb-..." or "boot.scene", no mount prefix): its bytes and size.
uint32_t GetFileCount () const
bool IsOpen () const
bool Open (const uint8_t *data, size_t size)
 Uses the image in data, which must stay where it is while files are found in it.

Static Public Member Functions

static uint32_t SizeFromHeader (const uint8_t *header, size_t bytes)
 The whole image's size, from its first kHeaderSize bytes: how much of a partition to map before Open.
static bool Write (std::vector< File > files, std::vector< uint8_t > &out, std::string &error)
 Packs files into an image.

Static Public Attributes

static constexpr size_t kDataAlignment = 16
static constexpr size_t kEntrySize = 16
static constexpr size_t kHeaderSize = 16
static constexpr char kMagic [4] = { 'D', 'K', 'F', 'I' }
static constexpr uint32_t kVersion = 1

Detailed Description

Read-only pack of a game's files in one block of bytes, used where it lies.

Member Function Documentation

◆ Find()

bool Deki::FileImage::Find ( const char * name,
size_t nameLength,
const uint8_t *& data,
size_t & size ) const

The file name (such as "assets/5a7800eb-..." or "boot.scene", no mount prefix): its bytes and size.

False when the image has no such file.

◆ GetFileCount()

uint32_t Deki::FileImage::GetFileCount ( ) const
inline

◆ IsOpen()

bool Deki::FileImage::IsOpen ( ) const
inline

◆ Open()

bool Deki::FileImage::Open ( const uint8_t * data,
size_t size )

Uses the image in data, which must stay where it is while files are found in it.

False, and nothing opened, when data does not hold a whole, well-formed image of this version.

◆ SizeFromHeader()

uint32_t Deki::FileImage::SizeFromHeader ( const uint8_t * header,
size_t bytes )
static

The whole image's size, from its first kHeaderSize bytes: how much of a partition to map before Open.

0 when they are not an image's header.

◆ Write()

bool Deki::FileImage::Write ( std::vector< File > files,
std::vector< uint8_t > & out,
std::string & error )
static

Packs files into an image.

False, with the reason in error, when two share a name, a name is empty, or the image would pass 4 GB.

Member Data Documentation

◆ kDataAlignment

size_t Deki::FileImage::kDataAlignment = 16
staticconstexpr

◆ kEntrySize

size_t Deki::FileImage::kEntrySize = 16
staticconstexpr

◆ kHeaderSize

size_t Deki::FileImage::kHeaderSize = 16
staticconstexpr

◆ kMagic

char Deki::FileImage::kMagic[4] = { 'D', 'K', 'F', 'I' }
staticconstexpr

◆ kVersion

uint32_t Deki::FileImage::kVersion = 1
staticconstexpr

The documentation for this class was generated from the following file: