Include and exclude asset type dumping configured by command line args

This commit is contained in:
Jan 2021-10-11 18:47:53 +02:00
parent e70cbaa4ce
commit 868bd070d0
21 changed files with 476 additions and 576 deletions

View File

@ -1,5 +1,6 @@
#include "ZoneDumperIW3.h" #include "ZoneDumperIW3.h"
#include "ObjWriting.h"
#include "Game/IW3/GameIW3.h" #include "Game/IW3/GameIW3.h"
#include "Game/IW3/GameAssetPoolIW3.h" #include "Game/IW3/GameAssetPoolIW3.h"
@ -21,8 +22,8 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
{ {
#define DUMP_ASSET_POOL(dumperType, poolName) \ #define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if(assetPools->poolName) \ if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
{ \ { \
dumperType dumper; \ dumperType dumper; \
dumper.DumpPool(context, assetPools->poolName.get()); \ dumper.DumpPool(context, assetPools->poolName.get()); \
@ -30,32 +31,32 @@ bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
const auto* assetPools = dynamic_cast<GameAssetPoolIW3*>(context.m_zone->m_pools.get()); const auto* assetPools = dynamic_cast<GameAssetPoolIW3*>(context.m_zone->m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset) // DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts) // DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel) DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel, ASSET_TYPE_XMODEL)
// DUMP_ASSET_POOL(AssetDumperMaterial, m_material) // DUMP_ASSET_POOL(AssetDumperMaterial, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set) // DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(AssetDumperGfxImage, m_image) DUMP_ASSET_POOL(AssetDumperGfxImage, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound) // DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve) // DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound) DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map) // DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map, ASSET_TYPE_CLIPMAP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world) // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp) // DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp) // DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents) DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world) // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def) // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont_s, m_font) // DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT)
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list) // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
// DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def) // DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize) DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
// DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon) // DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals) // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table) // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file) DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table) DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table, ASSET_TYPE_STRINGTABLE)
return true; return true;

View File

@ -1,5 +1,6 @@
#include "ZoneDumperIW4.h" #include "ZoneDumperIW4.h"
#include "ObjWriting.h"
#include "Game/IW4/GameIW4.h" #include "Game/IW4/GameIW4.h"
#include "Game/IW4/GameAssetPoolIW4.h" #include "Game/IW4/GameAssetPoolIW4.h"
@ -24,8 +25,8 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
{ {
#define DUMP_ASSET_POOL(dumperType, poolName) \ #define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if(assetPools->poolName) \ if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
{ \ { \
dumperType dumper; \ dumperType dumper; \
dumper.DumpPool(context, assetPools->poolName.get()); \ dumper.DumpPool(context, assetPools->poolName.get()); \
@ -33,42 +34,42 @@ bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(context.m_zone->m_pools.get()); const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(context.m_zone->m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset) // DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap) // DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap, ASSET_TYPE_PHYSCOLLMAP)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts) // DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel) DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel, ASSET_TYPE_XMODEL)
// DUMP_ASSET_POOL(AssetDumperMaterial, m_material) // DUMP_ASSET_POOL(AssetDumperMaterial, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperMaterialPixelShader, m_material_pixel_shader) // DUMP_ASSET_POOL(AssetDumperMaterialPixelShader, m_material_pixel_shader, ASSET_TYPE_PIXELSHADER)
// DUMP_ASSET_POOL(AssetDumperMaterialVertexShader, m_material_vertex_shader) // DUMP_ASSET_POOL(AssetDumperMaterialVertexShader, m_material_vertex_shader, ASSET_TYPE_VERTEXSHADER)
// DUMP_ASSET_POOL(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl) // DUMP_ASSET_POOL(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl, ASSET_TYPE_VERTEXDECL)
// DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set) // DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(AssetDumperGfxImage, m_image) DUMP_ASSET_POOL(AssetDumperGfxImage, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound) // DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve) // DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound) DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map) // DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map, ASSET_TYPE_CLIPMAP_MP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world) // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp) // DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp) // DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents) // DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world) // DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world, ASSET_TYPE_FXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world) // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def) // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont_s, m_font) // DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT)
DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list) DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def) DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize) DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon) DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals) // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table) // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file) DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table) DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table, ASSET_TYPE_STRINGTABLE)
// DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard) // DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard, ASSET_TYPE_LEADERBOARD)
// DUMP_ASSET_POOL(AssetDumperStructuredDataDefSet, m_structed_data_def_set) // DUMP_ASSET_POOL(AssetDumperStructuredDataDefSet, m_structed_data_def_set, ASSET_TYPE_STRUCTURED_DATA_DEF)
// DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer) // DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer, ASSET_TYPE_TRACER)
DUMP_ASSET_POOL(AssetDumperVehicle, m_vehicle) DUMP_ASSET_POOL(AssetDumperVehicle, m_vehicle, ASSET_TYPE_VEHICLE)
DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents) DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents, ASSET_TYPE_ADDON_MAP_ENTS)
return true; return true;

View File

