From 9a94f263f2656b4d5fe3f510a771c994bae5171d Mon Sep 17 00:00:00 2001 From: IAGOnGithub <122576313+IAGOnGithub@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:14:45 -0400 Subject: [PATCH] Support loopStart and loopEnd markers Some MIDI sequencing software (Sekaiju and GBA Mus Ripper) supports or denotes loops using the `loopStart` and `loopEnd` markers. This change allows mid2agb to convert them into loopBegin and loopEnd events like it would with `[` and `]`. --- tools/mid2agb/midi.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/mid2agb/midi.cpp b/tools/mid2agb/midi.cpp index fa7d9ce28574..c54fd7f23d9f 100644 --- a/tools/mid2agb/midi.cpp +++ b/tools/mid2agb/midi.cpp @@ -233,10 +233,10 @@ void MakeBlockEvent(Event& event, EventType type) std::string ReadEventText() { - char buffer[2]; + char buffer[9]; std::uint32_t length = ReadVLQ(); - if (length <= 2) + if (length <= 9) { if (fread(buffer, length, 1, g_inputFile) != 1) RaiseError("failed to read event text"); @@ -284,11 +284,11 @@ bool ReadSeqEvent(Event& event) // text event std::string text = ReadEventText(); - if (text == "[") + if (text == "[" || text == "loopStart") MakeBlockEvent(event, EventType::LoopBegin); else if (text == "][") MakeBlockEvent(event, EventType::LoopEndBegin); - else if (text == "]") + else if (text == "]" || text == "loopEnd") MakeBlockEvent(event, EventType::LoopEnd); else if (text == ":") MakeBlockEvent(event, EventType::Label);