From: <sv...@op...> - 2025-05-25 14:43:36
|
Author: sagamusix Date: Sun May 25 16:43:24 2025 New Revision: 23196 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=23196 Log: [Fix] MED: Jumps to a command in another sequence cannot be resolved using the current sequence's byte mapping; use the existing jump markers as a target instead (https://www.un4seen.com/forum/?msg=144699). Modified: trunk/OpenMPT/soundlib/InstrumentSynth.cpp trunk/OpenMPT/soundlib/InstrumentSynth.h trunk/OpenMPT/soundlib/Load_fc.cpp Modified: trunk/OpenMPT/soundlib/InstrumentSynth.cpp ============================================================================== --- trunk/OpenMPT/soundlib/InstrumentSynth.cpp Sun May 25 16:35:08 2025 (r23195) +++ trunk/OpenMPT/soundlib/InstrumentSynth.cpp Sun May 25 16:43:24 2025 (r23196) @@ -687,10 +687,9 @@ m_medArpPos = 0; return true; case Event::Type::MED_JumpScript: - if(event.u8 < chn.synthState.states.size()) + if(event.u8 < chn.synthState.states.size() && chn.pModInstrument && event.u8 < chn.pModInstrument->synth.m_scripts.size()) { - chn.synthState.states[event.u8].m_nextRow = event.u16; - chn.synthState.states[event.u8].m_ticksRemain = 0; + chn.synthState.states[event.u8].JumpToPosition(chn.pModInstrument->synth.m_scripts[event.u8], event.u16); chn.synthState.states[event.u8].m_stepsRemain = 0; } return false; Modified: trunk/OpenMPT/soundlib/InstrumentSynth.h ============================================================================== --- trunk/OpenMPT/soundlib/InstrumentSynth.h Sun May 25 16:35:08 2025 (r23195) +++ trunk/OpenMPT/soundlib/InstrumentSynth.h Sun May 25 16:43:24 2025 (r23196) @@ -63,7 +63,7 @@ Mupp_SetWaveform, // Parameter: Source instrument (uint8), waveform (uint8), volume (uint8) MED_DefineArpeggio, // Parameter: Arpeggio note (uint8), arp length or 0 if it's not the first note (uint16) - MED_JumpScript, // Parameter: Script index (uint8), jump target (uint16) + MED_JumpScript, // Parameter: Script index (uint8), jump target (uint16 - JumpMarker ID, not event index!) MED_SetEnvelope, // Parameter: Envelope index (uint8), loop on/off (uint8), is volume envelope (uint8) MED_SetVolume, // Parameter: Volume (uint8) MED_SetWaveform, // Parameter: Waveform (uint8) @@ -106,7 +106,7 @@ { Type::Jump, Type::JumpIfTrue, Type::EvaluateLoopCounter, Type::GTK_KeyOff, - Type::MED_JumpScript, Type::MED_HoldDecay, + Type::MED_HoldDecay, Type::FTM_SetInterrupt, }; Modified: trunk/OpenMPT/soundlib/Load_fc.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_fc.cpp Sun May 25 16:35:08 2025 (r23195) +++ trunk/OpenMPT/soundlib/Load_fc.cpp Sun May 25 16:43:24 2025 (r23196) @@ -119,6 +119,7 @@ FileReader file{script}; const bool isVolume = startSequence > 255; const uint8 volScriptSpeed = (script[0] > 0) ? script[0] : uint8_max; + events.push_back(InstrumentSynth::Event::JumpMarker(0)); if(isVolume) events.push_back(InstrumentSynth::Event::SetStepSpeed(volScriptSpeed, true)); |