summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/factories/BlobFactory.cpp23
-rw-r--r--src/factories/VtxFactory.cpp5
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";
}