struct IChunkFile : public _reference_target_t { struct ChunkDesc { ChunkTypes chunkType; int chunkVersion; int chunkId; uint32 fileOffset; void* data; uint32 size; bool bSwapEndian; }; };
IChunkFile.h
Chunked File (.cgf, .chr etc.) interface
struct ChunkDesc { ChunkTypes chunkType; int chunkVersion; int chunkId; uint32 fileOffset; void* data; uint32 size; bool bSwapEndian; };
IChunkFile.h
Chunk Description.
bool bSwapEndian;
int chunkId;
ChunkTypes chunkType;
int chunkVersion;
void* data;
uint32 fileOffset;
uint32 size;
ChunkDesc();
void GetMemoryUsage(ICrySizer * pSizer) const;
virtual int AddChunk(ChunkTypes chunkType, int chunkVersion, EEndianness eEndianness, const void* chunkData, int chunkSize) = 0;
Adds chunk to file, returns ChunkID of the added chunk.
virtual void DeleteChunkById(int nChunkId) = 0;
virtual void DeleteChunksByType(ChunkTypes nChunkType) = 0;
virtual ChunkDesc* FindChunkById(int nChunkId) = 0;
virtual ChunkDesc* FindChunkByType(ChunkTypes nChunkType) = 0;
virtual ChunkDesc* GetChunk(int nIndex) = 0;
Gets chunk description at i-th index.
virtual const ChunkDesc* GetChunk(int nIndex) const = 0;
virtual const char* GetLastError() const = 0;
virtual void GetMemoryUsage(ICrySizer * pSizer) const = 0;
virtual bool IsLoaded() const = 0;
virtual bool IsReadOnly() const = 0;
virtual int NumChunks() const = 0;
Gets the number of chunks.
virtual bool Read(const char * filename) = 0;
virtual bool ReadFromMemory(const void * pData, int nDataSize) = 0;
virtual void Release() = 0;
Releases chunk file interface.
virtual void ReleaseMemoryBuffer() = 0;
Releases memory that was allocated in WriteToMemoryBuffer()
virtual bool Write(const char * filename) = 0;
Writes chunks to file.
virtual bool WriteToMemoryBuffer(void ** pData, int * nSize) = 0;
Writes chunks to a memory buffer (allocated inside) and returns pointer to the allocated memory (pData) and its size (nSize). The memory will be released on destruction of the ChunkFile object, or on the next WriteToMemoryBuffer() call, or on ReleaseMemoryBuffer() call.