@ -1,5 +1,6 @@
#include "ZoneDumperIW5.h" #include "ZoneDumperIW5.h"
#include "ObjWriting.h"
#include "Game/IW5/GameIW5.h" #include "Game/IW5/GameIW5.h"
#include "Game/IW5/GameAssetPoolIW5.h" #include "Game/IW5/GameAssetPoolIW5.h"
@ -20,54 +21,54 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
{ {
#define DUMP_ASSET_POOL(dumperType, poolName) \ #define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if(assetPools->poolName) \ if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
{ \ { \
dumperType dumper; \ dumperType dumper; \
dumper.DumpPool(context, assetPools->poolName.get()); \ dumper.DumpPool(context, assetPools->poolName.get()); \
} }
const auto* assetPools = dynamic_cast<GameAssetPoolIW5*>(context.m_zone->m_pools.get()); const auto* assetPools = dynamic_cast<GameAssetPoolIW5*>(context.m_zone->m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset) // DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap) // DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap, ASSET_TYPE_PHYSCOLLMAP)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts) // DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
// DUMP_ASSET_POOL(AssetDumperXModelSurfs, m_xmodel_surfs) // DUMP_ASSET_POOL(AssetDumperXModelSurfs, m_xmodel_surfs, ASSET_TYPE_XMODEL_SURFS)
DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel) DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel, ASSET_TYPE_XMODEL)
// DUMP_ASSET_POOL(AssetDumperMaterial, m_material) // DUMP_ASSET_POOL(AssetDumperMaterial, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperMaterialPixelShader, m_material_pixel_shader) // DUMP_ASSET_POOL(AssetDumperMaterialPixelShader, m_material_pixel_shader, ASSET_TYPE_PIXELSHADER)
// DUMP_ASSET_POOL(AssetDumperMaterialVertexShader, m_material_vertex_shader) // DUMP_ASSET_POOL(AssetDumperMaterialVertexShader, m_material_vertex_shader, ASSET_TYPE_VERTEXSHADER)
// DUMP_ASSET_POOL(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl) // DUMP_ASSET_POOL(AssetDumperMaterialVertexDeclaration, m_material_vertex_decl, ASSET_TYPE_VERTEXDECL)
// DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set) // DUMP_ASSET_POOL(AssetDumperMaterialTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(AssetDumperGfxImage, m_image) DUMP_ASSET_POOL(AssetDumperGfxImage, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound) // DUMP_ASSET_POOL(AssetDumpersnd_alias_list_t, m_sound, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve) // DUMP_ASSET_POOL(AssetDumperSndCurve, m_sound_curve, ASSET_TYPE_SOUND_CURVE)
DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound) DUMP_ASSET_POOL(AssetDumperLoadedSound, m_loaded_sound, ASSET_TYPE_LOADED_SOUND)
// DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map) // DUMP_ASSET_POOL(AssetDumperclipMap_t, m_clip_map, ASSET_TYPE_CLIPMAP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world) // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGlassWorld, m_glass_world) // DUMP_ASSET_POOL(AssetDumperGlassWorld, m_glass_world, ASSET_TYPE_GLASSWORLD)
// DUMP_ASSET_POOL(AssetDumperPathData, m_path_data) // DUMP_ASSET_POOL(AssetDumperPathData, m_path_data, ASSET_TYPE_PATHDATA)
// DUMP_ASSET_POOL(AssetDumperVehicleTrack, m_vehicle_track) // DUMP_ASSET_POOL(AssetDumperVehicleTrack, m_vehicle_track, ASSET_TYPE_VEHICLE_TRACK)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents) // DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world) // DUMP_ASSET_POOL(AssetDumperFxWorld, m_fx_world, ASSET_TYPE_FXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world) // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def) // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont_s, m_font) // DUMP_ASSET_POOL(AssetDumperFont_s, m_font, ASSET_TYPE_FONT)
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list) // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
// DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def) // DUMP_ASSET_POOL(AssetDumpermenuDef_t, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize) DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
// DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment) // DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT)
// DUMP_ASSET_POOL(AssetDumperWeaponCompleteDef, m_weapon) // DUMP_ASSET_POOL(AssetDumperWeaponCompleteDef, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table) // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
// DUMP_ASSET_POOL(AssetDumperSurfaceFxTable, m_surface_fx_table) // DUMP_ASSET_POOL(AssetDumperSurfaceFxTable, m_surface_fx_table, ASSET_TYPE_SURFACE_FX)
DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file) DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE)
// DUMP_ASSET_POOL(AssetDumperScriptFile, m_script_file) // DUMP_ASSET_POOL(AssetDumperScriptFile, m_script_file, ASSET_TYPE_SCRIPTFILE)
DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table) DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table, ASSET_TYPE_STRINGTABLE)
// DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard) // DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard, ASSET_TYPE_LEADERBOARD)
// DUMP_ASSET_POOL(AssetDumperStructuredDataDefSet, m_structed_data_def_set) // DUMP_ASSET_POOL(AssetDumperStructuredDataDefSet, m_structed_data_def_set, ASSET_TYPE_STRUCTURED_DATA_DEF)
// DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer) // DUMP_ASSET_POOL(AssetDumperTracerDef, m_tracer, ASSET_TYPE_TRACER)
// DUMP_ASSET_POOL(AssetDumperVehicleDef, m_vehicle) // DUMP_ASSET_POOL(AssetDumperVehicleDef, m_vehicle, ASSET_TYPE_VEHICLE)
DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents) DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents, ASSET_TYPE_ADDON_MAP_ENTS)
return true; return true;

View File

@ -1,5 +1,6 @@
#include "ZoneDumperT5.h" #include "ZoneDumperT5.h"
#include "ObjWriting.h"
#include "Game/T5/GameT5.h" #include "Game/T5/GameT5.h"
#include "Game/T5/GameAssetPoolT5.h" #include "Game/T5/GameAssetPoolT5.h"
@ -22,47 +23,47 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
{ {
#define DUMP_ASSET_POOL(dumperType, poolName) \ #define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if(assetPools->poolName) \ if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
{ \ { \
dumperType dumper; \ dumperType dumper; \
dumper.DumpPool(context, assetPools->poolName); \ dumper.DumpPool(context, assetPools->poolName.get()); \
} }
const auto* assetPools = dynamic_cast<GameAssetPoolT5*>(context.m_zone->m_pools.get()); const auto* assetPools = dynamic_cast<GameAssetPoolT5*>(context.m_zone->m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset) // DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints) // DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints, ASSET_TYPE_PHYSCONSTRAINTS)
// DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def) // DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def, ASSET_TYPE_DESTRUCTIBLEDEF)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts) // DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel) DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel, ASSET_TYPE_XMODEL)
// DUMP_ASSET_POOL(AssetDumperMaterial, m_material) // DUMP_ASSET_POOL(AssetDumperMaterial, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set) // DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(AssetDumperGfxImage, m_image) DUMP_ASSET_POOL(AssetDumperGfxImage, m_image, ASSET_TYPE_IMAGE)
// DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank) // DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch) // DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch, ASSET_TYPE_SOUND_PATCH)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map) // DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world) // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp) // DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp) // DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents) // DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world) // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def) // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont, m_font) // DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT)
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list) // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
// DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def) // DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize) DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
// DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon) // DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON)
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals) // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table) // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file) DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table) DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table, ASSET_TYPE_STRINGTABLE)
// DUMP_ASSET_POOL(AssetDumperPackIndex, m_pack_index) // DUMP_ASSET_POOL(AssetDumperPackIndex, m_pack_index, ASSET_TYPE_PACK_INDEX)
// DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals) // DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals, ASSET_TYPE_XGLOBALS)
// DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl) // DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl, ASSET_TYPE_DDL)
// DUMP_ASSET_POOL(AssetDumperGlasses, m_glasses) // DUMP_ASSET_POOL(AssetDumperGlasses, m_glasses, ASSET_TYPE_GLASSES)
// DUMP_ASSET_POOL(AssetDumperEmblemSet, m_emblem_set) // DUMP_ASSET_POOL(AssetDumperEmblemSet, m_emblem_set, ASSET_TYPE_EMBLEMSET)
return true; return true;

View File

