From 73f7a4a1e97daba9f72b860c4b7e4fd5c20eae57 Mon Sep 17 00:00:00 2001 From: coco875 Date: Mon, 22 Dec 2025 18:06:24 +0100 Subject: fix size of track section --- src/factories/mk64/TrackSections.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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> MK64::TrackSectionsFactory::parse(std::vector& buffer, YAML::Node& node) { auto count = GetSafeNode(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 sections; -- cgit v1.2.3