ZoneLoading: Add dumper for Stringtable assets

This commit is contained in:
Jan 2019-11-18 21:44:51 +01:00
parent 1d609cc2d2
commit 97590148ad
2 changed files with 27 additions and 2 deletions

View File

@ -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);
}
}
}

View File

@ -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);