2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-01 14:37:25 +00:00

refactor: streamline slug, qdb and script dumper

This commit is contained in:
Jan Laupetin
2025-07-30 21:41:39 +01:00
parent bcb52391dc
commit 0eb14890ab
14 changed files with 122 additions and 110 deletions

View File

@@ -11,10 +11,10 @@
#include "ObjWriting.h"
#include "PhysConstraints/PhysConstraintsInfoStringDumperT6.h"
#include "PhysPreset/PhysPresetInfoStringDumperT6.h"
#include "Qdb/AssetDumperQdb.h"
#include "Qdb/QdbDumperT6.h"
#include "RawFile/RawFileDumperT6.h"
#include "Script/AssetDumperScriptParseTree.h"
#include "Slug/AssetDumperSlug.h"
#include "Script/ScriptDumperT6.h"
#include "Slug/SlugDumperT6.h"
#include "Sound/AssetDumperSndBank.h"
#include "Sound/AssetDumperSndDriverGlobals.h"
#include "StringTable/AssetDumperStringTable.h"
@@ -82,15 +82,15 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
// DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl, ASSET_TYPE_DDL)
// DUMP_ASSET_POOL(AssetDumperGlasses, m_glasses, ASSET_TYPE_GLASSES)
// DUMP_ASSET_POOL(AssetDumperEmblemSet, m_emblem_set, ASSET_TYPE_EMBLEMSET)
DUMP_ASSET_POOL(AssetDumperScriptParseTree, m_script, ASSET_TYPE_SCRIPTPARSETREE)
DUMP_ASSET_POOL(script::Dumper, m_script, ASSET_TYPE_SCRIPTPARSETREE)
// DUMP_ASSET_POOL(AssetDumperKeyValuePairs, m_key_value_pairs, ASSET_TYPE_KEYVALUEPAIRS)
DUMP_ASSET_POOL(AssetDumperVehicle, m_vehicle, ASSET_TYPE_VEHICLEDEF)
// DUMP_ASSET_POOL(AssetDumperMemoryBlock, m_memory_block, ASSET_TYPE_MEMORYBLOCK)
// DUMP_ASSET_POOL(AssetDumperAddonMapEnts, m_addon_map_ents, ASSET_TYPE_ADDON_MAP_ENTS)
DUMP_ASSET_POOL(AssetDumperTracer, m_tracer, ASSET_TYPE_TRACER)
// DUMP_ASSET_POOL(AssetDumperSkinnedVertsDef, m_skinned_verts, ASSET_TYPE_SKINNEDVERTS)
DUMP_ASSET_POOL(AssetDumperQdb, m_qdb, ASSET_TYPE_QDB)
DUMP_ASSET_POOL(AssetDumperSlug, m_slug, ASSET_TYPE_SLUG)
DUMP_ASSET_POOL(qdb::Dumper, m_qdb, ASSET_TYPE_QDB)
DUMP_ASSET_POOL(slug::Dumper, m_slug, ASSET_TYPE_SLUG)
// DUMP_ASSET_POOL(AssetDumperFootstepTableDef, m_footstep_table, ASSET_TYPE_FOOTSTEP_TABLE)
// DUMP_ASSET_POOL(AssetDumperFootstepFXTableDef, m_footstep_fx_table, ASSET_TYPE_FOOTSTEPFX_TABLE)
DUMP_ASSET_POOL(AssetDumperZBarrier, m_zbarrier, ASSET_TYPE_ZBARRIER)

View File

@@ -1,20 +0,0 @@
#include "AssetDumperQdb.h"
using namespace T6;
bool AssetDumperQdb::ShouldDump(XAssetInfo<Qdb>* asset)
{
return true;
}
void AssetDumperQdb::DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset)
{
const auto* qdb = asset->Asset();
const auto assetFile = context.OpenAssetFile(asset->m_name);
if (!assetFile)
return;
auto& stream = *assetFile;
stream.write(qdb->buffer, qdb->len);
}

