Reformat code with clang format

This commit is contained in:
Clang Format
2023-11-19 15:28:38 +01:00
committed by Jan
parent 22e17272fd
commit 6b4f5d94a8
1099 changed files with 16763 additions and 18076 deletions

View File

@ -1,8 +1,5 @@
#include "ContentWriterIW3.h"
#include <cassert>
#include <sstream>
#include "Game/IW3/XAssets/clipmap_t/clipmap_t_write_db.h"
#include "Game/IW3/XAssets/comworld/comworld_write_db.h"
#include "Game/IW3/XAssets/font_s/font_s_write_db.h"
@ -28,9 +25,11 @@
#include "Game/IW3/XAssets/weapondef/weapondef_write_db.h"
#include "Game/IW3/XAssets/xanimparts/xanimparts_write_db.h"
#include "Game/IW3/XAssets/xmodel/xmodel_write_db.h"
#include "Writing/WritingException.h"
#include <cassert>
#include <sstream>
using namespace IW3;
ContentWriter::ContentWriter()
@ -100,15 +99,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart)
void ContentWriter::WriteXAsset(const bool atStreamStart)
{
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
break;
assert(varXAsset != nullptr);
@ -118,40 +117,40 @@ void ContentWriter::WriteXAsset(const bool atStreamStart)
switch (varXAsset->type)
{
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve)
WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponDef, weapon)
SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve)
WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponDef, weapon)
SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
default:
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
}
#undef WRITE_ASSET

View File

@ -1,7 +1,7 @@
#pragma once
#include "Game/IW3/IW3.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
#include "Game/IW3/IW3.h"
namespace IW3
{
@ -23,4 +23,4 @@ namespace IW3
void WriteContent(Zone* zone, IZoneOutputStream* stream) override;
};
}
} // namespace IW3

View File

@ -1,10 +1,8 @@
#include "ZoneWriterFactoryIW3.h"
#include <cstring>
#include "ContentWriterIW3.h"
#include "Game/IW3/IW3.h"
#include "Game/IW3/GameIW3.h"
#include "Game/IW3/IW3.h"
#include "Game/IW3/ZoneConstantsIW3.h"
#include "Writing/Processor/OutputProcessorDeflate.h"
#include "Writing/Steps/StepAddOutputProcessor.h"
@ -14,6 +12,8 @@
#include "Writing/Steps/StepWriteZoneHeader.h"
#include "Writing/Steps/StepWriteZoneSizes.h"
#include <cstring>
using namespace IW3;
class ZoneWriterFactory::Impl
@ -24,7 +24,7 @@ class ZoneWriterFactory::Impl
public:
explicit Impl(Zone* zone)
: m_zone(zone),
m_writer(std::make_unique<ZoneWriter>())
m_writer(std::make_unique<ZoneWriter>())
{
}
@ -58,7 +58,8 @@ public:
{
SetupBlocks();
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
m_writer->AddWritingStep(std::move(contentInMemory));

View File

@ -1,9 +1,9 @@
#pragma once
#include <memory>
#include "Writing/IZoneWriterFactory.h"
#include <memory>
namespace IW3
{
class ZoneWriterFactory final : public IZoneWriterFactory
@ -14,4 +14,4 @@ namespace IW3
_NODISCARD bool SupportsZone(Zone* zone) const override;
_NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override;
};
}
} // namespace IW3

View File

@ -1,8 +1,5 @@
#include "ContentWriterIW4.h"
#include <cassert>
#include <sstream>
#include "Game/IW4/XAssets/addonmapents/addonmapents_write_db.h"
#include "Game/IW4/XAssets/clipmap_t/clipmap_t_write_db.h"
#include "Game/IW4/XAssets/comworld/comworld_write_db.h"
@ -38,9 +35,11 @@
#include "Game/IW4/XAssets/weaponcompletedef/weaponcompletedef_write_db.h"
#include "Game/IW4/XAssets/xanimparts/xanimparts_write_db.h"
#include "Game/IW4/XAssets/xmodel/xmodel_write_db.h"
#include "Writing/WritingException.h"
#include <cassert>
#include <sstream>
using namespace IW4;
ContentWriter::ContentWriter()
@ -110,15 +109,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart)
void ContentWriter::WriteXAsset(const bool atStreamStart)
{
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
break;
assert(varXAsset != nullptr);
@ -128,50 +127,50 @@ void ContentWriter::WriteXAsset(const bool atStreamStart)
switch (varXAsset->type)
{
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader)
WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader)
WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve)
WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon)
SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef)
WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet)
WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef)
WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef)
WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts)
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader)
WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader)
WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve)
WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon)
SKIP_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef)
WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet)
WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef)
WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef)
WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts)
default:
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
}
#undef WRITE_ASSET

View File

@ -1,7 +1,7 @@
#pragma once
#include "Game/IW4/IW4.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
#include "Game/IW4/IW4.h"
namespace IW4
{
@ -23,4 +23,4 @@ namespace IW4
void WriteContent(Zone* zone, IZoneOutputStream* stream) override;
};
}
} // namespace IW4

View File

