21 if ( header->
Size > bufferSize )
24 TBYTE* pBufferPos = buffer;
27 while ( compressedLeft > 0 )
33 compressedLeft -=
GetCommand( file, noOffset, chunkSize, offset );
38 TBYTE* unpackedData = pBufferPos - offset;
40 while ( chunkSize > 0 )
42 *( pBufferPos++ ) = *( unpackedData++ );
49 TSIZE readedCount = file->
Read( pBufferPos, chunkSize );
50 pBufferPos += readedCount;
51 compressedLeft -= readedCount;
58 for (
TSIZE i = 0; i < header->
Size; i++, pBufferPos++ )
64 uintptr_t sizeDecompressed = pBufferPos - buffer;
65 TASSERT( sizeDecompressed == header->
Size,
"Wrong decompressed size" );
67 return sizeDecompressed;
75 TSIZE readedSize = file->
Read( &btecHeader, headerSize );
96 if ( readedSize != headerSize )
116 TINT read_count = file->
Read( &size, 1 );
128 read_count += file->
Read( &secondByte, 1 );
129 size = ( size << 8 ) | secondByte;
135 read_count += file->
Read( &offset, 1 );
143 read_count += file->
Read( &secondByte, 1 );
144 offset = ( offset << 8 ) | secondByte;
@ TCOMPRESS_ERROR_WRONG_MAGIC
@ TCOMPRESS_ERROR_WRONG_HEADERSIZE
@ TCOMPRESS_ERROR_WRONG_SIZE
@ TCOMPRESS_ERROR_WRONG_VERSION
@ BTECOffsetFlag_BigOffset
@ BTECOffsetFlag_OffsetMask
#define TOSHI_NAMESPACE_START
#define TVERSION(VER_MAJOR, VER_MINOR)
#define TOSHI_NAMESPACE_END
TFORCEINLINE constexpr TUINT32 TFourCC(const TCHAR str[4])
#define TPROFILER_SCOPE()
static TINT GetCommand(TFile *file, TBOOL &hasOffset, TUINT32 &size, TINT &offset)
static TBOOL ms_bIsBigEndian
static constexpr TUINT32 HEADER_SIZE_12
static uintptr_t Decompress(TFile *file, TCompress::Header *header, TBYTE *buffer, TUINT32 bufferSize)
static int8_t GetHeader(TFile *file, TCompress::Header &btecHeader)
virtual TBOOL Seek(TINT a_iOffset, TSEEK a_eOrigin=TSEEK_CUR)=0
Shifts current file cursor based on the specified offset and origin.
virtual TSIZE Read(void *a_pDst, TSIZE a_uiSize)=0
Reads specified number of bytes from the file into the buffer.