From: <sv...@op...> - 2024-12-13 18:19:48
|
Author: sagamusix Date: Fri Dec 13 19:19:36 2024 New Revision: 22531 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22531 Log: [Fix] ITP: Instruments paths were always read as relative paths since r17468 (so since the first official release of OpenMPT 1.31), usually causing them to file to load. Modified: trunk/OpenMPT/soundlib/Load_itp.cpp Modified: trunk/OpenMPT/soundlib/Load_itp.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp Thu Dec 12 22:27:08 2024 (r22530) +++ trunk/OpenMPT/soundlib/Load_itp.cpp Fri Dec 13 19:19:36 2024 (r22531) @@ -256,7 +256,7 @@ #ifdef MODPLUG_TRACKER if(const auto fileName = file.GetOptionalFileName(); fileName.has_value()) { - instrPaths[ins] = mpt::AbsolutePathToRelative(instrPaths[ins], fileName->GetDirectoryWithDrive()); + instrPaths[ins] = mpt::RelativePathToAbsolute(instrPaths[ins], fileName->GetDirectoryWithDrive()); } else if(GetpModDoc() != nullptr) { instrPaths[ins] = mpt::RelativePathToAbsolute(instrPaths[ins], GetpModDoc()->GetPathNameMpt().GetDirectoryWithDrive()); @@ -304,15 +304,13 @@ // Pattern data size_t numCommands = GetNumChannels() * numRows; - if(patternChunk.CanRead(sizeof(ITPModCommand) * numCommands)) { - ModCommand *target = Patterns[pat].GetpModCommand(0, 0); - while(numCommands-- != 0) + for(ModCommand &m : Patterns[pat]) { ITPModCommand data; patternChunk.ReadStruct(data); - *(target++) = data; + m = data; } } } @@ -325,7 +323,7 @@ // Read number of embedded samples - at most as many as there are real samples in a valid file uint32 embeddedSamples = file.ReadUint32LE(); - if(embeddedSamples > m_nSamples) + if(embeddedSamples > GetNumSamples()) { return false; } |