@ -1,10 +1,8 @@
#include "ZoneWriterFactoryIW4.h"
#include <cstring>
#include "ContentWriterIW4.h"
#include "Game/IW4/IW4.h"
#include "Game/IW4/GameIW4.h"
#include "Game/IW4/IW4.h"
#include "Game/IW4/ZoneConstantsIW4.h"
#include "Writing/Processor/OutputProcessorDeflate.h"
#include "Writing/Steps/StepAddOutputProcessor.h"
@ -16,6 +14,8 @@
#include "Writing/Steps/StepWriteZoneHeader.h"
#include "Writing/Steps/StepWriteZoneSizes.h"
#include <cstring>
using namespace IW4;
class ZoneWriterFactory::Impl
@ -73,7 +73,8 @@ public:
SetupBlocks();
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
m_writer->AddWritingStep(std::move(contentInMemory));

View File

@ -1,9 +1,9 @@
#pragma once
#include <memory>
#include "Writing/IZoneWriterFactory.h"
#include <memory>
namespace IW4
{
class ZoneWriterFactory final : public IZoneWriterFactory
@ -14,4 +14,4 @@ namespace IW4
_NODISCARD bool SupportsZone(Zone* zone) const override;
_NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override;
};
}
} // namespace IW4

View File

@ -1,8 +1,5 @@
#include "ContentWriterIW5.h"
#include <cassert>
#include <sstream>
#include "Game/IW5/XAssets/addonmapents/addonmapents_write_db.h"
#include "Game/IW5/XAssets/clipmap_t/clipmap_t_write_db.h"
#include "Game/IW5/XAssets/comworld/comworld_write_db.h"
@ -43,9 +40,11 @@
#include "Game/IW5/XAssets/xanimparts/xanimparts_write_db.h"
#include "Game/IW5/XAssets/xmodel/xmodel_write_db.h"
#include "Game/IW5/XAssets/xmodelsurfs/xmodelsurfs_write_db.h"
#include "Writing/WritingException.h"
#include <cassert>
#include <sstream>
using namespace IW5;
ContentWriter::ContentWriter()
@ -115,15 +114,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart)
void ContentWriter::WriteXAsset(const bool atStreamStart)
{
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
break;
assert(varXAsset != nullptr);
@ -133,53 +132,53 @@ void ContentWriter::WriteXAsset(const bool atStreamStart)
switch (varXAsset->type)
{
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader)
WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader)
WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve)
WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GLASSWORLD, GlassWorld, glassWorld)
WRITE_ASSET(ASSET_TYPE_PATHDATA, PathData, pathData)
WRITE_ASSET(ASSET_TYPE_VEHICLE_TRACK, VehicleTrack, vehicleTrack)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_SURFACE_FX, SurfaceFxTable, surfaceFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_SCRIPTFILE, ScriptFile, scriptfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef)
WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet)
WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef)
WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef)
WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts)
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCOLLMAP, PhysCollmap, physCollmap)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL_SURFS, XModelSurfs, modelSurfs)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_PIXELSHADER, MaterialPixelShader, pixelShader)
WRITE_ASSET(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader, vertexShader)
WRITE_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve)
WRITE_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GLASSWORLD, GlassWorld, glassWorld)
WRITE_ASSET(ASSET_TYPE_PATHDATA, PathData, pathData)
WRITE_ASSET(ASSET_TYPE_VEHICLE_TRACK, VehicleTrack, vehicleTrack)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_FXWORLD, FxWorld, fxWorld)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponCompleteDef, weapon)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_SURFACE_FX, SurfaceFxTable, surfaceFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_SCRIPTFILE, ScriptFile, scriptfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef)
WRITE_ASSET(ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet, structuredDataDefSet)
WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef)
WRITE_ASSET(ASSET_TYPE_VEHICLE, VehicleDef, vehDef)
WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts)
default:
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
}
#undef WRITE_ASSET

View File

@ -1,7 +1,7 @@
#pragma once
#include "Game/IW5/IW5.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
#include "Game/IW5/IW5.h"
namespace IW5
{
@ -23,4 +23,4 @@ namespace IW5
void WriteContent(Zone* zone, IZoneOutputStream* stream) override;
};
}
} // namespace IW5

View File

@ -1,10 +1,8 @@
#include "ZoneWriterFactoryIW5.h"
#include <cstring>
#include "ContentWriterIW5.h"
#include "Game/IW5/IW5.h"
#include "Game/IW5/GameIW5.h"
#include "Game/IW5/IW5.h"
#include "Game/IW5/ZoneConstantsIW5.h"
#include "Writing/Processor/OutputProcessorDeflate.h"
#include "Writing/Steps/StepAddOutputProcessor.h"
@ -16,6 +14,8 @@
#include "Writing/Steps/StepWriteZoneHeader.h"
#include "Writing/Steps/StepWriteZoneSizes.h"
#include <cstring>
using namespace IW5;
class ZoneWriterFactory::Impl
@ -26,7 +26,7 @@ class ZoneWriterFactory::Impl
public:
explicit Impl(Zone* zone)
: m_zone(zone),
m_writer(std::make_unique<ZoneWriter>())
m_writer(std::make_unique<ZoneWriter>())
{
}
@ -74,7 +74,8 @@ public:
SetupBlocks();
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
m_writer->AddWritingStep(std::move(contentInMemory));

