diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-03-12 21:49:23 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2024-03-12 21:49:23 -0600 |
| commit | 50d064e2b4920c96716a6a528aae58d51c1ba781 (patch) | |
| tree | 84fed1d2bf108f0ede29a1ccfca7f5e44af94ebc | |
| parent | b56eefab94bc7ee42f18b2b943f65af5859c0518 (diff) | |
Added objinit sized because Sonic complains about it
| -rw-r--r-- | src/Companion.cpp | 1 | ||||
| -rw-r--r-- | src/factories/sf64/ObjInitFactory.cpp | 17 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp index 806e6a1..d4f95d1 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -81,7 +81,6 @@ void Companion::Init(const ExportType type) { this->RegisterFactory("SF64:HITBOX", std::make_shared<SF64::HitboxFactory>()); this->RegisterFactory("SF64:OBJECT_INIT", std::make_shared<SF64::ObjInitFactory>()); - this->Process(); } diff --git a/src/factories/sf64/ObjInitFactory.cpp b/src/factories/sf64/ObjInitFactory.cpp index 4b5c21a..437862f 100644 --- a/src/factories/sf64/ObjInitFactory.cpp +++ b/src/factories/sf64/ObjInitFactory.cpp @@ -6,8 +6,16 @@ void SF64::ObjInitCodeExporter::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 objs = std::static_pointer_cast<ObjInitData>(raw)->mObjInit; + if (Companion::Instance->IsDebug()) { + if (IS_SEGMENTED(offset)) { + offset = SEGMENT_OFFSET(offset); + } + write << "// 0x" << std::hex << std::uppercase << offset << "\n"; + } + write << "ObjectInit " << symbol << "[] = {\n"; for(auto& obj : objs) { auto enumName = Companion::Instance->GetEnumFromValue("ObjectId", obj.id).value_or(std::to_string(obj.id)); @@ -19,7 +27,14 @@ void SF64::ObjInitCodeExporter::Export(std::ostream &write, std::shared_ptr<IPar write << "{ " << NUM(obj.rot.x, 3) << ", " << NUM(obj.rot.y, 3) << ", " << NUM(obj.rot.z, 3) << " }, "; write << enumName << " },\n"; } - write << "};\n\n"; + write << "};\n"; + + if (Companion::Instance->IsDebug()) { + write << "// count: " << std::to_string(objs.size()) << " ObjectInits\n"; + write << "// 0x" << std::hex << std::uppercase << (offset + (sizeof(ObjectInit) * objs.size())) << "\n"; + } + + write << "\n"; } void SF64::ObjInitBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { |
