xoreos  0.0.5
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Aurora::GFXFile Class Reference

Class for parsing gfx files. More...

#include <gfxfile.h>

Collaboration diagram for Aurora::GFXFile:
Collaboration graph
[legend]

Classes

struct  RecordHeader
 The standard header of every tag. More...
 

Public Member Functions

 GFXFile (const Common::UString &resref, Aurora::ActionScript::AVM &avm)
 Open a gfx file specified by the reference and used with the specified avm. More...
 
float getFrameRate ()
 Get the framerate for this gfx file. More...
 
uint16 getExportedAssetId (const Common::UString &id)
 Get the corresponding character id for an exported asset. More...
 
GFXCharacter getCharacter (uint16 id)
 Get a character by id. More...
 
std::vector< GFXControlgetControls ()
 Get all root controls. More...
 

Private Member Functions

void load (Common::SeekableReadStream *gfx, Aurora::ActionScript::AVM &avm)
 
void readHeader ()
 Load all header information. More...
 
void readDefineShape (byte version)
 Read a DefineShape tag. More...
 
void readBackgroundColor ()
 Read the background color tag. More...
 
void readExportAssets ()
 Read an export assets tag. More...
 
void readImportAssets (ActionScript::AVM &avm)
 Read an import assets tag. More...
 
void readFileAttributes ()
 Read the file attributes tag. More...
 
void readDefineSprite ()
 Read a define sprite tag. More...
 
GFXControl readPlaceObject (byte version=1)
 Read a place object tag. More...
 
void readDefineFont ()
 Read a font definition version 3. More...
 
void readDefineEditText ()
 Read an edit text character. More...
 
void readInitAction (ActionScript::AVM &avm)
 Read a DoInitAction tag. More...
 
Aurora::ActionScript::ASBufferreadAction ()
 Read a DoAction tag. More...
 
void readGFXExporterInfo (RecordHeader header)
 Load the information about the gfx exporter. More...
 
void readGFXDefineExternalImage (RecordHeader header, byte version=0)
 Load an external image reference. More...
 
RecordHeader readRecordHeader ()
 Read a record header for the next tag. More...
 
Common::Rect readRectangle ()
 Read a basic rectangle type from the gfx file. More...
 
glm::mat3x2 readMatrix ()
 Read a matrix. More...
 
glm::u8vec3 readRGB ()
 Read an RGB color record. More...
 
glm::u8vec4 readRGBA ()
 Reag an RGBA color record. More...
 
std::vector< GFXCharacter::FillStylereadFillStyleArray (byte version)
 Read an fillstyle array. More...
 
GFXCharacter::FillStyle readFillStyle (byte version)
 Read an FillStyle record. More...
 
std::vector< GFXCharacter::LineStylereadLineStyleArray (byte version)
 Read a line style array. More...
 
GFXCharacter::LineStyle readLineStyle (byte version)
 Read a line style. More...
 
GFXControl::ColorTransform readColorTransform ()
 Read a color transform. More...
 
void readFocalGradient (byte version)
 Read a focal gradient record. More...
 
GFXCharacter::GradientRecord readGradientRecord (byte version)
 Read a gradient record. More...
 
std::vector< GFXCharacter::ShapeRecordreadShape (byte version, bool withStyle)
 Read a shape. More...
 
Common::UString readNullTerminatedString ()
 Read a null terminated string. More...
 
Common::UString readLengthPrefixedString ()
 Read a byte length prefixed string. More...
 
int32 read2ComplementValue (Common::BitStream &bitStream, size_t n)
 Read a 2's complement value. More...
 

Private Attributes

std::map< Common::UString, uint16_exportTable
 Every exported character id with the associated export name. More...
 
std::map< uint16, GFXCharacter_characters
 Every character associated with it's character id. More...
 
std::vector< GFXControl_controlTags
 All root control tags. More...
 
Common::ScopedPtr< Common::SeekableReadStream_gfx
 The read stream of this gfx file. More...
 
Common::Rect _frameSize
 The standard bounds of the ui in this file. More...
 
float _frameRate
 The frame rate, how fast this gui should be played. More...
 
unsigned short _frameCount
 The count of frames in this gfx file. More...
 

Detailed Description

Class for parsing gfx files.

This class parses a gfx file and and extracts it's controls and characters to a usable state.

Definition at line 348 of file gfxfile.h.

