From 97590148ada7c090e95361f2b15ca6c5230edccd Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 18 Nov 2019 21:44:51 +0100 Subject: [PATCH] ZoneLoading: Add dumper for Stringtable assets --- .../AssetDumpers/AssetDumperStringTable.cpp | 26 ++++++++++++++++++- src/ZoneLoading/Game/T6/ZoneDumperT6.cpp | 3 ++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/ZoneLoading/Game/T6/AssetDumpers/AssetDumperStringTable.cpp b/src/ZoneLoading/Game/T6/AssetDumpers/AssetDumperStringTable.cpp index c2c3035d..448ba002 100644 --- a/src/ZoneLoading/Game/T6/AssetDumpers/AssetDumperStringTable.cpp +++ b/src/ZoneLoading/Game/T6/AssetDumpers/AssetDumperStringTable.cpp @@ -9,5 +9,29 @@ std::string AssetDumperStringTable::GetFileNameForAsset(StringTable* asset) void AssetDumperStringTable::DumpAsset(StringTable* asset, FileAPI::File* out) { - // TODO + char separator[]{ ',' }; + char newLine[]{ '\n' }; + + for(int row = 0; row < asset->rowCount; row++) + { + for(int column = 0; column < asset->columnCount; column++) + { + const auto cell = &asset->values[column + row * asset->columnCount]; + + if (column != 0) + { + out->Write(separator, 1, sizeof separator); + } + + if(cell->string && *cell->string) + { + out->Write(cell->string, 1, strlen(cell->string)); + } + } + + if (row != asset->rowCount - 1) + { + out->Write(newLine, 1, sizeof newLine); + } + } } \ No newline at end of file diff --git a/src/ZoneLoading/Game/T6/ZoneDumperT6.cpp b/src/ZoneLoading/Game/T6/ZoneDumperT6.cpp index b7377487..8ab67ab0 100644 --- a/src/ZoneLoading/Game/T6/ZoneDumperT6.cpp +++ b/src/ZoneLoading/Game/T6/ZoneDumperT6.cpp @@ -6,6 +6,7 @@ #include "AssetDumpers/AssetDumperSlug.h" #include "AssetDumpers/AssetDumperQdb.h" #include "AssetDumpers/AssetDumperScriptParseTree.h" +#include "AssetDumpers/AssetDumperStringTable.h" bool ZoneDumperT6::CanHandleZone(Zone* zone) { @@ -53,7 +54,7 @@ bool ZoneDumperT6::DumpZone(Zone* zone, const std::string& basePath) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx); // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table); DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file); - // DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table); + DUMP_ASSET_POOL(AssetDumperStringTable, m_string_table); // DUMP_ASSET_POOL(AssetDumperLeaderboardDef, m_leaderboard); // DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals); // DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl);