13#ifndef __TOSHI_TTRB_H__
14# define __TOSHI_TTRB_H__
92 template <
class T>
void Read( T* a_pDst ) { m_ReadPos +=
m_pFile->Read( a_pDst,
sizeof( T ) ); }
93 template <
class T>
void Read( T* a_pDst,
TUINT a_uiCount ) { m_ReadPos +=
m_pFile->Read( a_pDst, a_uiCount *
sizeof( T ) ); }
109 FileInfo m_FileInfo[ 32 ];
136 : m_PositionCount( 0 ), m_Positions() {}
147 static TCHAR s_AlignBuffer[ 4 ] = { 0, 0, 0, 0 };
150 if ( alignValue != 4 )
152 return m_pFile->Write( s_AlignBuffer, alignValue );
219 return m_pFile->Write( &value,
sizeof( T ) );
225 return m_pFile->Write( buffer, size );
333 template <
typename T>
365 static void* s_pDefAllocatorUserData;
Core file system interface for the Toshi engine.
Quaternion implementation for the Toshi engine.
3D vector implementation for the Toshi engine
#define TSTATICCAST(POINTERTYPE, VALUE)
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
TFORCEINLINE constexpr TUINT32 TFourCC(const TCHAR str[4])
static size_t Compress(TFile *file, TBYTE *data, TUINT32 size, TUINT32 unused, TBOOL isBigEndian)
Endianess GetEndianess() const
static constexpr TUINT32 IDMAGICL
static constexpr TUINT32 IDMAGICB
TUINT32 Open(TFile *a_pFile)
void ReadCompressed(void *buffer, TUINT32 size)
void CompressSection(TFile *file, TBYTE *data, TUINT32 unk2, TUINT32 unk3)
const Hunk & GetCurrentHunk() const
void Close(TBOOL free=true)
void ReadRaw(void *dst, TUINT32 size)
void Read(T *a_pDst, TUINT a_uiCount)
TUINT32 ReadAlignmentPad()
TUINT8 ReadHunkData(void *dest)
TUINT8 ReadFORM(TFORM *section)
void WriteInt32(TINT32 value)
void WriteUInt32(TUINT32 value)
void Close()
Closes the file.
void WriteUInt16(TUINT16 value)
void WriteVector4(TVector4 &value)
TSIZE BeginForm(const TCHAR *name)
Begin a new form and saves it's info.
void WriteQuaternion(TQuaternion &value)
TUINT32 WriteAlignmentPad()
Aligns current position to 4.
void WriteBool(TBOOL value)
TTSFO::ERROR Create(const TCHAR *filepath, const TCHAR *magic="TRBF", Endianess endianess=Endianess_Little)
Creates file for writing.
TBOOL CloseHunk(HunkMark *hunkMark)
Closes the hunk.
void WriteFloat(float value)
void WriteInt8(int8_t value)
TSIZE EndForm()
Ends the current form if it exists.
void WriteUInt8(TUINT8 value)
TBOOL OpenHunk(HunkMark *hunkMark, const TCHAR *hunkName)
Opens new hunk.
TUINT32 Write(const T &value)
TUINT32 WriteRaw(const void *buffer, TSIZE size)
void WriteVector3(TVector3 &value)
TUINT32 WriteCompressed(const void *buffer, TSIZE size)
TUINT32 WriteHunk(TUINT32 hunkName, void *buffer=nullptr, TSIZE bufferSize=0)
Writes a hunk of data.
void(*)(AllocType alloctype, void *ptr, TINT16 unk1, TUINT32 unk2, void *userData) t_MemoryFuncDealloc
static TINT16 HashString(const TCHAR *str)
TINT32 GetNumSymbols() const
SYMB * GetSymbolTable() const
SecInfo * GetSectionInfoList() const
static TUINT32 GetHeaderSize(TUINT32 count)
void * GetSymbolAddress(TTRBSymbol &symb)
TTRBSymbol * GetSymbol(TINT index) const
static TUINT32 GetSymbolTableSize(TUINT32 count)
T * CastSymbol(const TCHAR *symbName)
ERROR Load(const TCHAR *a_szFilePath, TUINT32 a_uiUnknown=0)
void * GetSymbolAddress(const TCHAR *symbName)
SecInfo * GetSectionInfo(TINT index) const
const TCHAR * GetSymbolName(TINT index) const
void SetMemoryFunctions(t_MemoryFuncAlloc allocator, t_MemoryFuncDealloc deallocator, void *userdata)
@ ERROR_NO_FILEINFO_ON_STACK
TINT GetSymbolIndex(const TCHAR *symbName)
void *(*)(AllocType alloctype, TUINT32 size, TINT16 unk1, TUINT32 unk2, void *userData) t_MemoryFuncAlloc