Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
tag_io.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <Strings/components/diagnostics/errors/errors.h>
6 
7 #ifdef BLAM_EXPORTS
8 #define BLAM_EXT_API __declspec(dllexport)
9 #else
10 #define BLAM_EXT_API __declspec(dllimport)
11 #endif
12 
13 #ifndef BLAM
14 #define BLAM
15 #endif
16 
17 class BlamTagData;
18 
19 namespace Blam::Content::Tags
20 {
29  BLAM_EXT_API void AddExtraTagFolder(std::string tag_folder);
30 
36  BLAM void LoadReferencedTags(std::string tag_path);
37 
42 
56  BLAM BlamResult LoadTagFromFile(std::string tag_path, bool reload_if_already_loaded = true);
57 
58  BLAM BlamResult LoadTagFromMemoryBlock(char* address, int size, std::string tag_path, bool reload_if_already_loaded = true);
59 
67  BLAM BlamResult SaveTag(std::string tag_path);
68 
76  BLAM bool TagNeedsPostprocess(BlamTagData* tag_data);
77 
92  BLAM void TagPostprocess(BlamTagData* tag_data);
93 
94 
95  BLAM BlamTagData* CloneTag(BlamTagData* original_tag_data);
96 }
tag_block::entry_size
int entry_size
The size of each block entry.
Definition: tags.h:179
Blam::Settings::Config::GetEngineConfiguration
BLAM BlamConfigurationFile * GetEngineConfiguration()
Definition: config.cpp:58
tag_io.h
Blam::Content::Tags::SaveTag
BLAM BlamResult SaveTag(std::string tag_path)
Saves a tag data to a file.
Definition: tag_io.cpp:773
BLAM_EXT_API
#define BLAM_EXT_API
Definition: tag_io.h:10
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:196
tag_block::entry_data_address
void * entry_data_address
The address of the blocks' entry data.
Definition: tags.h:181
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:142
BlamTagFieldType::Bitfield16
@ Bitfield16
Indicates that the field is a Bitfield16.
BlamTagFieldType::Bitfield8
@ Bitfield8
Indicates that the field is a Bitfield8.
Blam::Content::Tags::GetFieldSize
BLAM int GetFieldSize(BlamTagFieldType type)
Definition: fields.cpp:100
tag_block< void >
LoadTagDataSection
void * LoadTagDataSection(int offset, int size, std::ifstream *tag_file)
Loads a tag data section from a file.
Definition: tag_io.cpp:83
logger.h
BlamTagFieldType::Comment
@ Comment
Indicates that the field is a comment. These do not store any tag data.
tag_reference::GetTagPath
std::string GetTagPath()
Retrieves the path of the tag that this tagref refers to.
Definition: tag_reference.cpp:45
BlamEngineDataFolder::Tags
@ Tags
Directory used for reading engine tags. Defaults to ./tags/
ascii
char ascii[128]
Typedef for an ascii field, used in tag data definitions.
Definition: tags.h:353
Blam::Content::Tags::GetLoadedTags
BLAM std::vector< BlamTagData * > * GetLoadedTags()
Retrieves the list of loaded tag data.
Definition: tags.cpp:151
BlamTagFieldType::TagReference
@ TagReference
Indicates that the field is a tag reference.
bitfield32
Typedef for a bitfield32 field, used in tag data definitions.
Definition: tags.h:314
BlamTagFieldType::Real
@ Real
Indicates that the field is a Float32.
BlamTagData::path
char path[256]
The tag's path.
Definition: tags.h:84
BlamTagFieldType::Bitfield32
@ Bitfield32
Indicates that the field is a Bitfield32.
BlamTagFieldType::Unspecified
@ Unspecified
Indicates that the field's type is not specified. Fields with this type should be considered invalid.
BlamTagFieldType::Int16
@ Int16
Indicates that the field is a 16-bit integer.
FixupClonedTagData
bool FixupClonedTagData(void *tag_address, int size, void *original_tag_address)
Definition: tag_io.cpp:267
Blam::Content::Tags::LoadTagFromFile
BLAM BlamResult LoadTagFromFile(std::string tag_path, bool reload_if_already_loaded=true)
Loads a tag from the engine's tag directory (default is '.
Definition: tag_io.cpp:317
tag_reference::data_size
int data_size
The size of tagref_address.
Definition: tags.h:224
field_reference::referenced_field_type
BlamTagFieldType referenced_field_type
Definition: tags.h:370
BuildTagDataSection
std::vector< char > BuildTagDataSection(void *section_data, int size, int start_offset)
Prepares a tag data section for saving.
Definition: tag_io.cpp:710
Blam::Content::Tags::GetTagClass
BLAM_EXT_API BlamTagClass * GetTagClass(std::string id)
Retrieves a tag class that matches the given string.
Definition: tagclass.cpp:64
USER_DATA_PATH
#define USER_DATA_PATH(path)
Macro to quickly access a user data folder.
Definition: config.h:43
Blam::Content::Tags::TagNeedsPostprocess
BLAM bool TagNeedsPostprocess(BlamTagData *tag_data)
Checks if a given tag requires additional post-processing.
Definition: tag_postprocess.cpp:95
BLAM
#define BLAM
Definition: tag_io.h:14
BlamTagFieldType::Int8
@ Int8
Indicates that the field is an 8-bit integer.
BlamTagFieldType
BlamTagFieldType
Enumerator listing all possible plugin field types.
Definition: tags.h:30
int8_t
signed char int8_t
Definition: stdint.h:11
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:275
BlamTagFieldType::Int64
@ Int64
Indicates that the field is a 32-bit integer.
LoadTagDataSection__New
bool LoadTagDataSection__New(void *tag_address, int size, int header_size)
Definition: tag_io.cpp:219
BlamTagData::SetTagPath
bool SetTagPath(std::string new_path)
Updates the tag path.
Definition: BlamTagData.cpp:31
int32_t
int int32_t
Definition: stdint.h:13
BlamTagFieldType::Ascii
@ Ascii
Indicates that the field is a string of text.
Blam::Content::Tags::CloneTag
BLAM BlamTagData * CloneTag(BlamTagData *original_tag_data)
Definition: tag_io.cpp:825
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:135
ENGINE_DATA_PATH
#define ENGINE_DATA_PATH(path)
Macro to quickly access a game engine data folder.
Definition: config.h:36
Blam::EngineDefs::GetVersion
const BLAM char * GetVersion()
Retrieves the version of the engine in the following format:
Definition: engine_definitions.cpp:150
tag_block::entry_count
int entry_count
The number of entries within the tag block.
Definition: tags.h:182
BlamTagFieldType::Int32
@ Int32
Indicates that the field is a 32-bit integer.
TagOrigin::Clone
@ Clone
Indicates the tag was created by cloning the data of an existing tag.
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:136
Blam::Content::Tags::TagPostprocess
BLAM void TagPostprocess(BlamTagData *tag_data)
Performs any required post-processing for a given tag.
Definition: tag_postprocess.cpp:115
tag_reference
Structure representing a tag reference.
Definition: tags.h:215
field_reference
Structure representing a field reference.
Definition: tags.h:367
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:134
Blam::Content::Tags::GetFieldName
BLAM std::string GetFieldName(BlamTagFieldType type)
Generates a string representation of a plugin field type.
Definition: fields.cpp:3
int64_t
long long int64_t
Definition: stdint.h:14
BlamTagFieldType::Color
@ Color
Indicates that the field is a color.
Blam::Content::Tags::LoadTagFromMemoryBlock
BLAM BlamResult LoadTagFromMemoryBlock(char *address, int size, std::string tag_path, bool reload_if_already_loaded=true)
Definition: tag_io.cpp:536
real
float real
Typedef for a 'real', aka a float.
Definition: tags.h:355
BlamTagFieldType::Boolean
@ Boolean
Indicates that the field is a boolean.
Blam::Content::Tags::GetTagData
BLAM BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: tags.cpp:80
extra_tag_search_folders
std::vector< std::string > extra_tag_search_folders
Definition: tag_io.cpp:17
Blam::Content::Tags::ResolveAllTagReferences
BLAM void ResolveAllTagReferences()
Attempts to resolve all tag references within all loaded tags.
Definition: tags.cpp:72
LoadSectionTagReferences
void LoadSectionTagReferences(char *address, int size, std::string tag_path)
Attempts to resolve any tag references within the given tag data section.
Definition: tag_io.cpp:26
TagOrigin::Memory
@ Memory
Indicates the tag originated from the engine's memory.
engine_definitions.h
tag_reference::data_is_tag
bool data_is_tag
Whether or not tagref_address points to tag data, or the tag's path.
Definition: tags.h:222
BlamTagFieldType::Enum32
@ Enum32
Indicates that the field is an Enum32.
data_reference::data_address
void * data_address
The address of the referenced data.
Definition: tags.h:265
Blam::Content::Tags::LoadReferencedTags
BLAM void LoadReferencedTags(std::string tag_path)
Attempts to resolve any tag references within a given tag.
Definition: tag_io.cpp:58
fields.h
BlamTagFieldType::Vector2
@ Vector2
Indicates that the field is a vector2.
BlamTagFieldType::Enum8
@ Enum8
Indicates that the field is an Enum8.
bitfield16
Typedef for a bitfield16 field, used in tag data definitions.
Definition: tags.h:290
data_reference
Structure representing a data reference.
Definition: tags.h:261
tag_reference::HasReference
bool HasReference()
Checks if a tag reference has a tag specified or not.
Definition: tag_reference.cpp:69
BlamTagFieldType::Block
@ Block
Indicates that the field is a tag block.
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:139
data_reference::data_size
int data_size
The size of the referenced data.
Definition: tags.h:266
field_reference::file_offset
uint32_t file_offset
Definition: tags.h:372
BlamTagFieldType::Vector4
@ Vector4
Indicates that the field is a vector4.
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:71
tagclass.h
config.h
tags.h
BlamTagData::origin
TagOrigin origin
The origin of the tag.
Definition: tags.h:86
int16_t
short int16_t
Definition: stdint.h:12
TagOrigin::BinaryFile
@ BinaryFile
Indicates the tag originated from a binary file.
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:68
BlamTagFieldType::Vector3
@ Vector3
Indicates that the field is a vector3.
tag_reference::tagref_address
void * tagref_address
The address of the tagref data.
Definition: tags.h:221
Blam::Content::Tags::AddExtraTagFolder
BLAM_EXT_API void AddExtraTagFolder(std::string tag_folder)
Adds an additional folder to search when attempting to load a tag.
Definition: tag_io.cpp:53
BlamTagFieldType::Enum16
@ Enum16
Indicates that the field is an Enum16.
BlamUserDataFolder::Tags
@ Tags
Directory storing user-created tags. Defaults to {DataRoot}/tags/.
field_reference::field_address
void * field_address
Definition: tags.h:371
BlamTagData::size
int size
The size of the tag's data in memory.
Definition: tags.h:72
tag_reference::ResolveReference
bool ResolveReference()
Attempts to resolve a tag reference.
Definition: tag_reference.cpp:7
BlamTagFieldType::DataReference
@ DataReference
Indicates that the field is a data reference.
BlamTagClass
Class representing a tag class.
Definition: tags.h:131
BlamTagFieldType::FieldReference
@ FieldReference
Indicates that the field is a fieldref.
BlamTagData::tag_class
std::string tag_class
The tag's short class name.
Definition: tags.h:85