Elaztek Developer Hub
Blamite Game Engine - blam!  00346.12.11.21.0529.blamite
The core library for the Blamite Game Engine.
tag_io.cpp File Reference

Functions

void LoadSectionTagReferences (char *address, int size, std::string tag_path)
 Attempts to resolve any tag references within the given tag data section. More...
 
void * LoadTagDataSection (int offset, int size, std::ifstream *tag_file)
 Loads a tag data section from a file. More...
 
std::vector< char > BuildTagDataSection (void *section_data, int size, int start_offset)
 Prepares a tag data section for saving. More...
 

Function Documentation

◆ BuildTagDataSection()

std::vector<char> BuildTagDataSection ( void *  section_data,
int  size,
int  start_offset 
)

Prepares a tag data section for saving.

This will build a list of all bytes for both the data section itself, as well as for any referenced data (such as blocks or tagrefs). It will also convert memory addresses to file offsets.

Parameters
section_data- Address of the section data, would be either the tag data, or the block entry data.
size- The size of the section data, would be either the tag's base size or the combined size of all block entries.
start_offset- The start offset of the data. Used to convert memory addresses to file offsets.
Returns
A list of bytes representing the tag data section.

◆ LoadSectionTagReferences()

void LoadSectionTagReferences ( char *  address,
int  size,
std::string  tag_path 
)

Attempts to resolve any tag references within the given tag data section.

Parameters
address- The data section address.
size- The data section size.
tag_path- The path of the tag. Used for debug messages.

◆ LoadTagDataSection()

void* LoadTagDataSection ( int  offset,
int  size,
std::ifstream *  tag_file 
)

Loads a tag data section from a file.

This can be used to load both base tag data, as well as tag entry data.

Parameters
offset- The offset to read from within the tag file.
size- The size of the section data.
tag_file- Pointer to the tag file to read from.
Returns
The address in memory of the newly loaded section.