Added sizes on more factories

This commit is contained in:
KiritoDv
2024-03-10 16:17:32 -06:00
parent 951e84d97d
commit e2372f45a2
2 changed files with 26 additions and 2 deletions
+22 -1
View File
@@ -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 ) {
+4 -1
View File
@@ -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";
}