diff options
| author | Jeod <47716344+JeodC@users.noreply.github.com> | 2026-10-27 18:30:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-27 16:30:25 -0600 |
| commit | 7f5d55f9de53f96e61c11399cb3066f8dd8e835e (patch) | |
| tree | 2c09dff4f79f14376e5dc78326edba695a93607d | |
| parent | 8ec843fcb11bf43b3a10e29a047ab24ae9302a19 (diff) | |
| -rw-r--r-- | src/factories/bk64/MusicFactory.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/factories/bk64/MusicFactory.cpp b/src/factories/bk64/MusicFactory.cpp index 5f557f2..7dc9e47 100644 --- a/src/factories/bk64/MusicFactory.cpp +++ b/src/factories/bk64/MusicFactory.cpp @@ -20,6 +20,7 @@ constexpr uint8_t kLoopStart = 0x2E; constexpr uint8_t kLoopEnd = 0x2D; constexpr uint8_t kBlockCode = 0xFE; constexpr uint32_t kLoopEndBytes = 6; +constexpr uint8_t kLoopForever = 0xFF; class TrackReader { public: @@ -150,6 +151,14 @@ bool DecodeTrack(const uint8_t* data, size_t size, uint32_t start, uint32_t end, event.aux = ReadU32BE(raw + 2); event.kind = static_cast<uint8_t>(MusicEventKind::LoopEnd); running = 0; + // The player never reads past a loop that runs forever, and BB escapes a 0xFE in these raw bytes. + if (event.byte2 == kLoopForever) { + out.push_back(event); + MusicEvent end; + end.kind = static_cast<uint8_t>(MusicEventKind::End); + out.push_back(end); + return !reader.Failed(); + } } else { return false; } @@ -422,8 +431,6 @@ ExportResult MusicModdingExporter::Export(std::ostream& write, std::shared_ptr<I namespace { -constexpr uint8_t kLoopForever = 0xFF; - struct SmfEvent { uint32_t tick = 0; int order = 0; |
