From: <sv...@op...> - 2024-12-03 21:26:43
|
Author: sagamusix Date: Tue Dec 3 22:26:27 2024 New Revision: 22463 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22463 Log: [Fix] MIDI I/O Plugin: Writing an empty global dump caused all subsequent macros to not be read. Global dump ID was conflicting with first macro, now that we support all 1000 parameters for automation. Reassign the global dump ID. This means that the plugin state of files created with OpenMPT 1.32.00.34 will not be restored correctly. But that's fine because it's just a single test version. Modified: trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp Modified: trunk/OpenMPT/common/versionNumber.h ============================================================================== --- trunk/OpenMPT/common/versionNumber.h Mon Dec 2 23:43:23 2024 (r22462) +++ trunk/OpenMPT/common/versionNumber.h Tue Dec 3 22:26:27 2024 (r22463) @@ -16,4 +16,4 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 32 #define VER_MINOR 00 -#define VER_MINORMINOR 34 +#define VER_MINORMINOR 35 Modified: trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp ============================================================================== --- trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp Mon Dec 2 23:43:23 2024 (r22462) +++ trunk/OpenMPT/mptrack/plugins/MidiInOut.cpp Tue Dec 3 22:26:27 2024 (r22463) @@ -180,9 +180,12 @@ #endif if(flags & kMacrosPresent) { - mpt::IO::WriteIntLE<uint32>(s, 0); // Initial dump ID - mpt::IO::WriteIntLE<uint32>(s, static_cast<uint32>(m_initialMidiDump.size())); - mpt::IO::Write(s, m_initialMidiDump); + if(!m_initialMidiDump.empty()) + { + mpt::IO::WriteIntLE<uint32>(s, uint32_max); // Initial dump ID + mpt::IO::WriteIntLE<uint32>(s, static_cast<uint32>(m_initialMidiDump.size())); + mpt::IO::Write(s, m_initialMidiDump); + } for(size_t i = 0; i < m_parameterMacros.size(); i++) { if(!m_parameterMacros[i].first.empty()) @@ -283,7 +286,7 @@ const auto [dumpID, dumpSize] = file.ReadArray<uint32le, 2>(); if((!dumpID && !dumpSize) || !file.CanRead(dumpSize)) break; - if(dumpID == 0) + if(dumpID == uint32_max) { file.ReadVector(m_initialMidiDump, dumpSize); m_alwaysSendInitialDump = (flags & kAlwaysSendDump) != 0; |