@ -1,5 +1,6 @@
#include "ZoneDumperT6.h" #include "ZoneDumperT6.h"
#include "ObjWriting.h"
#include "Game/T6/GameT6.h" #include "Game/T6/GameT6.h"
#include "Game/T6/GameAssetPoolT6.h" #include "Game/T6/GameAssetPoolT6.h"
@ -31,63 +32,63 @@ bool ZoneDumper::CanHandleZone(AssetDumpingContext& context) const
bool ZoneDumper::DumpZone(AssetDumpingContext& context) const bool ZoneDumper::DumpZone(AssetDumpingContext& context) const
{ {
#define DUMP_ASSET_POOL(dumperType, poolName) \ #define DUMP_ASSET_POOL(dumperType, poolName, assetType) \
if(assetPools->poolName) \ if(assetPools->poolName && ObjWriting::ShouldHandleAssetType(assetType)) \
{ \ { \
dumperType dumper; \ dumperType dumper; \
dumper.DumpPool(context, assetPools->poolName); \ dumper.DumpPool(context, assetPools->poolName.get()); \
} }
const auto* assetPools = dynamic_cast<GameAssetPoolT6*>(context.m_zone->m_pools.get()); const auto* assetPools = dynamic_cast<GameAssetPoolT6*>(context.m_zone->m_pools.get());
DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset); DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints); DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints, ASSET_TYPE_PHYSCONSTRAINTS)
// DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def); // DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def, ASSET_TYPE_DESTRUCTIBLEDEF)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts); // DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel); DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel, ASSET_TYPE_XMODEL)
// DUMP_ASSET_POOL(AssetDumperMaterial, m_material); // DUMP_ASSET_POOL(AssetDumperMaterial, m_material, ASSET_TYPE_MATERIAL)
// DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set); // DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
DUMP_ASSET_POOL(AssetDumperGfxImage, m_image); DUMP_ASSET_POOL(AssetDumperGfxImage, m_image, ASSET_TYPE_IMAGE)
DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank); DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank, ASSET_TYPE_SOUND)
// DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch); // DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch, ASSET_TYPE_SOUND_PATCH)
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map); // DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP)
// DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world); // DUMP_ASSET_POOL(AssetDumperComWorld, m_com_world, ASSET_TYPE_COMWORLD)
// DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp); // DUMP_ASSET_POOL(AssetDumperGameWorldSp, m_game_world_sp, ASSET_TYPE_GAMEWORLD_SP)
// DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp); // DUMP_ASSET_POOL(AssetDumperGameWorldMp, m_game_world_mp, ASSET_TYPE_GAMEWORLD_MP)
// DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents); // DUMP_ASSET_POOL(AssetDumperMapEnts, m_map_ents, ASSET_TYPE_MAP_ENTS)
// DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world); // DUMP_ASSET_POOL(AssetDumperGfxWorld, m_gfx_world, ASSET_TYPE_GFXWORLD)
// DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def); // DUMP_ASSET_POOL(AssetDumperGfxLightDef, m_gfx_light_def, ASSET_TYPE_LIGHT_DEF)
// DUMP_ASSET_POOL(AssetDumperFont, m_font); // DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT)
DUMP_ASSET_POOL(AssetDumperFontIcon, m_font_icon); DUMP_ASSET_POOL(AssetDumperFontIcon, m_font_icon, ASSET_TYPE_FONTICON)
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list); // DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
// DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def); // DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU)
DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize); DUMP_ASSET_POOL(AssetDumperLocalizeEntry, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon); DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON)
DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment); DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT)
DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique); DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique, ASSET_TYPE_ATTACHMENT_UNIQUE)
// DUMP_ASSET_POOL(AssetDumperWeaponCamo, m_camo); // DUMP_ASSET_POOL(AssetDumperWeaponCamo, m_camo, ASSET_TYPE_WEAPON_CAMO)
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals); // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx); // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table); // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file); DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE)
DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table); DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table, ASSET_TYPE_STRINGTABLE)
// DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard); // DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard, ASSET_TYPE_LEADERBOARD)
// DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals); // DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals, ASSET_TYPE_XGLOBALS)
// DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl); // DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl, ASSET_TYPE_DDL)
// DUMP_ASSET_POOL(AssetDumperGlasses, m_glasses); // DUMP_ASSET_POOL(AssetDumperGlasses, m_glasses, ASSET_TYPE_GLASSES)
// DUMP_ASSET_POOL(AssetDumperEmblemSet, m_emblem_set); // DUMP_ASSET_POOL(AssetDumperEmblemSet, m_emblem_set, ASSET_TYPE_EMBLEMSET)
DUMP_ASSET_POOL(AssetDumperScriptParseTree, m_script); DUMP_ASSET_POOL(AssetDumperScriptParseTree, m_script, ASSET_TYPE_SCRIPTPARSETREE)
// DUMP_ASSET_POOL(AssetDumperKeyValuePairs, m_key_value_pairs); // DUMP_ASSET_POOL(AssetDumperKeyValuePairs, m_key_value_pairs, ASSET_TYPE_KEYVALUEPAIRS)
DUMP_ASSET_POOL(AssetDumperVehicle, m_vehicle); DUMP_ASSET_POOL(AssetDumperVehicle, m_vehicle, ASSET_TYPE_VEHICLEDEF)
// DUMP_ASSET_POOL(AssetDumperMemoryBlock, m_memory_block); // DUMP_ASSET_POOL(AssetDumperMemoryBlock, m_memory_block, ASSET_TYPE_MEMORYBLOCK)
// DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents); // DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents, ASSET_TYPE_ADDON_MAP_ENTS)
DUMP_ASSET_POOL(AssetDumperTracer, m_tracer); DUMP_ASSET_POOL(AssetDumperTracer, m_tracer, ASSET_TYPE_TRACER)
// DUMP_ASSET_POOL(AssetDumperSkinnedVertsDef, m_skinned_verts); // DUMP_ASSET_POOL(AssetDumperSkinnedVertsDef, m_skinned_verts, ASSET_TYPE_SKINNEDVERTS)
DUMP_ASSET_POOL(AssetDumperQdb, m_qdb); DUMP_ASSET_POOL(AssetDumperQdb, m_qdb, ASSET_TYPE_QDB)
DUMP_ASSET_POOL(AssetDumperSlug, m_slug); DUMP_ASSET_POOL(AssetDumperSlug, m_slug, ASSET_TYPE_SLUG)
// DUMP_ASSET_POOL(AssetDumperFootstepTableDef, m_footstep_table); // DUMP_ASSET_POOL(AssetDumperFootstepTableDef, m_footstep_table, ASSET_TYPE_FOOTSTEP_TABLE)
// DUMP_ASSET_POOL(AssetDumperFootstepFXTableDef, m_footstep_fx_table); // DUMP_ASSET_POOL(AssetDumperFootstepFXTableDef, m_footstep_fx_table, ASSET_TYPE_FOOTSTEPFX_TABLE)
DUMP_ASSET_POOL(AssetDumperZBarrier, m_zbarrier); DUMP_ASSET_POOL(AssetDumperZBarrier, m_zbarrier, ASSET_TYPE_ZBARRIER)
return true; return true;

View File

@ -34,4 +34,14 @@ bool ObjWriting::DumpZone(AssetDumpingContext& context)
} }
return false; return false;
} }
bool ObjWriting::ShouldHandleAssetType(const asset_type_t assetType)
{
if (assetType < 0)
return false;
if (static_cast<size_t>(assetType) >= Configuration.AssetTypesToHandleBitfield.size())
return true;
return Configuration.AssetTypesToHandleBitfield[assetType];
}

View File

@ -1,6 +1,9 @@
#pragma once #pragma once
#include <vector>
#include "Dumping/AssetDumpingContext.h" #include "Dumping/AssetDumpingContext.h"
#include "Zone/ZoneTypes.h"
class ObjWriting class ObjWriting
{ {
@ -21,10 +24,13 @@ public:
}; };
bool Verbose = false; bool Verbose = false;
std::vector<bool> AssetTypesToHandleBitfield;
ImageOutputFormat_e ImageOutputFormat = ImageOutputFormat_e::DDS; ImageOutputFormat_e ImageOutputFormat = ImageOutputFormat_e::DDS;
ModelOutputFormat_e ModelOutputFormat = ModelOutputFormat_e::XMODEL_EXPORT; ModelOutputFormat_e ModelOutputFormat = ModelOutputFormat_e::XMODEL_EXPORT;
} Configuration; } Configuration;
static bool DumpZone(AssetDumpingContext& context); static bool DumpZone(AssetDumpingContext& context);
static bool ShouldHandleAssetType(asset_type_t assetType);
}; };

View File

