2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-17 07:21:43 +00:00

ObjLoading: Implement IPakEntryReadStream as a linear stream

This commit is contained in:
Jan
2020-02-09 09:51:57 +01:00
parent 7b3b527ece
commit 4baca81210
3 changed files with 121 additions and 110 deletions
@@ -7,8 +7,9 @@
class IPakEntryReadStream final : public FileAPI::IFile
{
static constexpr size_t IPAK_DECOMPRESS_BUFFER_SIZE = 0x8000;
uint8_t* m_chunk_buffer;
uint8_t* m_file_buffer;
IFile* m_file;
IPakStreamManagerActions* m_stream_manager_actions;
@@ -18,6 +19,13 @@ class IPakEntryReadStream final : public FileAPI::IFile
size_t m_entry_size;
uint8_t m_decompress_buffer[IPAK_DECOMPRESS_BUFFER_SIZE];
IPakDataBlockHeader* m_current_block;
unsigned m_next_command;
uint8_t* m_current_command_buffer;
size_t m_current_command_length;
size_t m_current_command_offset;
int64_t m_pos;
int64_t m_base_pos;
int64_t m_end_pos;
@@ -39,7 +47,8 @@ class IPakEntryReadStream final : public FileAPI::IFile
bool SetChunkBufferWindow(int64_t startPos, size_t chunkCount);
bool ValidateBlockHeader(IPakDataBlockHeader* blockHeader) const;
bool AdjustChunkBufferWindowForBlockHeader(IPakDataBlockHeader* blockHeader, size_t blockOffsetInChunk);
bool ProcessCommand(size_t commandSize, bool compressed);
bool NextBlock();
bool ProcessCommand(size_t commandSize, int compressed);
bool AdvanceStream();
public: