Skip to content

Commit

Permalink
[Fix] MIDI Macros: An unfinished byte right before a "s" SysEx checks…
Browse files Browse the repository at this point in the history
…um macro letter was not considered in the checksum.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22424 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Dec 1, 2024
1 parent 0b29383 commit bb691a9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions soundlib/MIDIMacroParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ MIDIMacroParser::MIDIMacroParser(const CSoundFile &sndFile, PlayState *playState
} else if(macro[pos] == 's')
{
// SysEx Checksum (not an original Impulse Tracker macro variable, but added for convenience)
if(!firstNibble) // From MIDI.TXT: '9n' is exactly the same as '09 n' or '9 n' -- so finish current byte first
{
outPos++;
firstNibble = true;
}

auto startPos = outPos;
while(startPos > 0 && out[--startPos] != 0xF0)
;
Expand Down

0 comments on commit bb691a9

Please sign in to comment.