Print debug info about structured data def when compiled with the debug flag for it

This commit is contained in:
Jan 2022-03-20 16:59:37 +01:00
parent 3fc9eac5f0
commit fef646fded
3 changed files with 20 additions and 0 deletions

View File

@ -58,6 +58,10 @@ workspace "OpenAssetTools"
"_CRT_SECURE_NO_WARNINGS" "_CRT_SECURE_NO_WARNINGS"
} }
filter "options:debug-structureddatadef"
defines { "STRUCTUREDDATADEF_DEBUG" }
filter {}
-- ======================== -- ========================
-- ThirdParty -- ThirdParty
-- ======================== -- ========================

View File

@ -46,6 +46,13 @@ void StructuredDataDefDumperNew::DumpEnum(const CommonStructuredDataEnum& _enum)
void StructuredDataDefDumperNew::DumpStruct(const CommonStructuredDataStruct& _struct) void StructuredDataDefDumperNew::DumpStruct(const CommonStructuredDataStruct& _struct)
{ {
#ifdef STRUCTUREDDATADEF_DEBUG
Indent();
m_stream << "// BitOffset: " << _struct.m_bit_offset << "\n";
Indent();
m_stream << "// Size (Byte): " << _struct.m_size_in_byte << "\n";
#endif
Indent(); Indent();
m_stream << "struct " << _struct.m_name << "\n"; m_stream << "struct " << _struct.m_name << "\n";
@ -78,6 +85,11 @@ void StructuredDataDefDumperNew::DumpDef(const CommonStructuredDataDef& def)
m_stream << "// ====================\n"; m_stream << "// ====================\n";
#ifdef STRUCTUREDDATADEF_DEBUG
m_stream << "// Size (Byte): " << def.m_size_in_byte << "\n";
m_stream << "// Checksum: " << def.m_checksum << "\n";
#endif
m_stream << "version " << def.m_version << "\n{\n"; m_stream << "version " << def.m_version << "\n{\n";
IncIndent(); IncIndent();

View File

@ -0,0 +1,4 @@
newoption {
trigger = "debug-structureddatadef",
description = "Activate additional debugging logic for StructuredDataDef assets"
}