diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-03-10 16:17:32 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2024-03-10 16:17:32 -0600 |
| commit | e2372f45a2885965c3b64071bfa096da798ded3c (patch) | |
| tree | 2d73f164bc7b6e9d92f9890041f54ebe77861267 /src | |
| parent | 951e84d97d15204bbae2fcb036dc57eaaf4039ae (diff) | |
Added sizes on more factories
Diffstat (limited to 'src')
| -rw-r--r-- | src/factories/BlobFactory.cpp | 23 | ||||
| -rw-r--r-- | src/factories/VtxFactory.cpp | 5 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/factories/BlobFactory.cpp b/src/factories/BlobFactory.cpp index ef4a978..0539641 100644 --- a/src/factories/BlobFactory.cpp +++ b/src/factories/BlobFactory.cpp @@ -1,11 +1,20 @@ #include "BlobFactory.h" +#include "Companion.h" #include "utils/Decompressor.h" #include <iomanip> void BlobCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { auto symbol = GetSafeNode(node, "symbol", entryName); + auto offset = GetSafeNode<uint32_t>(node, "offset"); auto data = std::static_pointer_cast<RawBuffer>(raw)->mBuffer; + if (Companion::Instance->IsDebug()) { + if (IS_SEGMENTED(offset)) { + offset = SEGMENT_OFFSET(offset); + } + write << "// 0x" << std::hex << std::uppercase << offset << "\n"; + } + if(node["ctype"]) { write << node["ctype"].as<std::string>() << " " << symbol << "[] = {\n" << tab; } else { @@ -19,7 +28,19 @@ void BlobCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> write << "0x" << std::hex << std::setw(2) << std::setfill('0') << (int) data[i] << ", "; } - write << "\n};\n\n"; + write << "\n};\n"; + + if (Companion::Instance->IsDebug()) { + const auto sz = data.size(); + + write << "// size: 0x" << std::hex << std::uppercase << sz << "\n"; + if (IS_SEGMENTED(offset)) { + offset = SEGMENT_OFFSET(offset); + } + write << "// 0x" << std::hex << std::uppercase << (offset + sz) << "\n"; + } + + write << "\n"; } void BlobBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { diff --git a/src/factories/VtxFactory.cpp b/src/factories/VtxFactory.cpp index c0b06ea..1aabaf0 100644 --- a/src/factories/VtxFactory.cpp +++ b/src/factories/VtxFactory.cpp @@ -28,6 +28,9 @@ void VtxCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> r } if (Companion::Instance->IsDebug()) { + if (IS_SEGMENTED(offset)) { + offset = SEGMENT_OFFSET(offset); + } write << "// 0x" << std::hex << std::uppercase << offset << "\n"; } @@ -61,7 +64,7 @@ void VtxCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> r write << "};\n"; if (Companion::Instance->IsDebug()) { - write << "// size: " << vtx.size() << "\n"; + write << "// count: " << vtx.size() << "\n"; write << "// 0x" << std::hex << std::uppercase << (offset + (sizeof(VtxRaw) * vtx.size())) << "\n"; } |
