mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-30 16:27:47 +00:00
35 lines
859 B
C++
35 lines
859 B
C++
#include "StringTableDumperIW3.h"
|
|
|
|
#include "Csv/CsvStream.h"
|
|
|
|
using namespace IW3;
|
|
|
|
namespace string_table
|
|
{
|
|
bool DumperIW3::ShouldDump(XAssetInfo<StringTable>* asset)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void DumperIW3::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 string_table
|