From: <sv...@op...> - 2024-05-11 23:27:58
|
Author: sagamusix Date: Sun May 12 01:27:46 2024 New Revision: 20790 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20790 Log: [Fix] IT compatibility: When triggering an empty instrument note slot, completely ignore the pattern cell - do not reset the currently playing instrument's envelopes (fixes wayfinder's Jet Rider), and also don't process any effects - including global ones. Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/UpgradeModule.cpp Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp ============================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp Sat May 11 23:50:47 2024 (r20789) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp Sun May 12 01:27:46 2024 (r20790) @@ -710,6 +710,7 @@ case kITInitialNoteMemory: desc = _T("Initial Last Note Memory of each channel is C-0 instead of No Note"); break; case kPluginDefaultProgramAndBank1: desc = _T("Assume initial plugin MIDI program and bank number is 1"); break; case kITNoSustainOnPortamento: desc = _T("Portamento after note-off does not re-enable sample sustain loop"); break; + case kITEmptyNoteMapSlotIgnoreCell: desc = _T("Ignore pattern cell completely when trying to play unmapped instrument note"); break; default: MPT_ASSERT_NOTREACHED(); } Modified: trunk/OpenMPT/soundlib/Snd_defs.h ============================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h Sat May 11 23:50:47 2024 (r20789) +++ trunk/OpenMPT/soundlib/Snd_defs.h Sun May 12 01:27:46 2024 (r20790) @@ -566,6 +566,7 @@ kITInitialNoteMemory, // Initial "last note memory" for each channel is C-0 and not "no note" kPluginDefaultProgramAndBank1, // Default program and bank is set to 1 for plugins, so if an instrument is set to either of those, the program / bank change event is not sent to the plugin kITNoSustainOnPortamento, // Do not re-enable sustain loop on portamento, even when switching between samples + kITEmptyNoteMapSlotIgnoreCell, // IT ignores the entire pattern cell when trying to play an unmapped note of an instrument // Add new play behaviours here. Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Sat May 11 23:50:47 2024 (r20789) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Sun May 12 01:27:46 2024 (r20790) @@ -2889,7 +2889,25 @@ if(ModCommand::IsNote(note)) { chn.nNewNote = chn.nLastNote = note; + } + // IT compatibility: Empty sample mapping + // This is probably the single biggest WTF replayer bug in Impulse Tracker. + // In instrument mode, when an note + instrument is triggered that does not map to any sample, the entire cell (including potentially present global effects!) + // is ignored. Even better, if on a following row another instrument number (this time without a note) is encountered, we end up in the same situation! + // Test cases: NoMap.it, NoMapEffects.it + if(m_playBehaviour[kITEmptyNoteMapSlotIgnoreCell] && instr > 0 && instr <= GetNumInstruments() + && Instruments[instr] != nullptr + && ModCommand::IsNote(chn.nNewNote) && Instruments[instr]->Keyboard[chn.nNewNote - NOTE_MIN] == 0 + && !Instruments[instr]->HasValidMIDIChannel()) + { + chn.nNewIns = static_cast<ModCommand::INSTR>(instr); + chn.ClearRowCmd(); + continue; + } + + if(ModCommand::IsNote(note)) + { // New Note Action ? if(!bPorta) { Modified: trunk/OpenMPT/soundlib/Sndfile.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp Sat May 11 23:50:47 2024 (r20789) +++ trunk/OpenMPT/soundlib/Sndfile.cpp Sun May 12 01:27:46 2024 (r20790) @@ -1183,6 +1183,7 @@ playBehaviour.set(kITResetFilterOnPortaSmpChange); playBehaviour.set(kITInitialNoteMemory); playBehaviour.set(kITNoSustainOnPortamento); + playBehaviour.set(kITEmptyNoteMapSlotIgnoreCell); break; case MOD_TYPE_XM: Modified: trunk/OpenMPT/soundlib/UpgradeModule.cpp ============================================================================== --- trunk/OpenMPT/soundlib/UpgradeModule.cpp Sat May 11 23:50:47 2024 (r20789) +++ trunk/OpenMPT/soundlib/UpgradeModule.cpp Sun May 12 01:27:46 2024 (r20790) @@ -597,6 +597,7 @@ { kITResetFilterOnPortaSmpChange, MPT_V("1.30.08.02") }, { kITInitialNoteMemory, MPT_V("1.31.00.25") }, { kITNoSustainOnPortamento, MPT_V("1.32.00.13") }, + { kITEmptyNoteMapSlotIgnoreCell, MPT_V("1.32.00.13") }, }; for(const auto &b : behaviours) |