View File

@ -1,9 +1,9 @@
#pragma once
#include <memory>
#include "Writing/IZoneWriterFactory.h"
#include <memory>
namespace IW5
{
class ZoneWriterFactory final : public IZoneWriterFactory
@ -14,4 +14,4 @@ namespace IW5
_NODISCARD bool SupportsZone(Zone* zone) const override;
_NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override;
};
}
} // namespace IW5

View File

@ -1,8 +1,5 @@
#include "ContentWriterT5.h"
#include <cassert>
#include <sstream>
#include "Game/T5/XAssets/clipmap_t/clipmap_t_write_db.h"
#include "Game/T5/XAssets/comworld/comworld_write_db.h"
#include "Game/T5/XAssets/ddlroot_t/ddlroot_t_write_db.h"
@ -35,9 +32,11 @@
#include "Game/T5/XAssets/xanimparts/xanimparts_write_db.h"
#include "Game/T5/XAssets/xglobals/xglobals_write_db.h"
#include "Game/T5/XAssets/xmodel/xmodel_write_db.h"
#include "Writing/WritingException.h"
#include <cassert>
#include <sstream>
using namespace T5;
ContentWriter::ContentWriter()
@ -107,15 +106,15 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart)
void ContentWriter::WriteXAsset(const bool atStreamStart)
{
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define SKIP_ASSET(type_index, typeName, headerEntry) \
case type_index: \
break;
assert(varXAsset != nullptr);
@ -125,46 +124,46 @@ void ContentWriter::WriteXAsset(const bool atStreamStart)
switch (varXAsset->type)
{
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints)
WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon)
WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_PACK_INDEX, PackIndex, packIndex)
WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals)
WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot)
WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses)
WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet)
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints)
WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon)
WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_PACK_INDEX, PackIndex, packIndex)
WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals)
WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot)
WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses)
WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet)
default:
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
}
#undef WRITE_ASSET

View File

@ -1,7 +1,7 @@
#pragma once
#include "Game/T5/T5.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
#include "Game/T5/T5.h"
namespace T5
{
@ -23,4 +23,4 @@ namespace T5
void WriteContent(Zone* zone, IZoneOutputStream* stream) override;
};
}
} // namespace T5

View File

@ -1,10 +1,8 @@
#include "ZoneWriterFactoryT5.h"
#include <cstring>
#include "ContentWriterT5.h"
#include "Game/T5/T5.h"
#include "Game/T5/GameT5.h"
#include "Game/T5/T5.h"
#include "Game/T5/ZoneConstantsT5.h"
#include "Writing/Processor/OutputProcessorDeflate.h"
#include "Writing/Steps/StepAddOutputProcessor.h"
@ -14,6 +12,8 @@
#include "Writing/Steps/StepWriteZoneHeader.h"
#include "Writing/Steps/StepWriteZoneSizes.h"
#include <cstring>
using namespace T5;
class ZoneWriterFactory::Impl
@ -24,7 +24,7 @@ class ZoneWriterFactory::Impl
public:
explicit Impl(Zone* zone)
: m_zone(zone),
m_writer(std::make_unique<ZoneWriter>())
m_writer(std::make_unique<ZoneWriter>())
{
}
@ -56,7 +56,8 @@ public:
{
SetupBlocks();
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
m_writer->AddWritingStep(std::move(contentInMemory));

View File

@ -1,9 +1,9 @@
#pragma once
#include <memory>
#include "Writing/IZoneWriterFactory.h"
#include <memory>
namespace T5
{
class ZoneWriterFactory final : public IZoneWriterFactory
@ -14,4 +14,4 @@ namespace T5
_NODISCARD bool SupportsZone(Zone* zone) const override;
_NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override;
};
}
} // namespace T5

View File

@ -1,8 +1,5 @@
#include "ContentWriterT6.h"
#include <cassert>
#include <sstream>
#include "Game/T6/XAssets/addonmapents/addonmapents_write_db.h"
#include "Game/T6/XAssets/clipmap_t/clipmap_t_write_db.h"
#include "Game/T6/XAssets/comworld/comworld_write_db.h"
@ -51,9 +48,11 @@
#include "Game/T6/XAssets/xglobals/xglobals_write_db.h"
#include "Game/T6/XAssets/xmodel/xmodel_write_db.h"
#include "Game/T6/XAssets/zbarrierdef/zbarrierdef_write_db.h"
#include "Writing/WritingException.h"
#include <cassert>
#include <sstream>
using namespace T6;
ContentWriter::ContentWriter()
@ -126,13 +125,13 @@ void ContentWriter::WriteScriptStringList(const bool atStreamStart)
void ContentWriter::WriteXAsset(const bool atStreamStart)
{
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
#define WRITE_ASSET(type_index, typeName, headerEntry) \
case type_index: \
{ \
Writer_##typeName writer(varXAsset->header.headerEntry, m_zone, m_stream); \
writer.Write(&varXAsset->header.headerEntry); \
break; \
}
assert(varXAsset != nullptr);
@ -141,62 +140,62 @@ void ContentWriter::WriteXAsset(const bool atStreamStart)
switch (varXAsset->type)
{
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints)
WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon)
WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment)
WRITE_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique)
WRITE_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo)
WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef)
WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals)
WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot)
WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses)
WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet)
WRITE_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree)
WRITE_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs)
WRITE_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef)
WRITE_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock);
WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts)
WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef)
WRITE_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef)
WRITE_ASSET(ASSET_TYPE_QDB, Qdb, qdb)
WRITE_ASSET(ASSET_TYPE_SLUG, Slug, slug)
WRITE_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef)
WRITE_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef)
WRITE_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef)
WRITE_ASSET(ASSET_TYPE_PHYSPRESET, PhysPreset, physPreset)
WRITE_ASSET(ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints, physConstraints)
WRITE_ASSET(ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef, destructibleDef)
WRITE_ASSET(ASSET_TYPE_XANIMPARTS, XAnimParts, parts)
WRITE_ASSET(ASSET_TYPE_XMODEL, XModel, model)
WRITE_ASSET(ASSET_TYPE_MATERIAL, Material, material)
WRITE_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet)
WRITE_ASSET(ASSET_TYPE_IMAGE, GfxImage, image)
WRITE_ASSET(ASSET_TYPE_SOUND, SndBank, sound)
WRITE_ASSET(ASSET_TYPE_SOUND_PATCH, SndPatch, soundPatch)
WRITE_ASSET(ASSET_TYPE_CLIPMAP, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_CLIPMAP_PVS, clipMap_t, clipMap)
WRITE_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_SP, GameWorldSp, gameWorldSp)
WRITE_ASSET(ASSET_TYPE_GAMEWORLD_MP, GameWorldMp, gameWorldMp)
WRITE_ASSET(ASSET_TYPE_MAP_ENTS, MapEnts, mapEnts)
WRITE_ASSET(ASSET_TYPE_GFXWORLD, GfxWorld, gfxWorld)
WRITE_ASSET(ASSET_TYPE_LIGHT_DEF, GfxLightDef, lightDef)
WRITE_ASSET(ASSET_TYPE_FONT, Font_s, font)
WRITE_ASSET(ASSET_TYPE_FONTICON, FontIcon, fontIcon)
WRITE_ASSET(ASSET_TYPE_MENULIST, MenuList, menuList)
WRITE_ASSET(ASSET_TYPE_MENU, menuDef_t, menu)
WRITE_ASSET(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry, localize)
WRITE_ASSET(ASSET_TYPE_WEAPON, WeaponVariantDef, weapon)
WRITE_ASSET(ASSET_TYPE_ATTACHMENT, WeaponAttachment, attachment)
WRITE_ASSET(ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique, attachmentUnique)
WRITE_ASSET(ASSET_TYPE_WEAPON_CAMO, WeaponCamo, weaponCamo)
WRITE_ASSET(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals, sndDriverGlobals)
WRITE_ASSET(ASSET_TYPE_FX, FxEffectDef, fx)
WRITE_ASSET(ASSET_TYPE_IMPACT_FX, FxImpactTable, impactFx)
WRITE_ASSET(ASSET_TYPE_RAWFILE, RawFile, rawfile)
WRITE_ASSET(ASSET_TYPE_STRINGTABLE, StringTable, stringTable)
WRITE_ASSET(ASSET_TYPE_LEADERBOARD, LeaderboardDef, leaderboardDef)
WRITE_ASSET(ASSET_TYPE_XGLOBALS, XGlobals, xGlobals)
WRITE_ASSET(ASSET_TYPE_DDL, ddlRoot_t, ddlRoot)
WRITE_ASSET(ASSET_TYPE_GLASSES, Glasses, glasses)
WRITE_ASSET(ASSET_TYPE_EMBLEMSET, EmblemSet, emblemSet)
WRITE_ASSET(ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree, scriptParseTree)
WRITE_ASSET(ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs, keyValuePairs)
WRITE_ASSET(ASSET_TYPE_VEHICLEDEF, VehicleDef, vehicleDef)
WRITE_ASSET(ASSET_TYPE_MEMORYBLOCK, MemoryBlock, memoryBlock);
WRITE_ASSET(ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts, addonMapEnts)
WRITE_ASSET(ASSET_TYPE_TRACER, TracerDef, tracerDef)
WRITE_ASSET(ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef, skinnedVertsDef)
WRITE_ASSET(ASSET_TYPE_QDB, Qdb, qdb)
WRITE_ASSET(ASSET_TYPE_SLUG, Slug, slug)
WRITE_ASSET(ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef, footstepTableDef)
WRITE_ASSET(ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef, footstepFXTableDef)
WRITE_ASSET(ASSET_TYPE_ZBARRIER, ZBarrierDef, zbarrierDef)
default:
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
{
std::ostringstream str;
str << "Unsupported asset type: " << varXAsset->type << ".";
throw WritingException(str.str());
}
}
#undef WRITE_ASSET

View File

@ -1,7 +1,7 @@
#pragma once
#include "Game/T6/T6.h"
#include "Writing/ContentWriterBase.h"
#include "Writing/IContentWritingEntryPoint.h"
#include "Game/T6/T6.h"
namespace T6
{
@ -23,4 +23,4 @@ namespace T6
void WriteContent(Zone* zone, IZoneOutputStream* stream) override;
};
}
} // namespace T6

