2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-13 20:21:48 +00:00

refactor: combined ZoneOutputStream interface with impl

This commit is contained in:
Jan Laupetin
2026-01-06 13:29:32 +00:00
parent a2ebf21c0f
commit df07ebe083
29 changed files with 354 additions and 310 deletions

View File

@@ -146,7 +146,7 @@ void ContentWriter::WriteXAssetArray(const bool atStreamStart, const size_t coun
}
}
void ContentWriter::WriteContent(IZoneOutputStream& stream)
void ContentWriter::WriteContent(ZoneOutputStream& stream)
{
m_stream = &stream;

View File

@@ -1,4 +1,5 @@
#pragma once
#include "Game/IW3/IW3.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
@@ -10,7 +11,7 @@ namespace IW3
public:
explicit ContentWriter(const Zone& zone);
void WriteContent(IZoneOutputStream& stream) override;
void WriteContent(ZoneOutputStream& stream) override;
private:
void CreateXAssetList(XAssetList& xAssetList, MemoryManager& memory) const;

View File

@@ -52,7 +52,7 @@ std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(const Zone& zone) co
SetupBlocks(*writer);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(zone), zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
std::make_unique<ContentWriter>(zone), zone, 32u, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
writer->AddWritingStep(std::move(contentInMemory));

View File

@@ -156,7 +156,7 @@ void ContentWriter::WriteXAssetArray(const bool atStreamStart, const size_t coun
}
}
void ContentWriter::WriteContent(IZoneOutputStream& stream)
void ContentWriter::WriteContent(ZoneOutputStream& stream)
{
m_stream = &stream;

View File

@@ -1,4 +1,5 @@
#pragma once
#include "Game/IW4/IW4.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
@@ -10,7 +11,7 @@ namespace IW4
public:
explicit ContentWriter(const Zone& zone);
void WriteContent(IZoneOutputStream& stream) override;
void WriteContent(ZoneOutputStream& stream) override;
private:
void CreateXAssetList(XAssetList& xAssetList, MemoryManager& memory) const;

View File

@@ -67,7 +67,7 @@ std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(const Zone& zone) co
SetupBlocks(*writer);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(zone), zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
std::make_unique<ContentWriter>(zone), zone, 32u, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
writer->AddWritingStep(std::move(contentInMemory));

View File

@@ -159,7 +159,7 @@ void ContentWriter::WriteXAssetArray(const bool atStreamStart, const size_t coun
}
}
void ContentWriter::WriteContent(IZoneOutputStream& stream)
void ContentWriter::WriteContent(ZoneOutputStream& stream)
{
m_stream = &stream;

View File

@@ -1,4 +1,5 @@
#pragma once
#include "Game/IW5/IW5.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
@@ -10,7 +11,7 @@ namespace IW5
public:
explicit ContentWriter(const Zone& zone);
void WriteContent(IZoneOutputStream& stream) override;
void WriteContent(ZoneOutputStream& stream) override;
private:
void CreateXAssetList(XAssetList& xAssetList, MemoryManager& memory) const;

View File

@@ -68,7 +68,7 @@ std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(const Zone& zone) co
SetupBlocks(*writer);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(zone), zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
std::make_unique<ContentWriter>(zone), zone, 32u, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
writer->AddWritingStep(std::move(contentInMemory));

View File

@@ -152,7 +152,7 @@ void ContentWriter::WriteXAssetArray(const bool atStreamStart, const size_t coun
}
}
void ContentWriter::WriteContent(IZoneOutputStream& stream)
void ContentWriter::WriteContent(ZoneOutputStream& stream)
{
m_stream = &stream;

View File

@@ -1,4 +1,5 @@
#pragma once
#include "Game/T5/T5.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
@@ -8,9 +9,9 @@ namespace T5
class ContentWriter final : public ContentWriterBase, public IContentWritingEntryPoint
{
public:
ContentWriter(const Zone& zone);
explicit ContentWriter(const Zone& zone);
void WriteContent(IZoneOutputStream& stream) override;
void WriteContent(ZoneOutputStream& stream) override;
private:
void CreateXAssetList(XAssetList& xAssetList, MemoryManager& memory) const;

View File

@@ -50,7 +50,7 @@ std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(const Zone& zone) co
SetupBlocks(*writer);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(zone), zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
std::make_unique<ContentWriter>(zone), zone, 32u, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
writer->AddWritingStep(std::move(contentInMemory));

View File

@@ -167,7 +167,7 @@ void ContentWriter::WriteXAssetArray(const bool atStreamStart, const size_t coun
}
}
void ContentWriter::WriteContent(IZoneOutputStream& stream)
void ContentWriter::WriteContent(ZoneOutputStream& stream)
{
m_stream = &stream;

View File

@@ -1,4 +1,5 @@
#pragma once
#include "Game/T6/T6.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
@@ -10,7 +11,7 @@ namespace T6
public:
explicit ContentWriter(const Zone& zone);
void WriteContent(IZoneOutputStream& stream) override;
void WriteContent(ZoneOutputStream& stream) override;
private:
void CreateXAssetList(XAssetList& xAssetList, MemoryManager& memory) const;

View File

@@ -106,7 +106,7 @@ std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(const Zone& zone) co
SetupBlocks(*writer);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(zone), zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
std::make_unique<ContentWriter>(zone), zone, 32u, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
writer->AddWritingStep(std::move(contentInMemory));
@@ -119,7 +119,6 @@ std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(const Zone& zone) co
AddXChunkProcessor(*writer, zone, isEncrypted, &dataToSignProvider, &xChunksProcessor);
// Start of the XFile struct
// m_writer->AddWritingStep(std::make_unique<StepSkipBytes>(8)); // Skip size and externalSize fields since they are not interesting for us
writer->AddWritingStep(std::make_unique<StepWriteZoneSizes>(contentInMemoryPtr));
writer->AddWritingStep(std::make_unique<StepWriteXBlockSizes>(zone));