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