summaryrefslogtreecommitdiff
path: root/src/factories/mk64/Waypoints.cpp
diff options
context:
space:
mode:
authorLywx <kiritodev01@gmail.com>2024-03-20 21:17:11 -0600
committerGitHub <noreply@github.com>2024-03-20 21:17:11 -0600
commitf0c70f855a892ca7dc21cee4b4037dad983adb8f (patch)
treef15cc271b00166476a2e7b780e50d911770a7316 /src/factories/mk64/Waypoints.cpp
parent8465919ab7aba6cfde7d25ad1731673e5da01642 (diff)
Auto pad and overlap detection (#47)
* Fully implemented pad and overlap detection * Cleaned code, fixed pad generation and added alignment * Added debug size on pads
Diffstat (limited to 'src/factories/mk64/Waypoints.cpp')
-rw-r--r--src/factories/mk64/Waypoints.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/factories/mk64/Waypoints.cpp b/src/factories/mk64/Waypoints.cpp
index 9149fb6..81e6b36 100644
--- a/src/factories/mk64/Waypoints.cpp
+++ b/src/factories/mk64/Waypoints.cpp
@@ -6,18 +6,19 @@
#define NUM(x) std::dec << std::setfill(' ') << std::setw(6) << x
#define COL(c) "0x" << std::hex << std::setw(2) << std::setfill('0') << c
-void MK64::WaypointHeaderExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement) {
+ExportResult MK64::WaypointHeaderExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement) {
const auto symbol = GetSafeNode(node, "symbol", entryName);
if(Companion::Instance->IsOTRMode()){
write << "static const char " << symbol << "[] = \"__OTR__" << (*replacement) << "\";\n\n";
- return;
+ return std::nullopt;
}
write << "extern TrackWaypoint " << symbol << "[];\n";
+ return std::nullopt;
}
-void MK64::WaypointCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
+ExportResult MK64::WaypointCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
auto waypoints = std::static_pointer_cast<WaypointData>(raw)->mWaypoints;
auto symbol = GetSafeNode(node, "symbol", entryName);
@@ -39,9 +40,10 @@ void MK64::WaypointCodeExporter::Export(std::ostream &write, std::shared_ptr<IPa
write << "{" << NUM(x) << ", " << NUM(y) << ", " << NUM(z) << ", " << NUM(seg) << " },\n";
}
write << "};\n\n";
+ return std::nullopt;
}
-void MK64::WaypointBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
+ExportResult MK64::WaypointBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
auto waypoints = std::static_pointer_cast<WaypointData>(raw)->mWaypoints;
auto writer = LUS::BinaryWriter();
@@ -55,6 +57,7 @@ void MK64::WaypointBinaryExporter::Export(std::ostream &write, std::shared_ptr<I
}
writer.Finish(write);
+ return std::nullopt;
}
std::optional<std::shared_ptr<IParsedData>> MK64::WaypointsFactory::parse(std::vector<uint8_t>& buffer, YAML::Node& node) {