View File

@ -1,16 +1,11 @@
#include "ZoneWriterFactoryT6.h"
#include <cassert>
#include <cstring>
#include "ContentWriterT6.h"
#include "Utils/ICapturedDataProvider.h"
#include "Game/T6/T6.h"
#include "Game/T6/GameT6.h"
#include "Game/T6/T6.h"
#include "Game/T6/ZoneConstantsT6.h"
#include "Utils/ICapturedDataProvider.h"
#include "Writing/Processor/OutputProcessorXChunks.h"
#include "Zone/XChunk/XChunkProcessorDeflate.h"
#include "Zone/XChunk/XChunkProcessorSalsa20Encryption.h"
#include "Writing/Steps/StepAddOutputProcessor.h"
#include "Writing/Steps/StepAlign.h"
#include "Writing/Steps/StepRemoveOutputProcessor.h"
@ -20,6 +15,11 @@
#include "Writing/Steps/StepWriteZoneContentToMemory.h"
#include "Writing/Steps/StepWriteZoneHeader.h"
#include "Writing/Steps/StepWriteZoneSizes.h"
#include "Zone/XChunk/XChunkProcessorDeflate.h"
#include "Zone/XChunk/XChunkProcessorSalsa20Encryption.h"
#include <cassert>
#include <cstring>
using namespace T6;
@ -56,7 +56,7 @@ public:
ZoneHeader header{};
header.m_version = ZoneConstants::ZONE_VERSION;
if(isSecure)
if (isSecure)
{
if (isOfficial)
memcpy(header.m_magic, ZoneConstants::MAGIC_SIGNED_TREYARCH, sizeof(ZoneHeader::m_magic));
@ -76,7 +76,8 @@ public:
void AddXChunkProcessor(const bool isEncrypted, ICapturedDataProvider** dataToSignProviderPtr, OutputProcessorXChunks** xChunkProcessorPtr) const
{
auto xChunkProcessor = std::make_unique<OutputProcessorXChunks>(ZoneConstants::STREAM_COUNT, ZoneConstants::XCHUNK_SIZE, ZoneConstants::XCHUNK_MAX_WRITE_SIZE, ZoneConstants::VANILLA_BUFFER_SIZE);
auto xChunkProcessor = std::make_unique<OutputProcessorXChunks>(
ZoneConstants::STREAM_COUNT, ZoneConstants::XCHUNK_SIZE, ZoneConstants::XCHUNK_MAX_WRITE_SIZE, ZoneConstants::VANILLA_BUFFER_SIZE);
if (xChunkProcessorPtr)
*xChunkProcessorPtr = xChunkProcessor.get();
@ -86,8 +87,8 @@ public:
if (isEncrypted)
{
// If zone is encrypted, the decryption is applied before the decompression. T6 Zones always use Salsa20.
auto chunkProcessorSalsa20 = std::make_unique<XChunkProcessorSalsa20Encryption>(ZoneConstants::STREAM_COUNT, m_zone->m_name, ZoneConstants::SALSA20_KEY_TREYARCH,
sizeof(ZoneConstants::SALSA20_KEY_TREYARCH));
auto chunkProcessorSalsa20 = std::make_unique<XChunkProcessorSalsa20Encryption>(
ZoneConstants::STREAM_COUNT, m_zone->m_name, ZoneConstants::SALSA20_KEY_TREYARCH, sizeof(ZoneConstants::SALSA20_KEY_TREYARCH));
// If there is encryption, the signed data of the zone is the final hash blocks provided by the Salsa20 IV adaption algorithm
if (dataToSignProviderPtr)
@ -97,7 +98,6 @@ public:
}
m_writer->AddWritingStep(std::make_unique<StepAddOutputProcessor>(std::move(xChunkProcessor)));
}
std::unique_ptr<ZoneWriter> CreateWriter()
@ -108,7 +108,8 @@ public:
SetupBlocks();
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto contentInMemory = std::make_unique<StepWriteZoneContentToMemory>(
std::make_unique<ContentWriter>(), m_zone, ZoneConstants::OFFSET_BLOCK_BIT_COUNT, ZoneConstants::INSERT_BLOCK);
auto* contentInMemoryPtr = contentInMemory.get();
m_writer->AddWritingStep(std::move(contentInMemory));
@ -121,7 +122,7 @@ public:
AddXChunkProcessor(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
// m_writer->AddWritingStep(std::make_unique<StepSkipBytes>(8)); // Skip size and externalSize fields since they are not interesting for us
m_writer->AddWritingStep(std::make_unique<StepWriteZoneSizes>(contentInMemoryPtr));
m_writer->AddWritingStep(std::make_unique<StepWriteXBlockSizes>(m_zone));

View File

@ -1,9 +1,9 @@
#pragma once
#include <memory>
#include "Writing/IZoneWriterFactory.h"
#include <memory>
namespace T6
{
class ZoneWriterFactory final : public IZoneWriterFactory
@ -14,4 +14,4 @@ namespace T6
_NODISCARD bool SupportsZone(Zone* zone) const override;
_NODISCARD std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const override;
};
}
} // namespace T6

View File

