Unlinker: Add skeleton for Dumping and listing of assets

This commit is contained in:
Jan
2019-11-15 18:17:08 +01:00
parent d176e137a5
commit 2fe3954da8
11 changed files with 214 additions and 4 deletions

View File

@ -334,4 +334,73 @@ void* GameAssetPoolT6::AddAsset(asset_type_t type, std::string name, void* asset
return nullptr;
#undef CASE_ADD_TO_POOL
}
ZoneContent GameAssetPoolT6::GetContent() const
{
ZoneContent content{};
content.m_game_name = "T6";
#define POOL_ADD_TO_CONTENT(assetTypeName, poolName) \
if((poolName) != nullptr) \
{ \
for(auto asset : *(poolName)) \
{ \
content.m_assets.emplace_back((assetTypeName), asset->m_name);\
} \
}
POOL_ADD_TO_CONTENT("physpreset", m_phys_preset);
POOL_ADD_TO_CONTENT("physconstraints", m_phys_constraints);
POOL_ADD_TO_CONTENT("destructibledef", m_destructible_def);
POOL_ADD_TO_CONTENT("xanim", m_xanim_parts);
POOL_ADD_TO_CONTENT("xmodel", m_xmodel);
POOL_ADD_TO_CONTENT("material", m_material);
POOL_ADD_TO_CONTENT("techniqueset", m_technique_set);
POOL_ADD_TO_CONTENT("image", m_image);
POOL_ADD_TO_CONTENT("soundbank", m_sound_bank);
POOL_ADD_TO_CONTENT("soundpatch", m_sound_patch);
POOL_ADD_TO_CONTENT("clipmap", m_clip_map);
POOL_ADD_TO_CONTENT("comworld", m_com_world);
POOL_ADD_TO_CONTENT("gameworldsp", m_game_world_sp);
POOL_ADD_TO_CONTENT("gameworldmp", m_game_world_mp);
POOL_ADD_TO_CONTENT("mapents", m_map_ents);
POOL_ADD_TO_CONTENT("gfxworld", m_gfx_world);
POOL_ADD_TO_CONTENT("gfxlightdef", m_gfx_light_def);
POOL_ADD_TO_CONTENT("font", m_font);
POOL_ADD_TO_CONTENT("fonticon", m_font_icon);
POOL_ADD_TO_CONTENT("menulist", m_menu_list);
POOL_ADD_TO_CONTENT("menudef", m_menu_def);
POOL_ADD_TO_CONTENT("localize", m_localize);
POOL_ADD_TO_CONTENT("weapon", m_weapon);
POOL_ADD_TO_CONTENT("attachment", m_attachment);
POOL_ADD_TO_CONTENT("attachmentunique", m_attachment_unique);
POOL_ADD_TO_CONTENT("camo", m_camo);
POOL_ADD_TO_CONTENT("snddriverglobals", m_snd_driver_globals);
POOL_ADD_TO_CONTENT("fx", m_fx);
POOL_ADD_TO_CONTENT("fximpacttable", m_fx_impact_table);
POOL_ADD_TO_CONTENT("rawfile", m_raw_file);
POOL_ADD_TO_CONTENT("stringtable", m_string_table);
POOL_ADD_TO_CONTENT("leaderboard", m_leaderboard);
POOL_ADD_TO_CONTENT("xglobals", m_xglobals);
POOL_ADD_TO_CONTENT("ddl", m_ddl);
POOL_ADD_TO_CONTENT("glasses", m_glasses);
POOL_ADD_TO_CONTENT("emblemset", m_emblem_set);
POOL_ADD_TO_CONTENT("script", m_script);
POOL_ADD_TO_CONTENT("keyvaluepairs", m_key_value_pairs);
POOL_ADD_TO_CONTENT("vehicle", m_vehicle);
POOL_ADD_TO_CONTENT("memoryblock", m_memory_block);
POOL_ADD_TO_CONTENT("addonmapents", m_addon_map_ents);
POOL_ADD_TO_CONTENT("tracer", m_tracer);
POOL_ADD_TO_CONTENT("skinnedverts", m_skinned_verts);
POOL_ADD_TO_CONTENT("qdb", m_qdb);
POOL_ADD_TO_CONTENT("slug", m_slug);
POOL_ADD_TO_CONTENT("footsteptable", m_footstep_table);
POOL_ADD_TO_CONTENT("footstepfxtable", m_footstep_fx_table);
POOL_ADD_TO_CONTENT("zbarrier", m_zbarrier);
return content;
#undef POOL_ADD_TO_CONTENT
}

View File

@ -65,4 +65,6 @@ public:
void InitPoolDynamic(asset_type_t type) override;
void* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<std::string>& scriptStrings, std::vector<XAssetDependency>& dependencies) override;
ZoneContent GetContent() const override;
};

View File

@ -2,6 +2,7 @@
#include "XAssetInfo.h"
#include "Zone/ZoneTypes.h"
#include "Zone/ZoneContent.h"
class IZoneAssetPools
{
@ -11,4 +12,5 @@ public:
virtual void* AddAsset(asset_type_t type, std::string name, void* asset, std::vector<std::string>& scriptStrings, std::vector<XAssetDependency>& dependencies) = 0;
virtual void InitPoolStatic(asset_type_t type, size_t capacity) = 0;
virtual void InitPoolDynamic(asset_type_t type) = 0;
};
virtual ZoneContent GetContent() const = 0;
};

View File

@ -8,11 +8,11 @@ class IGame;
class Zone
{
std::string m_name;
zone_priority_t m_priority;
IZoneAssetPools* m_pools;
public:
std::string m_name;
zone_priority_t m_priority;
IGame* m_game;
Zone(std::string name, zone_priority_t priority, IZoneAssetPools* pools, IGame* game);

View File

@ -0,0 +1,13 @@
#include "ZoneContent.h"
ZoneContent::GameAsset::GameAsset(std::string assetTypeName, std::string assetName)
{
m_asset_type_name = std::move(assetTypeName);
m_asset_name = std::move(assetName);
}
ZoneContent::ZoneContent()
{
m_game_name = "";
m_assets = std::vector<GameAsset>();
}

View File

@ -0,0 +1,21 @@
#pragma once
#include <string>
#include <vector>
class ZoneContent
{
public:
class GameAsset
{
public:
GameAsset(std::string assetTypeName, std::string assetName);
std::string m_asset_type_name;
std::string m_asset_name;
};
ZoneContent();
std::string m_game_name;
std::vector<GameAsset> m_assets;
};