mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-05-09 22:14:56 +00:00
move zoneloaderfactories in their respective game namespaces
This commit is contained in:
parent
f0c8ffa6be
commit
f3afaf3110
@ -23,12 +23,14 @@
|
|||||||
#include "Loading/Steps/StepRemoveProcessor.h"
|
#include "Loading/Steps/StepRemoveProcessor.h"
|
||||||
#include "Loading/Steps/StepVerifyHash.h"
|
#include "Loading/Steps/StepVerifyHash.h"
|
||||||
|
|
||||||
const std::string ZoneLoaderFactoryIW4::MAGIC_SIGNED_INFINITY_WARD = "IWff0100";
|
using namespace IW4;
|
||||||
const std::string ZoneLoaderFactoryIW4::MAGIC_UNSIGNED = "IWffu100";
|
|
||||||
const int ZoneLoaderFactoryIW4::VERSION = 276;
|
|
||||||
|
|
||||||
const std::string ZoneLoaderFactoryIW4::MAGIC_AUTH_HEADER = "IWffs100";
|
const std::string ZoneLoaderFactory::MAGIC_SIGNED_INFINITY_WARD = "IWff0100";
|
||||||
const uint8_t ZoneLoaderFactoryIW4::RSA_PUBLIC_KEY_INFINITY_WARD[]
|
const std::string ZoneLoaderFactory::MAGIC_UNSIGNED = "IWffu100";
|
||||||
|
const int ZoneLoaderFactory::VERSION = 276;
|
||||||
|
|
||||||
|
const std::string ZoneLoaderFactory::MAGIC_AUTH_HEADER = "IWffs100";
|
||||||
|
const uint8_t ZoneLoaderFactory::RSA_PUBLIC_KEY_INFINITY_WARD[]
|
||||||
{
|
{
|
||||||
0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01,
|
0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01,
|
||||||
0x00, 0xA5, 0x86, 0xCC, 0x18, 0xA9, 0x12, 0x17,
|
0x00, 0xA5, 0x86, 0xCC, 0x18, 0xA9, 0x12, 0x17,
|
||||||
@ -66,13 +68,13 @@ const uint8_t ZoneLoaderFactoryIW4::RSA_PUBLIC_KEY_INFINITY_WARD[]
|
|||||||
0x89, 0x02, 0x03, 0x01, 0x00, 0x01
|
0x89, 0x02, 0x03, 0x01, 0x00, 0x01
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t ZoneLoaderFactoryIW4::AUTHED_CHUNK_SIZE = 0x2000;
|
const size_t ZoneLoaderFactory::AUTHED_CHUNK_SIZE = 0x2000;
|
||||||
const size_t ZoneLoaderFactoryIW4::AUTHED_CHUNK_COUNT_PER_GROUP = 256;
|
const size_t ZoneLoaderFactory::AUTHED_CHUNK_COUNT_PER_GROUP = 256;
|
||||||
|
|
||||||
const int ZoneLoaderFactoryIW4::OFFSET_BLOCK_BIT_COUNT = 4;
|
const int ZoneLoaderFactory::OFFSET_BLOCK_BIT_COUNT = 4;
|
||||||
const block_t ZoneLoaderFactoryIW4::INSERT_BLOCK = IW4::XFILE_BLOCK_VIRTUAL;
|
const block_t ZoneLoaderFactory::INSERT_BLOCK = IW4::XFILE_BLOCK_VIRTUAL;
|
||||||
|
|
||||||
class ZoneLoaderFactoryIW4::Impl
|
class ZoneLoaderFactory::Impl
|
||||||
{
|
{
|
||||||
static GameLanguage GetZoneLanguage(std::string& zoneName)
|
static GameLanguage GetZoneLanguage(std::string& zoneName)
|
||||||
{
|
{
|
||||||
@ -228,14 +230,14 @@ public:
|
|||||||
|
|
||||||
// Start of the zone content
|
// Start of the zone content
|
||||||
zoneLoader->AddLoadingStep(
|
zoneLoader->AddLoadingStep(
|
||||||
new StepLoadZoneContent(new ContentLoaderIW4(), zone, OFFSET_BLOCK_BIT_COUNT, INSERT_BLOCK));
|
new StepLoadZoneContent(new ContentLoader(), zone, OFFSET_BLOCK_BIT_COUNT, INSERT_BLOCK));
|
||||||
|
|
||||||
// Return the fully setup zoneloader
|
// Return the fully setup zoneloader
|
||||||
return zoneLoader;
|
return zoneLoader;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ZoneLoader* ZoneLoaderFactoryIW4::CreateLoaderForHeader(ZoneHeader& header, std::string& fileName)
|
ZoneLoader* ZoneLoaderFactory::CreateLoaderForHeader(ZoneHeader& header, std::string& fileName)
|
||||||
{
|
{
|
||||||
return Impl::CreateLoaderForHeader(header, fileName);
|
return Impl::CreateLoaderForHeader(header, fileName);
|
||||||
}
|
}
|
||||||
|
@ -3,23 +3,26 @@
|
|||||||
#include "Loading/IZoneLoaderFactory.h"
|
#include "Loading/IZoneLoaderFactory.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class ZoneLoaderFactoryIW4 final : public IZoneLoaderFactory
|
namespace IW4
|
||||||
{
|
{
|
||||||
static const std::string MAGIC_SIGNED_INFINITY_WARD;
|
class ZoneLoaderFactory final : public IZoneLoaderFactory
|
||||||
static const std::string MAGIC_UNSIGNED;
|
{
|
||||||
static const int VERSION;
|
static const std::string MAGIC_SIGNED_INFINITY_WARD;
|
||||||
|
static const std::string MAGIC_UNSIGNED;
|
||||||
|
static const int VERSION;
|
||||||
|
|
||||||
static const std::string MAGIC_AUTH_HEADER;
|
static const std::string MAGIC_AUTH_HEADER;
|
||||||
static const uint8_t RSA_PUBLIC_KEY_INFINITY_WARD[];
|
static const uint8_t RSA_PUBLIC_KEY_INFINITY_WARD[];
|
||||||
|
|
||||||
static const size_t AUTHED_CHUNK_SIZE;
|
static const size_t AUTHED_CHUNK_SIZE;
|
||||||
static const unsigned AUTHED_CHUNK_COUNT_PER_GROUP;
|
static const unsigned AUTHED_CHUNK_COUNT_PER_GROUP;
|
||||||
|
|
||||||
static const int OFFSET_BLOCK_BIT_COUNT;
|
static const int OFFSET_BLOCK_BIT_COUNT;
|
||||||
static const block_t INSERT_BLOCK;
|
static const block_t INSERT_BLOCK;
|
||||||
|
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override;
|
ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -16,25 +16,27 @@
|
|||||||
#include "Utils/ClassUtils.h"
|
#include "Utils/ClassUtils.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "Loading/Steps/StepLoadZoneContent.h"
|
#include "Loading/Steps/StepLoadZoneContent.h"
|
||||||
#include "ContentLoader.h"
|
#include "ContentLoaderT6.h"
|
||||||
#include "Game/T6/GameAssetPoolT6.h"
|
#include "Game/T6/GameAssetPoolT6.h"
|
||||||
#include "Game/T6/GameT6.h"
|
#include "Game/T6/GameT6.h"
|
||||||
#include "Game/GameLanguage.h"
|
#include "Game/GameLanguage.h"
|
||||||
|
|
||||||
const std::string ZoneLoaderFactoryT6::MAGIC_SIGNED_TREYARCH = "TAff0100";
|
using namespace T6;
|
||||||
const std::string ZoneLoaderFactoryT6::MAGIC_SIGNED_ASSET_BUILDER = "ABff0100";
|
|
||||||
const std::string ZoneLoaderFactoryT6::MAGIC_UNSIGNED = "TAffu100";
|
|
||||||
const std::string ZoneLoaderFactoryT6::MAGIC_UNSIGNED_SERVER = "TAsvu100";
|
|
||||||
const int ZoneLoaderFactoryT6::VERSION = 147;
|
|
||||||
|
|
||||||
const int ZoneLoaderFactoryT6::STREAM_COUNT = 4;
|
const std::string ZoneLoaderFactory::MAGIC_SIGNED_TREYARCH = "TAff0100";
|
||||||
const int ZoneLoaderFactoryT6::XCHUNK_SIZE = 0x8000;
|
const std::string ZoneLoaderFactory::MAGIC_SIGNED_ASSET_BUILDER = "ABff0100";
|
||||||
const int ZoneLoaderFactoryT6::VANILLA_BUFFER_SIZE = 0x80000;
|
const std::string ZoneLoaderFactory::MAGIC_UNSIGNED = "TAffu100";
|
||||||
const int ZoneLoaderFactoryT6::OFFSET_BLOCK_BIT_COUNT = 3;
|
const std::string ZoneLoaderFactory::MAGIC_UNSIGNED_SERVER = "TAsvu100";
|
||||||
const block_t ZoneLoaderFactoryT6::INSERT_BLOCK = T6::XFILE_BLOCK_VIRTUAL;
|
const int ZoneLoaderFactory::VERSION = 147;
|
||||||
|
|
||||||
const std::string ZoneLoaderFactoryT6::MAGIC_AUTH_HEADER = "PHEEBs71";
|
const int ZoneLoaderFactory::STREAM_COUNT = 4;
|
||||||
const uint8_t ZoneLoaderFactoryT6::SALSA20_KEY_TREYARCH[]
|
const int ZoneLoaderFactory::XCHUNK_SIZE = 0x8000;
|
||||||
|
const int ZoneLoaderFactory::VANILLA_BUFFER_SIZE = 0x80000;
|
||||||
|
const int ZoneLoaderFactory::OFFSET_BLOCK_BIT_COUNT = 3;
|
||||||
|
const block_t ZoneLoaderFactory::INSERT_BLOCK = T6::XFILE_BLOCK_VIRTUAL;
|
||||||
|
|
||||||
|
const std::string ZoneLoaderFactory::MAGIC_AUTH_HEADER = "PHEEBs71";
|
||||||
|
const uint8_t ZoneLoaderFactory::SALSA20_KEY_TREYARCH[]
|
||||||
{
|
{
|
||||||
0x64, 0x1D, 0x8A, 0x2F,
|
0x64, 0x1D, 0x8A, 0x2F,
|
||||||
0xE3, 0x1D, 0x3A, 0xA6,
|
0xE3, 0x1D, 0x3A, 0xA6,
|
||||||
@ -46,7 +48,7 @@ const uint8_t ZoneLoaderFactoryT6::SALSA20_KEY_TREYARCH[]
|
|||||||
0x5E, 0xDC, 0x50, 0xBE
|
0x5E, 0xDC, 0x50, 0xBE
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t ZoneLoaderFactoryT6::RSA_PUBLIC_KEY_TREYARCH[]
|
const uint8_t ZoneLoaderFactory::RSA_PUBLIC_KEY_TREYARCH[]
|
||||||
{
|
{
|
||||||
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
|
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
|
||||||
0x00, 0xc7, 0x9d, 0x33, 0xe0, 0x75, 0xaf, 0xef,
|
0x00, 0xc7, 0x9d, 0x33, 0xe0, 0x75, 0xaf, 0xef,
|
||||||
@ -84,7 +86,7 @@ const uint8_t ZoneLoaderFactoryT6::RSA_PUBLIC_KEY_TREYARCH[]
|
|||||||
0x8b, 0x02, 0x03, 0x01, 0x00, 0x01
|
0x8b, 0x02, 0x03, 0x01, 0x00, 0x01
|
||||||
};
|
};
|
||||||
|
|
||||||
class ZoneLoaderFactoryT6::ZoneLoaderFactoryT6Impl
|
class ZoneLoaderFactory::Impl
|
||||||
{
|
{
|
||||||
static GameLanguage GetZoneLanguage(std::string& zoneName)
|
static GameLanguage GetZoneLanguage(std::string& zoneName)
|
||||||
{
|
{
|
||||||
@ -258,7 +260,7 @@ public:
|
|||||||
zoneLoader->AddLoadingStep(new StepAllocXBlocks());
|
zoneLoader->AddLoadingStep(new StepAllocXBlocks());
|
||||||
|
|
||||||
// Start of the zone content
|
// Start of the zone content
|
||||||
zoneLoader->AddLoadingStep(new StepLoadZoneContent(new ContentLoaderT6(), zone, OFFSET_BLOCK_BIT_COUNT, INSERT_BLOCK));
|
zoneLoader->AddLoadingStep(new StepLoadZoneContent(new ContentLoader(), zone, OFFSET_BLOCK_BIT_COUNT, INSERT_BLOCK));
|
||||||
|
|
||||||
if(isSecure)
|
if(isSecure)
|
||||||
{
|
{
|
||||||
@ -270,7 +272,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ZoneLoader* ZoneLoaderFactoryT6::CreateLoaderForHeader(ZoneHeader& header, std::string& fileName)
|
ZoneLoader* ZoneLoaderFactory::CreateLoaderForHeader(ZoneHeader& header, std::string& fileName)
|
||||||
{
|
{
|
||||||
return ZoneLoaderFactoryT6Impl::CreateLoaderForHeader(header, fileName);
|
return Impl::CreateLoaderForHeader(header, fileName);
|
||||||
}
|
}
|
@ -3,26 +3,29 @@
|
|||||||
#include "Loading/IZoneLoaderFactory.h"
|
#include "Loading/IZoneLoaderFactory.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class ZoneLoaderFactoryT6 final : public IZoneLoaderFactory
|
namespace T6
|
||||||
{
|
{
|
||||||
static const std::string MAGIC_SIGNED_TREYARCH;
|
class ZoneLoaderFactory final : public IZoneLoaderFactory
|
||||||
static const std::string MAGIC_SIGNED_ASSET_BUILDER;
|
{
|
||||||
static const std::string MAGIC_UNSIGNED;
|
static const std::string MAGIC_SIGNED_TREYARCH;
|
||||||
static const std::string MAGIC_UNSIGNED_SERVER;
|
static const std::string MAGIC_SIGNED_ASSET_BUILDER;
|
||||||
static const int VERSION;
|
static const std::string MAGIC_UNSIGNED;
|
||||||
|
static const std::string MAGIC_UNSIGNED_SERVER;
|
||||||
|
static const int VERSION;
|
||||||
|
|
||||||
static const int STREAM_COUNT;
|
static const int STREAM_COUNT;
|
||||||
static const int XCHUNK_SIZE;
|
static const int XCHUNK_SIZE;
|
||||||
static const int VANILLA_BUFFER_SIZE;
|
static const int VANILLA_BUFFER_SIZE;
|
||||||
static const int OFFSET_BLOCK_BIT_COUNT;
|
static const int OFFSET_BLOCK_BIT_COUNT;
|
||||||
static const block_t INSERT_BLOCK;
|
static const block_t INSERT_BLOCK;
|
||||||
|
|
||||||
static const std::string MAGIC_AUTH_HEADER;
|
static const std::string MAGIC_AUTH_HEADER;
|
||||||
static const uint8_t SALSA20_KEY_TREYARCH[];
|
static const uint8_t SALSA20_KEY_TREYARCH[];
|
||||||
static const uint8_t RSA_PUBLIC_KEY_TREYARCH[];
|
static const uint8_t RSA_PUBLIC_KEY_TREYARCH[];
|
||||||
|
|
||||||
class ZoneLoaderFactoryT6Impl;
|
class Impl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override;
|
ZoneLoader* CreateLoaderForHeader(ZoneHeader& header, std::string& fileName) override;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
#include "Game/IW4/ZoneLoaderFactoryIW4.h"
|
#include "Game/IW4/ZoneLoaderFactoryIW4.h"
|
||||||
#include "Game/T6/ZoneLoaderFactoryT6.h"
|
#include "Game/T6/ZoneLoaderFactoryT6.h"
|
||||||
|
|
||||||
IZoneLoaderFactory* zoneLoaderFactories[]
|
IZoneLoaderFactory* ZoneLoaderFactories[]
|
||||||
{
|
{
|
||||||
new ZoneLoaderFactoryIW4(),
|
new IW4::ZoneLoaderFactory(),
|
||||||
new ZoneLoaderFactoryT6()
|
new T6::ZoneLoaderFactory()
|
||||||
};
|
};
|
||||||
|
|
||||||
Zone* ZoneLoading::LoadZone(const std::string& path)
|
Zone* ZoneLoading::LoadZone(const std::string& path)
|
||||||
@ -25,7 +25,7 @@ Zone* ZoneLoading::LoadZone(const std::string& path)
|
|||||||
file.Read(&header, sizeof(ZoneHeader), 1);
|
file.Read(&header, sizeof(ZoneHeader), 1);
|
||||||
|
|
||||||
ZoneLoader* zoneLoader = nullptr;
|
ZoneLoader* zoneLoader = nullptr;
|
||||||
for(auto factory : zoneLoaderFactories)
|
for(auto* factory : ZoneLoaderFactories)
|
||||||
{
|
{
|
||||||
zoneLoader = factory->CreateLoaderForHeader(header, zoneName);
|
zoneLoader = factory->CreateLoaderForHeader(header, zoneName);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user