@ -1,10 +1,10 @@
#pragma once
#include "ContentWriterBase.h"
#include "Pool/XAssetInfo.h"
#include "Utils/ClassUtils.h"
#include "Zone/Zone.h"
#include "Zone/ZoneTypes.h"
#include "Pool/XAssetInfo.h"
#include "ContentWriterBase.h"
class AssetWriter : public ContentWriterBase
{

View File

@ -1,7 +1,7 @@
#pragma once
#include "Zone/Zone.h"
#include "Zone/Stream/IZoneOutputStream.h"
#include "Zone/Zone.h"
class ContentWriterBase
{

View File

@ -1,7 +1,7 @@
#pragma once
#include "Zone/Zone.h"
#include "Zone/Stream/IZoneOutputStream.h"
#include "Zone/Zone.h"
class IContentWritingEntryPoint
{
@ -14,4 +14,4 @@ public:
IContentWritingEntryPoint& operator=(IContentWritingEntryPoint&& other) noexcept = default;
virtual void WriteContent(Zone* zone, IZoneOutputStream* stream) = 0;
};
};

View File

@ -1,7 +1,7 @@
#pragma once
#include "Writing/ZoneWriter.h"
#include "IWritingStream.h"
#include "Writing/ZoneWriter.h"
class ZoneWriter;

View File

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include <cstdint>
class IWritingStream
{
@ -16,4 +16,4 @@ public:
virtual void Write(const void* buffer, size_t length) = 0;
virtual void Flush() = 0;
virtual int64_t Pos() = 0;
};
};

View File

@ -1,8 +1,8 @@
#pragma once
#include "Utils/ClassUtils.h"
#include "ZoneWriter.h"
#include "Zone/Zone.h"
#include "ZoneWriter.h"
class IZoneWriterFactory
{
@ -16,4 +16,4 @@ public:
_NODISCARD virtual bool SupportsZone(Zone* zone) const = 0;
_NODISCARD virtual std::unique_ptr<ZoneWriter> CreateWriter(Zone* zone) const = 0;
};
};

View File

@ -18,7 +18,7 @@ InMemoryZoneData::MemoryBuffer::MemoryBuffer(const size_t size)
void* InMemoryZoneData::GetBufferOfSize(const size_t size)
{
if(size > BUFFER_SIZE)
if (size > BUFFER_SIZE)
{
m_buffers.emplace_back(size);
}

View File

@ -1,7 +1,7 @@
#pragma once
#include <vector>
#include <memory>
#include <vector>
class InMemoryZoneData
{
@ -22,4 +22,4 @@ public:
InMemoryZoneData();
void* GetBufferOfSize(size_t size);
};
};

View File

@ -8,4 +8,4 @@ OutputStreamProcessor::OutputStreamProcessor()
void OutputStreamProcessor::SetBaseStream(IWritingStream* baseStream)
{
m_base_stream = baseStream;
}
}

View File

