summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcoco875 <pereira.jannin@gmail.com>2025-12-22 18:06:24 +0100
committerLywx <kiritodev01@gmail.com>2025-12-22 11:21:52 -0600
commit73f7a4a1e97daba9f72b860c4b7e4fd5c20eae57 (patch)
tree3cbfa04c066623cf2a3f00a77f0b26977353f798 /src
parent83f64f76c980edcafe4fcd17d6c9d658e4a7af01 (diff)
fix size of track section
Diffstat (limited to 'src')
-rw-r--r--src/factories/mk64/TrackSections.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/factories/mk64/TrackSections.cpp b/src/factories/mk64/TrackSections.cpp
index 63ad4a4..fb9d950 100644
--- a/src/factories/mk64/TrackSections.cpp
+++ b/src/factories/mk64/TrackSections.cpp
@@ -77,8 +77,11 @@ ExportResult MK64::TrackSectionsBinaryExporter::Export(std::ostream &write, std:
std::optional<std::shared_ptr<IParsedData>> MK64::TrackSectionsFactory::parse(std::vector<uint8_t>& buffer, YAML::Node& node) {
auto count = GetSafeNode<size_t>(node, "count");
+ // On-disk format: uint32_t addr + int8_t surf + int8_t sect + uint16_t flags = 8 bytes
+ // Note: sizeof(MK64::TrackSections) is 16 bytes due to uint64_t crc + padding
+ constexpr size_t kOnDiskTrackSectionSize = sizeof(uint32_t) + sizeof(int8_t) + sizeof(int8_t) + sizeof(uint16_t);
auto [_, segment] = Decompressor::AutoDecode(node, buffer);
- LUS::BinaryReader reader(segment.data, count * sizeof(MK64::TrackSections));
+ LUS::BinaryReader reader(segment.data, count * kOnDiskTrackSectionSize);
reader.SetEndianness(Torch::Endianness::Big);
std::vector<MK64::TrackSections> sections;