summaryrefslogtreecommitdiff
path: root/src/Companion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Companion.cpp')
-rw-r--r--src/Companion.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp
index 1f95e63..477edeb 100644
--- a/src/Companion.cpp
+++ b/src/Companion.cpp
@@ -32,6 +32,7 @@
#include "factories/sm64/DictionaryFactory.h"
#include "factories/sm64/TextFactory.h"
#include "factories/sm64/GeoLayoutFactory.h"
+#include "factories/sm64/CollisionFactory.h"
#include "factories/mk64/CourseVtx.h"
#include "factories/mk64/Waypoints.h"
@@ -85,6 +86,7 @@ void Companion::Init(const ExportType type) {
this->RegisterFactory("SM64:DICTIONARY", std::make_shared<SM64::DictionaryFactory>());
this->RegisterFactory("SM64:ANIM", std::make_shared<SM64::AnimationFactory>());
this->RegisterFactory("SM64:GEO_LAYOUT", std::make_shared<SM64::GeoLayoutFactory>());
+ this->RegisterFactory("SM64:COLLISION", std::make_shared<SM64::CollisionFactory>());
// MK64 specific
this->RegisterFactory("MK64:COURSE_VTX", std::make_shared<MK64::CourseVtxFactory>());
@@ -395,6 +397,14 @@ void Companion::ParseCurrentFileConfig(YAML::Node node) {
this->gCurrentVram = { addr, offset };
}
+ if(node["dependencies"]) {
+ auto deps = node["dependencies"];
+ for(auto dep = deps.begin(); dep != deps.end(); ++dep) {
+ this->gDependencies
+ this->gFileHeader += line->as<std::string>() + "\n";
+ }
+ }
+
this->gEnablePadGen = GetSafeNode<bool>(node, "autopads", true);
}
@@ -991,6 +1001,21 @@ std::optional<std::string> Companion::GetEnumFromValue(const std::string& key, i
return this->gEnums[key][id];
}
+std::optional<uint32_t> Companion::GetValueFromEnum(const std::string& key, const std::string& value) {
+ if(!this->gEnums.contains(key)){
+ return std::nullopt;
+ }
+
+ for(auto& [id, name] : this->gEnums[key]){
+ if(name == value){
+ return id;
+ }
+ }
+
+ return std::nullopt;
+}
+
+
std::optional<std::uint32_t> Companion::GetFileOffsetFromSegmentedAddr(const uint8_t segment) const {
auto segments = this->gConfig.segment;