Play-/Source/CsoImageStream.h

37 lines
959 B
C
Raw Normal View History

2015-04-11 19:16:11 +00:00
#pragma once
#include "Types.h"
#include "Stream.h"
class CCsoImageStream : public Framework::CStream
{
public:
2018-04-30 20:01:23 +00:00
CCsoImageStream(Framework::CStream* baseStream);
virtual ~CCsoImageStream();
2015-04-11 19:16:11 +00:00
2018-04-30 20:01:23 +00:00
virtual void Seek(int64 pos, Framework::STREAM_SEEK_DIRECTION whence) override;
virtual uint64 Tell() override;
virtual bool IsEOF() override;
virtual uint64 Read(void* dest, uint64 bytes) override;
virtual uint64 Write(const void* src, uint64 bytes) override;
2015-04-11 19:16:11 +00:00
private:
2018-04-30 20:01:23 +00:00
void ReadFileHeader();
void InitializeBuffers();
uint64 GetTotalSize() const;
uint32 ReadFromNextFrame(uint8* dest, uint64 maxBytes);
uint64 ReadBaseAt(uint64 pos, uint8* dest, uint64 bytes);
void DecompressFrame(uint32 frame, uint64 readBufferSize);
2015-04-11 19:16:11 +00:00
2018-04-30 20:01:23 +00:00
Framework::CStream* m_baseStream;
uint32 m_frameSize;
uint8 m_frameShift;
uint8 m_indexShift;
uint8* m_readBuffer;
uint8* m_zlibBuffer;
uint32 m_zlibBufferFrame;
uint32* m_index;
uint64 m_totalSize;
uint64 m_position;
2015-04-11 19:16:11 +00:00
};