Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mid2agb: Support loopStart and loopEnd markers #2049

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tools/mid2agb/midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down