Skip to content

Commit

Permalink
Merged revision(s) 21771-21772 from trunk/OpenMPT:
Browse files Browse the repository at this point in the history
[Imp] IT: Don't import SAx High Offset command for IT 1.xx modules. This feature was added in IT 2.00.
........
[Fix] IT: Command fixups need to be done before the command memory is updated.
........


git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.31@21773 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Sep 30, 2024
1 parent 45e5a20 commit 7e5e72e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions soundlib/Load_it.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ bool CSoundFile::ReadIT(FileReader &file, ModLoadingFlags loadFlags)

auto patData = Patterns[pat].begin();
ROWINDEX row = 0;
ModCommand dummy{};
while(row < numRows && patternData.CanRead(1))
{
uint8 b = patternData.ReadUint8();
Expand Down Expand Up @@ -1057,7 +1058,6 @@ bool CSoundFile::ReadIT(FileReader &file, ModLoadingFlags loadFlags)
}

// Now we grab the data for this particular row/channel.
ModCommand dummy{};
ModCommand &m = ch < m_nChannels ? patData[ch] : dummy;

if(chnMask[ch] & 0x10)
Expand Down Expand Up @@ -1138,15 +1138,21 @@ bool CSoundFile::ReadIT(FileReader &file, ModLoadingFlags loadFlags)
{
const auto [command, param] = patternData.ReadArray<uint8, 2>();
S3MConvert(m, command, param, true);
// In some IT-compatible trackers, it is possible to input a parameter without a command.
// In this case, we still need to update the last value memory. OpenMPT didn't do this until v1.25.01.07.
// Example: ckbounce.it
lastValue[ch].command = m.command;
lastValue[ch].param = m.param;

// IT 1.xx does not support high offset command
if(m.command == CMD_S3MCMDEX && (m.param & 0xF0) == 0xA0 && fileHeader.cmwt < 0x0200)
m.command = CMD_DUMMY;
// Fix handling of commands V81-VFF in ITs made with old Schism Tracker versions
// (fixed in https://github.com/schismtracker/schismtracker/commit/ab5517d4730d4c717f7ebffb401445679bd30888 - one of the last versions to identify as v0.50)
if(m.command == CMD_GLOBALVOLUME && m.param > 0x80 && fileHeader.cwtv >= 0x1000 && fileHeader.cwtv <= 0x1050)
m.param = 0x80;

// In some IT-compatible trackers, it is possible to input a parameter without a command.
// In this case, we still need to update the last value memory (so that we don't reuse a previous non-empty effect).
// OpenMPT didn't do this until v1.25.01.07.
// Example: ckbounce.it
lastValue[ch].command = m.command;
lastValue[ch].param = m.param;
}
}
}
Expand Down

0 comments on commit 7e5e72e

Please sign in to comment.