Constructor & Destructor Documentation

◆ GFXFile()

Aurora::GFXFile::GFXFile ( const Common::UString resref,
Aurora::ActionScript::AVM avm 
)

Open a gfx file specified by the reference and used with the specified avm.

Parameters
resrefthe resref of the gfx file
avmThe AVM that should be used throughout the loading process

Definition at line 198 of file gfxfile.cpp.

References Aurora::kFileTypeGFX, load(), and ResMan.

Here is the call graph for this function:

Member Function Documentation

◆ getCharacter()

GFXCharacter Aurora::GFXFile::getCharacter ( uint16  id)

Get a character by id.

Definition at line 214 of file gfxfile.cpp.

References _characters.

Referenced by readImportAssets().

Here is the caller graph for this function:

◆ getControls()

std::vector<GFXControl> Aurora::GFXFile::getControls ( )
inline

Get all root controls.

Definition at line 366 of file gfxfile.h.

References _controlTags.

◆ getExportedAssetId()

uint16 Aurora::GFXFile::getExportedAssetId ( const Common::UString id)

Get the corresponding character id for an exported asset.

Definition at line 206 of file gfxfile.cpp.

References _exportTable.

◆ getFrameRate()

float Aurora::GFXFile::getFrameRate ( )
inline

Get the framerate for this gfx file.

Definition at line 358 of file gfxfile.h.

References _frameRate.

◆ load()

void Aurora::GFXFile::load ( Common::SeekableReadStream gfx,
Aurora::ActionScript::AVM avm 
)
private

Definition at line 222 of file gfxfile.cpp.

References _controlTags, _gfx, Aurora::GFXControl::DoAction::asBuffer, Aurora::GFXControl::createDoAction(), Aurora::GFXControl::createShowFrame(), Common::decompressDeflateWithoutOutputSize(), Aurora::kCFXID, Aurora::kTagTypeDefineEditText, Aurora::kTagTypeDefineFont3, Aurora::kTagTypeDefineShape, Aurora::kTagTypeDefineShape2, Aurora::kTagTypeDefineShape3, Aurora::kTagTypeDefineSprite, Aurora::kTagTypeDoAction, Aurora::kTagTypeDoInitAction, Aurora::kTagTypeEnd, Aurora::kTagTypeExportAssets, Aurora::kTagTypeFileAttributes, Aurora::kTagTypeFrameLabel, Aurora::kTagTypeGFXDefineExternalImage, Aurora::kTagTypeGFXDefineExternalImage2, Aurora::kTagTypeGFXExporterInfo, Aurora::kTagTypeImportAssets2, Aurora::kTagTypePlaceObject2, Aurora::kTagTypeSetBackgroundColor, Aurora::kTagTypeShowFrame, Common::kWindowBitsMax, readAction(), readBackgroundColor(), readDefineEditText(), readDefineFont(), readDefineShape(), readDefineSprite(), readExportAssets(), readFileAttributes(), readGFXDefineExternalImage(), readGFXExporterInfo(), readHeader(), readImportAssets(), readInitAction(), readNullTerminatedString(), readPlaceObject(), readRecordHeader(), Common::ReadStream::readUint32BE(), Common::ScopedPtrBase< T, Deallocator >::reset(), Common::SeekableReadStream::size(), Common::SeekableReadStream::skip(), Aurora::GFXFile::RecordHeader::tagLength, Aurora::GFXFile::RecordHeader::tagType, and warning().

Referenced by GFXFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read2ComplementValue()

int32 Aurora::GFXFile::read2ComplementValue ( Common::BitStream bitStream,
size_t  n 
)
private

Read a 2's complement value.

Definition at line 1129 of file gfxfile.cpp.

References Common::BitStream::getBits().

Referenced by readMatrix(), readRectangle(), and readShape().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAction()

Aurora::ActionScript::ASBuffer * Aurora::GFXFile::readAction ( )
private

Read a DoAction tag.

Definition at line 727 of file gfxfile.cpp.

References _gfx, and Common::SeekableReadStream::kOriginCurrent.

Referenced by load(), readDefineSprite(), and readInitAction().

Here is the caller graph for this function:

◆ readBackgroundColor()

void Aurora::GFXFile::readBackgroundColor ( )
private

Read the background color tag.

Definition at line 341 of file gfxfile.cpp.

References readRGB().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readColorTransform()

