Skip to content

Commit

Permalink
[Mod] SymMOD: Ignore unknown hunks, as that's what Symphonie does as …
Browse files Browse the repository at this point in the history
…well. Fixes reading of Natsh1.SymMOD, which has garbage at the end of the file.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@21825 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Oct 15, 2024
1 parent 04496d5 commit 79e2a03
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions soundlib/Load_symmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ bool CSoundFile::ReadSymMOD(FileReader &file, ModLoadingFlags loadFlags)
uint16 sampleBoost = 2500;
bool isSymphoniePro = false;
bool externalSamples = false;
bool unknownHunks = false;
std::vector<SymPosition> positions;
std::vector<SymSequence> sequences;
std::vector<SymEvent> patternData;
Expand Down Expand Up @@ -1197,16 +1198,19 @@ bool CSoundFile::ReadSymMOD(FileReader &file, ModLoadingFlags loadFlags)
file.Skip(file.ReadUint32BE());
break;

// Unrecognized chunk/value type
// Unrecognized chunk/value type (e.g. garbage at the end of Natsh1.SymMOD)
default:
return false;
unknownHunks = true;
break;
}
}

if(!trackLen || instruments.empty())
return false;
if((loadFlags & loadPatternData) && (positions.empty() || patternData.empty() || sequences.empty()))
return false;
if(unknownHunks)
AddToLog(LogWarning, U_("Unknown hunks were found and ignored."));

// Let's hope noone is going to use the 256th instrument ;)
if(instruments.size() >= MAX_INSTRUMENTS)
Expand Down

0 comments on commit 79e2a03

Please sign in to comment.