S3M import: fix crash when two subsong seps presen
This commit is contained in:
parent
26b72eb348
commit
eb4cc768c7
|
@ -190,6 +190,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
|
||||||
logD("reading orders...");
|
logD("reading orders...");
|
||||||
size_t curSubSong=0;
|
size_t curSubSong=0;
|
||||||
ds.subsong[curSubSong]->ordersLen=0;
|
ds.subsong[curSubSong]->ordersLen=0;
|
||||||
|
bool subSongIncreased=false;
|
||||||
for (int i=0; i<ordersLen; i++) {
|
for (int i=0; i<ordersLen; i++) {
|
||||||
unsigned char nextOrder=reader.readC();
|
unsigned char nextOrder=reader.readC();
|
||||||
orders[i]=curOrder;
|
orders[i]=curOrder;
|
||||||
|
@ -202,10 +203,14 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
|
||||||
// next subsong
|
// next subsong
|
||||||
if (nextOrder==255) {
|
if (nextOrder==255) {
|
||||||
logV("- end of song");
|
logV("- end of song");
|
||||||
curSubSong++;
|
if (!subSongIncreased) {
|
||||||
|
curSubSong++;
|
||||||
|
subSongIncreased=true;
|
||||||
|
}
|
||||||
curOrder=0;
|
curOrder=0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
subSongIncreased=false;
|
||||||
if (ds.subsong.size()<=curSubSong) {
|
if (ds.subsong.size()<=curSubSong) {
|
||||||
ds.subsong.push_back(new DivSubSong);
|
ds.subsong.push_back(new DivSubSong);
|
||||||
ds.subsong[curSubSong]->ordersLen=0;
|
ds.subsong[curSubSong]->ordersLen=0;
|
||||||
|
@ -264,8 +269,9 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
|
||||||
ds.systemName="PC";
|
ds.systemName="PC";
|
||||||
if (hasPCM) {
|
if (hasPCM) {
|
||||||
ds.system[ds.systemLen]=DIV_SYSTEM_ES5506;
|
ds.system[ds.systemLen]=DIV_SYSTEM_ES5506;
|
||||||
ds.systemVol[ds.systemLen]=(float)globalVol/256.0;
|
ds.systemVol[ds.systemLen]=(float)globalVol/64.0;
|
||||||
ds.systemPan[ds.systemLen]=0;
|
ds.systemPan[ds.systemLen]=0;
|
||||||
|
ds.systemFlags[ds.systemLen].set("volScale",3900);
|
||||||
ds.systemFlags[ds.systemLen].set("amigaVol",true);
|
ds.systemFlags[ds.systemLen].set("amigaVol",true);
|
||||||
ds.systemFlags[ds.systemLen].set("amigaPitch",true);
|
ds.systemFlags[ds.systemLen].set("amigaPitch",true);
|
||||||
ds.systemLen++;
|
ds.systemLen++;
|
||||||
|
|
Loading…
Reference in a new issue