From 2fe371e543c71a0958965c4017e6a637db3f8869 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 26 Jun 2024 04:06:31 -0500 Subject: [PATCH] IT import: accept songs without instruments --- src/engine/fileOps/it.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/engine/fileOps/it.cpp b/src/engine/fileOps/it.cpp index 09e250f39..a8f7dd6e5 100644 --- a/src/engine/fileOps/it.cpp +++ b/src/engine/fileOps/it.cpp @@ -477,6 +477,14 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) { if (samplePtr[i]==0) { ds.sample.push_back(s); + + // does the song not use instruments? + // create instrument then + if (ds.insLen==0) { + DivInstrument* ins=new DivInstrument; + ins->type=DIV_INS_ES5506; + ds.ins.push_back(ins); + } continue; } @@ -636,9 +644,21 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) { } } + // does the song not use instruments? + // create instrument then + if (ds.insLen==0) { + DivInstrument* ins=new DivInstrument; + ins->name=s->name; + ins->type=DIV_INS_ES5506; + ins->amiga.initSample=i; + ds.ins.push_back(ins); + } + ds.sample.push_back(s); } + ds.insLen=ds.ins.size(); + // read patterns int maxChan=0; for (int i=0; i