mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-05-07 13:04:58 +00:00
refactor: update ZoneLoading classes codestyle
This commit is contained in:
parent
446c38d8ee
commit
4ce82ad63c
@ -11,6 +11,10 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ContentLoaderBase() = default;
|
virtual ~ContentLoaderBase() = default;
|
||||||
|
ContentLoaderBase(const ContentLoaderBase& other) = default;
|
||||||
|
ContentLoaderBase(ContentLoaderBase&& other) noexcept = default;
|
||||||
|
ContentLoaderBase& operator=(const ContentLoaderBase& other) = delete;
|
||||||
|
ContentLoaderBase& operator=(ContentLoaderBase&& other) noexcept = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit ContentLoaderBase(Zone& zone);
|
explicit ContentLoaderBase(Zone& zone);
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
class IHashProvider
|
class IHashProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
IHashProvider() = default;
|
||||||
|
virtual ~IHashProvider() = default;
|
||||||
|
IHashProvider(const IHashProvider& other) = default;
|
||||||
|
IHashProvider(IHashProvider&& other) noexcept = default;
|
||||||
|
IHashProvider& operator=(const IHashProvider& other) = default;
|
||||||
|
IHashProvider& operator=(IHashProvider&& other) noexcept = default;
|
||||||
|
|
||||||
virtual void GetHash(unsigned hashIndex, const uint8_t** pHash, size_t* pSize) = 0;
|
virtual void GetHash(unsigned hashIndex, const uint8_t** pHash, size_t* pSize) = 0;
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,12 @@ class ZoneLoader;
|
|||||||
class ILoadingStep
|
class ILoadingStep
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ILoadingStep() = default;
|
||||||
virtual ~ILoadingStep() = default;
|
virtual ~ILoadingStep() = default;
|
||||||
|
ILoadingStep(const ILoadingStep& other) = default;
|
||||||
|
ILoadingStep(ILoadingStep&& other) noexcept = default;
|
||||||
|
ILoadingStep& operator=(const ILoadingStep& other) = default;
|
||||||
|
ILoadingStep& operator=(ILoadingStep&& other) noexcept = default;
|
||||||
|
|
||||||
virtual void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) = 0;
|
virtual void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) = 0;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
class ILoadingStream
|
class ILoadingStream
|
||||||
|
@ -4,5 +4,12 @@
|
|||||||
class ISignatureProvider
|
class ISignatureProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ISignatureProvider() = default;
|
||||||
|
virtual ~ISignatureProvider() = default;
|
||||||
|
ISignatureProvider(const ISignatureProvider& other) = default;
|
||||||
|
ISignatureProvider(ISignatureProvider&& other) noexcept = default;
|
||||||
|
ISignatureProvider& operator=(const ISignatureProvider& other) = default;
|
||||||
|
ISignatureProvider& operator=(ISignatureProvider&& other) noexcept = default;
|
||||||
|
|
||||||
virtual void GetSignature(const uint8_t** pSignature, size_t* pSize) = 0;
|
virtual void GetSignature(const uint8_t** pSignature, size_t* pSize) = 0;
|
||||||
};
|
};
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ILoadingStream.h"
|
#include "ILoadingStream.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
|
||||||
class LoadingFileStream final : public ILoadingStream
|
class LoadingFileStream final : public ILoadingStream
|
||||||
{
|
{
|
||||||
std::istream& m_stream;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LoadingFileStream(std::istream& stream);
|
explicit LoadingFileStream(std::istream& stream);
|
||||||
|
|
||||||
size_t Load(void* buffer, size_t length) override;
|
size_t Load(void* buffer, size_t length) override;
|
||||||
int64_t Pos() override;
|
int64_t Pos() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::istream& m_stream;
|
||||||
};
|
};
|
||||||
|
@ -6,10 +6,11 @@
|
|||||||
|
|
||||||
class StepAddProcessor final : public ILoadingStep
|
class StepAddProcessor final : public ILoadingStep
|
||||||
{
|
{
|
||||||
std::unique_ptr<StreamProcessor> m_stream_processor;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StepAddProcessor(std::unique_ptr<StreamProcessor> streamProcessor);
|
explicit StepAddProcessor(std::unique_ptr<StreamProcessor> streamProcessor);
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<StreamProcessor> m_stream_processor;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
#include "Loading/Exception/InvalidXBlockSizeException.h"
|
#include "Loading/Exception/InvalidXBlockSizeException.h"
|
||||||
|
|
||||||
const uint64_t StepAllocXBlocks::MAX_XBLOCK_SIZE = 0x3C000000;
|
namespace
|
||||||
|
{
|
||||||
|
constexpr uint64_t MAX_XBLOCK_SIZE = 0x3C000000;
|
||||||
|
}
|
||||||
|
|
||||||
void StepAllocXBlocks::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
void StepAllocXBlocks::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
||||||
{
|
{
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
class StepAllocXBlocks final : public ILoadingStep
|
class StepAllocXBlocks final : public ILoadingStep
|
||||||
{
|
{
|
||||||
static const uint64_t MAX_XBLOCK_SIZE;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,7 @@ void StepLoadHash::GetHash(const unsigned hashIndex, const uint8_t** pHash, size
|
|||||||
{
|
{
|
||||||
assert(pHash != nullptr);
|
assert(pHash != nullptr);
|
||||||
assert(pSize != nullptr);
|
assert(pSize != nullptr);
|
||||||
assert(hashIndex >= 0 && hashIndex < m_hash_count);
|
assert(hashIndex < m_hash_count);
|
||||||
|
|
||||||
assert(m_hashes);
|
assert(m_hashes);
|
||||||
|
|
||||||
|
@ -4,14 +4,11 @@
|
|||||||
#include "Loading/ILoadingStep.h"
|
#include "Loading/ILoadingStep.h"
|
||||||
#include "Utils/ICapturedDataProvider.h"
|
#include "Utils/ICapturedDataProvider.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class StepLoadHash final : public ILoadingStep, public IHashProvider, public ICapturedDataProvider
|
class StepLoadHash final : public ILoadingStep, public IHashProvider, public ICapturedDataProvider
|
||||||
{
|
{
|
||||||
const size_t m_hash_size;
|
|
||||||
const unsigned m_hash_count;
|
|
||||||
std::unique_ptr<uint8_t[]> m_hashes;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StepLoadHash(size_t hashSize, unsigned hashCount);
|
StepLoadHash(size_t hashSize, unsigned hashCount);
|
||||||
~StepLoadHash() override;
|
~StepLoadHash() override;
|
||||||
@ -24,4 +21,9 @@ public:
|
|||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
void GetHash(unsigned hashIndex, const uint8_t** pHash, size_t* pSize) override;
|
void GetHash(unsigned hashIndex, const uint8_t** pHash, size_t* pSize) override;
|
||||||
void GetCapturedData(const uint8_t** pCapturedData, size_t* pSize) override;
|
void GetCapturedData(const uint8_t** pCapturedData, size_t* pSize) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const size_t m_hash_size;
|
||||||
|
const unsigned m_hash_count;
|
||||||
|
std::unique_ptr<uint8_t[]> m_hashes;
|
||||||
};
|
};
|
||||||
|
@ -5,22 +5,16 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
StepLoadSignature::StepLoadSignature(const size_t signatureSize)
|
StepLoadSignature::StepLoadSignature(const size_t signatureSize)
|
||||||
|
: m_signature(std::make_unique<uint8_t[]>(signatureSize)),
|
||||||
|
m_signature_size(signatureSize)
|
||||||
{
|
{
|
||||||
m_signature_size = signatureSize;
|
|
||||||
m_signature = new uint8_t[signatureSize];
|
|
||||||
}
|
|
||||||
|
|
||||||
StepLoadSignature::~StepLoadSignature()
|
|
||||||
{
|
|
||||||
delete[] m_signature;
|
|
||||||
m_signature = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StepLoadSignature::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
void StepLoadSignature::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
||||||
{
|
{
|
||||||
assert(stream != nullptr);
|
assert(stream != nullptr);
|
||||||
|
|
||||||
if (stream->Load(m_signature, m_signature_size) != m_signature_size)
|
if (stream->Load(m_signature.get(), m_signature_size) != m_signature_size)
|
||||||
throw UnexpectedEndOfFileException();
|
throw UnexpectedEndOfFileException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +25,6 @@ void StepLoadSignature::GetSignature(const uint8_t** pSignature, size_t* pSize)
|
|||||||
|
|
||||||
assert(m_signature != nullptr);
|
assert(m_signature != nullptr);
|
||||||
|
|
||||||
*pSignature = m_signature;
|
*pSignature = m_signature.get();
|
||||||
*pSize = m_signature_size;
|
*pSize = m_signature_size;
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,17 @@
|
|||||||
#include "Loading/ILoadingStep.h"
|
#include "Loading/ILoadingStep.h"
|
||||||
#include "Loading/ISignatureProvider.h"
|
#include "Loading/ISignatureProvider.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class StepLoadSignature final : public ILoadingStep, public ISignatureProvider
|
class StepLoadSignature final : public ILoadingStep, public ISignatureProvider
|
||||||
{
|
{
|
||||||
uint8_t* m_signature;
|
|
||||||
size_t m_signature_size;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StepLoadSignature(size_t signatureSize);
|
explicit StepLoadSignature(size_t signatureSize);
|
||||||
~StepLoadSignature() override;
|
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
void GetSignature(const uint8_t** pSignature, size_t* pSize) override;
|
void GetSignature(const uint8_t** pSignature, size_t* pSize) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<uint8_t[]> m_signature;
|
||||||
|
size_t m_signature_size;
|
||||||
};
|
};
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include "Zone/Stream/Impl/XBlockInputStream.h"
|
#include "Zone/Stream/Impl/XBlockInputStream.h"
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
StepLoadZoneContent::StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint,
|
StepLoadZoneContent::StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint,
|
||||||
Zone* zone,
|
Zone* zone,
|
||||||
const int offsetBlockBitCount,
|
const int offsetBlockBitCount,
|
||||||
@ -17,9 +15,7 @@ StepLoadZoneContent::StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoi
|
|||||||
|
|
||||||
void StepLoadZoneContent::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
void StepLoadZoneContent::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
||||||
{
|
{
|
||||||
auto* inputStream = new XBlockInputStream(zoneLoader->m_blocks, stream, m_offset_block_bit_count, m_insert_block);
|
const auto inputStream = std::make_unique<XBlockInputStream>(zoneLoader->m_blocks, stream, m_offset_block_bit_count, m_insert_block);
|
||||||
|
|
||||||
m_content_loader->Load(inputStream);
|
m_content_loader->Load(inputStream.get());
|
||||||
|
|
||||||
delete inputStream;
|
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,14 @@
|
|||||||
|
|
||||||
class StepLoadZoneContent final : public ILoadingStep
|
class StepLoadZoneContent final : public ILoadingStep
|
||||||
{
|
{
|
||||||
std::unique_ptr<IContentLoadingEntryPoint> m_content_loader;
|
|
||||||
Zone* m_zone;
|
|
||||||
int m_offset_block_bit_count;
|
|
||||||
block_t m_insert_block;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint, Zone* zone, int offsetBlockBitCount, block_t insertBlock);
|
StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint, Zone* zone, int offsetBlockBitCount, block_t insertBlock);
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<IContentLoadingEntryPoint> m_content_loader;
|
||||||
|
Zone* m_zone;
|
||||||
|
int m_offset_block_bit_count;
|
||||||
|
block_t m_insert_block;
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Loading/ILoadingStep.h"
|
#include "Loading/ILoadingStep.h"
|
||||||
#include "Utils/ClassUtils.h"
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
class StepLoadZoneSizes final : public ILoadingStep
|
class StepLoadZoneSizes final : public ILoadingStep
|
||||||
{
|
{
|
||||||
size_t m_size;
|
|
||||||
size_t m_external_size;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StepLoadZoneSizes();
|
StepLoadZoneSizes();
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
_NODISCARD size_t GetSize() const;
|
[[nodiscard]] size_t GetSize() const;
|
||||||
_NODISCARD size_t GetExternalSize() const;
|
[[nodiscard]] size_t GetExternalSize() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
size_t m_size;
|
||||||
|
size_t m_external_size;
|
||||||
};
|
};
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
|
|
||||||
class StepRemoveProcessor final : public ILoadingStep
|
class StepRemoveProcessor final : public ILoadingStep
|
||||||
{
|
{
|
||||||
StreamProcessor* m_stream_processor;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StepRemoveProcessor(StreamProcessor* streamProcessor);
|
explicit StepRemoveProcessor(StreamProcessor* streamProcessor);
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
StreamProcessor* m_stream_processor;
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ void StepVerifyFileName::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* str
|
|||||||
bufferOffset++;
|
bufferOffset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string originalFileName = originalFilenameStream.str();
|
const auto originalFileName = originalFilenameStream.str();
|
||||||
|
|
||||||
if (originalFileName != m_expected_file_name)
|
if (originalFileName != m_expected_file_name)
|
||||||
throw InvalidFileNameException(m_expected_file_name, originalFileName);
|
throw InvalidFileNameException(m_expected_file_name, originalFileName);
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
class StepVerifyFileName final : public ILoadingStep
|
class StepVerifyFileName final : public ILoadingStep
|
||||||
{
|
{
|
||||||
std::string m_expected_file_name;
|
|
||||||
size_t m_file_name_buffer_size;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StepVerifyFileName(std::string fileName, size_t fileNameBufferSize);
|
explicit StepVerifyFileName(std::string fileName, size_t fileNameBufferSize);
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_expected_file_name;
|
||||||
|
size_t m_file_name_buffer_size;
|
||||||
};
|
};
|
||||||
|
@ -16,8 +16,6 @@ StepVerifyHash::StepVerifyHash(std::unique_ptr<cryptography::IHashFunction> hash
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StepVerifyHash::~StepVerifyHash() = default;
|
|
||||||
|
|
||||||
void StepVerifyHash::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
void StepVerifyHash::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
||||||
{
|
{
|
||||||
const uint8_t* dataToHash = nullptr;
|
const uint8_t* dataToHash = nullptr;
|
||||||
@ -31,7 +29,7 @@ void StepVerifyHash::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
|
|||||||
if (hashSize != m_hash_function->GetHashSize())
|
if (hashSize != m_hash_function->GetHashSize())
|
||||||
throw InvalidHashException();
|
throw InvalidHashException();
|
||||||
|
|
||||||
const std::unique_ptr<uint8_t[]> hashMemory = std::make_unique<uint8_t[]>(m_hash_function->GetHashSize());
|
const auto hashMemory = std::make_unique<uint8_t[]>(m_hash_function->GetHashSize());
|
||||||
m_hash_function->Init();
|
m_hash_function->Init();
|
||||||
m_hash_function->Process(dataToHash, dataToHashSize);
|
m_hash_function->Process(dataToHash, dataToHashSize);
|
||||||
m_hash_function->Finish(hashMemory.get());
|
m_hash_function->Finish(hashMemory.get());
|
||||||
|
@ -9,21 +9,17 @@
|
|||||||
|
|
||||||
class StepVerifyHash final : public ILoadingStep
|
class StepVerifyHash final : public ILoadingStep
|
||||||
{
|
{
|
||||||
std::unique_ptr<cryptography::IHashFunction> m_hash_function;
|
|
||||||
unsigned m_hash_index;
|
|
||||||
IHashProvider* m_hash_provider;
|
|
||||||
ICapturedDataProvider* m_data_provider;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StepVerifyHash(std::unique_ptr<cryptography::IHashFunction> hashFunction,
|
StepVerifyHash(std::unique_ptr<cryptography::IHashFunction> hashFunction,
|
||||||
unsigned hashIndex,
|
unsigned hashIndex,
|
||||||
IHashProvider* hashProvider,
|
IHashProvider* hashProvider,
|
||||||
ICapturedDataProvider* dataProvider);
|
ICapturedDataProvider* dataProvider);
|
||||||
~StepVerifyHash();
|
|
||||||
StepVerifyHash(const StepVerifyHash& other) = delete;
|
|
||||||
StepVerifyHash(StepVerifyHash&& other) noexcept = default;
|
|
||||||
StepVerifyHash& operator=(const StepVerifyHash& other) = delete;
|
|
||||||
StepVerifyHash& operator=(StepVerifyHash&& other) noexcept = default;
|
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<cryptography::IHashFunction> m_hash_function;
|
||||||
|
unsigned m_hash_index;
|
||||||
|
IHashProvider* m_hash_provider;
|
||||||
|
ICapturedDataProvider* m_data_provider;
|
||||||
};
|
};
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
class StepVerifyMagic final : public ILoadingStep
|
class StepVerifyMagic final : public ILoadingStep
|
||||||
{
|
{
|
||||||
const char* m_magic;
|
|
||||||
size_t m_magic_len;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StepVerifyMagic(const char* magic);
|
explicit StepVerifyMagic(const char* magic);
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char* m_magic;
|
||||||
|
size_t m_magic_len;
|
||||||
};
|
};
|
||||||
|
@ -7,19 +7,15 @@
|
|||||||
|
|
||||||
class StepVerifySignature final : public ILoadingStep
|
class StepVerifySignature final : public ILoadingStep
|
||||||
{
|
{
|
||||||
std::unique_ptr<cryptography::IPublicKeyAlgorithm> m_algorithm;
|
|
||||||
ISignatureProvider* m_signature_provider;
|
|
||||||
ICapturedDataProvider* m_signature_data_provider;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StepVerifySignature(std::unique_ptr<cryptography::IPublicKeyAlgorithm> signatureAlgorithm,
|
StepVerifySignature(std::unique_ptr<cryptography::IPublicKeyAlgorithm> signatureAlgorithm,
|
||||||
ISignatureProvider* signatureProvider,
|
ISignatureProvider* signatureProvider,
|
||||||
ICapturedDataProvider* signatureDataProvider);
|
ICapturedDataProvider* signatureDataProvider);
|
||||||
~StepVerifySignature() override = default;
|
|
||||||
StepVerifySignature(const StepVerifySignature& other) = delete;
|
|
||||||
StepVerifySignature(StepVerifySignature&& other) noexcept = default;
|
|
||||||
StepVerifySignature& operator=(const StepVerifySignature& other) = delete;
|
|
||||||
StepVerifySignature& operator=(StepVerifySignature&& other) noexcept = default;
|
|
||||||
|
|
||||||
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
void PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<cryptography::IPublicKeyAlgorithm> m_algorithm;
|
||||||
|
ISignatureProvider* m_signature_provider;
|
||||||
|
ICapturedDataProvider* m_signature_data_provider;
|
||||||
};
|
};
|
||||||
|
@ -13,18 +13,7 @@ class ILoadingStep;
|
|||||||
|
|
||||||
class ZoneLoader
|
class ZoneLoader
|
||||||
{
|
{
|
||||||
std::vector<std::unique_ptr<ILoadingStep>> m_steps;
|
|
||||||
std::vector<std::unique_ptr<StreamProcessor>> m_processors;
|
|
||||||
|
|
||||||
bool m_processor_chain_dirty;
|
|
||||||
|
|
||||||
std::unique_ptr<Zone> m_zone;
|
|
||||||
|
|
||||||
ILoadingStream* BuildLoadingChain(ILoadingStream* rootStream);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<XBlock*> m_blocks;
|
|
||||||
|
|
||||||
explicit ZoneLoader(std::unique_ptr<Zone> zone);
|
explicit ZoneLoader(std::unique_ptr<Zone> zone);
|
||||||
|
|
||||||
void AddXBlock(std::unique_ptr<XBlock> block);
|
void AddXBlock(std::unique_ptr<XBlock> block);
|
||||||
@ -34,4 +23,16 @@ public:
|
|||||||
void RemoveStreamProcessor(StreamProcessor* streamProcessor);
|
void RemoveStreamProcessor(StreamProcessor* streamProcessor);
|
||||||
|
|
||||||
std::unique_ptr<Zone> LoadZone(std::istream& stream);
|
std::unique_ptr<Zone> LoadZone(std::istream& stream);
|
||||||
|
|
||||||
|
std::vector<XBlock*> m_blocks;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ILoadingStream* BuildLoadingChain(ILoadingStream* rootStream);
|
||||||
|
|
||||||
|
std::vector<std::unique_ptr<ILoadingStep>> m_steps;
|
||||||
|
std::vector<std::unique_ptr<StreamProcessor>> m_processors;
|
||||||
|
|
||||||
|
bool m_processor_chain_dirty;
|
||||||
|
|
||||||
|
std::unique_ptr<Zone> m_zone;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user