From: <sv...@op...> - 2024-12-13 18:20:05
|
Author: sagamusix Date: Fri Dec 13 19:19:53 2024 New Revision: 22532 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22532 Log: Merged revision(s) 22531 from trunk/OpenMPT: [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: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/soundlib/Load_itp.cpp Modified: branches/OpenMPT-1.31/soundlib/Load_itp.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_itp.cpp Fri Dec 13 19:19:36 2024 (r22531) +++ branches/OpenMPT-1.31/soundlib/Load_itp.cpp Fri Dec 13 19:19:53 2024 (r22532) @@ -261,7 +261,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()); @@ -309,15 +309,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; } } } @@ -330,7 +328,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; } |