@ -1,13 +1,13 @@
#include "OutputProcessorDeflate.h"
#include <stdexcept>
#include <cstdint>
#include <memory>
#include <zlib.h>
#include "Utils/ClassUtils.h"
#include "Writing/WritingException.h"
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <zlib.h>
class OutputProcessorDeflate::Impl
{
z_stream m_stream{};
@ -62,7 +62,7 @@ public:
m_stream.next_out = m_buffer.get();
m_stream.avail_out = m_buffer_size;
}
const auto ret = deflate(&m_stream, Z_NO_FLUSH);
if (ret != Z_OK)
throw WritingException("Failed to deflate memory of zone.");
@ -73,7 +73,7 @@ public:
{
m_stream.avail_in = 0;
m_stream.next_in = Z_NULL;
while(true)
while (true)
{
if (m_stream.avail_out < m_buffer_size)
{
@ -83,7 +83,7 @@ public:
}
const auto ret = deflate(&m_stream, Z_FINISH);
if(ret == Z_OK)
if (ret == Z_OK)
continue;
if (ret != Z_STREAM_END)

View File

@ -1,9 +1,9 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include "Writing/OutputStreamProcessor.h"
#include <cstddef>
#include <cstdint>
class OutputProcessorDeflate final : public OutputStreamProcessor
{
class Impl;
@ -23,4 +23,4 @@ public:
void Write(const void* buffer, size_t length) override;
void Flush() override;
int64_t Pos() override;
};
};

View File

@ -1,12 +1,12 @@
#include "OutputProcessorXChunks.h"
#include "Writing/WritingException.h"
#include "Zone/XChunk/XChunkException.h"
#include "Zone/ZoneTypes.h"
#include <cassert>
#include <cstring>
#include "Writing/WritingException.h"
#include "Zone/ZoneTypes.h"
#include "Zone/XChunk/XChunkException.h"
void OutputProcessorXChunks::Init()
{
if (m_vanilla_buffer_size > 0)

View File

@ -1,12 +1,12 @@
#pragma once
#include <memory>
#include <vector>
#include <cstdint>
#include <cstddef>
#include "Writing/OutputStreamProcessor.h"
#include "Zone/XChunk/IXChunkProcessor.h"
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
class OutputProcessorXChunks final : public OutputStreamProcessor
{
std::vector<std::unique_ptr<IXChunkProcessor>> m_chunk_processors;

View File

@ -1,4 +1,5 @@
#include "StepAddOutputProcessor.h"
#include <cassert>
StepAddOutputProcessor::StepAddOutputProcessor(std::unique_ptr<OutputStreamProcessor> streamProcessor)
@ -14,4 +15,4 @@ void StepAddOutputProcessor::PerformStep(ZoneWriter* zoneWriter, IWritingStream*
stream->Flush();
zoneWriter->AddStreamProcessor(std::move(m_stream_processor));
m_stream_processor = nullptr;
}
}

View File

@ -1,9 +1,9 @@
#pragma once
#include <memory>
#include "Writing/OutputStreamProcessor.h"
#include "Writing/IWritingStep.h"
#include "Writing/OutputStreamProcessor.h"
#include <memory>
class StepAddOutputProcessor final : public IWritingStep
{

View File

@ -12,6 +12,6 @@ void StepAlign::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream)
const auto targetPos = (pos + m_align_to - 1) / m_align_to * m_align_to;
const auto valueCount = static_cast<size_t>(targetPos - pos);
for(auto i = 0u; i < valueCount; i++)
for (auto i = 0u; i < valueCount; i++)
stream->Write(&m_align_value, sizeof(m_align_value));
}

View File

@ -1,10 +1,10 @@
#pragma once
#include "Writing/IWritingStep.h"
#include <cstddef>
#include <cstdint>
#include "Writing/IWritingStep.h"
class StepAlign final : public IWritingStep
{
size_t m_align_to;

View File

@ -1,7 +1,7 @@
#pragma once
#include "Writing/OutputStreamProcessor.h"
#include "Writing/IWritingStep.h"
#include "Writing/OutputStreamProcessor.h"
class StepRemoveOutputProcessor final : public IWritingStep
{

View File

@ -3,9 +3,7 @@
#include <algorithm>
#include <ctime>
StepWriteTimestamp::StepWriteTimestamp()
{
}
StepWriteTimestamp::StepWriteTimestamp() {}
void StepWriteTimestamp::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream)
{

View File

@ -7,7 +7,7 @@ StepWriteXBlockSizes::StepWriteXBlockSizes(Zone* zone)
void StepWriteXBlockSizes::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream)
{
for(const auto& block : zoneWriter->m_blocks)
for (const auto& block : zoneWriter->m_blocks)
{
auto blockSize = static_cast<xblock_size_t>(block->m_buffer_size);
stream->Write(&blockSize, sizeof(blockSize));

View File

@ -12,7 +12,7 @@ void StepWriteZero::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream)
const uint64_t num = 0;
size_t toWrite;
for(auto i = 0u; i < m_count; i += toWrite)
for (auto i = 0u; i < m_count; i += toWrite)
{
toWrite = std::min(sizeof(uint64_t), m_count - i);
stream->Write(&num, toWrite);

View File

@ -7,7 +7,7 @@ StepWriteZoneContentToFile::StepWriteZoneContentToFile(StepWriteZoneContentToMem
void StepWriteZoneContentToFile::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream)
{
for(const auto& dataBuffer : m_memory->GetData()->m_buffers)
for (const auto& dataBuffer : m_memory->GetData()->m_buffers)
{
stream->Write(dataBuffer.m_data.get(), dataBuffer.m_size);
}

View File

@ -2,7 +2,10 @@
#include "Zone/Stream/Impl/InMemoryZoneOutputStream.h"
StepWriteZoneContentToMemory::StepWriteZoneContentToMemory(std::unique_ptr<IContentWritingEntryPoint> entryPoint, Zone* zone, int offsetBlockBitCount, block_t insertBlock)
StepWriteZoneContentToMemory::StepWriteZoneContentToMemory(std::unique_ptr<IContentWritingEntryPoint> entryPoint,
Zone* zone,
int offsetBlockBitCount,
block_t insertBlock)
: m_content_loader(std::move(entryPoint)),
m_zone_data(std::make_unique<InMemoryZoneData>()),
m_zone(zone),

View File

@ -1,11 +1,11 @@
#pragma once
#include <memory>
#include "Utils/ClassUtils.h"
#include "Writing/IContentWritingEntryPoint.h"
#include "Writing/InMemoryZoneData.h"
#include "Writing/IWritingStep.h"
#include "Writing/InMemoryZoneData.h"
#include <memory>
class StepWriteZoneContentToMemory final : public IWritingStep
{

View File

@ -1,9 +1,9 @@
#pragma once
#include <string>
#include <exception>
#include "Utils/ClassUtils.h"
#include <exception>
#include <string>
class WritingException final : public std::exception
{
std::string m_error_message;

View File

@ -1,8 +1,8 @@
#pragma once
#include <ostream>
#include "IWritingStream.h"
#include <ostream>
class WritingFileStream final : public IWritingStream
{
std::ostream& m_stream;

View File

@ -1,11 +1,11 @@
#include "ZoneWriter.h"
#include <iostream>
#include <stdexcept>
#include "WritingException.h"
#include "WritingFileStream.h"
#include <iostream>
#include <stdexcept>
ZoneWriter::ZoneWriter()
: m_processor_chain_dirty(false)
{

View File

@ -1,12 +1,12 @@
#pragma once
#include <vector>
#include <memory>
#include "IWritingStep.h"
#include "OutputStreamProcessor.h"
#include "Zone/Zone.h"
#include <memory>
#include <vector>
class IWritingStep;
class ZoneWriter

View File

@ -1,11 +1,11 @@
#pragma once
#include "Zone/Stream/IZoneStream.h"
#include <cstddef>
#include <typeindex>
#include <typeinfo>
#include "Zone/Stream/IZoneStream.h"
class IZoneOutputStream : public IZoneStream
{
public:
@ -23,44 +23,37 @@ public:
virtual void ReusableAddOffset(void* ptr, size_t size, size_t count, std::type_index type) = 0;
virtual void MarkFollowing(void** pPtr) = 0;
template<typename T>
bool ReusableShouldWrite(T** pPtr)
template<typename T> bool ReusableShouldWrite(T** pPtr)
{
return ReusableShouldWrite(reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(pPtr)), sizeof(T), std::type_index(typeid(T)));
}
template<typename T>
void ReusableAddOffset(T* ptr)
template<typename T> void ReusableAddOffset(T* ptr)
{
ReusableAddOffset(const_cast<void*>(reinterpret_cast<const void*>(ptr)), sizeof(T), 1, std::type_index(typeid(T)));
}
template<typename T>
void ReusableAddOffset(T* ptr, const size_t count)
template<typename T> void ReusableAddOffset(T* ptr, const size_t count)
{
ReusableAddOffset(const_cast<void*>(reinterpret_cast<const void*>(ptr)), sizeof(T), count, std::type_index(typeid(T)));
}
template<typename T>
T* Write(T* dst)
template<typename T> T* Write(T* dst)
{
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), sizeof(T)));
}
template<typename T>
T* Write(T* dst, const uint32_t count)
template<typename T> T* Write(T* dst, const uint32_t count)
{
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), count * sizeof(T)));
}
template<typename T>
T* WritePartial(T* dst, const size_t size)
template<typename T> T* WritePartial(T* dst, const size_t size)
{
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), size));
}
template<typename T>
void MarkFollowing(T*& ptr)
template<typename T> void MarkFollowing(T*& ptr)
{
MarkFollowing(reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(&ptr)));
}

