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

Loading BioWare's TLK talk tables. More...

#include <talktable_tlk.h>

Inheritance diagram for Aurora::TalkTable_TLK:
Inheritance graph
[legend]
Collaboration diagram for Aurora::TalkTable_TLK:
Collaboration graph
[legend]

Classes

struct  Entry
 A talk resource entry. More...
 

Public Member Functions

 TalkTable_TLK (Common::SeekableReadStream *tlk, Common::Encoding encoding)
 Take over this stream and read a TLK out of it. More...
 
 ~TalkTable_TLK ()
 
uint32 getLanguageID () const
 Return the language ID (ungendered) of the talk table. More...
 
bool hasEntry (uint32 strRef) const
 
const Common::UStringgetString (uint32 strRef) const
 
const Common::UStringgetSoundResRef (uint32 strRef) const
 
uint32 getSoundID (uint32 strRef) const
 
- Public Member Functions inherited from Aurora::AuroraFile
 AuroraFile ()
 
void clear ()
 
uint32 getID () const
 Return the file's ID. More...
 
uint32 getVersion () const
 Return the file's version. More...
 
bool isUTF16LE () const
 Were the ID and version encoded in little-endian UTF-16 in the file? More...
 
- Public Member Functions inherited from Aurora::TalkTable
virtual ~TalkTable ()
 

Static Public Member Functions

static uint32 getLanguageID (Common::SeekableReadStream &tlk)
 
static uint32 getLanguageID (const Common::UString &file)
 
- Static Public Member Functions inherited from Aurora::AuroraFile
static void readHeader (Common::ReadStream &stream, uint32 &id, uint32 &version, bool &utf16le)
 Read the header out of a stream. More...
 
static void readHeader (Common::ReadStream &stream, uint32 &id, uint32 &version)
 Read the ID and version out of a stream. More...
 
static uint32 readHeaderID (Common::ReadStream &stream)
 Read the ID out of a stream. More...
 
- Static Public Member Functions inherited from Aurora::TalkTable
static TalkTableload (Common::SeekableReadStream *tlk, Common::Encoding encoding)
 Take over this stream and read a talk table (of either format) out of it. More...
 

Private Types

enum  EntryFlags { kFlagTextPresent = (1 << 0), kFlagSoundPresent = (1 << 1), kFlagSoundLengthPresent = (1 << 2) }
 The entries' flags. More...
 
typedef std::vector< EntryEntries
 

Private Member Functions

void load ()
 
void readEntryTableV3 (uint32 stringsOffset)
 
void readEntryTableV4 ()
 
void readString (Entry &entry) const
 

Private Attributes

Common::ScopedPtr< Common::SeekableReadStream_tlk
 
uint32 _languageID
 
Entries _entries
 

Additional Inherited Members

- Protected Member Functions inherited from Aurora::AuroraFile
void readHeader (Common::ReadStream &stream)
 
- Protected Member Functions inherited from Aurora::TalkTable
 TalkTable (Common::Encoding encoding)
 
- Static Protected Member Functions inherited from Aurora::AuroraFile
static uint32 convertUTF16LE (uint32 x1, uint32 x2)
 
- Protected Attributes inherited from Aurora::AuroraFile
uint32 _id
 The file's ID. More...
 
uint32 _version
 The file's version. More...
 
bool _utf16le
 The file's ID and version are in little-endian UTF-16. More...
 
- Protected Attributes inherited from Aurora::TalkTable
Common::Encoding _encoding
 

Detailed Description

Loading BioWare's TLK talk tables.

See class TalkTable for a general overview how talk tables work.

Unlike TalkTable_GFF, a TLK talk table is its own simple binary format. It has a numerical, game-local ID of the language it contains, and stores a few more optional data points per string, like a reference to a voice-over file.

There are two versions of TLK files known and supported

Definition at line 53 of file talktable_tlk.h.

Member Typedef Documentation

◆ Entries

typedef std::vector<Entry> Aurora::TalkTable_TLK::Entries
private

Definition at line 98 of file talktable_tlk.h.

Member Enumeration Documentation

◆ EntryFlags

The entries' flags.

Enumerator
kFlagTextPresent 
kFlagSoundPresent 
kFlagSoundLengthPresent 

Definition at line 75 of file talktable_tlk.h.

Constructor & Destructor Documentation

◆ TalkTable_TLK()

Aurora::TalkTable_TLK::TalkTable_TLK ( Common::SeekableReadStream tlk,
Common::Encoding  encoding 
)

Take over this stream and read a TLK out of it.

