summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/factories/sm64/PaintingFactory.cpp4
-rw-r--r--src/factories/sm64/PaintingMapFactory.cpp6
-rw-r--r--src/factories/sm64/geo/GeoUtils.cpp2
3 files changed, 9 insertions, 3 deletions
diff --git a/src/factories/sm64/PaintingFactory.cpp b/src/factories/sm64/PaintingFactory.cpp
index 5f3f4a0..d9b40a4 100644
--- a/src/factories/sm64/PaintingFactory.cpp
+++ b/src/factories/sm64/PaintingFactory.cpp
@@ -165,6 +165,7 @@ ExportResult SM64::PaintingBinaryExporter::Export(std::ostream &write, std::shar
writer.Write(hash);
} else {
SPDLOG_WARN("Could not find DisplayList at 0x{:X}", ptr);
+ writer.Write((uint64_t) 0);
}
}
@@ -177,6 +178,7 @@ ExportResult SM64::PaintingBinaryExporter::Export(std::ostream &write, std::shar
writer.Write(hash);
} else {
SPDLOG_WARN("Could not find Texture Maps at 0x{:X}", ptr);
+ writer.Write((uint64_t) 0);
}
}
@@ -189,6 +191,7 @@ ExportResult SM64::PaintingBinaryExporter::Export(std::ostream &write, std::shar
writer.Write(hash);
} else {
SPDLOG_WARN("Could not find Texture Arrays at 0x{:X}", ptr);
+ writer.Write((uint64_t) 0);
}
}
@@ -204,6 +207,7 @@ ExportResult SM64::PaintingBinaryExporter::Export(std::ostream &write, std::shar
writer.Write(hash);
} else {
SPDLOG_WARN("Could not find DisplayList at 0x{:X}", ptr);
+ writer.Write((uint64_t) 0);
}
}
diff --git a/src/factories/sm64/PaintingMapFactory.cpp b/src/factories/sm64/PaintingMapFactory.cpp
index 61bf7e7..677906d 100644
--- a/src/factories/sm64/PaintingMapFactory.cpp
+++ b/src/factories/sm64/PaintingMapFactory.cpp
@@ -55,7 +55,9 @@ ExportResult SM64::PaintingMapBinaryExporter::Export(std::ostream &write, std::s
WriteHeader(writer, Torch::ResourceType::PaintingData, 0);
- writer.Write((int16_t)paintingData->mPaintingMappings.size());
+ writer.Write((uint32_t) (paintingData->mPaintingMappings.size() + paintingData->mPaintingGroups.size()) + 2 );
+
+ writer.Write((int16_t) paintingData->mPaintingMappings.size());
for (auto &mapping : paintingData->mPaintingMappings) {
writer.Write(mapping.vtxId);
@@ -63,7 +65,7 @@ ExportResult SM64::PaintingMapBinaryExporter::Export(std::ostream &write, std::s
writer.Write(mapping.texY);
}
- writer.Write((int16_t)paintingData->mPaintingGroups.size());
+ writer.Write((int16_t) paintingData->mPaintingGroups.size());
for (auto &group : paintingData->mPaintingGroups) {
writer.Write(group.x);
diff --git a/src/factories/sm64/geo/GeoUtils.cpp b/src/factories/sm64/geo/GeoUtils.cpp
index 91f4158..540122f 100644
--- a/src/factories/sm64/geo/GeoUtils.cpp
+++ b/src/factories/sm64/geo/GeoUtils.cpp
@@ -1,6 +1,6 @@
#include "GeoUtils.h"
-#define next_s16_in_geo_script(src) BSWAP16((*(*src)++))
+#define next_s16_in_geo_script(src) (int16_t) BSWAP16((*(*src)++))
int16_t* read_vec3s_to_vec3f(Vec3f& dst, int16_t *src) {
dst.x = next_s16_in_geo_script(&src);