Skip to content

Commit

Permalink
Fixed some sm64 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
KiritoDv committed Oct 3, 2024
1 parent 2985786 commit b2f3d9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/factories/sm64/PaintingFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}

Expand All @@ -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);
}
}

Expand All @@ -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);
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/factories/sm64/PaintingMapFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ 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);
writer.Write(mapping.texX);
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);
Expand Down
2 changes: 1 addition & 1 deletion src/factories/sm64/geo/GeoUtils.cpp
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit b2f3d9d

Please sign in to comment.