Definition at line 46 of file talktable_tlk.cpp.

References _tlk, and load().

Here is the call graph for this function:

◆ ~TalkTable_TLK()

Aurora::TalkTable_TLK::~TalkTable_TLK ( )

Definition at line 54 of file talktable_tlk.cpp.

Member Function Documentation

◆ getLanguageID() [1/3]

uint32 Aurora::TalkTable_TLK::getLanguageID ( ) const

Return the language ID (ungendered) of the talk table.

Definition at line 138 of file talktable_tlk.cpp.

References _languageID.

Referenced by Engines::KotOR2::KotOR2Engine::detectLanguages(), Engines::KotOR::KotOREngine::detectLanguages(), Engines::NWN2::NWN2Engine::detectLanguages(), Engines::NWN::NWNEngine::detectLanguages(), getLanguageID(), and Engines::Jade::getTLKLanguage().

Here is the caller graph for this function:

◆ getLanguageID() [2/3]

uint32 Aurora::TalkTable_TLK::getLanguageID ( Common::SeekableReadStream tlk)
static

Definition at line 170 of file talktable_tlk.cpp.

References Aurora::kLanguageInvalid, kTLKID, kVersion3, kVersion4, Aurora::AuroraFile::readHeader(), and Common::ReadStream::readUint32LE().

Here is the call graph for this function:

◆ getLanguageID() [3/3]

uint32 Aurora::TalkTable_TLK::getLanguageID ( const Common::UString file)
static

Definition at line 182 of file talktable_tlk.cpp.

References getLanguageID(), Aurora::kLanguageInvalid, and Common::ReadFile::open().

Here is the call graph for this function:

◆ getSoundID()

uint32 Aurora::TalkTable_TLK::getSoundID ( uint32  strRef) const
virtual

Implements Aurora::TalkTable.

Definition at line 163 of file talktable_tlk.cpp.

References _entries, and Aurora::kFieldIDInvalid.

◆ getSoundResRef()

const Common::UString & Aurora::TalkTable_TLK::getSoundResRef ( uint32  strRef) const
virtual

Implements Aurora::TalkTable.

Definition at line 156 of file talktable_tlk.cpp.

References _entries, and Aurora::kEmptyString.

◆ getString()

const Common::UString & Aurora::TalkTable_TLK::getString ( uint32  strRef) const
virtual

Implements Aurora::TalkTable.

Definition at line 147 of file talktable_tlk.cpp.

References _entries, Aurora::kEmptyString, and readString().

Here is the call graph for this function:

◆ hasEntry()

bool Aurora::TalkTable_TLK::hasEntry ( uint32  strRef) const
virtual

Implements Aurora::TalkTable.

Definition at line 142 of file talktable_tlk.cpp.

References _entries.

◆ load()

void Aurora::TalkTable_TLK::load ( )
private

Definition at line 57 of file talktable_tlk.cpp.

References _entries, Aurora::AuroraFile::_id, _languageID, _tlk, Aurora::AuroraFile::_version, Common::StackException::add(), Common::debugTag(), kTLKID, kVersion3, kVersion4, readEntryTableV3(), readEntryTableV4(), and Aurora::AuroraFile::readHeader().

Referenced by TalkTable_TLK().

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

◆ readEntryTableV3()

void Aurora::TalkTable_TLK::readEntryTableV3 ( uint32  stringsOffset)
private

Definition at line 94 of file talktable_tlk.cpp.

References _entries, _tlk, Common::kEncodingASCII, Aurora::kFieldIDInvalid, and Common::readStringFixed().

Referenced by load().

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

◆ readEntryTableV4()

void Aurora::TalkTable_TLK::readEntryTableV4 ( )
private

Definition at line 107 of file talktable_tlk.cpp.

References _entries, _tlk, and kFlagTextPresent.

Referenced by load().

Here is the caller graph for this function:

◆ readString()

void Aurora::TalkTable_TLK::readString ( Entry entry) const
private

Member Data Documentation

◆ _entries

Entries Aurora::TalkTable_TLK::_entries
mutableprivate

◆ _languageID

uint32 Aurora::TalkTable_TLK::_languageID
private

Definition at line 103 of file talktable_tlk.h.

Referenced by getLanguageID(), and load().

◆ _tlk

Common::ScopedPtr<Common::SeekableReadStream> Aurora::TalkTable_TLK::_tlk
private

Definition at line 101 of file talktable_tlk.h.

Referenced by load(), readEntryTableV3(), readEntryTableV4(), readString(), and TalkTable_TLK().


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