Added objinit sized because Sonic complains about it

This commit is contained in:
KiritoDv
2024-03-12 21:49:23 -06:00
parent b56eefab94
commit 50d064e2b4
2 changed files with 16 additions and 2 deletions
-1
View File
@@ -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();
}
+16 -1
View File
@@ -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 ) {