25 #ifndef AURORA_GFF4FILE_H 26 #define AURORA_GFF4FILE_H 31 #include "glm/mat4x4.hpp" 33 #include <boost/noncopyable.hpp> 45 class SeekableReadStream;
46 class SeekableSubReadStreamEndian;
293 bool getVector4(
uint32 field,
double &v1,
double &v2,
double &v3,
double &v4)
const;
298 bool getVector4(
uint32 field,
float &v1,
float &v2,
float &v3,
float &v4)
const;
322 bool getString(
uint32 field, std::vector<Common::UString> &list)
const;
326 std::vector<uint32> &strRefs, std::vector<Common::UString> &strs)
const;
330 std::vector<uint32> &strRefs, std::vector<Common::UString> &strs)
const;
439 #endif // AURORA_GFF4FILE_H #define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
bool getVector3(uint32 field, double &v1, double &v2, double &v3) const
std::map< uint32, Field > FieldMap
uint32 getType() const
Return the GFF4's specific type.
This is a wrapper around SeekableSubReadStream, but it adds non-endian read methods whose endianness ...
Common::UString getString(uint32 field, Common::Encoding encoding, const Common::UString &def="") const
Return a field string, read from the given encoding.
A class holding an UTF-8 string.
uint32 getDataOffset() const
All currently known fields in V4.0/V4.1 GFFs.
uint32 label
A numerical label of the field.
std::vector< StructTemplate > StructTemplates
int64 getSint(uint32 field, int64 def=0) const
uint32 getListCount(Common::SeekableSubReadStreamEndian &data, const Field &field) const
uint32 getFieldSize(FieldType type) const
bool getTalkString(uint32 field, Common::Encoding encoding, uint32 &strRef, Common::UString &str) const
Return a talk string, which is a reference into the TalkTable and an optional direct string...
bool isBigEndian() const
Is the GFF4's platform natively big endian?
void unregisterStruct(uint64 id)
const GFF4Struct * getGeneric(uint32 field) const
A GFF (generic file format) V4.0/V4.1 file, found in Dragon Age: Origins, Dragon Age 2 and Sonic Chro...
bool hasSharedStrings() const
float getFloat(uint32 field, float def=0.0f) const
A 32bit fixed-point value, found in Sonic.
uint16 structIndex
Index of the field's struct type (if kFieldTypeStruct).
A simple scoped smart pointer template.
Common::ScopedPtr< Common::SeekableReadStream > _origStream
std::vector< const GFF4Struct * > GFF4List
Common::SeekableReadStream * getData(uint32 field) const
Return the raw data of the field as a Seekable(Sub)ReadStream.
ASCII string, found in Sonic.
void load(GFF4File &parent, uint32 offset, const GFF4File::StructTemplate &tmplt)
2 unsigned 32bit integers, reference into the TLK table.
double getDouble(uint32 field, double def=0.0) const
FieldType type
Type of the field.
uint64 getID() const
Return the struct's unique ID within the GFF4.
Base for BioWare's Aurora engine files.
uint32 getDataOffset(bool isReference, uint32 offset) const
void loadStructs(GFF4File &parent, Field &field)
std::vector< Field > fields
bool isList
Is this field a singular item or a list?
FieldType
The type of a GFF4 field.
bool hasField(uint32 field) const
Does this specific field exist?
uint32 getPlatform() const
Return the platform this GFF4 is for.
uint32 getRefCount() const
Return the number of structs that refer to this struct.
Utility functions for working with differing string encodings.
Low-level type definitions to handle fixed width types portably.
3 IEEE floats, 3D vector.
const Field * getField(uint32 field) const
bool getFieldProperties(uint32 field, FieldType &type, uint32 &label, bool &isList) const
Collectively return all field properties in one go.
std::map< uint64, GFF4Struct * > StructMap
static uint64 generateID(uint32 offset, const GFF4File::StructTemplate *tmplt=0)
const StructTemplate & getStructTemplate(uint32 i) const
Common::UString getSharedString(uint32 i) const
Common::SeekableSubReadStreamEndian & getStream(uint32 offset) const
StructMap _structs
All actual structs in this GFF4.
Basic type definitions to handle files used in BioWare's Aurora engine.
GFF4List structs
List of GFF4Struct (if kFieldTypeStruct).
bool isReference
Is this field a reference (pointer) to another field?
void loadHeader(uint32 type)
bool getVectorMatrix(uint32 field, std::vector< double > &vectorMatrix) const
Return a field vector or a matrix type as a std::vector of doubles.
bool getMatrix4x4(uint32 field, double(&m)[16]) const
const GFF4Struct * getStruct(uint32 field) const
GFF4File(Common::SeekableReadStream *gff4, uint32 type=0xFFFFFFFF)
Take over this stream and read a GFF4 file out of it.
FieldType getFieldType(uint32 field) const
Return the type of this field, or kFieldTypeNone if it doesn't exist.
void loadGeneric(GFF4File &parent, Field &field)
uint32 getTypeVersion() const
Return the GFF4's specific type version.
16 IEEE floats, 4x4 matrix in row-major order.
64bit IEEE float (double).
SharedStrings _sharedStrings
The shared strings used in V4.1.
Base class for most files found in games using BioWare's Aurora engine.
FileType
Various file types used by the Aurora engine and found in archives.
A template of a struct, used when loading a struct.
bool getBool(uint32 field, bool def=false) const
Common::Encoding getNativeEncoding() const
Return the native UTF-16 encoding according to the GFF4's platform.
StructTemplates _structTemplates
All struct templates in this GFF4.
4 IEEE floats, Quaternion rotation.
A field in the GFF4 struct.
Common::ScopedPtr< Common::SeekableSubReadStreamEndian > _stream
A "generic" field, able to hold any other type.
4 IEEE floats, 4D vector.
const std::vector< uint32 > & getFieldLabels() const
Return a list of all field labels in this struct.
const GFF4List & getList(uint32 field) const
GFF4Struct * findStruct(uint64 id)
size_t getFieldCount() const
Return the number of fields in this struct.
uint64 getUint(uint32 field, uint64 def=0) const
void registerStruct(uint64 id, GFF4Struct *strct)
const GFF4Struct & getTopLevel() const
Returns the top-level struct.
GFF4Struct * _topLevelStruct
The top-level struct.
GFF4Struct(GFF4File &parent, uint32 offset, const GFF4File::StructTemplate &tmplt)
Load a GFF4 struct.
Interface for a seekable & readable data stream.
4 IEEE floats, RGBA color.
std::vector< uint32 > _fieldLabels
The labels of all fields in this struct.
bool getVector4(uint32 field, double &v1, double &v2, double &v3, double &v4) const
Header _header
This GFF4's header.
uint32 offset
Offset into the GFF4 data.
std::vector< Common::UString > SharedStrings
uint32 getLabel() const
Return the struct's label.
uint32 getVectorMatrixLength(const Field &field, uint32 minLength, uint32 maxLength) const
bool isGeneric
Is this field found in a generic?