GFXControl::ColorTransform Aurora::GFXFile::readColorTransform ( )
private

◆ readDefineEditText()

void Aurora::GFXFile::readDefineEditText ( )
private

◆ readDefineFont()

void Aurora::GFXFile::readDefineFont ( )
private

◆ readDefineShape()

void Aurora::GFXFile::readDefineShape ( byte  version)
private

Read a DefineShape tag.

Definition at line 331 of file gfxfile.cpp.

References _characters, _gfx, Aurora::GFXCharacter::Shape::bounds, Aurora::GFXCharacter::createShape(), readRectangle(), readShape(), and Aurora::GFXCharacter::Shape::shapeRecords.

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readDefineSprite()

void Aurora::GFXFile::readDefineSprite ( )
private

◆ readExportAssets()

void Aurora::GFXFile::readExportAssets ( )
private

Read an export assets tag.

Definition at line 345 of file gfxfile.cpp.

References _exportTable, _gfx, and readNullTerminatedString().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readFileAttributes()

void Aurora::GFXFile::readFileAttributes ( )
private

Read the file attributes tag.

Definition at line 375 of file gfxfile.cpp.

References _gfx, Common::ScopedPtrBase< T, Deallocator >::get(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::skip(), and warning().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readFillStyle()

GFXCharacter::FillStyle Aurora::GFXFile::readFillStyle ( byte  version)
private

◆ readFillStyleArray()

std::vector< GFXCharacter::FillStyle > Aurora::GFXFile::readFillStyleArray ( byte  version)
private

Read an fillstyle array.

Definition at line 873 of file gfxfile.cpp.

References _gfx, and readFillStyle().

Referenced by readShape().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readFocalGradient()

void Aurora::GFXFile::readFocalGradient ( byte  version)
private

Read a focal gradient record.

Definition at line 989 of file gfxfile.cpp.

◆ readGFXDefineExternalImage()

void Aurora::GFXFile::readGFXDefineExternalImage ( RecordHeader  header,
byte  version = 0 
)
private

◆ readGFXExporterInfo()

void Aurora::GFXFile::readGFXExporterInfo ( RecordHeader  header)
private

Load the information about the gfx exporter.

Definition at line 748 of file gfxfile.cpp.

References _gfx, readLengthPrefixedString(), and Aurora::GFXFile::RecordHeader::tagLength.

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readGradientRecord()

GFXCharacter::GradientRecord Aurora::GFXFile::readGradientRecord ( byte  version)
private

Read a gradient record.

Definition at line 993 of file gfxfile.cpp.

References _gfx, Aurora::GFXCharacter::GradientRecord::color, Aurora::GFXCharacter::GradientRecord::ratio, readRGB(), and readRGBA().

Referenced by readFillStyle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readHeader()

void Aurora::GFXFile::readHeader ( )
private

Load all header information.

Definition at line 322 of file gfxfile.cpp.

References _frameCount, _frameRate, _frameSize, _gfx, and readRectangle().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readImportAssets()

void Aurora::GFXFile::readImportAssets ( ActionScript::AVM avm)
private

Read an import assets tag.

Definition at line 355 of file gfxfile.cpp.

References _characters, _gfx, getCharacter(), Common::FilePath::getStem(), and readNullTerminatedString().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readInitAction()

void Aurora::GFXFile::readInitAction ( ActionScript::AVM avm)
private

Read a DoInitAction tag.

Definition at line 716 of file gfxfile.cpp.

References _gfx, readAction(), warning(), and Common::StackException::what().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readLengthPrefixedString()

Common::UString Aurora::GFXFile::readLengthPrefixedString ( )
private

Read a byte length prefixed string.

Definition at line 1124 of file gfxfile.cpp.

References _gfx, Common::kEncodingASCII, and Common::readStringFixed().

Referenced by readDefineFont(), readGFXDefineExternalImage(), and readGFXExporterInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readLineStyle()

GFXCharacter::LineStyle Aurora::GFXFile::readLineStyle ( byte  version)
private

Read a line style.

Definition at line 950 of file gfxfile.cpp.

References _gfx, Aurora::GFXCharacter::LineStyle::color, readRGB(), readRGBA(), and Aurora::GFXCharacter::LineStyle::width.

Referenced by readLineStyleArray().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readLineStyleArray()

std::vector< GFXCharacter::LineStyle > Aurora::GFXFile::readLineStyleArray ( byte  version)
private

Read a line style array.

Definition at line 937 of file gfxfile.cpp.

References _gfx, and readLineStyle().

Referenced by readShape().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readMatrix()

glm::mat3x2 Aurora::GFXFile::readMatrix ( )
private

Read a matrix.

Definition at line 828 of file gfxfile.cpp.

References _gfx, Common::ScopedPtrBase< T, Deallocator >::get(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit(), read2ComplementValue(), and readNintendoFixedPoint().

Referenced by readFillStyle(), and readPlaceObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readNullTerminatedString()

Common::UString Aurora::GFXFile::readNullTerminatedString ( )
private

Read a null terminated string.

Definition at line 1120 of file gfxfile.cpp.

References _gfx, Common::kEncodingASCII, and Common::readString().

Referenced by load(), readDefineEditText(), readExportAssets(), readImportAssets(), and readPlaceObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPlaceObject()

GFXControl Aurora::GFXFile::readPlaceObject ( byte  version = 1)
private

◆ readRecordHeader()

GFXFile::RecordHeader Aurora::GFXFile::readRecordHeader ( )
private

Read a record header for the next tag.

Definition at line 799 of file gfxfile.cpp.

References _gfx, Common::ScopedPtrBase< T, Deallocator >::get(), Aurora::GFXFile::RecordHeader::tagLength, and Aurora::GFXFile::RecordHeader::tagType.

Referenced by load(), and readDefineSprite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readRectangle()

Common::Rect Aurora::GFXFile::readRectangle ( )
private

Read a basic rectangle type from the gfx file.

Definition at line 813 of file gfxfile.cpp.

References _gfx, Common::ScopedPtrBase< T, Deallocator >::get(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBits(), Common::Rect::h, read2ComplementValue(), Common::Rect::w, Common::Rect::x, and Common::Rect::y.

Referenced by readDefineEditText(), readDefineFont(), readDefineShape(), and readHeader().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readRGB()

glm::u8vec3 Aurora::GFXFile::readRGB ( )
private

Read an RGB color record.

Definition at line 856 of file gfxfile.cpp.

References _gfx.

Referenced by readBackgroundColor(), readFillStyle(), readGradientRecord(), and readLineStyle().

Here is the caller graph for this function:

◆ readRGBA()

glm::u8vec4 Aurora::GFXFile::readRGBA ( )
private

Reag an RGBA color record.

Definition at line 864 of file gfxfile.cpp.

References _gfx.

Referenced by readDefineEditText(), readFillStyle(), readGradientRecord(), and readLineStyle().

Here is the caller graph for this function:

◆ readShape()

std::vector< GFXCharacter::ShapeRecord > Aurora::GFXFile::readShape ( byte  version,
bool  withStyle 
)
private

Member Data Documentation

◆ _characters

std::map<uint16, GFXCharacter> Aurora::GFXFile::_characters
private

Every character associated with it's character id.

Definition at line 378 of file gfxfile.h.

Referenced by getCharacter(), readDefineEditText(), readDefineFont(), readDefineShape(), readDefineSprite(), readGFXDefineExternalImage(), and readImportAssets().

◆ _controlTags

std::vector<GFXControl> Aurora::GFXFile::_controlTags
private

All root control tags.

Definition at line 380 of file gfxfile.h.

Referenced by getControls(), and load().

◆ _exportTable

std::map<Common::UString, uint16> Aurora::GFXFile::_exportTable
private

Every exported character id with the associated export name.

Definition at line 376 of file gfxfile.h.

Referenced by getExportedAssetId(), and readExportAssets().

◆ _frameCount

unsigned short Aurora::GFXFile::_frameCount
private

The count of frames in this gfx file.

Definition at line 390 of file gfxfile.h.

Referenced by readHeader().

◆ _frameRate

float Aurora::GFXFile::_frameRate
private

The frame rate, how fast this gui should be played.

Definition at line 388 of file gfxfile.h.

Referenced by getFrameRate(), and readHeader().

◆ _frameSize

Common::Rect Aurora::GFXFile::_frameSize
private

The standard bounds of the ui in this file.

Definition at line 386 of file gfxfile.h.

Referenced by readHeader().

◆ _gfx

Common::ScopedPtr<Common::SeekableReadStream> Aurora::GFXFile::_gfx
private

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