2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-10-18 12:39:03 +00:00

chore: generalize IAssetDumper interface

This commit is contained in:
Jan Laupetin
2025-10-15 20:06:01 +01:00
parent c6e9cbedda
commit 6a84d1ea68
152 changed files with 1051 additions and 586 deletions

View File

@@ -25,7 +25,8 @@ public:
[[nodiscard]] virtual std::optional<asset_type_t> GetHandlingAssetType() const = 0;
virtual AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) = 0;
virtual void FinalizeZone(AssetCreationContext& context) {};
virtual void FinalizeZone(AssetCreationContext& context) {}
};
template<typename AssetType> class AssetCreator : public IAssetCreator

View File

@@ -1,18 +1,24 @@
#pragma once
#include "Game/IAsset.h"
#include "IAssetDumper.h"
#include "Pool/AssetPool.h"
template<class T> class AbstractAssetDumper : public IAssetDumper<T>
template<class AssetType> class AbstractAssetDumper : public IAssetDumper
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
public:
[[nodiscard]] size_t GetProgressTotalCount(const AssetPool<T>& pool) const override
using AssetType_t = AssetType;
[[nodiscard]] size_t GetProgressTotalCount() const override
{
return pool.m_asset_lookup.size();
return m_pool.m_asset_lookup.size();
}
void DumpPool(AssetDumpingContext& context, const AssetPool<T>& pool) override
void Dump(AssetDumpingContext& context) override
{
for (const auto* assetInfo : pool)
for (const auto* assetInfo : m_pool)
{
if (assetInfo->m_name[0] == ',' || !ShouldDump(*assetInfo))
{
@@ -26,10 +32,38 @@ public:
}
protected:
virtual bool ShouldDump(const XAssetInfo<T>& asset)
explicit AbstractAssetDumper(const AssetPool<typename AssetType::Type>& pool)
: m_pool(pool)
{
}
virtual bool ShouldDump(const XAssetInfo<typename AssetType::Type>& asset)
{
return true;
}
virtual void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T>& asset) = 0;
virtual void DumpAsset(AssetDumpingContext& context, const XAssetInfo<typename AssetType::Type>& asset) = 0;
const AssetPool<typename AssetType::Type>& m_pool;
};
template<class AssetType> class AbstractSingleProgressAssetDumper : public IAssetDumper
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
public:
using AssetType_t = AssetType;
[[nodiscard]] size_t GetProgressTotalCount() const override
{
return m_pool.m_asset_lookup.empty() ? 0uz : 1uz;
}
protected:
explicit AbstractSingleProgressAssetDumper(const AssetPool<typename AssetType::Type>& pool)
: m_pool(pool)
{
}
const AssetPool<typename AssetType::Type>& m_pool;
};

View File

@@ -1,9 +1,8 @@
#pragma once
#include "AssetDumpingContext.h"
#include "Pool/AssetPool.h"
template<class T> class IAssetDumper
class IAssetDumper
{
public:
IAssetDumper() = default;
@@ -13,6 +12,6 @@ public:
IAssetDumper& operator=(const IAssetDumper& other) = default;
IAssetDumper& operator=(IAssetDumper&& other) noexcept = default;
[[nodiscard]] virtual size_t GetProgressTotalCount(const AssetPool<T>& pool) const = 0;
virtual void DumpPool(AssetDumpingContext& context, const AssetPool<T>& pool) = 0;
[[nodiscard]] virtual size_t GetProgressTotalCount() const = 0;
virtual void Dump(AssetDumpingContext& context) = 0;
};

View File

