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:
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
23
src/ObjWriting/Game/T6/Qdb/QdbDumperT6.cpp
Normal file
23
src/ObjWriting/Game/T6/Qdb/QdbDumperT6.cpp
Normal 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
|
@@ -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
|
@@ -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);
|
||||
}
|
23
src/ObjWriting/Game/T6/Script/ScriptDumperT6.cpp
Normal file
23
src/ObjWriting/Game/T6/Script/ScriptDumperT6.cpp
Normal 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
|
@@ -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
|
@@ -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);
|
||||
}
|
23
src/ObjWriting/Game/T6/Slug/SlugDumperT6.cpp
Normal file
23
src/ObjWriting/Game/T6/Slug/SlugDumperT6.cpp
Normal 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
|
@@ -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
|
Reference in New Issue
Block a user