@ -210,6 +210,23 @@ class Unlinker::Impl
return true; return true;
} }
void UpdateAssetIncludesAndExcludes(const AssetDumpingContext& context) const
{
const auto assetTypeCount = context.m_zone->m_pools->GetAssetTypeCount();
ObjWriting::Configuration.AssetTypesToHandleBitfield = std::vector<bool>(assetTypeCount);
for(auto i = 0; i < assetTypeCount; i++)
{
const auto assetTypeName = std::string(context.m_zone->m_pools->GetAssetTypeName(i));
if (m_args.m_specified_asset_types.find(assetTypeName) != m_args.m_specified_asset_types.end())
ObjWriting::Configuration.AssetTypesToHandleBitfield[i] = m_args.m_asset_type_handling == UnlinkerArgs::AssetTypeHandling::INCLUDE;
else
ObjWriting::Configuration.AssetTypesToHandleBitfield[i] = m_args.m_asset_type_handling == UnlinkerArgs::AssetTypeHandling::EXCLUDE;
}
}
/** /**
* \brief Performs the tasks specified by the command line arguments on the specified zone. * \brief Performs the tasks specified by the command line arguments on the specified zone.
* \param zone The zone to handle. * \param zone The zone to handle.
@ -249,6 +266,7 @@ class Unlinker::Impl
context.m_gdt = std::move(gdt); context.m_gdt = std::move(gdt);
} }
UpdateAssetIncludesAndExcludes(context);
ObjWriting::DumpZone(context); ObjWriting::DumpZone(context);
if (m_args.m_use_gdt) if (m_args.m_use_gdt)

View File

@ -79,6 +79,22 @@ const CommandLineOption* const OPTION_GDT =
.WithDescription("Dumps assets in a GDT whenever possible.") .WithDescription("Dumps assets in a GDT whenever possible.")
.Build(); .Build();
const CommandLineOption* const OPTION_EXCLUDE_ASSETS =
CommandLineOption::Builder::Create()
.WithLongName("exclude-assets")
.WithDescription("Specify all asset types that should be excluded.")
.WithParameter("assetTypeList")
.Reusable()
.Build();
const CommandLineOption* const OPTION_INCLUDE_ASSETS =
CommandLineOption::Builder::Create()
.WithLongName("include-assets")
.WithDescription("Specify all asset types that should be included.")
.WithParameter("assetTypeList")
.Reusable()
.Build();
const CommandLineOption* const COMMAND_LINE_OPTIONS[] const CommandLineOption* const COMMAND_LINE_OPTIONS[]
{ {
OPTION_HELP, OPTION_HELP,
@ -90,7 +106,9 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]
OPTION_SEARCH_PATH, OPTION_SEARCH_PATH,
OPTION_IMAGE_FORMAT, OPTION_IMAGE_FORMAT,
OPTION_MODEL_FORMAT, OPTION_MODEL_FORMAT,
OPTION_GDT OPTION_GDT,
OPTION_EXCLUDE_ASSETS,
OPTION_INCLUDE_ASSETS
}; };
UnlinkerArgs::UnlinkerArgs() UnlinkerArgs::UnlinkerArgs()
@ -98,6 +116,7 @@ UnlinkerArgs::UnlinkerArgs()
m_zone_pattern(R"(\?zone\?)"), m_zone_pattern(R"(\?zone\?)"),
m_task(ProcessingTask::DUMP), m_task(ProcessingTask::DUMP),
m_minimal_zone_def(false), m_minimal_zone_def(false),
m_asset_type_handling(AssetTypeHandling::EXCLUDE),
m_use_gdt(false), m_use_gdt(false),
m_verbose(false) m_verbose(false)
{ {
@ -171,6 +190,25 @@ bool UnlinkerArgs::SetModelDumpingMode()
return false; return false;
} }
void UnlinkerArgs::ParseCommaSeparatedAssetTypeString(const std::string& input)
{
auto currentPos = 0u;
size_t endPos;
std::string lowerInput(input);
for (auto& c : lowerInput)
c = static_cast<char>(tolower(c));
while (currentPos < lowerInput.size() && (endPos = lowerInput.find_first_of(',', currentPos)) != std::string::npos)
{
m_specified_asset_types.emplace(lowerInput, currentPos, endPos - currentPos);
currentPos = endPos + 1;
}
if (currentPos < lowerInput.size())
m_specified_asset_types.emplace(lowerInput, currentPos, lowerInput.size() - currentPos);
}
bool UnlinkerArgs::ParseArgs(const int argc, const char** argv) bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
{ {
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1])) if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
@ -246,6 +284,27 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
// --gdt // --gdt
m_use_gdt = m_argument_parser.IsOptionSpecified(OPTION_GDT); m_use_gdt = m_argument_parser.IsOptionSpecified(OPTION_GDT);
// --exclude-assets
// --include-assets
if (m_argument_parser.IsOptionSpecified(OPTION_EXCLUDE_ASSETS) && m_argument_parser.IsOptionSpecified(OPTION_INCLUDE_ASSETS))
{
std::cout << "You can only asset types to either exclude or include, not both\n";
return false;
}
if (m_argument_parser.IsOptionSpecified(OPTION_EXCLUDE_ASSETS))
{
m_asset_type_handling = AssetTypeHandling::EXCLUDE;
for (const auto& exclude : m_argument_parser.GetParametersForOption(OPTION_EXCLUDE_ASSETS))
ParseCommaSeparatedAssetTypeString(exclude);
}
else if (m_argument_parser.IsOptionSpecified(OPTION_INCLUDE_ASSETS))
{
m_asset_type_handling = AssetTypeHandling::INCLUDE;
for (const auto& include : m_argument_parser.GetParametersForOption(OPTION_INCLUDE_ASSETS))
ParseCommaSeparatedAssetTypeString(include);
}
return true; return true;
} }

View File

@ -2,6 +2,7 @@
#include <regex> #include <regex>
#include <set> #include <set>
#include <vector> #include <vector>
#include <string>
#include "Utils/Arguments/ArgumentParser.h" #include "Utils/Arguments/ArgumentParser.h"
#include "Zone/Zone.h" #include "Zone/Zone.h"
@ -24,6 +25,8 @@ private:
bool SetImageDumpingMode(); bool SetImageDumpingMode();
bool SetModelDumpingMode(); bool SetModelDumpingMode();
void ParseCommaSeparatedAssetTypeString(const std::string& input);
public: public:
enum class ProcessingTask enum class ProcessingTask
{ {
@ -31,6 +34,12 @@ public:
LIST LIST
}; };
enum class AssetTypeHandling
{
EXCLUDE,
INCLUDE
};
std::vector<std::string> m_zones_to_load; std::vector<std::string> m_zones_to_load;
std::vector<std::string> m_zones_to_unlink; std::vector<std::string> m_zones_to_unlink;
std::set<std::string> m_user_search_paths; std::set<std::string> m_user_search_paths;
@ -39,6 +48,9 @@ public:
std::string m_output_folder; std::string m_output_folder;
bool m_minimal_zone_def; bool m_minimal_zone_def;
std::set<std::string> m_specified_asset_types;
AssetTypeHandling m_asset_type_handling;
bool m_use_gdt; bool m_use_gdt;
bool m_verbose; bool m_verbose;

View File

@ -84,35 +84,6 @@ GameAssetPoolIW3::GameAssetPoolIW3(Zone* zone, const int priority)
m_priority(priority) m_priority(priority)
{ {
static_assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); static_assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT);
m_phys_preset = nullptr;
m_xanim_parts = nullptr;
m_xmodel = nullptr;
m_material = nullptr;
m_material_pixel_shader = nullptr;
m_material_vertex_shader = nullptr;
m_material_vertex_decl = nullptr;
m_technique_set = nullptr;
m_image = nullptr;
m_sound = nullptr;
m_sound_curve = nullptr;
m_loaded_sound = nullptr;
m_clip_map = nullptr;
m_com_world = nullptr;
m_game_world_sp = nullptr;
m_game_world_mp = nullptr;
m_map_ents = nullptr;
m_gfx_world = nullptr;
m_gfx_light_def = nullptr;
m_font = nullptr;
m_menu_list = nullptr;
m_menu_def = nullptr;
m_localize = nullptr;
m_weapon = nullptr;
m_fx = nullptr;
m_fx_impact_table = nullptr;
m_raw_file = nullptr;
m_string_table = nullptr;
} }
void GameAssetPoolIW3::InitPoolStatic(const asset_type_t type, const size_t capacity) void GameAssetPoolIW3::InitPoolStatic(const asset_type_t type, const size_t capacity)
@ -327,3 +298,13 @@ const char* GameAssetPoolIW3::GetAssetTypeName(const asset_type_t assetType) con
{ {
return AssetTypeNameByType(assetType); return AssetTypeNameByType(assetType);
} }
asset_type_t GameAssetPoolIW3::AssetTypeCount()
{
return ASSET_TYPE_COUNT;
}
asset_type_t GameAssetPoolIW3::GetAssetTypeCount() const
{
return AssetTypeCount();
}

View File

@ -53,6 +53,10 @@ public:
void InitPoolDynamic(asset_type_t type) override; void InitPoolDynamic(asset_type_t type) override;
_NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override; _NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
static const char* AssetTypeNameByType(asset_type_t assetType); static const char* AssetTypeNameByType(asset_type_t assetType);
_NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override; _NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
static asset_type_t AssetTypeCount();
_NODISCARD asset_type_t GetAssetTypeCount() const override;
}; };

View File

@ -104,42 +104,6 @@ GameAssetPoolIW4::GameAssetPoolIW4(Zone* zone, const int priority)
m_priority(priority) m_priority(priority)
{ {
assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT);
m_phys_preset = nullptr;
m_phys_collmap = nullptr;
m_xanim_parts = nullptr;
m_xmodel = nullptr;
m_material = nullptr;
m_material_pixel_shader = nullptr;
m_material_vertex_shader = nullptr;
m_material_vertex_decl = nullptr;
m_technique_set = nullptr;
m_image = nullptr;
m_sound = nullptr;
m_sound_curve = nullptr;
m_loaded_sound = nullptr;
m_clip_map = nullptr;
m_com_world = nullptr;
m_game_world_sp = nullptr;
m_game_world_mp = nullptr;
m_map_ents = nullptr;
m_fx_world = nullptr;
m_gfx_world = nullptr;
m_gfx_light_def = nullptr;
m_font = nullptr;
m_menu_list = nullptr;
m_menu_def = nullptr;
m_localize = nullptr;
m_weapon = nullptr;
m_fx = nullptr;
m_fx_impact_table = nullptr;
m_raw_file = nullptr;
m_string_table = nullptr;
m_leaderboard = nullptr;
m_structed_data_def_set = nullptr;
m_tracer = nullptr;
m_vehicle = nullptr;
m_addon_map_ents = nullptr;
} }
void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capacity) void GameAssetPoolIW4::InitPoolStatic(const asset_type_t type, const size_t capacity)
@ -394,3 +358,13 @@ const char* GameAssetPoolIW4::GetAssetTypeName(const asset_type_t assetType) con
{ {
return AssetTypeNameByType(assetType); return AssetTypeNameByType(assetType);
} }
asset_type_t GameAssetPoolIW4::AssetTypeCount()
{
return ASSET_TYPE_COUNT;
}
asset_type_t GameAssetPoolIW4::GetAssetTypeCount() const
{
return AssetTypeCount();
}

View File

@ -2,6 +2,7 @@
#include <memory> #include <memory>
#include "Utils/ClassUtils.h"
#include "Pool/ZoneAssetPools.h" #include "Pool/ZoneAssetPools.h"
#include "Pool/AssetPool.h" #include "Pool/AssetPool.h"
#include "Game/IW4/IW4.h" #include "Game/IW4/IW4.h"
@ -59,7 +60,11 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) override; void InitPoolStatic(asset_type_t type, size_t capacity) override;
void InitPoolDynamic(asset_type_t type) override; void InitPoolDynamic(asset_type_t type) override;
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override; _NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
static const char* AssetTypeNameByType(asset_type_t assetType); static const char* AssetTypeNameByType(asset_type_t assetType);
const char* GetAssetTypeName(asset_type_t assetType) const override; _NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
static asset_type_t AssetTypeCount();
_NODISCARD asset_type_t GetAssetTypeCount() const override;
}; };

View File

@ -110,47 +110,6 @@ GameAssetPoolIW5::GameAssetPoolIW5(Zone* zone, const int priority)
m_priority(priority) m_priority(priority)
{ {
assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT);
m_phys_preset = nullptr;
m_phys_collmap = nullptr;
m_xanim_parts = nullptr;
m_xmodel_surfs = nullptr;
m_xmodel = nullptr;
m_material = nullptr;
m_material_pixel_shader = nullptr;
m_material_vertex_shader = nullptr;
m_material_vertex_decl = nullptr;
m_technique_set = nullptr;
m_image = nullptr;
m_sound = nullptr;
m_sound_curve = nullptr;
m_loaded_sound = nullptr;
m_clip_map = nullptr;
m_com_world = nullptr;
m_glass_world = nullptr;
m_path_data = nullptr;
m_vehicle_track = nullptr;
m_map_ents = nullptr;
m_fx_world = nullptr;
m_gfx_world = nullptr;
m_gfx_light_def = nullptr;
m_font = nullptr;
m_menu_list = nullptr;
m_menu_def = nullptr;
m_localize = nullptr;
m_attachment = nullptr;
m_weapon = nullptr;
m_fx = nullptr;
m_fx_impact_table = nullptr;
m_surface_fx_table = nullptr;
m_raw_file = nullptr;
m_script_file = nullptr;
m_string_table = nullptr;
m_leaderboard = nullptr;
m_structed_data_def_set = nullptr;
m_tracer = nullptr;
m_vehicle = nullptr;
m_addon_map_ents = nullptr;
} }
void GameAssetPoolIW5::InitPoolStatic(const asset_type_t type, const size_t capacity) void GameAssetPoolIW5::InitPoolStatic(const asset_type_t type, const size_t capacity)
@ -421,3 +380,13 @@ const char* GameAssetPoolIW5::GetAssetTypeName(const asset_type_t assetType) con
{ {
return AssetTypeNameByType(assetType); return AssetTypeNameByType(assetType);
} }
asset_type_t GameAssetPoolIW5::AssetTypeCount()
{
return ASSET_TYPE_COUNT;
}
asset_type_t GameAssetPoolIW5::GetAssetTypeCount() const
{
return AssetTypeCount();
}

View File

@ -64,7 +64,11 @@ public:
void InitPoolStatic(asset_type_t type, size_t capacity) override; void InitPoolStatic(asset_type_t type, size_t capacity) override;
void InitPoolDynamic(asset_type_t type) override; void InitPoolDynamic(asset_type_t type) override;
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override; _NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
static const char* AssetTypeNameByType(asset_type_t assetType); static const char* AssetTypeNameByType(asset_type_t assetType);
const char* GetAssetTypeName(asset_type_t assetType) const override; _NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
static asset_type_t AssetTypeCount();
_NODISCARD asset_type_t GetAssetTypeCount() const override;
}; };

View File

@ -60,80 +60,6 @@ GameAssetPoolT5::GameAssetPoolT5(Zone* zone, const int priority)
m_priority(priority) m_priority(priority)
{ {
assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT);
m_phys_preset = nullptr;
m_phys_constraints = nullptr;
m_destructible_def = nullptr;
m_xanim_parts = nullptr;
m_xmodel = nullptr;
m_material = nullptr;
m_technique_set = nullptr;
m_image = nullptr;
m_sound_bank = nullptr;
m_sound_patch = nullptr;
m_clip_map = nullptr;
m_com_world = nullptr;
m_game_world_sp = nullptr;
m_game_world_mp = nullptr;
m_map_ents = nullptr;
m_gfx_world = nullptr;
m_gfx_light_def = nullptr;
m_font = nullptr;
m_menu_list = nullptr;
m_menu_def = nullptr;
m_localize = nullptr;
m_weapon = nullptr;
m_snd_driver_globals = nullptr;
m_fx = nullptr;
m_fx_impact_table = nullptr;
m_raw_file = nullptr;
m_string_table = nullptr;
m_pack_index = nullptr;
m_xglobals = nullptr;
m_ddl = nullptr;
m_glasses = nullptr;
m_emblem_set = nullptr;
}
GameAssetPoolT5::~GameAssetPoolT5()
{
#define DELETE_POOL(poolName) \
delete (poolName); (poolName) = nullptr;
DELETE_POOL(m_phys_preset);
DELETE_POOL(m_phys_constraints);
DELETE_POOL(m_destructible_def);
DELETE_POOL(m_xanim_parts);
DELETE_POOL(m_xmodel);
DELETE_POOL(m_material);
DELETE_POOL(m_technique_set);
DELETE_POOL(m_image);
DELETE_POOL(m_sound_bank);
DELETE_POOL(m_sound_patch);
DELETE_POOL(m_clip_map);
DELETE_POOL(m_com_world);
DELETE_POOL(m_game_world_sp);
DELETE_POOL(m_game_world_mp);
DELETE_POOL(m_map_ents);
DELETE_POOL(m_gfx_world);
DELETE_POOL(m_gfx_light_def);
DELETE_POOL(m_font);
DELETE_POOL(m_menu_list);
DELETE_POOL(m_menu_def);
DELETE_POOL(m_localize);
DELETE_POOL(m_weapon);
DELETE_POOL(m_snd_driver_globals);
DELETE_POOL(m_fx);
DELETE_POOL(m_fx_impact_table);
DELETE_POOL(m_raw_file);
DELETE_POOL(m_string_table);
DELETE_POOL(m_pack_index);
DELETE_POOL(m_xglobals);
DELETE_POOL(m_ddl);
DELETE_POOL(m_glasses);
DELETE_POOL(m_emblem_set);
#undef DELETE_POOL
} }
void GameAssetPoolT5::InitPoolStatic(const asset_type_t type, const size_t capacity) void GameAssetPoolT5::InitPoolStatic(const asset_type_t type, const size_t capacity)
@ -143,7 +69,7 @@ void GameAssetPoolT5::InitPoolStatic(const asset_type_t type, const size_t capac
{ \ { \
if((poolName) == nullptr && capacity > 0) \ if((poolName) == nullptr && capacity > 0) \
{ \ { \
(poolName) = new AssetPoolStatic<poolType>(capacity, m_priority, (assetType)); \ (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \
} \ } \
break; \ break; \
} }
@ -199,7 +125,7 @@ void GameAssetPoolT5::InitPoolDynamic(const asset_type_t type)
{ \ { \
if((poolName) == nullptr) \ if((poolName) == nullptr) \
{ \ { \
(poolName) = new AssetPoolDynamic<poolType>(m_priority, (assetType)); \ (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \
} \ } \
break; \ break; \
} }
@ -377,3 +303,13 @@ const char* GameAssetPoolT5::GetAssetTypeName(const asset_type_t assetType) cons
{ {
return AssetTypeNameByType(assetType); return AssetTypeNameByType(assetType);
} }
asset_type_t GameAssetPoolT5::AssetTypeCount()
{
return ASSET_TYPE_COUNT;
}
asset_type_t GameAssetPoolT5::GetAssetTypeCount() const
{
return AssetTypeCount();
}

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <memory>
#include "Pool/ZoneAssetPools.h" #include "Pool/ZoneAssetPools.h"
#include "Pool/AssetPool.h" #include "Pool/AssetPool.h"
#include "Game/T5/T5.h" #include "Game/T5/T5.h"
@ -15,46 +17,50 @@ protected:
XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override; XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override;
public: public:
AssetPool<T5::PhysPreset>* m_phys_preset; std::unique_ptr<AssetPool<T5::PhysPreset>> m_phys_preset;
AssetPool<T5::PhysConstraints>* m_phys_constraints; std::unique_ptr<AssetPool<T5::PhysConstraints>> m_phys_constraints;
AssetPool<T5::DestructibleDef>* m_destructible_def; std::unique_ptr<AssetPool<T5::DestructibleDef>> m_destructible_def;
AssetPool<T5::XAnimParts>* m_xanim_parts; std::unique_ptr<AssetPool<T5::XAnimParts>> m_xanim_parts;
AssetPool<T5::XModel>* m_xmodel; std::unique_ptr<AssetPool<T5::XModel>> m_xmodel;
AssetPool<T5::Material>* m_material; std::unique_ptr<AssetPool<T5::Material>> m_material;
AssetPool<T5::MaterialTechniqueSet>* m_technique_set; std::unique_ptr<AssetPool<T5::MaterialTechniqueSet>> m_technique_set;
AssetPool<T5::GfxImage>* m_image; std::unique_ptr<AssetPool<T5::GfxImage>> m_image;
AssetPool<T5::SndBank>* m_sound_bank; std::unique_ptr<AssetPool<T5::SndBank>> m_sound_bank;
AssetPool<T5::SndPatch>* m_sound_patch; std::unique_ptr<AssetPool<T5::SndPatch>> m_sound_patch;
AssetPool<T5::clipMap_t>* m_clip_map; std::unique_ptr<AssetPool<T5::clipMap_t>> m_clip_map;
AssetPool<T5::ComWorld>* m_com_world; std::unique_ptr<AssetPool<T5::ComWorld>> m_com_world;
AssetPool<T5::GameWorldSp>* m_game_world_sp; std::unique_ptr<AssetPool<T5::GameWorldSp>> m_game_world_sp;
AssetPool<T5::GameWorldMp>* m_game_world_mp; std::unique_ptr<AssetPool<T5::GameWorldMp>> m_game_world_mp;
AssetPool<T5::MapEnts>* m_map_ents; std::unique_ptr<AssetPool<T5::MapEnts>> m_map_ents;
AssetPool<T5::GfxWorld>* m_gfx_world; std::unique_ptr<AssetPool<T5::GfxWorld>> m_gfx_world;
AssetPool<T5::GfxLightDef>* m_gfx_light_def; std::unique_ptr<AssetPool<T5::GfxLightDef>> m_gfx_light_def;
AssetPool<T5::Font_s>* m_font; std::unique_ptr<AssetPool<T5::Font_s>> m_font;
AssetPool<T5::MenuList>* m_menu_list; std::unique_ptr<AssetPool<T5::MenuList>> m_menu_list;
AssetPool<T5::menuDef_t>* m_menu_def; std::unique_ptr<AssetPool<T5::menuDef_t>> m_menu_def;
AssetPool<T5::LocalizeEntry>* m_localize; std::unique_ptr<AssetPool<T5::LocalizeEntry>> m_localize;
AssetPool<T5::WeaponVariantDef>* m_weapon; std::unique_ptr<AssetPool<T5::WeaponVariantDef>> m_weapon;
AssetPool<T5::SndDriverGlobals>* m_snd_driver_globals; std::unique_ptr<AssetPool<T5::SndDriverGlobals>> m_snd_driver_globals;
AssetPool<T5::FxEffectDef>* m_fx; std::unique_ptr<AssetPool<T5::FxEffectDef>> m_fx;
AssetPool<T5::FxImpactTable>* m_fx_impact_table; std::unique_ptr<AssetPool<T5::FxImpactTable>> m_fx_impact_table;
AssetPool<T5::RawFile>* m_raw_file; std::unique_ptr<AssetPool<T5::RawFile>> m_raw_file;
AssetPool<T5::StringTable>* m_string_table; std::unique_ptr<AssetPool<T5::StringTable>> m_string_table;
AssetPool<T5::PackIndex>* m_pack_index; std::unique_ptr<AssetPool<T5::PackIndex>> m_pack_index;
AssetPool<T5::XGlobals>* m_xglobals; std::unique_ptr<AssetPool<T5::XGlobals>> m_xglobals;
AssetPool<T5::ddlRoot_t>* m_ddl; std::unique_ptr<AssetPool<T5::ddlRoot_t>> m_ddl;
AssetPool<T5::Glasses>* m_glasses; std::unique_ptr<AssetPool<T5::Glasses>> m_glasses;
AssetPool<T5::EmblemSet>* m_emblem_set; std::unique_ptr<AssetPool<T5::EmblemSet>> m_emblem_set;
GameAssetPoolT5(Zone* zone, int priority); GameAssetPoolT5(Zone* zone, int priority);
~GameAssetPoolT5() override; ~GameAssetPoolT5() override = default;
void InitPoolStatic(asset_type_t type, size_t capacity) override; void InitPoolStatic(asset_type_t type, size_t capacity) override;
void InitPoolDynamic(asset_type_t type) override; void InitPoolDynamic(asset_type_t type) override;
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override; _NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
static const char* AssetTypeNameByType(asset_type_t assetType); static const char* AssetTypeNameByType(asset_type_t assetType);
const char* GetAssetTypeName(asset_type_t assetType) const override; _NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
static asset_type_t AssetTypeCount();
_NODISCARD asset_type_t GetAssetTypeCount() const override;
}; };

View File

@ -77,112 +77,6 @@ GameAssetPoolT6::GameAssetPoolT6(Zone* zone, const int priority)
m_priority(priority) m_priority(priority)
{ {
assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT); assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT);
m_phys_preset = nullptr;
m_phys_constraints = nullptr;
m_destructible_def = nullptr;
m_xanim_parts = nullptr;
m_xmodel = nullptr;
m_material = nullptr;
m_technique_set = nullptr;
m_image = nullptr;
m_sound_bank = nullptr;
m_sound_patch = nullptr;
m_clip_map = nullptr;
m_com_world = nullptr;
m_game_world_sp = nullptr;
m_game_world_mp = nullptr;
m_map_ents = nullptr;
m_gfx_world = nullptr;
m_gfx_light_def = nullptr;
m_font = nullptr;
m_font_icon = nullptr;
m_menu_list = nullptr;
m_menu_def = nullptr;
m_localize = nullptr;
m_weapon = nullptr;
m_attachment = nullptr;
m_attachment_unique = nullptr;
m_camo = nullptr;
m_snd_driver_globals = nullptr;
m_fx = nullptr;
m_fx_impact_table = nullptr;
m_raw_file = nullptr;
m_string_table = nullptr;
m_leaderboard = nullptr;
m_xglobals = nullptr;
m_ddl = nullptr;
m_glasses = nullptr;
m_emblem_set = nullptr;
m_script = nullptr;
m_key_value_pairs = nullptr;
m_vehicle = nullptr;
m_memory_block = nullptr;
m_addon_map_ents = nullptr;
m_tracer = nullptr;
m_skinned_verts = nullptr;
m_qdb = nullptr;
m_slug = nullptr;
m_footstep_table = nullptr;
m_footstep_fx_table = nullptr;
m_zbarrier = nullptr;
}
GameAssetPoolT6::~GameAssetPoolT6()
{
#define DELETE_POOL(poolName) \
delete (poolName); (poolName) = nullptr;
DELETE_POOL(m_phys_preset);
DELETE_POOL(m_phys_constraints);
DELETE_POOL(m_destructible_def);
DELETE_POOL(m_xanim_parts);
DELETE_POOL(m_xmodel);
DELETE_POOL(m_material);
DELETE_POOL(m_technique_set);
DELETE_POOL(m_image);
DELETE_POOL(m_sound_bank);
DELETE_POOL(m_sound_patch);
DELETE_POOL(m_clip_map);
DELETE_POOL(m_com_world);
DELETE_POOL(m_game_world_sp);
DELETE_POOL(m_game_world_mp);
DELETE_POOL(m_map_ents);
DELETE_POOL(m_gfx_world);
DELETE_POOL(m_gfx_light_def);
DELETE_POOL(m_font);
DELETE_POOL(m_font_icon);
DELETE_POOL(m_menu_list);
DELETE_POOL(m_menu_def);
DELETE_POOL(m_localize);
DELETE_POOL(m_weapon);
DELETE_POOL(m_attachment);
DELETE_POOL(m_attachment_unique);
DELETE_POOL(m_camo);
DELETE_POOL(m_snd_driver_globals);
DELETE_POOL(m_fx);
DELETE_POOL(m_fx_impact_table);
DELETE_POOL(m_raw_file);
DELETE_POOL(m_string_table);
DELETE_POOL(m_leaderboard);
DELETE_POOL(m_xglobals);
DELETE_POOL(m_ddl);
DELETE_POOL(m_glasses);
DELETE_POOL(m_emblem_set);
DELETE_POOL(m_script);
DELETE_POOL(m_key_value_pairs);
DELETE_POOL(m_vehicle);
DELETE_POOL(m_memory_block);
DELETE_POOL(m_addon_map_ents);
DELETE_POOL(m_tracer);
DELETE_POOL(m_skinned_verts);
DELETE_POOL(m_qdb);
DELETE_POOL(m_slug);
DELETE_POOL(m_footstep_table);
DELETE_POOL(m_footstep_fx_table);
DELETE_POOL(m_zbarrier);
#undef DELETE_POOL
} }
void GameAssetPoolT6::InitPoolStatic(const asset_type_t type, const size_t capacity) void GameAssetPoolT6::InitPoolStatic(const asset_type_t type, const size_t capacity)
@ -192,7 +86,7 @@ void GameAssetPoolT6::InitPoolStatic(const asset_type_t type, const size_t capac
{ \ { \
if((poolName) == nullptr && capacity > 0) \ if((poolName) == nullptr && capacity > 0) \
{ \ { \
(poolName) = new AssetPoolStatic<poolType>(capacity, m_priority, (assetType)); \ (poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \
} \ } \
break; \ break; \
} }
@ -264,7 +158,7 @@ void GameAssetPoolT6::InitPoolDynamic(const asset_type_t type)
{ \ { \
if((poolName) == nullptr) \ if((poolName) == nullptr) \
{ \ { \
(poolName) = new AssetPoolDynamic<poolType>(m_priority, (assetType)); \ (poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \
} \ } \
break; \ break; \
} }
@ -490,3 +384,13 @@ const char* GameAssetPoolT6::GetAssetTypeName(const asset_type_t assetType) cons
{ {
return AssetTypeNameByType(assetType); return AssetTypeNameByType(assetType);
} }
asset_type_t GameAssetPoolT6::AssetTypeCount()
{
return ASSET_TYPE_COUNT;
}
asset_type_t GameAssetPoolT6::GetAssetTypeCount() const
{
return AssetTypeCount();
}

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <memory>
#include "Pool/ZoneAssetPools.h" #include "Pool/ZoneAssetPools.h"
#include "Pool/AssetPool.h" #include "Pool/AssetPool.h"
#include "Game/T6/T6.h" #include "Game/T6/T6.h"
@ -15,62 +17,66 @@ protected:
XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override; XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override;
public: public:
AssetPool<T6::PhysPreset>* m_phys_preset; std::unique_ptr<AssetPool<T6::PhysPreset>> m_phys_preset;
AssetPool<T6::PhysConstraints>* m_phys_constraints; std::unique_ptr<AssetPool<T6::PhysConstraints>> m_phys_constraints;
AssetPool<T6::DestructibleDef>* m_destructible_def; std::unique_ptr<AssetPool<T6::DestructibleDef>> m_destructible_def;
AssetPool<T6::XAnimParts>* m_xanim_parts; std::unique_ptr<AssetPool<T6::XAnimParts>> m_xanim_parts;
AssetPool<T6::XModel>* m_xmodel; std::unique_ptr<AssetPool<T6::XModel>> m_xmodel;
AssetPool<T6::Material>* m_material; std::unique_ptr<AssetPool<T6::Material>> m_material;
AssetPool<T6::MaterialTechniqueSet>* m_technique_set; std::unique_ptr<AssetPool<T6::MaterialTechniqueSet>> m_technique_set;
AssetPool<T6::GfxImage>* m_image; std::unique_ptr<AssetPool<T6::GfxImage>> m_image;
AssetPool<T6::SndBank>* m_sound_bank; std::unique_ptr<AssetPool<T6::SndBank>> m_sound_bank;
AssetPool<T6::SndPatch>* m_sound_patch; std::unique_ptr<AssetPool<T6::SndPatch>> m_sound_patch;
AssetPool<T6::clipMap_t>* m_clip_map; std::unique_ptr<AssetPool<T6::clipMap_t>> m_clip_map;
AssetPool<T6::ComWorld>* m_com_world; std::unique_ptr<AssetPool<T6::ComWorld>> m_com_world;
AssetPool<T6::GameWorldSp>* m_game_world_sp; std::unique_ptr<AssetPool<T6::GameWorldSp>> m_game_world_sp;
AssetPool<T6::GameWorldMp>* m_game_world_mp; std::unique_ptr<AssetPool<T6::GameWorldMp>> m_game_world_mp;
AssetPool<T6::MapEnts>* m_map_ents; std::unique_ptr<AssetPool<T6::MapEnts>> m_map_ents;
AssetPool<T6::GfxWorld>* m_gfx_world; std::unique_ptr<AssetPool<T6::GfxWorld>> m_gfx_world;
AssetPool<T6::GfxLightDef>* m_gfx_light_def; std::unique_ptr<AssetPool<T6::GfxLightDef>> m_gfx_light_def;
AssetPool<T6::Font_s>* m_font; std::unique_ptr<AssetPool<T6::Font_s>> m_font;
AssetPool<T6::FontIcon>* m_font_icon; std::unique_ptr<AssetPool<T6::FontIcon>> m_font_icon;
AssetPool<T6::MenuList>* m_menu_list; std::unique_ptr<AssetPool<T6::MenuList>> m_menu_list;
AssetPool<T6::menuDef_t>* m_menu_def; std::unique_ptr<AssetPool<T6::menuDef_t>> m_menu_def;
AssetPool<T6::LocalizeEntry>* m_localize; std::unique_ptr<AssetPool<T6::LocalizeEntry>> m_localize;
AssetPool<T6::WeaponVariantDef>* m_weapon; std::unique_ptr<AssetPool<T6::WeaponVariantDef>> m_weapon;
AssetPool<T6::WeaponAttachment>* m_attachment; std::unique_ptr<AssetPool<T6::WeaponAttachment>> m_attachment;
AssetPool<T6::WeaponAttachmentUnique>* m_attachment_unique; std::unique_ptr<AssetPool<T6::WeaponAttachmentUnique>> m_attachment_unique;
AssetPool<T6::WeaponCamo>* m_camo; std::unique_ptr<AssetPool<T6::WeaponCamo>> m_camo;
AssetPool<T6::SndDriverGlobals>* m_snd_driver_globals; std::unique_ptr<AssetPool<T6::SndDriverGlobals>> m_snd_driver_globals;
AssetPool<T6::FxEffectDef>* m_fx; std::unique_ptr<AssetPool<T6::FxEffectDef>> m_fx;
AssetPool<T6::FxImpactTable>* m_fx_impact_table; std::unique_ptr<AssetPool<T6::FxImpactTable>> m_fx_impact_table;
AssetPool<T6::RawFile>* m_raw_file; std::unique_ptr<AssetPool<T6::RawFile>> m_raw_file;
AssetPool<T6::StringTable>* m_string_table; std::unique_ptr<AssetPool<T6::StringTable>> m_string_table;
AssetPool<T6::LeaderboardDef>* m_leaderboard; std::unique_ptr<AssetPool<T6::LeaderboardDef>> m_leaderboard;
AssetPool<T6::XGlobals>* m_xglobals; std::unique_ptr<AssetPool<T6::XGlobals>> m_xglobals;
AssetPool<T6::ddlRoot_t>* m_ddl; std::unique_ptr<AssetPool<T6::ddlRoot_t>> m_ddl;
AssetPool<T6::Glasses>* m_glasses; std::unique_ptr<AssetPool<T6::Glasses>> m_glasses;
AssetPool<T6::EmblemSet>* m_emblem_set; std::unique_ptr<AssetPool<T6::EmblemSet>> m_emblem_set;
AssetPool<T6::ScriptParseTree>* m_script; std::unique_ptr<AssetPool<T6::ScriptParseTree>> m_script;
AssetPool<T6::KeyValuePairs>* m_key_value_pairs; std::unique_ptr<AssetPool<T6::KeyValuePairs>> m_key_value_pairs;
AssetPool<T6::VehicleDef>* m_vehicle; std::unique_ptr<AssetPool<T6::VehicleDef>> m_vehicle;
AssetPool<T6::MemoryBlock>* m_memory_block; std::unique_ptr<AssetPool<T6::MemoryBlock>> m_memory_block;
AssetPool<T6::AddonMapEnts>* m_addon_map_ents; std::unique_ptr<AssetPool<T6::AddonMapEnts>> m_addon_map_ents;
AssetPool<T6::TracerDef>* m_tracer; std::unique_ptr<AssetPool<T6::TracerDef>> m_tracer;
AssetPool<T6::SkinnedVertsDef>* m_skinned_verts; std::unique_ptr<AssetPool<T6::SkinnedVertsDef>> m_skinned_verts;
AssetPool<T6::Qdb>* m_qdb; std::unique_ptr<AssetPool<T6::Qdb>> m_qdb;
AssetPool<T6::Slug>* m_slug; std::unique_ptr<AssetPool<T6::Slug>> m_slug;
AssetPool<T6::FootstepTableDef>* m_footstep_table; std::unique_ptr<AssetPool<T6::FootstepTableDef>> m_footstep_table;
AssetPool<T6::FootstepFXTableDef>* m_footstep_fx_table; std::unique_ptr<AssetPool<T6::FootstepFXTableDef>> m_footstep_fx_table;
AssetPool<T6::ZBarrierDef>* m_zbarrier; std::unique_ptr<AssetPool<T6::ZBarrierDef>> m_zbarrier;
GameAssetPoolT6(Zone* zone, int priority); GameAssetPoolT6(Zone* zone, int priority);
~GameAssetPoolT6() override; ~GameAssetPoolT6() override = default;
void InitPoolStatic(asset_type_t type, size_t capacity) override; void InitPoolStatic(asset_type_t type, size_t capacity) override;
void InitPoolDynamic(asset_type_t type) override; void InitPoolDynamic(asset_type_t type) override;
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override; _NODISCARD XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
static const char* AssetTypeNameByType(asset_type_t assetType); static const char* AssetTypeNameByType(asset_type_t assetType);
const char* GetAssetTypeName(asset_type_t assetType) const override; _NODISCARD const char* GetAssetTypeName(asset_type_t assetType) const override;
static asset_type_t AssetTypeCount();
_NODISCARD asset_type_t GetAssetTypeCount() const override;
}; };

View File

@ -33,6 +33,7 @@ public:
XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings); XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings);
XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone); XAssetInfoGeneric* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone);
_NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const = 0; _NODISCARD virtual XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const = 0;
_NODISCARD virtual asset_type_t GetAssetTypeCount() const = 0;
_NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0; _NODISCARD virtual const char* GetAssetTypeName(asset_type_t assetType) const = 0;
virtual void InitPoolStatic(asset_type_t type, size_t capacity) = 0; virtual void InitPoolStatic(asset_type_t type, size_t capacity) = 0;