xoreos
0.0.5
|
Class for parsing gfx files. More...
#include <gfxfile.h>
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< GFXControl > | getControls () |
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::ASBuffer * | readAction () |
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::FillStyle > | readFillStyleArray (byte version) |
Read an fillstyle array. More... | |
GFXCharacter::FillStyle | readFillStyle (byte version) |
Read an FillStyle record. More... | |
std::vector< GFXCharacter::LineStyle > | readLineStyleArray (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::ShapeRecord > | readShape (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... | |
Class for parsing gfx files.
This class parses a gfx file and and extracts it's controls and characters to a usable state.
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.
resref | the resref of the gfx file |
avm | The AVM that should be used throughout the loading process |
Definition at line 198 of file gfxfile.cpp.
References Aurora::kFileTypeGFX, load(), and ResMan.
GFXCharacter Aurora::GFXFile::getCharacter | ( | uint16 | id | ) |
Get a character by id.
Definition at line 214 of file gfxfile.cpp.
References _characters.
Referenced by readImportAssets().
|
inline |
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.
|
inline |
Get the framerate for this gfx file.
Definition at line 358 of file gfxfile.h.
References _frameRate.
|
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().
|
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().
|
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().
|
private |
Read the background color tag.
Definition at line 341 of file gfxfile.cpp.
References readRGB().
Referenced by load().
|
private |
Read a color transform.
Definition at line 962 of file gfxfile.cpp.
References _gfx, Aurora::GFXControl::ColorTransform::addA, Aurora::GFXControl::ColorTransform::addB, Aurora::GFXControl::ColorTransform::addG, Aurora::GFXControl::ColorTransform::addR, Aurora::GFXControl::ColorTransform::addTransform, Common::ScopedPtrBase< T, Deallocator >::get(), Aurora::GFXControl::ColorTransform::mulA, Aurora::GFXControl::ColorTransform::mulB, Aurora::GFXControl::ColorTransform::mulG, Aurora::GFXControl::ColorTransform::mulR, and Aurora::GFXControl::ColorTransform::mulTransform.
Referenced by readPlaceObject().
|
private |
Read an edit text character.
Definition at line 640 of file gfxfile.cpp.
References _characters, _gfx, Aurora::GFXCharacter::EditTextLayout::alignment, Aurora::GFXCharacter::EditText::autosize, Aurora::GFXCharacter::EditText::bounds, Aurora::GFXCharacter::createEditText(), Aurora::GFXCharacter::EditText::fontHeight, Aurora::GFXCharacter::EditText::fontId, Common::ScopedPtrBase< T, Deallocator >::get(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit(), Aurora::GFXCharacter::EditText::html, Aurora::GFXCharacter::EditTextLayout::indent, Aurora::GFXCharacter::EditText::initialText, Aurora::GFXCharacter::EditText::layout, Aurora::GFXCharacter::EditTextLayout::leading, Aurora::GFXCharacter::EditTextLayout::leftMargin, Aurora::GFXCharacter::EditText::maxLength, Aurora::GFXCharacter::EditText::multiLine, Aurora::GFXCharacter::EditText::noSelect, Aurora::GFXCharacter::EditText::password, readNullTerminatedString(), Aurora::GFXCharacter::EditText::readOnly, readRectangle(), readRGBA(), Aurora::GFXCharacter::EditTextLayout::rightMargin, Aurora::GFXCharacter::EditText::textColor, warning(), and Aurora::GFXCharacter::EditText::wordWrap.
Referenced by load().
|
private |
Read a font definition version 3.
Definition at line 523 of file gfxfile.cpp.
References _characters, _gfx, Aurora::GFXCharacter::Glyph::bounds, Aurora::GFXCharacter::Glyph::code, Aurora::GFXCharacter::createFont(), Aurora::GFXCharacter::Font::fontAscent, Aurora::GFXCharacter::Font::fontDescent, Aurora::GFXCharacter::Font::fontLeading, Common::ScopedPtrBase< T, Deallocator >::get(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit(), Aurora::GFXCharacter::Font::glyphs, Aurora::GFXCharacter::Font::kerningCodes, Aurora::GFXCharacter::Font::name, readLengthPrefixedString(), readRectangle(), readShape(), Aurora::GFXCharacter::Glyph::shapeRecords, and warning().
Referenced by load().
|
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().
|
private |
Read a define sprite tag.
Definition at line 401 of file gfxfile.cpp.
References _characters, _gfx, Aurora::GFXControl::DoAction::asBuffer, Aurora::GFXCharacter::Sprite::controls, Aurora::GFXControl::createDoAction(), Aurora::GFXControl::createShowFrame(), Aurora::GFXCharacter::createSprite(), Aurora::GFXCharacter::Sprite::frameCount, Aurora::kTagTypeDoAction, Aurora::kTagTypeDoInitAction, Aurora::kTagTypeEnd, Aurora::kTagTypeFrameLabel, Aurora::kTagTypePlaceObject, Aurora::kTagTypePlaceObject2, Aurora::kTagTypePlaceObject3, Aurora::kTagTypeRemoveObject, Aurora::kTagTypeRemoveObject2, Aurora::kTagTypeShowFrame, Aurora::kTagTypeSoundStreamBlock, Aurora::kTagTypeSoundStreamHead, Aurora::kTagTypeSoundStreamHead2, Aurora::kTagTypeStartSound, readAction(), readPlaceObject(), readRecordHeader(), Aurora::GFXFile::RecordHeader::tagLength, Aurora::GFXFile::RecordHeader::tagType, and warning().
Referenced by load().
|
private |
Read an export assets tag.
Definition at line 345 of file gfxfile.cpp.
References _exportTable, _gfx, and readNullTerminatedString().
Referenced by load().
|
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().
|
private |
Read an FillStyle record.
Definition at line 886 of file gfxfile.cpp.
References _gfx, Aurora::GFXCharacter::Fill::color, Common::ScopedPtrBase< T, Deallocator >::get(), Aurora::GFXCharacter::Bitmap::id, Aurora::GFXCharacter::Gradient::interpolationMode, Aurora::GFXCharacter::Gradient::matrix, Aurora::GFXCharacter::Bitmap::matrix, readGradientRecord(), readMatrix(), readRGB(), readRGBA(), Aurora::GFXCharacter::Gradient::records, Aurora::GFXCharacter::Gradient::spreadMode, Aurora::GFXCharacter::FillStyle::type, and Aurora::GFXCharacter::FillStyle::value.
Referenced by readFillStyleArray().
|
private |
Read an fillstyle array.
Definition at line 873 of file gfxfile.cpp.
References _gfx, and readFillStyle().
Referenced by readShape().
|
private |
Read a focal gradient record.
Definition at line 989 of file gfxfile.cpp.
|
private |
Load an external image reference.
Definition at line 771 of file gfxfile.cpp.
References _characters, _gfx, Aurora::GFXCharacter::ExternalImage::bitmapFormat, Aurora::GFXCharacter::createExternalImage(), Aurora::GFXCharacter::ExternalImage::height, Aurora::GFXCharacter::ExternalImage::name, readLengthPrefixedString(), Aurora::GFXFile::RecordHeader::tagLength, and Aurora::GFXCharacter::ExternalImage::width.
Referenced by load().
|
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().
|
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().
|
private |
Load all header information.
Definition at line 322 of file gfxfile.cpp.
References _frameCount, _frameRate, _frameSize, _gfx, and readRectangle().
Referenced by load().
|
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().
|
private |
Read a DoInitAction tag.
Definition at line 716 of file gfxfile.cpp.
References _gfx, readAction(), warning(), and Common::StackException::what().
Referenced by load().
|
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().
|
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().
|
private |
Read a line style array.
Definition at line 937 of file gfxfile.cpp.
References _gfx, and readLineStyle().
Referenced by readShape().
|
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().
|
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().
|
private |
Read a place object tag.
Definition at line 457 of file gfxfile.cpp.
References _gfx, Aurora::GFXControl::PlaceObject::blendMode, Aurora::GFXControl::PlaceObject::characterId, Aurora::GFXControl::PlaceObject::colorTransform, Aurora::GFXControl::createPlaceObject(), Aurora::GFXControl::PlaceObject::depth, Common::ScopedPtrBase< T, Deallocator >::get(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit(), Aurora::GFXControl::PlaceObject::hasMove, Aurora::GFXControl::PlaceObject::matrix, Aurora::GFXControl::PlaceObject::name, readColorTransform(), readMatrix(), and readNullTerminatedString().
Referenced by load(), and readDefineSprite().
|
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().
|
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().
|
private |
Read an RGB color record.
Definition at line 856 of file gfxfile.cpp.
References _gfx.
Referenced by readBackgroundColor(), readFillStyle(), readGradientRecord(), and readLineStyle().
|
private |
Reag an RGBA color record.
Definition at line 864 of file gfxfile.cpp.
References _gfx.
Referenced by readDefineEditText(), readFillStyle(), readGradientRecord(), and readLineStyle().
|
private |
Read a shape.
Definition at line 1004 of file gfxfile.cpp.
References _gfx, Aurora::GFXCharacter::ShapeRecord::anchorDeltaX, Aurora::GFXCharacter::ShapeRecord::anchorDeltaY, Aurora::GFXCharacter::ShapeRecord::controlDeltaX, Aurora::GFXCharacter::ShapeRecord::controlDeltaY, Aurora::GFXCharacter::ShapeRecord::curvedEdge, Aurora::GFXCharacter::ShapeRecord::deltaX, Aurora::GFXCharacter::ShapeRecord::deltaY, Aurora::GFXCharacter::ShapeRecord::fillStyle0, Aurora::GFXCharacter::ShapeRecord::fillStyle1, Common::ScopedPtrBase< T, Deallocator >::get(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBits(), Aurora::GFXCharacter::ShapeRecord::lineStyle, Aurora::GFXCharacter::ShapeRecord::move, read2ComplementValue(), readFillStyleArray(), readLineStyleArray(), Aurora::GFXCharacter::ShapeRecord::straightEdge, and Aurora::GFXCharacter::ShapeRecord::style.
Referenced by readDefineFont(), and readDefineShape().
|
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().
|
private |
All root control tags.
Definition at line 380 of file gfxfile.h.
Referenced by getControls(), and load().
|
private |
Every exported character id with the associated export name.
Definition at line 376 of file gfxfile.h.
Referenced by getExportedAssetId(), and readExportAssets().
|
private |
The count of frames in this gfx file.
Definition at line 390 of file gfxfile.h.
Referenced by readHeader().
|
private |
The frame rate, how fast this gui should be played.
Definition at line 388 of file gfxfile.h.
Referenced by getFrameRate(), and readHeader().
|
private |
The standard bounds of the ui in this file.
Definition at line 386 of file gfxfile.h.
Referenced by readHeader().
|
private |
The read stream of this gfx file.
Definition at line 383 of file gfxfile.h.
Referenced by load(), readAction(), readColorTransform(), readDefineEditText(), readDefineFont(), readDefineShape(), readDefineSprite(), readExportAssets(), readFileAttributes(), readFillStyle(), readFillStyleArray(), readGFXDefineExternalImage(), readGFXExporterInfo(), readGradientRecord(), readHeader(), readImportAssets(), readInitAction(), readLengthPrefixedString(), readLineStyle(), readLineStyleArray(), readMatrix(), readNullTerminatedString(), readPlaceObject(), readRecordHeader(), readRectangle(), readRGB(), readRGBA(), and readShape().