mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-01-11 03:01:49 +00:00
chore: generalize IAssetDumper interface
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user