@@ -62,7 +62,8 @@ namespace
namespace image
{
DumperIW3::DumperIW3()
DumperIW3::DumperIW3(const AssetPool<AssetImage::Type>& pool)
: AbstractAssetDumper(pool)
{
switch (ObjWriting::Configuration.ImageOutputFormat)
{

View File

@@ -8,13 +8,13 @@
namespace image
{
class DumperIW3 final : public AbstractAssetDumper<IW3::GfxImage>
class DumperIW3 final : public AbstractAssetDumper<IW3::AssetImage>
{
public:
DumperIW3();
explicit DumperIW3(const AssetPool<IW3::AssetImage::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::GfxImage>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::AssetImage::Type>& asset) override;
private:
std::unique_ptr<IImageWriter> m_writer;

View File

@@ -11,14 +11,19 @@ using namespace IW3;
namespace localize
{
size_t DumperIW3::GetProgressTotalCount(const AssetPool<IW3::LocalizeEntry>& pool) const
DumperIW3::DumperIW3(const AssetPool<IW3::AssetLocalize::Type>& pool)
: AbstractSingleProgressAssetDumper(pool)
{
return pool.m_asset_lookup.empty() ? 0uz : 1uz;
}
void DumperIW3::DumpPool(AssetDumpingContext& context, const AssetPool<LocalizeEntry>& pool)
size_t DumperIW3::GetProgressTotalCount() const
{
if (pool.m_asset_lookup.empty())
return m_pool.m_asset_lookup.empty() ? 0uz : 1uz;
}
void DumperIW3::Dump(AssetDumpingContext& context)
{
if (m_pool.m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
@@ -35,7 +40,7 @@ namespace localize
stringFileDumper.SetNotes("");
for (const auto* localizeEntry : pool)
for (const auto* localizeEntry : m_pool)
{
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value);
}

View File

@@ -2,13 +2,16 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW3/IW3.h"
#include "Pool/AssetPool.h"
namespace localize
{
class DumperIW3 final : public IAssetDumper<IW3::LocalizeEntry>
class DumperIW3 final : public AbstractSingleProgressAssetDumper<IW3::AssetLocalize>
{
public:
[[nodiscard]] size_t GetProgressTotalCount(const AssetPool<IW3::LocalizeEntry>& pool) const override;
void DumpPool(AssetDumpingContext& context, const AssetPool<IW3::LocalizeEntry>& pool) override;
explicit DumperIW3(const AssetPool<IW3::AssetLocalize::Type>& pool);
[[nodiscard]] size_t GetProgressTotalCount() const override;
void Dump(AssetDumpingContext& context) override;
};
} // namespace localize

View File

@@ -4,6 +4,11 @@ using namespace IW3;
namespace map_ents
{
DumperIW3::DumperIW3(const AssetPool<IW3::AssetMapEnts::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW3::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MapEnts>& asset)
{
const auto* mapEnts = asset.Asset();

View File

@@ -5,8 +5,11 @@
namespace map_ents
{
class DumperIW3 final : public AbstractAssetDumper<IW3::MapEnts>
class DumperIW3 final : public AbstractAssetDumper<IW3::AssetMapEnts>
{
public:
explicit DumperIW3(const AssetPool<IW3::AssetMapEnts::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::MapEnts>& asset) override;
};

View File

@@ -15,56 +15,55 @@ using namespace IW3;
bool ObjWriter::DumpZone(AssetDumpingContext& context) const
{
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
#define REGISTER_DUMPER(dumperType, poolName) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(dumperType::AssetType_t::EnumEntry)) \
{ \
dumperType dumper; \
totalProgress += dumper.GetProgressTotalCount(*assetPools->poolName); \
dumpingFunctions.emplace_back( \
[](AssetDumpingContext& funcContext, const GameAssetPoolIW3* funcPools) \
{ \
dumperType dumper; \
dumper.DumpPool(funcContext, *funcPools->poolName); \
}); \
dumpers.emplace_back(std::make_unique<dumperType>(*assetPools->poolName)); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolIW3*>(context.m_zone.m_pools.get());
std::vector<std::unique_ptr<IAssetDumper>> dumpers;
size_t totalProgress = 0uz;
std::vector<std::function<void(AssetDumpingContext & context, const GameAssetPoolIW3*)>> dumpingFunctions;
// REGISTER_DUMPER(AssetDumperPhysPreset, m_phys_preset)
// REGISTER_DUMPER(AssetDumperXAnimParts, m_xanim_parts)
REGISTER_DUMPER(xmodel::DumperIW3, m_xmodel)
REGISTER_DUMPER(material::JsonDumperIW3, m_material)
// REGISTER_DUMPER(AssetDumperMaterialTechniqueSet, m_technique_set)
REGISTER_DUMPER(image::DumperIW3, m_image)
// REGISTER_DUMPER(AssetDumpersnd_alias_list_t, m_sound)
// REGISTER_DUMPER(AssetDumperSndCurve, m_sound_curve)
REGISTER_DUMPER(sound::LoadedSoundDumperIW3, m_loaded_sound)
// REGISTER_DUMPER(AssetDumperClipMap, m_clip_map)
// REGISTER_DUMPER(AssetDumperComWorld, m_com_world)
// REGISTER_DUMPER(AssetDumperGameWorldSp, m_game_world_sp)
// REGISTER_DUMPER(AssetDumperGameWorldMp, m_game_world_mp)
REGISTER_DUMPER(map_ents::DumperIW3, m_map_ents)
// REGISTER_DUMPER(AssetDumperGfxWorld, m_gfx_world)
// REGISTER_DUMPER(AssetDumperGfxLightDef, m_gfx_light_def)
// REGISTER_DUMPER(AssetDumperFont_s, m_font)
// REGISTER_DUMPER(AssetDumperMenuList, m_menu_list)
// REGISTER_DUMPER(AssetDumpermenuDef_t, m_menu_def)
REGISTER_DUMPER(localize::DumperIW3, m_localize)
// REGISTER_DUMPER(AssetDumperWeapon, m_weapon)
// REGISTER_DUMPER(AssetDumperSndDriverGlobals, m_snd_driver_globals)
// REGISTER_DUMPER(AssetDumperFxEffectDef, m_fx)
// REGISTER_DUMPER(AssetDumperFxImpactTable, m_fx_impact_table)
REGISTER_DUMPER(raw_file::DumperIW3, m_raw_file)
REGISTER_DUMPER(string_table::DumperIW3, m_string_table)
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
DUMP_ASSET_POOL(xmodel::DumperIW3, m_xmodel, ASSET_TYPE_XMODEL)
DUMP_ASSET_POOL(material::JsonDumperIW3, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(image::DumperIW3, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(sound::LoadedSoundDumperIW3, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP_PVS)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
DUMP_ASSET_POOL(map_ents::DumperIW3, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT)
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
// DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(localize::DumperIW3, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
// DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(raw_file::DumperIW3, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(string_table::DumperIW3, m_string_table, ASSET_TYPE_STRINGTABLE)
if (context.ShouldTrackProgress())
{
size_t totalProgress = 0uz;
for (const auto& dumper : dumpers)
totalProgress += dumper->GetProgressTotalCount();
context.SetTotalProgress(totalProgress);
for (const auto& func : dumpingFunctions)
func(context, assetPools);
context.SetTotalProgress(totalProgress);
}
for (const auto& dumper : dumpers)
dumper->Dump(context);
return true;
#undef DUMP_ASSET_POOL
#undef REGISTER_DUMPER
}

View File

@@ -4,6 +4,11 @@ using namespace IW3;
namespace raw_file
{
DumperIW3::DumperIW3(const AssetPool<AssetRawFile::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW3::DumpAsset(AssetDumpingContext& context, const XAssetInfo<RawFile>& asset)
{
const auto* rawFile = asset.Asset();

View File

@@ -5,8 +5,11 @@
namespace raw_file
{
class DumperIW3 final : public AbstractAssetDumper<IW3::RawFile>
class DumperIW3 final : public AbstractAssetDumper<IW3::AssetRawFile>
{
public:
explicit DumperIW3(const AssetPool<IW3::AssetRawFile::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::RawFile>& asset) override;
};

View File

@@ -25,6 +25,11 @@ namespace
namespace sound
{
LoadedSoundDumperIW3::LoadedSoundDumperIW3(const AssetPool<AssetLoadedSound::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void LoadedSoundDumperIW3::DumpAsset(AssetDumpingContext& context, const XAssetInfo<LoadedSound>& asset)
{
const auto* loadedSound = asset.Asset();

View File

@@ -5,9 +5,12 @@
namespace sound
{
class LoadedSoundDumperIW3 final : public AbstractAssetDumper<IW3::LoadedSound>
class LoadedSoundDumperIW3 final : public AbstractAssetDumper<IW3::AssetLoadedSound>
{
public:
explicit LoadedSoundDumperIW3(const AssetPool<IW3::AssetLoadedSound::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::LoadedSound>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::AssetLoadedSound::Type>& asset) override;
};
} // namespace sound

View File

@@ -6,6 +6,11 @@ using namespace IW3;
namespace string_table
{
DumperIW3::DumperIW3(const AssetPool<AssetStringTable::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW3::DumpAsset(AssetDumpingContext& context, const XAssetInfo<StringTable>& asset)
{
const auto* stringTable = asset.Asset();

View File

@@ -5,8 +5,11 @@
namespace string_table
{
class DumperIW3 final : public AbstractAssetDumper<IW3::StringTable>
class DumperIW3 final : public AbstractAssetDumper<IW3::AssetStringTable>
{
public:
explicit DumperIW3(const AssetPool<IW3::AssetStringTable::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::StringTable>& asset) override;
};

View File

@@ -59,7 +59,8 @@ namespace
namespace image
{
DumperIW4::DumperIW4()
DumperIW4::DumperIW4(const AssetPool<AssetImage::Type>& pool)
: AbstractAssetDumper(pool)
{
switch (ObjWriting::Configuration.ImageOutputFormat)
{
@@ -76,7 +77,7 @@ namespace image
}
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<GfxImage>& asset)
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetImage::Type>& asset)
{
const auto* image = asset.Asset();
const auto texture = LoadImageData(context.m_obj_search_path, *image);

View File

@@ -8,13 +8,13 @@
namespace image
{
class DumperIW4 final : public AbstractAssetDumper<IW4::GfxImage>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetImage>
{
public:
DumperIW4();
explicit DumperIW4(const AssetPool<IW4::AssetImage::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::GfxImage>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetImage::Type>& asset) override;
private:
std::unique_ptr<IImageWriter> m_writer;

View File

@@ -77,7 +77,12 @@ namespace
namespace leaderboard
{
void JsonDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<LeaderboardDef>& asset)
JsonDumperIW4::JsonDumperIW4(const AssetPool<AssetLeaderboard::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void JsonDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetLeaderboard::Type>& asset)
{
const auto assetFile = context.OpenAssetFile(GetJsonFileNameForAsset(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace leaderboard
{
class JsonDumperIW4 final : public AbstractAssetDumper<IW4::LeaderboardDef>
class JsonDumperIW4 final : public AbstractAssetDumper<IW4::AssetLeaderboard>
{
public:
explicit JsonDumperIW4(const AssetPool<IW4::AssetLeaderboard::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::LeaderboardDef>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetLeaderboard::Type>& asset) override;
};
} // namespace leaderboard

View File

@@ -6,7 +6,12 @@ using namespace IW4;
namespace light_def
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<GfxLightDef>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetLightDef::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetLightDef::Type>& asset)
{
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace light_def
{
class DumperIW4 final : public AbstractAssetDumper<IW4::GfxLightDef>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetLightDef>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetLightDef::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::GfxLightDef>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetLightDef::Type>& asset) override;
};
} // namespace light_def

View File

@@ -10,14 +10,14 @@ using namespace IW4;
namespace localize
{
size_t DumperIW4::GetProgressTotalCount(const AssetPool<LocalizeEntry>& pool) const
DumperIW4::DumperIW4(const AssetPool<AssetLocalize::Type>& pool)
: AbstractSingleProgressAssetDumper(pool)
{
return pool.m_asset_lookup.empty() ? 0uz : 1uz;
}
void DumperIW4::DumpPool(AssetDumpingContext& context, const AssetPool<LocalizeEntry>& pool)
void DumperIW4::Dump(AssetDumpingContext& context)
{
if (pool.m_asset_lookup.empty())
if (m_pool.m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
@@ -34,7 +34,7 @@ namespace localize
stringFileDumper.SetNotes("");
for (const auto* localizeEntry : pool)
for (const auto* localizeEntry : m_pool)
{
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value);
}

View File

@@ -5,10 +5,11 @@
namespace localize
{
class DumperIW4 final : public IAssetDumper<IW4::LocalizeEntry>
class DumperIW4 final : public AbstractSingleProgressAssetDumper<IW4::AssetLocalize>
{
public:
[[nodiscard]] size_t GetProgressTotalCount(const AssetPool<IW4::LocalizeEntry>& pool) const override;
void DumpPool(AssetDumpingContext& context, const AssetPool<IW4::LocalizeEntry>& pool) override;
explicit DumperIW4(const AssetPool<IW4::AssetLocalize::Type>& pool);
void Dump(AssetDumpingContext& context) override;
};
} // namespace localize

View File

@@ -7,7 +7,12 @@ using namespace IW4;
namespace addon_map_ents
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AddonMapEnts>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetAddonMapEnts::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetAddonMapEnts::Type>& asset)
{
const auto* addonMapEnts = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace addon_map_ents
{
class DumperIW4 final : public AbstractAssetDumper<IW4::AddonMapEnts>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetAddonMapEnts>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetAddonMapEnts::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AddonMapEnts>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetAddonMapEnts::Type>& asset) override;
};
} // namespace addon_map_ents

View File

@@ -1110,7 +1110,12 @@ namespace
namespace material
{
void DecompilingGdtDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<Material>& asset)
DecompilingGdtDumperIW4::DecompilingGdtDumperIW4(const AssetPool<AssetMaterial::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DecompilingGdtDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetMaterial::Type>& asset)
{
if (!context.m_gdt)
return;

View File

@@ -5,9 +5,12 @@
namespace material
{
class DecompilingGdtDumperIW4 final : public AbstractAssetDumper<IW4::Material>
class DecompilingGdtDumperIW4 final : public AbstractAssetDumper<IW4::AssetMaterial>
{
public:
explicit DecompilingGdtDumperIW4(const AssetPool<IW4::AssetMaterial::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::Material>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetMaterial::Type>& asset) override;
};
} // namespace material

View File

@@ -1,7 +1,6 @@
#include "MenuDumperIW4.h"
#include "Game/IW4/GameAssetPoolIW4.h"
#include "Game/IW4/Menu/MenuDumperIW4.h"
#include "MenuListDumperIW4.h"
#include "MenuWriterIW4.h"
#include "ObjWriting.h"
@@ -26,7 +25,12 @@ namespace
namespace menu
{
void MenuDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<menuDef_t>& asset)
MenuDumperIW4::MenuDumperIW4(const AssetPool<AssetMenu::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void MenuDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetMenu::Type>& asset)
{
const auto* menu = asset.Asset();
auto* zoneState = context.GetZoneAssetDumperState<MenuDumpingZoneState>();

View File

@@ -2,13 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "Menu/MenuDumpingZoneState.h"
namespace menu
{
class MenuDumperIW4 final : public AbstractAssetDumper<IW4::menuDef_t>
class MenuDumperIW4 final : public AbstractAssetDumper<IW4::AssetMenu>
{
public:
explicit MenuDumperIW4(const AssetPool<IW4::AssetMenu::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::menuDef_t>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetMenu::Type>& asset) override;
};
} // namespace menu

View File

@@ -147,7 +147,12 @@ namespace menu
}
}
void MenuListDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MenuList>& asset)
MenuListDumperIW4::MenuListDumperIW4(const AssetPool<AssetMenuList::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void MenuListDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetMenuList::Type>& asset)
{
const auto* menuList = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);
@@ -169,13 +174,13 @@ namespace menu
menuWriter->End();
}
void MenuListDumperIW4::DumpPool(AssetDumpingContext& context, const AssetPool<MenuList>& pool)
void MenuListDumperIW4::Dump(AssetDumpingContext& context)
{
auto* zoneState = context.GetZoneAssetDumperState<MenuDumpingZoneState>();
for (const auto* asset : pool)
for (const auto* asset : m_pool)
CreateDumpingStateForMenuListIW4(zoneState, asset->Asset());
AbstractAssetDumper<MenuList>::DumpPool(context, pool);
AbstractAssetDumper::Dump(context);
}
} // namespace menu

View File

@@ -2,19 +2,20 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "Game/IW4/Menu/MenuDumperIW4.h"
#include "Menu/MenuDumpingZoneState.h"
namespace menu
{
void CreateDumpingStateForMenuListIW4(MenuDumpingZoneState* zoneState, const IW4::MenuList* menuList);
class MenuListDumperIW4 final : public AbstractAssetDumper<IW4::MenuList>
class MenuListDumperIW4 final : public AbstractAssetDumper<IW4::AssetMenuList>
{
public:
void DumpPool(AssetDumpingContext& context, const AssetPool<IW4::MenuList>& pool) override;
explicit MenuListDumperIW4(const AssetPool<IW4::AssetMenuList::Type>& pool);
void Dump(AssetDumpingContext& context) override;
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::MenuList>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetMenuList::Type>& asset) override;
};
} // namespace menu

View File

@@ -30,68 +30,67 @@ using namespace IW4;
bool ObjWriter::DumpZone(AssetDumpingContext& context) const
{
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
#define REGISTER_DUMPER(dumperType, poolName) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(dumperType::AssetType_t::EnumEntry)) \
{ \
dumperType dumper; \
totalProgress += dumper.GetProgressTotalCount(*assetPools->poolName); \
dumpingFunctions.emplace_back( \
[](AssetDumpingContext& funcContext, const GameAssetPoolIW4* funcPools) \
{ \
dumperType dumper; \
dumper.DumpPool(funcContext, *funcPools->poolName); \
}); \
dumpers.emplace_back(std::make_unique<dumperType>(*assetPools->poolName)); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(context.m_zone.m_pools.get());
std::vector<std::unique_ptr<IAssetDumper>> dumpers;
size_t totalProgress = 0uz;
std::vector<std::function<void(AssetDumpingContext & context, const GameAssetPoolIW4*)>> dumpingFunctions;
DUMP_ASSET_POOL(phys_preset::InfoStringDumperIW4, m_phys_preset, ASSET_TYPE_PHYSPRESET)
DUMP_ASSET_POOL(phys_collmap::DumperIW4, m_phys_collmap, ASSET_TYPE_PHYSCOLLMAP)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
DUMP_ASSET_POOL(xmodel::DumperIW4, m_xmodel, ASSET_TYPE_XMODEL)
DUMP_ASSET_POOL(material::JsonDumperIW4, m_material, ASSET_TYPE_MATERIAL)
REGISTER_DUMPER(phys_preset::InfoStringDumperIW4, m_phys_preset)
REGISTER_DUMPER(phys_collmap::DumperIW4, m_phys_collmap)
// REGISTER_DUMPER(AssetDumperXAnimParts, m_xanim_parts)
REGISTER_DUMPER(xmodel::DumperIW4, m_xmodel)
REGISTER_DUMPER(material::JsonDumperIW4, m_material)
#ifdef EXPERIMENTAL_MATERIAL_COMPILATION
DUMP_ASSET_POOL(material::DecompilingGdtDumperIW4, m_material, ASSET_TYPE_MATERIAL)
DUMP_ASSET_POOL(material::DecompilingGdtDumperIW4, m_material)
#endif
DUMP_ASSET_POOL(shader::PixelShaderDumperIW4, m_material_pixel_shader, ASSET_TYPE_PIXELSHADER)
DUMP_ASSET_POOL(shader::VertexShaderDumperIW4, m_material_vertex_shader, ASSET_TYPE_VERTEXSHADER)
DUMP_ASSET_POOL(techset::DumperIW4, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(image::DumperIW4, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
DUMP_ASSET_POOL(sound_curve::DumperIW4, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(sound::LoadedSoundDumperIW4, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP_MP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world, ASSET_TYPE_FXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
DUMP_ASSET_POOL(light_def::DumperIW4, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT)
DUMP_ASSET_POOL(menu::MenuListDumperIW4, m_menu_list, ASSET_TYPE_MENULIST)
DUMP_ASSET_POOL(menu::MenuDumperIW4, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(localize::DumperIW4, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
DUMP_ASSET_POOL(weapon::DumperIW4, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(raw_file::DumperIW4, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(string_table::DumperIW4, m_string_table, ASSET_TYPE_STRINGTABLE)
DUMP_ASSET_POOL(leaderboard::JsonDumperIW4, m_leaderboard, ASSET_TYPE_LEADERBOARD)
DUMP_ASSET_POOL(structured_data_def::DumperIW4, m_structed_data_def_set, ASSET_TYPE_STRUCTURED_DATA_DEF)
DUMP_ASSET_POOL(tracer::DumperIW4, m_tracer, ASSET_TYPE_TRACER)
DUMP_ASSET_POOL(vehicle::DumperIW4, m_vehicle, ASSET_TYPE_VEHICLE)
DUMP_ASSET_POOL(addon_map_ents::DumperIW4, m_addon_map_ents, ASSET_TYPE_ADDON_MAP_ENTS)
REGISTER_DUMPER(shader::PixelShaderDumperIW4, m_material_pixel_shader)
REGISTER_DUMPER(shader::VertexShaderDumperIW4, m_material_vertex_shader)
REGISTER_DUMPER(techset::DumperIW4, m_technique_set)
REGISTER_DUMPER(image::DumperIW4, m_image)
// REGISTER_DUMPER(AssetDumpersnd_alias_list_t, m_sound)
REGISTER_DUMPER(sound_curve::DumperIW4, m_sound_curve)
REGISTER_DUMPER(sound::LoadedSoundDumperIW4, m_loaded_sound)
// REGISTER_DUMPER(AssetDumperClipMap, m_clip_map)
// REGISTER_DUMPER(AssetDumperComWorld, m_com_world)
// REGISTER_DUMPER(AssetDumperGameWorldSp, m_game_world_sp)
// REGISTER_DUMPER(AssetDumperGameWorldMp, m_game_world_mp)
// REGISTER_DUMPER(AssetDumperMapEnts, m_map_ents)
// REGISTER_DUMPER(AssetDumperFxWorld, m_fx_world)
// REGISTER_DUMPER(AssetDumperGfxWorld, m_gfx_world)
REGISTER_DUMPER(light_def::DumperIW4, m_gfx_light_def)
// REGISTER_DUMPER(AssetDumperFont_s, m_font)
REGISTER_DUMPER(menu::MenuListDumperIW4, m_menu_list)
REGISTER_DUMPER(menu::MenuDumperIW4, m_menu_def)
REGISTER_DUMPER(localize::DumperIW4, m_localize)
REGISTER_DUMPER(weapon::DumperIW4, m_weapon)
// REGISTER_DUMPER(AssetDumperSndDriverGlobals, m_snd_driver_globals)
// REGISTER_DUMPER(AssetDumperFxEffectDef, m_fx)
// REGISTER_DUMPER(AssetDumperFxImpactTable, m_fx_impact_table)
REGISTER_DUMPER(raw_file::DumperIW4, m_raw_file)
REGISTER_DUMPER(string_table::DumperIW4, m_string_table)
REGISTER_DUMPER(leaderboard::JsonDumperIW4, m_leaderboard)
REGISTER_DUMPER(structured_data_def::DumperIW4, m_structed_data_def_set)
REGISTER_DUMPER(tracer::DumperIW4, m_tracer)
REGISTER_DUMPER(vehicle::DumperIW4, m_vehicle)
REGISTER_DUMPER(addon_map_ents::DumperIW4, m_addon_map_ents)
context.SetTotalProgress(totalProgress);
for (const auto& func : dumpingFunctions)
func(context, assetPools);
if (context.ShouldTrackProgress())
{
size_t totalProgress = 0uz;
for (const auto& dumper : dumpers)
totalProgress += dumper->GetProgressTotalCount();
context.SetTotalProgress(totalProgress);
}
for (const auto& dumper : dumpers)
dumper->Dump(context);
return true;
#undef DUMP_ASSET_POOL
#undef REGISTER_DUMPER
}

View File

@@ -10,7 +10,12 @@ using namespace IW4;
namespace phys_collmap
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<PhysCollmap>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetPhysCollMap::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetPhysCollMap::Type>& asset)
{
const auto* physCollmap = asset.Asset();
const auto assetFile = context.OpenAssetFile(phys_collmap::GetFileNameForAssetName(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace phys_collmap
{
class DumperIW4 final : public AbstractAssetDumper<IW4::PhysCollmap>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetPhysCollMap>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetPhysCollMap::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::PhysCollmap>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetPhysCollMap::Type>& asset) override;
};
} // namespace phys_collmap

View File

@@ -80,7 +80,12 @@ namespace
namespace phys_preset
{
void InfoStringDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<PhysPreset>& asset)
InfoStringDumperIW4::InfoStringDumperIW4(const AssetPool<AssetPhysPreset::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void InfoStringDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetPhysPreset::Type>& asset)
{
// Only dump raw when no gdt available
if (context.m_gdt)

View File

@@ -2,13 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "InfoString/InfoString.h"
namespace phys_preset
{
class InfoStringDumperIW4 final : public AbstractAssetDumper<IW4::PhysPreset>
class InfoStringDumperIW4 final : public AbstractAssetDumper<IW4::AssetPhysPreset>
{
public:
explicit InfoStringDumperIW4(const AssetPool<IW4::AssetPhysPreset::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::PhysPreset>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetPhysPreset::Type>& asset) override;
};
} // namespace phys_preset

View File

@@ -10,7 +10,12 @@ using namespace IW4;
namespace raw_file
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<RawFile>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetRawFile::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetRawFile::Type>& asset)
{
const auto* rawFile = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace raw_file
{
class DumperIW4 final : public AbstractAssetDumper<IW4::RawFile>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetRawFile>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetRawFile::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::RawFile>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetRawFile::Type>& asset) override;
};
} // namespace raw_file

View File

@@ -6,7 +6,12 @@ using namespace IW4;
namespace shader
{
void PixelShaderDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MaterialPixelShader>& asset)
PixelShaderDumperIW4::PixelShaderDumperIW4(const AssetPool<AssetPixelShader::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void PixelShaderDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetPixelShader::Type>& asset)
{
const auto* pixelShader = asset.Asset();
const auto shaderFile = context.OpenAssetFile(shader::GetFileNameForPixelShaderAssetName(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace shader
{
class PixelShaderDumperIW4 final : public AbstractAssetDumper<IW4::MaterialPixelShader>
class PixelShaderDumperIW4 final : public AbstractAssetDumper<IW4::AssetPixelShader>
{
public:
explicit PixelShaderDumperIW4(const AssetPool<IW4::AssetPixelShader::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::MaterialPixelShader>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetPixelShader::Type>& asset) override;
};
} // namespace shader

View File

@@ -6,7 +6,12 @@ using namespace IW4;
namespace shader
{
void VertexShaderDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MaterialVertexShader>& asset)
VertexShaderDumperIW4::VertexShaderDumperIW4(const AssetPool<AssetVertexShader::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void VertexShaderDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetVertexShader::Type>& asset)
{
const auto* vertexShader = asset.Asset();
const auto shaderFile = context.OpenAssetFile(shader::GetFileNameForVertexShaderAssetName(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace shader
{
class VertexShaderDumperIW4 final : public AbstractAssetDumper<IW4::MaterialVertexShader>
class VertexShaderDumperIW4 final : public AbstractAssetDumper<IW4::AssetVertexShader>
{
public:
explicit VertexShaderDumperIW4(const AssetPool<IW4::AssetVertexShader::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::MaterialVertexShader>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetVertexShader::Type>& asset) override;
};
} // namespace shader

View File

@@ -25,7 +25,12 @@ namespace
namespace sound
{
void LoadedSoundDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<LoadedSound>& asset)
LoadedSoundDumperIW4::LoadedSoundDumperIW4(const AssetPool<AssetLoadedSound::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void LoadedSoundDumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetLoadedSound::Type>& asset)
{
const auto* loadedSound = asset.Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace sound
{
class LoadedSoundDumperIW4 final : public AbstractAssetDumper<IW4::LoadedSound>
class LoadedSoundDumperIW4 final : public AbstractAssetDumper<IW4::AssetLoadedSound>
{
public:
explicit LoadedSoundDumperIW4(const AssetPool<IW4::AssetLoadedSound::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::LoadedSound>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetLoadedSound::Type>& asset) override;
};
} // namespace sound

View File

@@ -7,7 +7,12 @@ using namespace IW4;
namespace sound_curve
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<SndCurve>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetSoundCurve::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetSoundCurve::Type>& asset)
{
const auto* sndCurve = asset.Asset();

View File

@@ -5,9 +5,12 @@
namespace sound_curve
{
class DumperIW4 final : public AbstractAssetDumper<IW4::SndCurve>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetSoundCurve>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetSoundCurve::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::SndCurve>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetSoundCurve::Type>& asset) override;
};
} // namespace sound_curve

View File

@@ -6,7 +6,12 @@ using namespace IW4;
namespace string_table
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<StringTable>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetStringTable::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetStringTable::Type>& asset)
{
const auto* stringTable = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace string_table
{
class DumperIW4 final : public AbstractAssetDumper<IW4::StringTable>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetStringTable>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetStringTable::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::StringTable>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetStringTable::Type>& asset) override;
};
} // namespace string_table

View File

@@ -1,9 +1,11 @@
#include "StructuredDataDefDumperIW4.h"
#include "StructuredDataDef/CommonStructuredDataDef.h"
#include "StructuredDataDef/StructuredDataDefDumper.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <sstream>
using namespace IW4;
@@ -185,7 +187,12 @@ namespace
namespace structured_data_def
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<StructuredDataDefSet>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetStructuredDataDef::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetStructuredDataDef::Type>& asset)
{
const auto* set = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -2,15 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "StructuredDataDef/CommonStructuredDataDef.h"
#include <cstddef>
namespace structured_data_def
{
class DumperIW4 final : public AbstractAssetDumper<IW4::StructuredDataDefSet>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetStructuredDataDef>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetStructuredDataDef::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::StructuredDataDefSet>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetStructuredDataDef::Type>& asset) override;
};
} // namespace structured_data_def

View File

@@ -536,7 +536,12 @@ namespace IW4
namespace techset
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MaterialTechniqueSet>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetTechniqueSet::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetTechniqueSet::Type>& asset)
{
const auto* techset = asset.Asset();

View File

@@ -5,9 +5,12 @@
namespace techset
{
class DumperIW4 final : public AbstractAssetDumper<IW4::MaterialTechniqueSet>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetTechniqueSet>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetTechniqueSet::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::MaterialTechniqueSet>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetTechniqueSet::Type>& asset) override;
};
} // namespace techset

View File

@@ -52,7 +52,12 @@ namespace
namespace tracer
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<TracerDef>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetTracer::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetTracer::Type>& asset)
{
// Only dump raw when no gdt available
if (context.m_gdt)

View File

@@ -2,13 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "InfoString/InfoString.h"
namespace tracer
{
class DumperIW4 final : public AbstractAssetDumper<IW4::TracerDef>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetTracer>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetTracer::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::TracerDef>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetTracer::Type>& asset) override;
};
} // namespace tracer

View File

@@ -93,7 +93,12 @@ namespace
namespace vehicle
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<VehicleDef>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetVehicle::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetVehicle::Type>& asset)
{
// Only dump raw when no gdt available
if (context.m_gdt)

View File

@@ -2,13 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "InfoString/InfoString.h"
namespace vehicle
{
class DumperIW4 final : public AbstractAssetDumper<IW4::VehicleDef>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetVehicle>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetVehicle::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::VehicleDef>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetVehicle::Type>& asset) override;
};
} // namespace vehicle

View File

@@ -405,7 +405,12 @@ namespace
namespace weapon
{
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<WeaponCompleteDef>& asset)
DumperIW4::DumperIW4(const AssetPool<AssetWeapon::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW4::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetWeapon::Type>& asset)
{
// Only dump raw when no gdt available
if (context.m_gdt)

View File

@@ -2,13 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW4/IW4.h"
#include "InfoString/InfoString.h"
namespace weapon
{
class DumperIW4 final : public AbstractAssetDumper<IW4::WeaponCompleteDef>
class DumperIW4 final : public AbstractAssetDumper<IW4::AssetWeapon>
{
public:
explicit DumperIW4(const AssetPool<IW4::AssetWeapon::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::WeaponCompleteDef>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW4::AssetWeapon::Type>& asset) override;
};
} // namespace weapon

View File

@@ -60,7 +60,8 @@ namespace
namespace image
{
DumperIW5::DumperIW5()
DumperIW5::DumperIW5(const AssetPool<AssetImage::Type>& pool)
: AbstractAssetDumper(pool)
{
switch (ObjWriting::Configuration.ImageOutputFormat)
{
@@ -77,7 +78,7 @@ namespace image
}
}
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<GfxImage>& asset)
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetImage::Type>& asset)
{
const auto* image = asset.Asset();
const auto texture = LoadImageData(context.m_obj_search_path, *image);

View File

@@ -8,13 +8,13 @@
namespace image
{
class DumperIW5 final : public AbstractAssetDumper<IW5::GfxImage>
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetImage>
{
public:
DumperIW5();
explicit DumperIW5(const AssetPool<IW5::AssetImage::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::GfxImage>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetImage::Type>& asset) override;
private:
std::unique_ptr<IImageWriter> m_writer;

View File

@@ -94,7 +94,12 @@ namespace
namespace leaderboard
{
void JsonDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<LeaderboardDef>& asset)
JsonDumperIW5::JsonDumperIW5(const AssetPool<AssetLeaderboard::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void JsonDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetLeaderboard::Type>& asset)
{
const auto assetFile = context.OpenAssetFile(GetJsonFileNameForAsset(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace leaderboard
{
class JsonDumperIW5 final : public AbstractAssetDumper<IW5::LeaderboardDef>
class JsonDumperIW5 final : public AbstractAssetDumper<IW5::AssetLeaderboard>
{
public:
explicit JsonDumperIW5(const AssetPool<IW5::AssetLeaderboard::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::LeaderboardDef>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetLeaderboard::Type>& asset) override;
};
} // namespace leaderboard

View File

@@ -11,14 +11,14 @@ using namespace IW5;
namespace localize
{
size_t DumperIW5::GetProgressTotalCount(const AssetPool<IW5::LocalizeEntry>& pool) const
DumperIW5::DumperIW5(const AssetPool<AssetLocalize::Type>& pool)
: AbstractSingleProgressAssetDumper(pool)
{
return pool.m_asset_lookup.empty() ? 0uz : 1uz;
}
void DumperIW5::DumpPool(AssetDumpingContext& context, const AssetPool<LocalizeEntry>& pool)
void DumperIW5::Dump(AssetDumpingContext& context)
{
if (pool.m_asset_lookup.empty())
if (m_pool.m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
@@ -35,7 +35,7 @@ namespace localize
stringFileDumper.SetNotes("");
for (const auto* localizeEntry : pool)
for (const auto* localizeEntry : m_pool)
{
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value);
}

View File

@@ -5,10 +5,11 @@
namespace localize
{
class DumperIW5 final : public IAssetDumper<IW5::LocalizeEntry>
class DumperIW5 final : public AbstractSingleProgressAssetDumper<IW5::AssetLocalize>
{
public:
[[nodiscard]] size_t GetProgressTotalCount(const AssetPool<IW5::LocalizeEntry>& pool) const override;
void DumpPool(AssetDumpingContext& context, const AssetPool<IW5::LocalizeEntry>& pool) override;
explicit DumperIW5(const AssetPool<IW5::AssetLocalize::Type>& pool);
void Dump(AssetDumpingContext& context) override;
};
} // namespace localize

View File

@@ -7,7 +7,12 @@ using namespace IW5;
namespace addon_map_ents
{
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AddonMapEnts>& asset)
DumperIW5::DumperIW5(const AssetPool<AssetAddonMapEnts::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetAddonMapEnts::Type>& asset)
{
const auto* addonMapEnts = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace addon_map_ents
{
class DumperIW5 final : public AbstractAssetDumper<IW5::AddonMapEnts>
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetAddonMapEnts>
{
public:
explicit DumperIW5(const AssetPool<IW5::AssetAddonMapEnts::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AddonMapEnts>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetAddonMapEnts::Type>& asset) override;
};
} // namespace addon_map_ents

View File

@@ -51,7 +51,12 @@ namespace
namespace menu
{
void MenuDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<menuDef_t>& asset)
MenuDumperIW5::MenuDumperIW5(const AssetPool<AssetMenu::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void MenuDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetMenu::Type>& asset)
{
const auto* menu = asset.Asset();
const auto menuFilePath = GetPathForMenu(asset);

View File

@@ -2,13 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW5/IW5.h"
#include "Game/IW5/Menu/MenuDumperIW5.h"
namespace menu
{
class MenuDumperIW5 final : public AbstractAssetDumper<IW5::menuDef_t>
class MenuDumperIW5 final : public AbstractAssetDumper<IW5::AssetMenu>
{
public:
explicit MenuDumperIW5(const AssetPool<IW5::AssetMenu::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::menuDef_t>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetMenu::Type>& asset) override;
};
} // namespace menu

View File

@@ -106,7 +106,12 @@ namespace
namespace menu
{
void MenuListDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<MenuList>& asset)
MenuListDumperIW5::MenuListDumperIW5(const AssetPool<AssetMenuList::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void MenuListDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetMenuList::Type>& asset)
{
const auto* menuList = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace menu
{
class MenuListDumperIW5 final : public AbstractAssetDumper<IW5::MenuList>
class MenuListDumperIW5 final : public AbstractAssetDumper<IW5::AssetMenuList>
{
public:
explicit MenuListDumperIW5(const AssetPool<IW5::AssetMenuList::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::MenuList>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetMenuList::Type>& asset) override;
};
} // namespace menu

View File

@@ -21,70 +21,69 @@ using namespace IW5;
bool ObjWriter::DumpZone(AssetDumpingContext& context) const
{
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
#define REGISTER_DUMPER(dumperType, poolName) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(dumperType::AssetType_t::EnumEntry)) \
{ \
dumperType dumper; \
totalProgress += dumper.GetProgressTotalCount(*assetPools->poolName); \
dumpingFunctions.emplace_back( \
[](AssetDumpingContext& funcContext, const GameAssetPoolIW5* funcPools) \
{ \
dumperType dumper; \
dumper.DumpPool(funcContext, *funcPools->poolName); \
}); \
dumpers.emplace_back(std::make_unique<dumperType>(*assetPools->poolName)); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolIW5*>(context.m_zone.m_pools.get());
std::vector<std::unique_ptr<IAssetDumper>> dumpers;
size_t totalProgress = 0uz;
std::vector<std::function<void(AssetDumpingContext & context, const GameAssetPoolIW5*)>> dumpingFunctions;
// REGISTER_DUMPER(AssetDumperPhysPreset, m_phys_preset)
// REGISTER_DUMPER(AssetDumperPhysCollmap, m_phys_collmap)
// REGISTER_DUMPER(AssetDumperXAnimParts, m_xanim_parts)
// REGISTER_DUMPER(AssetDumperXModelSurfs, m_xmodel_surfs)
REGISTER_DUMPER(xmodel::DumperIW5, m_xmodel)
REGISTER_DUMPER(material::JsonDumperIW5, m_material)
// REGISTER_DUMPER(AssetDumperMaterialPixelShader, m_material_pixel_shader)
// REGISTER_DUMPER(AssetDumperMaterialVertexShader, m_material_vertex_shader)
// REGISTER_DUMPER(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl)
// REGISTER_DUMPER(AssetDumperMaterialTechniqueSet, m_technique_set)
REGISTER_DUMPER(image::DumperIW5, m_image)
// REGISTER_DUMPER(AssetDumpersnd_alias_list_t, m_sound)
// REGISTER_DUMPER(AssetDumperSndCurve, m_sound_curve)
REGISTER_DUMPER(sound::LoadedSoundDumperIW5, m_loaded_sound)
// REGISTER_DUMPER(AssetDumperclipMap_t, m_clip_map)
// REGISTER_DUMPER(AssetDumperComWorld, m_com_world)
// REGISTER_DUMPER(AssetDumperGlassWorld, m_glass_world)
// REGISTER_DUMPER(AssetDumperPathData, m_path_data)
// REGISTER_DUMPER(AssetDumperVehicleTrack, m_vehicle_track)
// REGISTER_DUMPER(AssetDumperMapEnts, m_map_ents)
// REGISTER_DUMPER(AssetDumperFxWorld, m_fx_world)
// REGISTER_DUMPER(AssetDumperGfxWorld, m_gfx_world)
// REGISTER_DUMPER(AssetDumperGfxLightDef, m_gfx_light_def)
// REGISTER_DUMPER(AssetDumperFont_s, m_font)
REGISTER_DUMPER(menu::MenuListDumperIW5, m_menu_list)
REGISTER_DUMPER(menu::MenuDumperIW5, m_menu_def)
REGISTER_DUMPER(localize::DumperIW5, m_localize)
REGISTER_DUMPER(attachment::JsonDumperIW5, m_attachment)
REGISTER_DUMPER(weapon::DumperIW5, m_weapon)
// REGISTER_DUMPER(AssetDumperFxEffectDef, m_fx)
// REGISTER_DUMPER(AssetDumperFxImpactTable, m_fx_impact_table)
// REGISTER_DUMPER(AssetDumperSurfaceFxTable, m_surface_fx_table)
REGISTER_DUMPER(raw_file::DumperIW5, m_raw_file)
REGISTER_DUMPER(script::DumperIW5, m_script_file)
REGISTER_DUMPER(string_table::DumperIW5, m_string_table)
REGISTER_DUMPER(leaderboard::JsonDumperIW5, m_leaderboard)
// REGISTER_DUMPER(AssetDumperStructuredDataDefSet, m_structed_data_def_set)
// REGISTER_DUMPER(AssetDumperTracerDef, m_tracer)
// REGISTER_DUMPER(AssetDumperVehicleDef, m_vehicle)
REGISTER_DUMPER(addon_map_ents::DumperIW5, m_addon_map_ents)
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap, ASSET_TYPE_PHYSCOLLMAP)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
// DUMP_ASSET_POOL(AssetDumperXModelSurfs, m_xmodel_surfs, ASSET_TYPE_XMODEL_SURFS)
DUMP_ASSET_POOL(xmodel::DumperIW5, m_xmodel, ASSET_TYPE_XMODEL)
DUMP_ASSET_POOL(material::JsonDumperIW5, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperMaterialPixelShader, m_material_pixel_shader, ASSET_TYPE_PIXELSHADER)
// DUMP_ASSET_POOL(AssetDumperMaterialVertexShader, m_material_vertex_shader, ASSET_TYPE_VERTEXSHADER)
// DUMP_ASSET_POOL(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl, ASSET_TYPE_VERTEXDECL)
// DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(image::DumperIW5, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(sound::LoadedSoundDumperIW5, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map, ASSET_TYPE_CLIPMAP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGlassWorld, m_glass_world, ASSET_TYPE_GLASSWORLD)
// DUMP_ASSET_POOL(AssetDumperPathData, m_path_data, ASSET_TYPE_PATHDATA)
// DUMP_ASSET_POOL(AssetDumperVehicleTrack, m_vehicle_track, ASSET_TYPE_VEHICLE_TRACK)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world, ASSET_TYPE_FXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT)
DUMP_ASSET_POOL(menu::MenuListDumperIW5, m_menu_list, ASSET_TYPE_MENULIST)
DUMP_ASSET_POOL(menu::MenuDumperIW5, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(localize::DumperIW5, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
DUMP_ASSET_POOL(attachment::JsonDumperIW5, m_attachment, ASSET_TYPE_ATTACHMENT)
DUMP_ASSET_POOL(weapon::DumperIW5, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
// DUMP_ASSET_POOL(AssetDumperSurfaceFxTable, m_surface_fx_table, ASSET_TYPE_SURFACE_FX)
DUMP_ASSET_POOL(raw_file::DumperIW5, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(script::DumperIW5, m_script_file, ASSET_TYPE_SCRIPTFILE)
DUMP_ASSET_POOL(string_table::DumperIW5, m_string_table, ASSET_TYPE_STRINGTABLE)
DUMP_ASSET_POOL(leaderboard::JsonDumperIW5, m_leaderboard, ASSET_TYPE_LEADERBOARD)
// DUMP_ASSET_POOL(AssetDumperStructuredDataDefSet, m_structed_data_def_set, ASSET_TYPE_STRUCTURED_DATA_DEF)
// DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer, ASSET_TYPE_TRACER)
// DUMP_ASSET_POOL(AssetDumperVehicleDef, m_vehicle, ASSET_TYPE_VEHICLE)
DUMP_ASSET_POOL(addon_map_ents::DumperIW5, m_addon_map_ents, ASSET_TYPE_ADDON_MAP_ENTS)
if (context.ShouldTrackProgress())
{
size_t totalProgress = 0uz;
for (const auto& dumper : dumpers)
totalProgress += dumper->GetProgressTotalCount();
context.SetTotalProgress(totalProgress);
for (const auto& func : dumpingFunctions)
func(context, assetPools);
context.SetTotalProgress(totalProgress);
}
for (const auto& dumper : dumpers)
dumper->Dump(context);
return true;
#undef DUMP_ASSET_POOL
#undef REGISTER_DUMPER
}

View File

@@ -10,7 +10,12 @@ using namespace IW5;
namespace raw_file
{
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<RawFile>& asset)
DumperIW5::DumperIW5(const AssetPool<AssetRawFile::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetRawFile::Type>& asset)
{
const auto* rawFile = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace raw_file
{
class DumperIW5 final : public AbstractAssetDumper<IW5::RawFile>
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetRawFile>
{
public:
explicit DumperIW5(const AssetPool<IW5::AssetRawFile::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::RawFile>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetRawFile::Type>& asset) override;
};
} // namespace raw_file

View File

@@ -4,8 +4,13 @@ using namespace IW5;
namespace script
{
DumperIW5::DumperIW5(const AssetPool<AssetScript::Type>& pool)
: AbstractAssetDumper(pool)
{
}
// See https://github.com/xensik/gsc-tool#file-format for an in-depth explanation about the .gscbin format
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<ScriptFile>& asset)
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetScript::Type>& asset)
{
auto* scriptFile = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name + ".gscbin");

View File

@@ -5,9 +5,12 @@
namespace script
{
class DumperIW5 final : public AbstractAssetDumper<IW5::ScriptFile>
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetScript>
{
public:
explicit DumperIW5(const AssetPool<IW5::AssetScript::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::ScriptFile>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetScript::Type>& asset) override;
};
} // namespace script

View File

@@ -25,7 +25,12 @@ namespace
namespace sound
{
void LoadedSoundDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<LoadedSound>& asset)
LoadedSoundDumperIW5::LoadedSoundDumperIW5(const AssetPool<AssetLoadedSound::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void LoadedSoundDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetLoadedSound::Type>& asset)
{
const auto* loadedSound = asset.Asset();
const auto assetFile = context.OpenAssetFile(std::format("sound/{}", asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace sound
{
class LoadedSoundDumperIW5 final : public AbstractAssetDumper<IW5::LoadedSound>
class LoadedSoundDumperIW5 final : public AbstractAssetDumper<IW5::AssetLoadedSound>
{
public:
explicit LoadedSoundDumperIW5(const AssetPool<IW5::AssetLoadedSound::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::LoadedSound>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetLoadedSound::Type>& asset) override;
};
} // namespace sound

View File

@@ -6,7 +6,12 @@ using namespace IW5;
namespace string_table
{
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<StringTable>& asset)
DumperIW5::DumperIW5(const AssetPool<AssetStringTable::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetStringTable::Type>& asset)
{
const auto* stringTable = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace string_table
{
class DumperIW5 final : public AbstractAssetDumper<IW5::StringTable>
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetStringTable>
{
public:
explicit DumperIW5(const AssetPool<IW5::AssetStringTable::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::StringTable>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetStringTable::Type>& asset) override;
};
} // namespace string_table

View File

@@ -395,7 +395,12 @@ namespace
namespace attachment
{
void JsonDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<WeaponAttachment>& asset)
JsonDumperIW5::JsonDumperIW5(const AssetPool<AssetAttachment::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void JsonDumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetAttachment::Type>& asset)
{
const auto assetFile = context.OpenAssetFile(GetJsonFileNameForAssetName(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace attachment
{
class JsonDumperIW5 final : public AbstractAssetDumper<IW5::WeaponAttachment>
class JsonDumperIW5 final : public AbstractAssetDumper<IW5::AssetAttachment>
{
public:
explicit JsonDumperIW5(const AssetPool<IW5::AssetAttachment::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::WeaponAttachment>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetAttachment::Type>& asset) override;
};
} // namespace attachment

View File

@@ -733,7 +733,12 @@ namespace
namespace weapon
{
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<WeaponCompleteDef>& asset)
DumperIW5::DumperIW5(const AssetPool<AssetWeapon::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperIW5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetWeapon::Type>& asset)
{
// TODO: only dump infostring fields when non-default

View File

@@ -2,13 +2,15 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW5/IW5.h"
#include "InfoString/InfoString.h"
namespace weapon
{
class DumperIW5 final : public AbstractAssetDumper<IW5::WeaponCompleteDef>
class DumperIW5 final : public AbstractAssetDumper<IW5::AssetWeapon>
{
public:
explicit DumperIW5(const AssetPool<IW5::AssetWeapon::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::WeaponCompleteDef>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW5::AssetWeapon::Type>& asset) override;
};
} // namespace weapon

View File

@@ -59,7 +59,8 @@ namespace
namespace image
{
DumperT5::DumperT5()
DumperT5::DumperT5(const AssetPool<AssetImage::Type>& pool)
: AbstractAssetDumper(pool)
{
switch (ObjWriting::Configuration.ImageOutputFormat)
{
@@ -76,7 +77,7 @@ namespace image
}
}
void DumperT5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<GfxImage>& asset)
void DumperT5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetImage::Type>& asset)
{
const auto* image = asset.Asset();
const auto texture = LoadImageData(context.m_obj_search_path, *image);

View File

@@ -8,13 +8,13 @@
namespace image
{
class DumperT5 final : public AbstractAssetDumper<T5::GfxImage>
class DumperT5 final : public AbstractAssetDumper<T5::AssetImage>
{
public:
DumperT5();
explicit DumperT5(const AssetPool<T5::AssetImage::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::GfxImage>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::AssetImage::Type>& asset) override;
private:
std::unique_ptr<IImageWriter> m_writer;

View File

@@ -11,14 +11,14 @@ using namespace T5;
namespace localize
{
size_t DumperT5::GetProgressTotalCount(const AssetPool<T5::LocalizeEntry>& pool) const
DumperT5::DumperT5(const AssetPool<AssetLocalize::Type>& pool)
: AbstractSingleProgressAssetDumper(pool)
{
return pool.m_asset_lookup.empty() ? 0uz : 1uz;
}
void DumperT5::DumpPool(AssetDumpingContext& context, const AssetPool<LocalizeEntry>& pool)
void DumperT5::Dump(AssetDumpingContext& context)
{
if (pool.m_asset_lookup.empty())
if (m_pool.m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
@@ -35,7 +35,7 @@ namespace localize
stringFileDumper.SetNotes("");
for (const auto* localizeEntry : pool)
for (const auto* localizeEntry : m_pool)
{
stringFileDumper.WriteLocalizeEntry(localizeEntry->m_name, localizeEntry->Asset()->value);
}

View File

@@ -5,10 +5,11 @@
namespace localize
{
class DumperT5 final : public IAssetDumper<T5::LocalizeEntry>
class DumperT5 final : public AbstractSingleProgressAssetDumper<T5::AssetLocalize>
{
public:
[[nodiscard]] size_t GetProgressTotalCount(const AssetPool<T5::LocalizeEntry>& pool) const override;
void DumpPool(AssetDumpingContext& context, const AssetPool<T5::LocalizeEntry>& pool) override;
explicit DumperT5(const AssetPool<T5::AssetLocalize::Type>& pool);
void Dump(AssetDumpingContext& context) override;
};
} // namespace localize

View File

@@ -13,62 +13,61 @@ using namespace T5;
bool ObjWriter::DumpZone(AssetDumpingContext& context) const
{
#define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
#define REGISTER_DUMPER(dumperType, poolName) \
if (assetPools->poolName && ObjWriting::ShouldHandleAssetType(dumperType::AssetType_t::EnumEntry)) \
{ \
dumperType dumper; \
totalProgress += dumper.GetProgressTotalCount(*assetPools->poolName); \
dumpingFunctions.emplace_back( \
[](AssetDumpingContext& funcContext, const GameAssetPoolT5* funcPools) \
{ \
dumperType dumper; \
dumper.DumpPool(funcContext, *funcPools->poolName); \
}); \
dumpers.emplace_back(std::make_unique<dumperType>(*assetPools->poolName)); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolT5*>(context.m_zone.m_pools.get());
std::vector<std::unique_ptr<IAssetDumper>> dumpers;
size_t totalProgress = 0uz;
std::vector<std::function<void(AssetDumpingContext & context, const GameAssetPoolT5*)>> dumpingFunctions;
// REGISTER_DUMPER(AssetDumperPhysPreset, m_phys_preset)
// REGISTER_DUMPER(AssetDumperPhysConstraints, m_phys_constraints)
// REGISTER_DUMPER(AssetDumperDestructibleDef, m_destructible_def)
// REGISTER_DUMPER(AssetDumperXAnimParts, m_xanim_parts)
REGISTER_DUMPER(xmodel::DumperT5, m_xmodel)
REGISTER_DUMPER(material::JsonDumperT5, m_material)
// REGISTER_DUMPER(AssetDumperTechniqueSet, m_technique_set)
REGISTER_DUMPER(image::DumperT5, m_image)
// REGISTER_DUMPER(AssetDumperSndBank, m_sound_bank)
// REGISTER_DUMPER(AssetDumperSndPatch, m_sound_patch)
// REGISTER_DUMPER(AssetDumperClipMap, m_clip_map)
// REGISTER_DUMPER(AssetDumperComWorld, m_com_world)
// REGISTER_DUMPER(AssetDumperGameWorldSp, m_game_world_sp)
// REGISTER_DUMPER(AssetDumperGameWorldMp, m_game_world_mp)
// REGISTER_DUMPER(AssetDumperMapEnts, m_map_ents)
// REGISTER_DUMPER(AssetDumperGfxWorld, m_gfx_world)
// REGISTER_DUMPER(AssetDumperGfxLightDef, m_gfx_light_def)
// REGISTER_DUMPER(AssetDumperFont, m_font)
// REGISTER_DUMPER(AssetDumperMenuList, m_menu_list)
// REGISTER_DUMPER(AssetDumperMenuDef, m_menu_def)
REGISTER_DUMPER(localize::DumperT5, m_localize)
// REGISTER_DUMPER(AssetDumperWeapon, m_weapon)
// REGISTER_DUMPER(AssetDumperSndDriverGlobals, m_snd_driver_globals)
// REGISTER_DUMPER(AssetDumperFxEffectDef, m_fx)
// REGISTER_DUMPER(AssetDumperFxImpactTable, m_fx_impact_table)
REGISTER_DUMPER(raw_file::DumperT5, m_raw_file)
REGISTER_DUMPER(string_table::DumperT5, m_string_table)
// REGISTER_DUMPER(AssetDumperPackIndex, m_pack_index)
// REGISTER_DUMPER(AssetDumperXGlobals, m_xglobals)
// REGISTER_DUMPER(AssetDumperDDLRoot, m_ddl)
// REGISTER_DUMPER(AssetDumperGlasses, m_glasses)
// REGISTER_DUMPER(AssetDumperEmblemSet, m_emblem_set)
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints, ASSET_TYPE_PHYSCONSTRAINTS)
// DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def, ASSET_TYPE_DESTRUCTIBLEDEF)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
DUMP_ASSET_POOL(xmodel::DumperT5, m_xmodel, ASSET_TYPE_XMODEL)
DUMP_ASSET_POOL(material::JsonDumperT5, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(image::DumperT5, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch, ASSET_TYPE_SOUND_PATCH)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP_PVS)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT)
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
// DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(localize::DumperT5, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
// DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(raw_file::DumperT5, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(string_table::DumperT5, m_string_table, ASSET_TYPE_STRINGTABLE)
// DUMP_ASSET_POOL(AssetDumperPackIndex, m_pack_index, ASSET_TYPE_PACK_INDEX)
// DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals, ASSET_TYPE_XGLOBALS)
// DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl, ASSET_TYPE_DDL)
// DUMP_ASSET_POOL(AssetDumperGlasses, m_glasses, ASSET_TYPE_GLASSES)
// DUMP_ASSET_POOL(AssetDumperEmblemSet, m_emblem_set, ASSET_TYPE_EMBLEMSET)
if (context.ShouldTrackProgress())
{
size_t totalProgress = 0uz;
for (const auto& dumper : dumpers)
totalProgress += dumper->GetProgressTotalCount();
context.SetTotalProgress(totalProgress);
for (const auto& func : dumpingFunctions)
func(context, assetPools);
context.SetTotalProgress(totalProgress);
}
for (const auto& dumper : dumpers)
dumper->Dump(context);
return true;
#undef DUMP_ASSET_POOL
#undef REGISTER_DUMPER
}

View File

@@ -96,7 +96,12 @@ namespace
namespace raw_file
{
void DumperT5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<RawFile>& asset)
DumperT5::DumperT5(const AssetPool<AssetRawFile::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperT5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetRawFile::Type>& asset)
{
const auto* rawFile = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace raw_file
{
class DumperT5 final : public AbstractAssetDumper<T5::RawFile>
class DumperT5 final : public AbstractAssetDumper<T5::AssetRawFile>
{
public:
explicit DumperT5(const AssetPool<T5::AssetRawFile::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::RawFile>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::AssetRawFile::Type>& asset) override;
};
} // namespace raw_file

View File

@@ -6,7 +6,12 @@ using namespace T5;
namespace string_table
{
void DumperT5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<StringTable>& asset)
DumperT5::DumperT5(const AssetPool<AssetStringTable::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void DumperT5::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetStringTable::Type>& asset)
{
const auto* stringTable = asset.Asset();
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace string_table
{
class DumperT5 final : public AbstractAssetDumper<T5::StringTable>
class DumperT5 final : public AbstractAssetDumper<T5::AssetStringTable>
{
public:
explicit DumperT5(const AssetPool<T5::AssetStringTable::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::StringTable>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T5::AssetStringTable::Type>& asset) override;
};
} // namespace string_table

View File

@@ -133,7 +133,12 @@ namespace
namespace font_icon
{
void CsvDumperT6::DumpAsset(AssetDumpingContext& context, const XAssetInfo<FontIcon>& asset)
CsvDumperT6::CsvDumperT6(const AssetPool<AssetFontIcon::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void CsvDumperT6::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetFontIcon::Type>& asset)
{
const auto assetFile = context.OpenAssetFile(asset.m_name);

View File

@@ -5,9 +5,12 @@
namespace font_icon
{
class CsvDumperT6 final : public AbstractAssetDumper<T6::FontIcon>
class CsvDumperT6 final : public AbstractAssetDumper<T6::AssetFontIcon>
{
public:
explicit CsvDumperT6(const AssetPool<T6::AssetFontIcon::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T6::FontIcon>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T6::AssetFontIcon::Type>& asset) override;
};
} // namespace font_icon

View File

@@ -9,12 +9,12 @@ using namespace T6;
namespace font_icon
{
std::unique_ptr<IAssetDumper<FontIcon>> CreateDumperT6()
std::unique_ptr<IAssetDumper> CreateDumperT6(const AssetPool<AssetFontIcon::Type>& pool)
{
#ifdef DUMP_FONT_ICON_AS_CSV
return std::make_unique<CsvDumperT6>();
return std::make_unique<CsvDumperT6>(pool);
#else
return std::make_unique<JsonDumperT6>();
return std::make_unique<JsonDumperT6>(pool);
#endif
}
} // namespace font_icon

View File

@@ -7,5 +7,5 @@
namespace font_icon
{
std::unique_ptr<IAssetDumper<T6::FontIcon>> CreateDumperT6();
std::unique_ptr<IAssetDumper> CreateDumperT6(const AssetPool<T6::AssetFontIcon::Type>& pool);
} // namespace font_icon

View File

@@ -78,7 +78,12 @@ namespace
namespace font_icon
{
void JsonDumperT6::DumpAsset(AssetDumpingContext& context, const XAssetInfo<FontIcon>& asset)
JsonDumperT6::JsonDumperT6(const AssetPool<AssetFontIcon::Type>& pool)
: AbstractAssetDumper(pool)
{
}
void JsonDumperT6::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetFontIcon::Type>& asset)
{
const auto assetFile = context.OpenAssetFile(GetJsonFileNameForAssetName(asset.m_name));

View File

@@ -5,9 +5,12 @@
namespace font_icon
{
class JsonDumperT6 final : public AbstractAssetDumper<T6::FontIcon>
class JsonDumperT6 final : public AbstractAssetDumper<T6::AssetFontIcon>
{
public:
explicit JsonDumperT6(const AssetPool<T6::AssetFontIcon::Type>& pool);
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T6::FontIcon>& asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<T6::AssetFontIcon::Type>& asset) override;
};
} // namespace font_icon

View File

@@ -77,7 +77,8 @@ namespace
namespace image
{
DumperT6::DumperT6()
DumperT6::DumperT6(const AssetPool<AssetImage::Type>& pool)
: AbstractAssetDumper(pool)
{
switch (ObjWriting::Configuration.ImageOutputFormat)
{
@@ -94,7 +95,7 @@ namespace image
}
}
void DumperT6::DumpAsset(AssetDumpingContext& context, const XAssetInfo<GfxImage>& asset)
void DumperT6::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetImage::Type>& asset)
{
const auto* image = asset.Asset();
const auto texture = LoadImageData(context.m_obj_search_path, *image);

Some files were not shown because too many files have changed in this diff Show More