2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-30 16:27:47 +00:00

refactor: streamline stringtable dumper

This commit is contained in:
Jan Laupetin
2025-07-30 22:59:57 +01:00
parent 0eb14890ab
commit e26c66ed60
20 changed files with 226 additions and 211 deletions

View File

@@ -0,0 +1,34 @@
#include "StringTableDumperIW3.h"
#include "Csv/CsvStream.h"
using namespace IW3;
namespace IW3::string_table
{
bool Dumper::ShouldDump(XAssetInfo<StringTable>* asset)
{
return true;
}
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset)
{
const auto* stringTable = asset->Asset();
const auto assetFile = context.OpenAssetFile(asset->m_name);
if (!assetFile)
return;
CsvOutputStream csv(*assetFile);
for (auto row = 0; row < stringTable->rowCount; row++)
{
for (auto column = 0; column < stringTable->columnCount; column++)
{
csv.WriteColumn(stringTable->values[column + row * stringTable->columnCount]);
}
csv.NextRow();
}
}
} // namespace IW3::string_table