View File

@@ -0,0 +1,23 @@
#include "QdbDumperT6.h"
using namespace T6;
namespace T6::qdb
{
bool Dumper::ShouldDump(XAssetInfo<Qdb>* asset)
{
return true;
}
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset)
{
const auto* qdb = asset->Asset();
const auto assetFile = context.OpenAssetFile(asset->m_name);
if (!assetFile)
return;
auto& stream = *assetFile;
stream.write(qdb->buffer, qdb->len);
}
} // namespace T6::qdb

View File

@@ -3,12 +3,12 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
namespace T6::qdb
{
class AssetDumperQdb final : public AbstractAssetDumper<Qdb>
class Dumper final : public AbstractAssetDumper<Qdb>
{
protected:
bool ShouldDump(XAssetInfo<Qdb>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Qdb>* asset) override;
};
} // namespace T6
} // namespace T6::qdb

View File

@@ -1,20 +0,0 @@
#include "AssetDumperScriptParseTree.h"
using namespace T6;
bool AssetDumperScriptParseTree::ShouldDump(XAssetInfo<ScriptParseTree>* asset)
{
return true;
}
void AssetDumperScriptParseTree::DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset)
{
const auto* scriptParseTree = asset->Asset();
const auto assetFile = context.OpenAssetFile(asset->m_name);
if (!assetFile)
return;
auto& stream = *assetFile;
stream.write(scriptParseTree->buffer, scriptParseTree->len);
}

View File

@@ -0,0 +1,23 @@
#include "ScriptDumperT6.h"
using namespace T6;
namespace T6::script
{
bool Dumper::ShouldDump(XAssetInfo<ScriptParseTree>* asset)
{
return true;
}
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset)
{
const auto* scriptParseTree = asset->Asset();
const auto assetFile = context.OpenAssetFile(asset->m_name);
if (!assetFile)
return;
auto& stream = *assetFile;
stream.write(scriptParseTree->buffer, scriptParseTree->len);
}
} // namespace T6::script

View File

@@ -3,12 +3,12 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
namespace T6::script
{
class AssetDumperScriptParseTree final : public AbstractAssetDumper<ScriptParseTree>
class Dumper final : public AbstractAssetDumper<ScriptParseTree>
{
protected:
bool ShouldDump(XAssetInfo<ScriptParseTree>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<ScriptParseTree>* asset) override;
};
} // namespace T6
} // namespace T6::script

View File

@@ -1,20 +0,0 @@
#include "AssetDumperSlug.h"
using namespace T6;
bool AssetDumperSlug::ShouldDump(XAssetInfo<Slug>* asset)
{
return true;
}
void AssetDumperSlug::DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset)
{
const auto* slug = asset->Asset();
const auto assetFile = context.OpenAssetFile(asset->m_name);
if (!assetFile)
return;
auto& stream = *assetFile;
stream.write(slug->buffer, slug->len);
}

View File

@@ -0,0 +1,23 @@
#include "SlugDumperT6.h"
using namespace T6;
namespace T6::slug
{
bool Dumper::ShouldDump(XAssetInfo<Slug>* asset)
{
return true;
}
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset)
{
const auto* slug = asset->Asset();
const auto assetFile = context.OpenAssetFile(asset->m_name);
if (!assetFile)
return;
auto& stream = *assetFile;
stream.write(slug->buffer, slug->len);
}
} // namespace T6::slug

View File

@@ -3,12 +3,12 @@
#include "Dumping/AbstractAssetDumper.h"
#include "Game/T6/T6.h"
namespace T6
namespace T6::slug
{
class AssetDumperSlug final : public AbstractAssetDumper<Slug>
class Dumper final : public AbstractAssetDumper<Slug>
{
protected:
bool ShouldDump(XAssetInfo<Slug>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Slug>* asset) override;
};
} // namespace T6
} // namespace T6::slug