View File

@ -15,7 +15,8 @@ InMemoryZoneOutputStream::ReusableEntry::ReusableEntry(void* startPtr, const siz
: m_start_ptr(startPtr),
m_end_ptr(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(startPtr) + entrySize * entryCount)),
m_start_zone_ptr(startZonePtr),
m_entry_size(entrySize), m_entry_count(entryCount)
m_entry_size(entrySize),
m_entry_count(entryCount)
{
}
@ -184,16 +185,16 @@ bool InMemoryZoneOutputStream::ReusableShouldWrite(void** pPtr, const size_t ent
return true;
}
for(const auto& entry : foundEntriesForType->second)
for (const auto& entry : foundEntriesForType->second)
{
if(*pPtr >= entry.m_start_ptr && *pPtr < entry.m_end_ptr)
if (*pPtr >= entry.m_start_ptr && *pPtr < entry.m_end_ptr)
{
assert((reinterpret_cast<uintptr_t>(*pPtr) - reinterpret_cast<uintptr_t>(entry.m_start_ptr)) % entrySize == 0);
*pPtr = reinterpret_cast<void*>(entry.m_start_zone_ptr + (reinterpret_cast<uintptr_t>(*pPtr) - reinterpret_cast<uintptr_t>(entry.m_start_ptr)));
return false;
}
}
return true;
}

View File

@ -1,12 +1,12 @@
#pragma once
#include "Writing/InMemoryZoneData.h"
#include "Zone/Stream/IZoneOutputStream.h"
#include "Zone/XBlock.h"
#include <stack>
#include <unordered_map>
#include <vector>
#include "Writing/InMemoryZoneData.h"
#include "Zone/XBlock.h"
#include "Zone/Stream/IZoneOutputStream.h"
class InMemoryZoneOutputStream final : public IZoneOutputStream
{
class ReusableEntry

View File

@ -7,14 +7,8 @@
#include "Game/T6/ZoneWriterFactoryT6.h"
#include "Writing/IZoneWriterFactory.h"
IZoneWriterFactory* ZoneWriterFactories[]
{
new IW3::ZoneWriterFactory(),
new IW4::ZoneWriterFactory(),
new IW5::ZoneWriterFactory(),
new T5::ZoneWriterFactory(),
new T6::ZoneWriterFactory()
};
IZoneWriterFactory* ZoneWriterFactories[]{
new IW3::ZoneWriterFactory(), new IW4::ZoneWriterFactory(), new IW5::ZoneWriterFactory(), new T5::ZoneWriterFactory(), new T6::ZoneWriterFactory()};
bool ZoneWriting::WriteZone(std::ostream& stream, Zone* zone)
{

View File

@ -1,11 +1,11 @@
#pragma once
#include <string>
#include <ostream>
#include "Zone/Zone.h"
#include <ostream>
#include <string>
class ZoneWriting
{
public:
static bool WriteZone(std::ostream& stream, Zone* zone);
};
};