2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-06-26 22:31:50 +00:00

Write XChunks in fastfiles

This commit is contained in:
Jan
2021-03-17 22:25:47 +01:00
parent f22012d282
commit 724e221ba4
13 changed files with 151 additions and 32 deletions

View File

@ -1,26 +1,45 @@
#pragma once
#include <memory>
#include <vector>
#include <cstdint>
#include <cstddef>
#include "Writing/OutputStreamProcessor.h"
#include "Zone/XChunk/IXChunkProcessor.h"
class OutputProcessorXChunks final : public OutputStreamProcessor
{
class Impl;
Impl* m_impl;
std::vector<std::unique_ptr<IXChunkProcessor>> m_chunk_processors;
int m_stream_count;
size_t m_chunk_size;
size_t m_vanilla_buffer_size;
bool m_initialized;
int m_current_stream;
size_t m_vanilla_buffer_offset;
std::vector<std::unique_ptr<uint8_t[]>> m_buffers;
uint8_t* m_input_buffer;
uint8_t* m_output_buffer;
size_t m_input_size;
void Init();
void WriteChunk();
public:
OutputProcessorXChunks(int numStreams, size_t xChunkSize);
OutputProcessorXChunks(int numStreams, size_t xChunkSize, size_t vanillaBufferSize);
~OutputProcessorXChunks() override;
~OutputProcessorXChunks() override = default;
OutputProcessorXChunks(const OutputProcessorXChunks& other) = delete;
OutputProcessorXChunks(OutputProcessorXChunks&& other) noexcept;
OutputProcessorXChunks(OutputProcessorXChunks&& other) noexcept = default;
OutputProcessorXChunks& operator=(const OutputProcessorXChunks& other) = delete;
OutputProcessorXChunks& operator=(OutputProcessorXChunks&& other) noexcept;
OutputProcessorXChunks& operator=(OutputProcessorXChunks&& other) noexcept = default;
void AddChunkProcessor(std::unique_ptr<IXChunkProcessor> chunkProcessor) const;
void AddChunkProcessor(std::unique_ptr<IXChunkProcessor> chunkProcessor);
void Write(const void* buffer, size_t length) override;
void Flush() override;
int64_t Pos() override;
};