60 Entries::iterator e =
_entries.find(strRef);
66 return e->second->text;
95 e.
add(
"Unable to load GFF TLK");
106 for (GFF4List::const_iterator s = strings.begin(); s != strings.end(); ++s) {
111 if (strRef == 0xFFFFFFFF)
116 std::pair<Entries::iterator, bool> result =
_entries.insert(std::make_pair(strRef, entry.
get()));
130 for (GFF4List::const_iterator s = strings.begin(); s != strings.end(); ++s) {
135 if (strRef == 0xFFFFFFFF)
140 std::pair<Entries::iterator, bool> result =
_entries.insert(std::make_pair(strRef, entry.
get()));
164 entry.
text =
"[???]";
172 if (!huffTree || !bitStream)
193 std::vector<uint16> utf16Str;
197 uint32 index = startOffset >> 5;
198 uint32 shift = startOffset & 0x1F;
201 ptrdiff_t e = (huffTree.
size() / 8) - 1;
204 bitStream.
seek(index * 4);
205 const ptrdiff_t offset = (bitStream.
readUint32() >> shift) & 1;
207 huffTree.
seek(((e * 2) + offset) * 4);
211 index += (shift >> 5);
216 utf16Str.push_back(TO_LE_16(0xFFFF - e));
218 }
while (utf16Str.back() != 0);
220 const byte *data =
reinterpret_cast<const byte *
>(&utf16Str[0]);
221 const size_t size = utf16Str.size() * 2;
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
void readString05(Entry &entry, bool bigEndian) const
void add(const char *s,...) GCC_PRINTF(2
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.
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
Base class for BioWare's talk tables.
uint32 getSoundID(uint32 strRef) const
UTF-16 LE (little endian).
TalkTable_GFF(Common::SeekableReadStream *tlk, Common::Encoding encoding)
Take over this stream and read a GFF'd TLK out of it.
static const uint32 kVersion05
A GFF (generic file format) V4.0/V4.1 file, found in Dragon Age: Origins, Dragon Age 2 and Sonic Chro...
static const uint32 kTLKID
Exception that provides a stack of explanations.
size_t size() const
Obtains the total size of the stream, measured in bytes.
std::vector< const GFF4Struct * > GFF4List
Handling version V4.0/V4.1 of BioWare's GFFs (generic file format).
Basic exceptions to throw.
static const uint32 kVersion02
size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)
Sets the stream position indicator for the stream.
void load(Common::SeekableReadStream *tlk)
Utility templates and functions.
Common::Encoding _encoding
bool hasField(uint32 field) const
Does this specific field exist?
const Common::UString & getString(uint32 strRef) const
A scoped plain pointer, allowing pointer-y access and normal deletion.
void load02(const GFF4Struct &top)
Basic reading stream interfaces.
static const uint32 kVersion04
Common::ScopedPtr< GFF4File > _gff
PointerType get() const
Returns the plain pointer value.
void readString(Entry &entry) const
const Common::UString & getSoundResRef(uint32 strRef) const
static const uint32 kFieldIDInvalid
bool hasEntry(uint32 strRef) const
UString readString(SeekableReadStream &stream, Encoding encoding)
Read a string with the given encoding of a stream.
const GFF4List & getList(uint32 field) const
static const Common::UString kEmptyString
void load05(const GFF4Struct &top)
uint64 getUint(uint32 field, uint64 def=0) const
void readString02(Entry &entry) const
Interface for a seekable & readable data stream.
Handling BioWare's GFF'd talk tables.