No structured data shenanigans while dumping

This commit is contained in:
Louvenarde 2024-01-13 21:10:15 +01:00
parent 4badcdd008
commit 70f34a9319
2 changed files with 120 additions and 115 deletions

View File

@ -117,7 +117,7 @@ namespace Components
}
}
bool StructuredData::UpdateVersionOffsets(Game::StructuredDataDefSet *set, Game::StructuredDataBuffer *buffer, Game::StructuredDataDef *whatever)
bool StructuredData::UpdateVersionOffsets(Game::StructuredDataDefSet* set, Game::StructuredDataBuffer* buffer, Game::StructuredDataDef* whatever)
{
Game::StructuredDataDef* newDef = &set->defs[0];
Game::StructuredDataDef* oldDef = &set->defs[0];
@ -165,6 +165,10 @@ namespace Components
// TODO: Since all of the following is zonebuilder-only code, move it to IW4OF or IStructuredDataDefSet.cpp
AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, const std::string& filename, bool* /*restrict*/)
{
if (ZoneBuilder::IsDumpingZone()) {
return;
}
// Only intercept playerdatadef loading
if (type != Game::ASSET_TYPE_STRUCTURED_DATA_DEF || filename != "mp/playerdata.def") return;

View File

@ -129,6 +129,7 @@ namespace Components
#endif
static bool IsEnabled();
static bool IsDumpingZone() { return DumpingZone.length() > 0; };
static std::string TraceZone;
static std::vector<std::pair<Game::XAssetType, std::string>> TraceAssets;
@ -142,7 +143,7 @@ namespace Components
static iw4of::api* GetExporter();
private:
static int StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image);
static int StoreTexture(Game::GfxImageLoadDef** loadDef, Game::GfxImage* image);
static void ReleaseTexture(Game::XAssetHeader header);
static std::string FindMaterialByTechnique(const std::string& name);